The air was thick with emotion.
Deliya was both excited and terrified, which in the heart of battle, was often one and the same. She was a Brion. Treading the line between life and death, living another day and dying right – that was the Brion way. She thrived on it.
The mercilessly cold, eerily beautiful planet Antaris stretched endlessly before her.
Everyone walked the Brion way around Deliya, whether they liked it or not.
Only hours before, she had stood in the largest arena aboard the battleship Triumphant, called so by the simplistic enemies – and allies – of the Brions. It was more amusing than annoying to the Brions, so they let it be. Deliya suspected that their Elders and generals preferred to portray a bit more uncultured image of themselves to make the others keep their distance. The Brions weren't known for their friendliness.
In secret, she was proud and believed that to be just. After all, the Triumphant was the most feared vessel to navigate the galaxy. Some of their enemies – and once again, some of their allies – had ships programmed to recognize the Triumphant's signature code or had complicated scanning systems to alert them of a ship roughly the same size and speed. Deliya didn't revel in dread exactly, but the ship's reputation was well earned and she liked it. They were the face and image of the Brions, for all that was good and bad.
The arena was the way Brion warriors met before battle. There they'd stood and listened in silence as their commander spoke of Antaris. On other ships, the arena was a place to show strength. All Brion commanders welcomed challenges, it was their way. In an arena, any warrior of rank could argue their case and if need be, fight for their opinion. Technically, the Triumphant should have functioned in the same manner, but to Deliya's knowledge there wasn't anyone suicidal enough to even dare think of challenging their commander.
There wasn't anyone to oppose attacking Antaris anyway.
The ice planet, the Brions felt, should have been their ally. However, the same qualities they searched for in an ally often made for an instant enemy.
Antaris was unforgiving, of which they approved. It was also cold while they burned hot. Initial meetings had eventually resulted in conflict, and neither was the forgiving type. So after a raid to Briolina, the Brions' home planet, Antaris' fate had been sealed. Even the Galactic Union, which usually frowned upon the Brions' quick and swift revenge, hadn't protested in any way.
Deliya's fellow officers had joked that with their fierce reputation being what it was, when news of the attack on Briolina had reached the Union, the general reaction had been a collective sigh. Not one of regret, but one of pre-emptive mourning for the Antanaris. The galaxy was getting acquainted with the myriad of species that inhabited it, but there were some that just didn't want to play together with the others.
As she walked on the gleaming, almost blinding-white surface of Antaris, Deliya was completely aware that was how most of the galaxy viewed the Antanaris. The Brions wouldn't win any popularity contests either, but they at least made an effort. The Antanaris did not. In fact, the commander had hinted that the Union had been relieved by the attack. At last, they could let the Brions loose on someone they had no obligation to defend. Let them shed blood and maybe cool off for a while.
The fact that the commander had nearly smiled at that false belief brought a smile to Deliya's lips.
Above, the stars shone on the eternal night of Antaris. The emptiness of the planet loomed all around her. To the naked eye, there was simply nothing to see but vast, endless fields of solid white rock and gentle snow. Of course it was gentle only to the eye, not in the least to the feet slipping on its treacherous surface. The only reason they hadn't caught the Antanaris yet, Deliya felt, was that they knew the terrain so much better and could move swiftly out of the Brions' way to the crevices and hideouts.
They literally vanished from sight if they wished to. The Brions, however, were light on their feet too. And in their blood, the battle lust sang.
All Brion warriors were born to fight. They grew bigger and stronger and faster than their brothers and sisters, every sense they had only sharpening with time. As they fought, they gained experience to match their natural ability. All that should have been enough to explain their role in the galaxy as the guard dog of the Galactic Union.
Deliya knew the commander and the Elders of the Brions cultivated that image carefully – they were the dog that bit the Union's enemies, but kept it aware it had no master. The Union feared them, as they should.


text:
<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: forum_viewthread.php 33371 2013-06-03 05:58:41Z nemohou $
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

require_once libfile('function/forumlist');
require_once libfile('function/discuzcode');
require_once libfile('function/post');

$thread = & $_G['forum_thread'];
$forum = & $_G['forum'];

if(!$_G['forum_thread'] || !$_G['forum']) {
	showmessage('thread_nonexistence');
}

$page = max(1, $_G['page']);

if($page === 1 && !empty($_G['setting']['antitheft']['allow']) && empty($_G['setting']['antitheft']['disable']['thread']) && empty($_G['forum']['noantitheft'])) {
	helper_antitheft::check($_G['forum_thread']['tid'], 'tid');
}

if($_G['setting']['cachethreadlife'] && $_G['forum']['threadcaches'] && !$_G['uid'] && $page == 1 && !$_G['forum']['special'] && empty($_GET['do']) && !defined('IN_ARCHIVER') && !defined('IN_MOBILE')) {
	viewthread_loadcache();
}

$threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array();
$threadtable_info = !empty($_G['cache']['threadtable_info']) ? $_G['cache']['threadtable_info'] : array();

$archiveid = $thread['threadtableid'];
$thread['is_archived'] = $archiveid ? true : false;
$thread['archiveid'] = $archiveid;
$forum['threadtableid'] = $archiveid;
$threadtable = $thread['threadtable'];
$posttableid = $thread['posttableid'];
$posttable = $thread['posttable'];

$_G['action']['fid'] = $_G['fid'];
$_G['action']['tid'] = $_G['tid'];
if($_G['fid'] == $_G['setting']['followforumid'] && $_G['adminid'] != 1) {
	dheader("Location: home.php?mod=follow");
}
$close_leftinfo = intval($_G['setting']['close_leftinfo']);
if($_G['setting']['close_leftinfo_userctrl']) {
	if($_G['cookie']['close_leftinfo'] == 1) {
		$close_leftinfo = 1;
	} elseif($_G['cookie']['close_leftinfo'] == 2) {
		$close_leftinfo = 0;
	}
}
$_GET['authorid'] = !empty($_GET['authorid']) ? intval($_GET['authorid']) : 0;
$_GET['ordertype'] = !empty($_GET['ordertype']) ? intval($_GET['ordertype']) : 0;
$_GET['from'] = in_array($_GET['from'], array('preview', 'portal', 'album')) ? $_GET['from'] : '';
if($_GET['from'] == 'portal' && !$_G['setting']['portalstatus']) {
	$_GET['from'] = '';
} elseif($_GET['from'] == 'preview' && !$_G['inajax']) {
	$_GET['from'] = '';
} elseif($_GET['from'] == 'album' && ($_G['setting']['guestviewthumb']['flag'] && !$_G['uid'] || !$_G['group']['allowgetimage'])) {
	$_GET['from'] = '';
}

$fromuid = $_G['setting']['creditspolicy']['promotion_visit'] && $_G['uid'] ? '&fromuid='.$_G['uid'] : '';
$feeduid = $_G['forum_thread']['authorid'] ? $_G['forum_thread']['authorid'] : 0;
$feedpostnum = $_G['forum_thread']['replies'] > $_G['ppp'] ? $_G['ppp'] : ($_G['forum_thread']['replies'] ? $_G['forum_thread']['replies'] : 1);

if(!empty($_GET['extra'])) {
	parse_str($_GET['extra'], $extra);
	$_GET['extra'] = array();
	foreach($extra as $_k => $_v) {
		if(preg_match('/^\w+$/', $_k)) {
			if(!is_array($_v)) {
				$_GET['extra'][] = $_k.'='.rawurlencode($_v);
			} else {
				$_GET['extra'][] = http_build_query(array($_k => $_v));
			}
		}
	}
	$_GET['extra'] = implode('&', $_GET['extra']);
}

$_G['forum_threadindex'] = '';
$skipaids = $aimgs = $_G['forum_posthtml'] = array();

$thread['subjectenc'] = rawurlencode($_G['forum_thread']['subject']);
$thread['short_subject'] = cutstr($_G['forum_thread']['subject'], 52);

$navigation = '';
if($_GET['from'] == 'portal') {
	if($_G['forum']['status'] == 3) {
		_checkviewgroup();
	}
	$_G['setting']['ratelogon'] = 1;
	$navigation = ' › '.lang('core', 'portal').'';
	$navsubject = $_G['forum_thread']['subject'];
	$navtitle = $_G['forum_thread']['subject'];

}elseif($_GET['from'] == 'preview') {

	$_G['setting']['ratelogon'] = 1;

} elseif($_G['forum']['status'] == 3) {
	_checkviewgroup();
	$nav = get_groupnav($_G['forum']);
	$navigation = ' › '.$_G['setting']['navs'][3]['navname'].' '.$nav['nav'];
	$upnavlink = 'forum.php?mod=forumdisplay&fid='.$_G['fid'].($_GET['extra'] && !IS_ROBOT ? '&'.$_GET['extra'] : '');
	$_G['grouptypeid'] = $_G['forum']['fup'];

} else {
	$navigation = '';
	$upnavlink = 'forum.php?mod=forumdisplay&fid='.$_G['fid'].($_GET['extra'] && !IS_ROBOT ? '&'.$_GET['extra'] : '');

	if($_G['forum']['type'] == 'sub') {
		$fup = $_G['cache']['forums'][$_G['forum']['fup']]['fup'];
		$t_link = $_G['cache']['forums'][$fup]['type'] == 'group' ? 'forum.php?gid='.$fup : 'forum.php?mod=forumdisplay&fid='.$fup;
		$navigation .= ' › '.($_G['cache']['forums'][$fup]['name']).'';
	}

	if($_G['forum']['fup']) {
		$fup = $_G['forum']['fup'];
		$t_link = $_G['cache']['forums'][$fup]['type'] == 'group' ? 'forum.php?gid='.$fup : 'forum.php?mod=forumdisplay&fid='.$fup;
		$navigation .= ' › '.($_G['cache']['forums'][$fup]['name']).'';
	}

	$t_link = 'forum.php?mod=forumdisplay&fid='.$_G['fid'].($_GET['extra'] && !IS_ROBOT ? '&'.$_GET['extra'] : '');
	$navigation .= ' › '.($_G['forum']['name']).'';

	if($archiveid) {
		if($threadtable_info[$archiveid]['displayname']) {
			$t_name = dhtmlspecialchars($threadtable_info[$archiveid]['displayname']);
		} else {
			$t_name = lang('core', 'archive').' '.$archiveid;
		}
		$navigation .= ' › '.$t_name.'';
	}

	unset($t_link, $t_name);
}

$_GET['extra'] = $_GET['extra'] ? rawurlencode($_GET['extra']) : '';

if(@in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {
	$canonical = rewriteoutput('forum_viewthread', 1, '', $_G['tid'], 1, '', '');
} else {
	$canonical = 'forum.php?mod=viewthread&tid='.$_G['tid'];
}
$_G['setting']['seohead'] .= '<link href="'.$_G['siteurl'].$canonical.'" rel="canonical" />';

$_G['forum_tagscript'] = '';

$threadsort = $thread['sortid'] && isset($_G['forum']['threadsorts']['types'][$thread['sortid']]) ? 1 : 0;
if($threadsort) {
	require_once libfile('function/threadsort');
	$threadsortshow = threadsortshow($thread['sortid'], $_G['tid']);
}

if(empty($_G['forum']['allowview'])) {

	if(!$_G['forum']['viewperm'] && !$_G['group']['readaccess']) {
		showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
	} elseif($_G['forum']['viewperm'] && !forumperm($_G['forum']['viewperm'])) {
		showmessagenoperm('viewperm', $_G['fid']);
	}

} elseif($_G['forum']['allowview'] == -1) {
	showmessage('forum_access_view_disallow');
}

if($_G['forum']['formulaperm']) {
	formulaperm($_G['forum']['formulaperm']);
}

if($_G['forum']['password'] && $_G['forum']['password'] != $_G['cookie']['fidpw'.$_G['fid']]) {
	dheader("Location: $_G[siteurl]forum.php?mod=forumdisplay&fid=$_G[fid]");
}

if($_G['forum']['price'] && !$_G['forum']['ismoderator']) {
	$membercredits = C::t('common_member_forum_buylog')->get_credits($_G['uid'], $_G['fid']);
	$paycredits = $_G['forum']['price'] - $membercredits;
	if($paycredits > 0) {
		dheader("Location: $_G[siteurl]forum.php?mod=forumdisplay&fid=$_G[fid]");
	}
}

if($_G['forum_thread']['readperm'] && $_G['forum_thread']['readperm'] > $_G['group']['readaccess'] && !$_G['forum']['ismoderator'] && $_G['forum_thread']['authorid'] != $_G['uid']) {
	showmessage('thread_nopermission', NULL, array('readperm' => $_G['forum_thread']['readperm']), array('login' => 1));
}

$usemagic = array('user' => array(), 'thread' => array());

$replynotice = getstatus($_G['forum_thread']['status'], 6);

$hiddenreplies = getstatus($_G['forum_thread']['status'], 2);

$rushreply = getstatus($_G['forum_thread']['status'], 3);

$savepostposition = getstatus($_G['forum_thread']['status'], 1);

$incollection = getstatus($_G['forum_thread']['status'], 9);

$_G['forum_threadpay'] = FALSE;
if($_G['forum_thread']['price'] > 0 && $_G['forum_thread']['special'] == 0) {
	if($_G['setting']['maxchargespan'] && TIMESTAMP - $_G['forum_thread']['dateline'] >= $_G['setting']['maxchargespan'] * 3600) {
		C::t('forum_thread')->update($_G['tid'], array('price' => 0), false, false, $archiveid);
		$_G['forum_thread']['price'] = 0;
	} else {
		$exemptvalue = $_G['forum']['ismoderator'] ? 128 : 16;
		if(!($_G['group']['exempt'] & $exemptvalue) && $_G['forum_thread']['authorid'] != $_G['uid']) {
			if(!(C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BTC', $_G['tid']))) {
				require_once libfile('thread/pay', 'include');
				$_G['forum_threadpay'] = TRUE;
			}
		}
	}
}

if($rushreply) {
	$rewardfloor = '';
	$rushresult = $rewardfloorarr = $rewardfloorarray = array();
	$rushresult = C::t('forum_threadrush')->fetch($_G['tid']);
	if($rushresult['creditlimit'] == -996) {
		$rushresult['creditlimit'] = '';
	}
	if((TIMESTAMP < $rushresult['starttimefrom'] || ($rushresult['starttimeto'] && TIMESTAMP > $rushresult['starttimeto']) || ($rushresult['stopfloor'] && $_G['forum_thread']['replies'] + 1 >= $rushresult['stopfloor'])) && $_G['forum_thread']['closed'] == 0) {
		C::t('forum_thread')->update($_G['tid'], array('closed'=>1));
	} elseif(($rushresult['starttimefrom'] && TIMESTAMP > $rushresult['starttimefrom']) && $_G['forum_thread']['closed'] == 1) {
		if(($rushresult['starttimeto'] && TIMESTAMP < $rushresult['starttimeto'] || !$rushresult['starttimeto']) && ($rushresult['stopfloor'] && $_G['forum_thread']['replies'] + 1 < $rushresult['stopfloor'] || !$rushresult['stopfloor'])) {
			C::t('forum_thread')->update($_G['tid'], array('closed'=>0));
		}
	}
	if($rushresult['starttimefrom'] > TIMESTAMP) {
		$rushresult['timer'] = $rushresult['starttimefrom'] - TIMESTAMP;
		$rushresult['timertype'] = 'start';
	} elseif($rushresult['starttimeto'] > TIMESTAMP) {
		$rushresult['timer'] = $rushresult['starttimeto'] - TIMESTAMP;
		$rushresult['timertype'] = 'end';
	}
	$rushresult['starttimefrom'] = $rushresult['starttimefrom'] ? dgmdate($rushresult['starttimefrom']) : '';
	$rushresult['starttimeto'] = $rushresult['starttimeto'] ? dgmdate($rushresult['starttimeto']) : '';
	$rushresult['creditlimit_title'] = $_G['setting']['creditstransextra'][11] ? $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][11]]['title'] : lang('forum/misc', 'credit_total');
}

if($_G['forum_thread']['replycredit'] > 0) {
	$_G['forum_thread']['replycredit_rule'] = C::t('forum_replycredit')->fetch($thread['tid']);
	$_G['forum_thread']['replycredit_rule']['remaining'] = $_G['forum_thread']['replycredit'] / $_G['forum_thread']['replycredit_rule']['extcredits'];
	$_G['forum_thread']['replycredit_rule']['extcreditstype'] = $_G['forum_thread']['replycredit_rule']['extcreditstype'] ? $_G['forum_thread']['replycredit_rule']['extcreditstype'] : $_G['setting']['creditstransextra'][10] ;
}
$_G['group']['raterange'] = $_G['setting']['modratelimit'] && $adminid == 3 && !$_G['forum']['ismoderator'] ? array() : $_G['group']['raterange'];

$_G['group']['allowgetattach'] = !empty($_G['forum']['allowgetattach']) || ($_G['group']['allowgetattach'] && !$_G['forum']['getattachperm']) || forumperm($_G['forum']['getattachperm']);
$_G['group']['allowgetimage'] = !empty($_G['forum']['allowgetimage']) || ($_G['group']['allowgetimage'] && !$_G['forum']['getattachperm']) || forumperm($_G['forum']['getattachperm']);
$_G['getattachcredits'] = '';
if($_G['forum_thread']['attachment']) {
	$exemptvalue = $_G['forum']['ismoderator'] ? 32 : 4;
	if(!($_G['group']['exempt'] & $exemptvalue)) {
		$creditlog = updatecreditbyaction('getattach', $_G['uid'], array(), '', 1, 0, $_G['forum_thread']['fid']);
		$p = '';
		if($creditlog['updatecredit']) for($i = 1;$i <= 8;$i++) {
			if($policy = $creditlog['extcredits'.$i]) {
				$_G['getattachcredits'] .= $p.$_G['setting']['extcredits'][$i]['title'].' '.$policy.' '.$_G['setting']['extcredits'][$i]['unit'];
				$p = ', ';
			}
		}
	}
}

$exemptvalue = $_G['forum']['ismoderator'] ? 64 : 8;
$_G['forum_attachmentdown'] = $_G['group']['exempt'] & $exemptvalue;

$seccodecheck = ($_G['setting']['seccodestatus'] & 4) && (!$_G['setting']['seccodedata']['minposts'] || getuserprofile('posts') < $_G['setting']['seccodedata']['minposts']);
$secqaacheck = $_G['setting']['secqaa']['status'] & 2 && (!$_G['setting']['secqaa']['minposts'] || getuserprofile('posts') < $_G['setting']['secqaa']['minposts']);
$usesigcheck = $_G['uid'] && $_G['group']['maxsigsize'];

$postlist = $_G['forum_attachtags'] = $attachlist = $_G['forum_threadstamp'] = array();
$aimgcount = 0;
$_G['forum_attachpids'] = array();

if(!empty($_GET['action']) && $_GET['action'] == 'printable' && $_G['tid']) {
	require_once libfile('thread/printable', 'include');
	dexit();
}

if($_G['forum_thread']['stamp'] >= 0) {
	$_G['forum_threadstamp'] = $_G['cache']['stamps'][$_G['forum_thread']['stamp']];
}

$lastmod = viewthread_lastmod($_G['forum_thread']);

$showsettings = str_pad(decbin($_G['setting']['showsettings']), 3, '0', STR_PAD_LEFT);

$showsignatures = $showsettings{0};
$showavatars = $showsettings{1};
$_G['setting']['showimages'] = $showsettings{2};

$highlightstatus = isset($_GET['highlight']) && str_replace('+', '', $_GET['highlight']) ? 1 : 0;

$_G['forum']['allowreply'] = isset($_G['forum']['allowreply']) ? $_G['forum']['allowreply'] : '';
$_G['forum']['allowpost'] = isset($_G['forum']['allowpost']) ? $_G['forum']['allowpost'] : '';

$allowpostreply = ($_G['forum']['allowreply'] != -1) && (($_G['forum_thread']['isgroup'] || (!$_G['forum_thread']['closed'] && !checkautoclose($_G['forum_thread']))) || $_G['forum']['ismoderator']) && ((!$_G['forum']['replyperm'] && $_G['group']['allowreply']) || ($_G['forum']['replyperm'] && forumperm($_G['forum']['replyperm'])) || $_G['forum']['allowreply']);
$fastpost = $_G['setting']['fastpost'] && !$_G['forum_thread']['archiveid'] && ($_G['forum']['status'] != 3 || $_G['isgroupuser']);
$allowfastpost = $_G['setting']['fastpost'] && $allowpostreply;
if(!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum']) || !$_G['adminid'] && (!cknewuser(1) || $_G['setting']['newbiespan'] && (!getuserprofile('lastpost') || TIMESTAMP - getuserprofile('lastpost') < $_G['setting']['newbiespan'] * 60) && TIMESTAMP - $_G['member']['regdate'] < $_G['setting']['newbiespan'] * 60)) {
	$allowfastpost = false;
}
$_G['group']['allowpost'] = $_G['forum']['allowpost'] != -1 && ((!$_G['forum']['postperm'] && $_G['group']['allowpost']) || ($_G['forum']['postperm'] && forumperm($_G['forum']['postperm'])) || $_G['forum']['allowpost']);

$_G['forum']['allowpostattach'] = isset($_G['forum']['allowpostattach']) ? $_G['forum']['allowpostattach'] : '';
$allowpostattach = $allowpostreply && ($_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || (!$_G['forum']['postattachperm'] && $_G['group']['allowpostattach']) || ($_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm']))));

if($_G['group']['allowpost']) {
	$_G['group']['allowpostpoll'] = $_G['group']['allowpostpoll'] && ($_G['forum']['allowpostspecial'] & 1);
	$_G['group']['allowposttrade'] = $_G['group']['allowposttrade'] && ($_G['forum']['allowpostspecial'] & 2);
	$_G['group']['allowpostreward'] = $_G['group']['allowpostreward'] && ($_G['forum']['allowpostspecial'] & 4) && isset($_G['setting']['extcredits'][$_G['setting']['creditstrans']]);
	$_G['group']['allowpostactivity'] = $_G['group']['allowpostactivity'] && ($_G['forum']['allowpostspecial'] & 8);
	$_G['group']['allowpostdebate'] = $_G['group']['allowpostdebate'] && ($_G['forum']['allowpostspecial'] & 16);
} else {
	$_G['group']['allowpostpoll'] = $_G['group']['allowposttrade'] = $_G['group']['allowpostreward'] = $_G['group']['allowpostactivity'] = $_G['group']['allowpostdebate'] = FALSE;
}

$_G['forum']['threadplugin'] = $_G['group']['allowpost'] && $_G['setting']['threadplugins'] ? is_array($_G['forum']['threadplugin']) ? $_G['forum']['threadplugin'] : dunserialize($_G['forum']['threadplugin']) : array();

$_G['setting']['visitedforums'] = $_G['setting']['visitedforums'] && $_G['forum']['status'] != 3 ? visitedforums() : '';

$relatedthreadlist = array();
$relatedthreadupdate = $tagupdate = FALSE;
$relatedkeywords = $tradekeywords = $_G['forum_firstpid'] = '';

if(!isset($_G['cookie']['collapse']) || strpos($_G['cookie']['collapse'], 'modarea_c') === FALSE) {
	$collapseimg['modarea_c'] = 'collapsed_no';
	$collapse['modarea_c'] = '';
} else {
	$collapseimg['modarea_c'] = 'collapsed_yes';
	$collapse['modarea_c'] = 'display: none';
}

$threadtag = array();
viewthread_updateviews($archiveid);

$_G['setting']['infosidestatus']['posts'] = $_G['setting']['infosidestatus'][1] && isset($_G['setting']['infosidestatus']['f'.$_G['fid']]['posts']) ? $_G['setting']['infosidestatus']['f'.$_G['fid']]['posts'] : $_G['setting']['infosidestatus']['posts'];

$postfieldsadd = $specialadd1 = $specialadd2 = $specialextra = '';
$tpids = array();
if($_G['forum_thread']['special'] == 2) {
	if(!empty($_GET['do']) && $_GET['do'] == 'tradeinfo') {
		require_once libfile('thread/trade', 'include');
	}
	$query = C::t('forum_trade')->fetch_all_thread_goods($_G['tid']);
	foreach($query as $trade) {
		$tpids[] = $trade['pid'];
	}
	$specialadd2 = 1;

} elseif($_G['forum_thread']['special'] == 5) {
	$_GET['stand'] = isset($_GET['stand']) && in_array($_GET['stand'], array(0, 1, 2)) ? $_GET['stand'] : null;
	if(isset($_GET['stand'])) {
		$specialadd2 = 1;
		$specialextra = "&stand=$_GET[stand]";
	}
}

$onlyauthoradd = $threadplughtml = '';

$maxposition = 0;
if(empty($_GET['viewpid'])) {
	$disablepos = !$rushreply && C::t('forum_threaddisablepos')->fetch($_G['tid']) ? 1 : 0;
	if(!$disablepos && !in_array($_G['forum_thread']['special'], array(2,3,5))) {
		if($_G['forum_thread']['maxposition']) {
			$maxposition = $_G['forum_thread']['maxposition'];
		} else {
			$maxposition = C::t('forum_post')->fetch_maxposition_by_tid($posttableid, $_G['tid']);
		}
	}

	$ordertype = empty($_GET['ordertype']) && getstatus($_G['forum_thread']['status'], 4) ? 1 : $_GET['ordertype'];
	if($_GET['from'] == 'album') {
		$ordertype = 1;
	}
	$sticklist = array();
	if($_G['page'] === 1 && $_G['forum_thread']['stickreply'] && empty($_GET['authorid'])) {
		$poststick = C::t('forum_poststick')->fetch_all_by_tid($_G['tid']);
		foreach(C::t('forum_post')->fetch_all($posttableid, array_keys($poststick)) as $post) {
			$post['position'] = $poststick[$post['pid']]['position'];
			$post['avatar'] = avatar($post['authorid'], 'small');
			$post['isstick'] = true;
			$sticklist[$post['pid']] = $post;
		}
		$stickcount = count($sticklist);
	}
	if($rushreply) {
		$rushids = $rushpids = $rushpositionlist = $preg = $arr = array();
		$str = ',,';
		$preg_str = rushreply_rule($rushresult);
		if($_GET['checkrush']) {
			$maxposition = 0;
			for($i = 1; $i <= $_G['forum_thread']['replies'] + 1; $i++) {
				$str = $str.$i.',,';
			}
			preg_match_all($preg_str, $str, $arr);
			$arr = $arr[0];
			foreach($arr as $var) {
				$var = str_replace(',', '', $var);
				$rushids[$var] = $var;
			}
			$temp_reply = $_G['forum_thread']['replies'];
			$_G['forum_thread']['replies'] = $countrushpost = max(0, count($rushids) - 1);
			$rushids = array_slice($rushids, ($page - 1) * $_G['ppp'], $_G['ppp']);
			foreach(C::t('forum_post')->fetch_all_by_tid_position($posttableid, $_G['tid'], $rushids) as $post) {
				$postarr[$post['position']] = $post;
			}
		} else {
			for($i = ($page - 1) * $_G['ppp'] + 1; $i <= $page * $_G['ppp']; $i++) {
				$str = $str.$i.',,';
			}
			preg_match_all($preg_str, $str, $arr);
			$arr = $arr[0];
			foreach($arr as $var) {
				$var = str_replace(',', '', $var);
				$rushids[$var] = $var;
			}
			$_G['forum_thread']['replies'] = $_G['forum_thread']['replies'] - 1;
		}
	}

	if(!empty($_GET['authorid'])) {
		$maxposition = 0;
		$_G['forum_thread']['replies'] = C::t('forum_post')->count_by_tid_invisible_authorid($_G['tid'], $_GET['authorid']);
		$_G['forum_thread']['replies']--;
		if($_G['forum_thread']['replies'] < 0) {
			showmessage('undefined_action');
		}
		$onlyauthoradd = 1;
	} elseif($_G['forum_thread']['special'] == 5) {
		if(isset($_GET['stand']) && $_GET['stand'] >= 0 && $_GET['stand'] < 3) {
			$_G['forum_thread']['replies'] = C::t('forum_debatepost')->count_by_tid_stand($_G['tid'], $_GET['stand']);
		} else {
			$_G['forum_thread']['replies'] = C::t('forum_post')->count_visiblepost_by_tid($_G['tid']);
			$_G['forum_thread']['replies'] > 0 && $_G['forum_thread']['replies']--;
		}
	} elseif($_G['forum_thread']['special'] == 2) {
		$tradenum = C::t('forum_trade')->fetch_counter_thread_goods($_G['tid']);
		$_G['forum_thread']['replies'] -= $tradenum;
	}

	if($maxposition) {
		$_G['forum_thread']['replies'] = $maxposition - 1;
	}
	$_G['ppp'] = $_G['forum']['threadcaches'] && !$_G['uid'] ? $_G['setting']['postperpage'] : $_G['ppp'];
	$totalpage = ceil(($_G['forum_thread']['replies'] + 1) / $_G['ppp']);
	$page > $totalpage && $page = $totalpage;
	$_G['forum_pagebydesc'] = !$maxposition && $page > 2 && $page > ($totalpage / 2) ? TRUE : FALSE;

	if($_G['forum_pagebydesc']) {
		$firstpagesize = ($_G['forum_thread']['replies'] + 1) % $_G['ppp'];
		$_G['forum_ppp3'] = $_G['forum_ppp2'] = $page == $totalpage && $firstpagesize ? $firstpagesize : $_G['ppp'];
		$realpage = $totalpage - $page + 1;
		if($firstpagesize == 0) {
			$firstpagesize = $_G['ppp'];
		}
		$start_limit = max(0, ($realpage - 2) * $_G['ppp'] + $firstpagesize);
		$_G['forum_numpost'] = ($page - 1) * $_G['ppp'];
		if($ordertype != 1) {
		} else {
			$_G['forum_numpost'] = $_G['forum_thread']['replies'] + 2 - $_G['forum_numpost'] + ($page > 1 ? 1 : 0);
		}
	} else {
		$start_limit = $_G['forum_numpost'] = max(0, ($page - 1) * $_G['ppp']);
		if($start_limit > $_G['forum_thread']['replies']) {
			$start_limit = $_G['forum_numpost'] = 0;
			$page = 1;
		}
		if($ordertype != 1) {
		} else {
			$_G['forum_numpost'] = $_G['forum_thread']['replies'] + 2 - $_G['forum_numpost'] + ($page > 1 ? 1 : 0);
		}
	}
	$multipage = multi($_G['forum_thread']['replies'] + 1, $_G['ppp'], $page, 'forum.php?mod=viewthread&tid='.$_G['tid'].
		($_G['forum_thread']['is_archived'] ? '&archive='.$_G['forum_thread']['archiveid'] : '').
		'&extra='.$_GET['extra'].
		($ordertype && $ordertype != getstatus($_G['forum_thread']['status'], 4) ? '&ordertype='.$ordertype : '').
		(isset($_GET['highlight']) ? '&highlight='.rawurlencode($_GET['highlight']) : '').
		(!empty($_GET['authorid']) ? '&authorid='.$_GET['authorid'] : '').
		(!empty($_GET['from']) ? '&from='.$_GET['from'] : '').
		(!empty($_GET['checkrush']) ? '&checkrush='.$_GET['checkrush'] : '').
		(!empty($_GET['modthreadkey']) ? '&modthreadkey='.rawurlencode($_GET['modthreadkey']) : '').
		$specialextra);
} else {
	$_GET['viewpid'] = intval($_GET['viewpid']);
	$pageadd = "AND p.pid='$_GET[viewpid]'";
}

$_G['forum_newpostanchor'] = $_G['forum_postcount'] = 0;

$_G['forum_onlineauthors'] = $_G['forum_cachepid'] = $_G['blockedpids'] = array();

$isdel_post = $cachepids = $postusers = $skipaids = array();

if($_G['forum_auditstatuson'] || in_array($_G['forum_thread']['displayorder'], array(-2, -3, -4)) && $_G['forum_thread']['authorid'] == $_G['uid']) {
	$visibleallflag = 1;
}

if($maxposition) {
	$start = ($page - 1) * $_G['ppp'] + 1;
	$end = $start + $_G['ppp'];
	if($ordertype == 1) {
		$end = $maxposition - ($page - 1) * $_G['ppp'] + ($page > 1 ? 2 : 1);
		$start = $end - $_G['ppp'] + ($page > 1 ? 0 : 1);
		$start = max(array(1,$start));
	}
	$have_badpost = $realpost = $lastposition = 0;
	foreach(C::t('forum_post')->fetch_all_by_tid_range_position($posttableid, $_G['tid'], $start, $end, $maxposition, $ordertype) as $post) {
		if($post['invisible'] != 0) {
			$have_badpost = 1;
		}
		$cachepids[$post[position]] = $post['pid'];
		$postarr[$post[position]] = $post;
		$lastposition = $post['position'];
	}
	$realpost = count($postarr);
	if($realpost != $_G['ppp'] || $have_badpost) {
		$k = 0;
		for($i = $start; $i < $end; $i ++) {
			if(!empty($cachepids[$i])) {
				$k = $cachepids[$i];
				$isdel_post[$i] = array('deleted' => 1, 'pid' => $k, 'message' => '', 'position' => $i);
			} elseif($i < $maxposition || ($lastposition && $i < $lastposition)) {
				$isdel_post[$i] = array('deleted' => 1, 'pid' => $k, 'message' => '', 'position' => $i);
			}
			$k ++;
		}
	}
	$pagebydesc = false;
}

if($_GET['checkrush'] && $rushreply) {
	$_G['forum_thread']['replies'] = $temp_reply;
}

if(!$maxposition && empty($postarr)) {

	if(empty($_GET['viewpid'])) {
		if($_G['forum_thread']['special'] == 2) {
			$postarr = C::t('forum_post')->fetch_all_tradepost_viewthread_by_tid($_G['tid'], $visibleallflag, $_GET['authorid'], $tpids, $_G['forum_pagebydesc'], $ordertype, $start_limit, ($_G['forum_pagebydesc'] ? $_G['forum_ppp2'] : $_G['ppp']));
		} elseif($_G['forum_thread']['special'] == 5) {
			$postarr = C::t('forum_post')->fetch_all_debatepost_viewthread_by_tid($_G['tid'], $visibleallflag, $_GET['authorid'], $_GET['stand'], $_G['forum_pagebydesc'], $ordertype, $start_limit, ($_G['forum_pagebydesc'] ? $_G['forum_ppp2'] : $_G['ppp']));
		} else {
			$postarr = C::t('forum_post')->fetch_all_common_viewthread_by_tid($_G['tid'], $visibleallflag, $_GET['authorid'], $_G['forum_pagebydesc'], $ordertype, $_G['forum_thread']['replies'] + 1, $start_limit, ($_G['forum_pagebydesc'] ? $_G['forum_ppp2'] : $_G['ppp']));
		}
	} else {
		$post = array();
		if($_G['forum_thread']['special'] == 2) {
			if(!in_array($_GET['viewpid'], $tpids)) {
				$post = C::t('forum_post')->fetch('tid:'.$_G['tid'],$_GET['viewpid']);
			}
		} elseif($_G['forum_thread']['special'] == 5) {
			$post = C::t('forum_post')->fetch('tid:'.$_G['tid'], $_GET['viewpid']);
			$debatpost = C::t('forum_debatepost')->fetch($_GET['viewpid']);
			if(!isset($_GET['stand']) || (isset($_GET['stand']) && ($post['first'] == 1 || $debatpost['stand'] == $_GET['stand']))) {
				$post = array_merge($post, $debatpost);
			} else {
				$post = array();
			}
			unset($debatpost);
		} else {
			$post = C::t('forum_post')->fetch('tid:'.$_G['tid'], $_GET['viewpid']);
		}

		if($post) {
			if($visibleallflag || (!$visibleallflag && !$post['invisible'])) {
				$postarr[0] = $post;
			}
		}
	}

}

if(!empty($isdel_post)) {
	$updatedisablepos = false;
	foreach($isdel_post as $id => $post) {
		if(isset($postarr[$id]['invisible']) && ($postarr[$id]['invisible'] == 0 || $postarr[$id]['invisible'] == -3 || $visibleallflag)) {
			continue;
		}
		$postarr[$id] = $post;
		$updatedisablepos = true;
	}
	if($updatedisablepos && !$rushreply) {
		C::t('forum_threaddisablepos')->insert(array('tid' => $_G['tid']), false, true);
		dheader("Location:forum.php?mod=viewthread&tid=$_G[tid]");
	}
	$ordertype != 1 ? ksort($postarr) : krsort($postarr);
}
$summary = '';
if($page == 1 && $ordertype == 1) {
	$firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid']);
	if($firstpost['invisible'] == 0 || $visibleallflag == 1) {
		$postarr = array_merge(array($firstpost), $postarr);
		unset($firstpost);
	}
}
$tagnames = $locationpids = $hotpostarr = $hotpids = $member_blackList = array();

$remainhots = ($_G['page'] == 1 && !$rushreply && !$hiddenreplies && !$_G['forum_thread']['special'] && !$_G['forum']['noforumrecommend'] && empty($_GET['authorid'])) ? $_G['setting']['threadhotreplies'] : 0;
if($remainhots) {
	$hotpids = array_keys(C::t('forum_hotreply_number')->fetch_all_by_tid_total($_G['tid'], 10));
	$remainhots = $remainhots - count($hotpids);
}

if($_G['setting']['nofilteredpost'] && $_G['forum_thread']['replies'] > $_G['setting']['postperpage'] && $remainhots) {
	$hotpids = array_merge($hotpids, array_keys(C::t('forum_filter_post')->fetch_all_by_tid_postlength_limit($_G['tid'], $remainhots)));
}

if($hotpids) {
	$hotposts = C::t('forum_post')->fetch_all_by_pid($posttableid, $hotpids);
	foreach($hotpids as $hotpid) {
		if($hotposts[$hotpid]) {
			$hotpostarr[$hotpid] = $hotposts[$hotpid];
			$hotpostarr[$hotpid]['hotrecommended'] = true;
		}
	}
	unset($hotposts);
}

if($hotpostarr || $sticklist) {
	$_newpostarr_first = array_shift($postarr);
	$postarr = (array)$sticklist + (array)$hotpostarr + $postarr;
	array_unshift($postarr, $_newpostarr_first);
	unset($_newpostarr_first, $sticklist);
}

foreach($postarr as $post) {
	if(($onlyauthoradd && empty($post['anonymous']) || !$onlyauthoradd) && !isset($postlist[$post['pid']])) {

		if(isset($hotpostarr[$post['pid']])) {
			$post['existinfirstpage'] = true;
		}

		$postusers[$post['authorid']] = array();
		if($post['first']) {
			if($ordertype == 1 && $page != 1) {
				continue;
			}
			$_G['forum_firstpid'] = $post['pid'];
			if(IS_ROBOT || $_G['adminid'] == 1) $summary = str_replace(array("\r", "\n"), '', messagecutstr(strip_tags($post['message']), 160));
			$tagarray_all = $posttag_array = array();
			$tagarray_all = explode("\t", $post['tags']);
			if($tagarray_all) {
				foreach($tagarray_all as $var) {
					if($var) {
						$tag = explode(',', $var);
						$posttag_array[] = $tag;
						$tagnames[] = $tag[1];
					}
				}
			}
			$post['tags'] = $posttag_array;
			if($post['tags']) {
				$post['relateitem'] = getrelateitem($post['tags'], $post['tid'], $_G['setting']['relatenum'], $_G['setting']['relatetime']);
			}
			if(!$_G['forum']['disablecollect']) {
				if($incollection) {
					$post['relatecollection'] = getrelatecollection($post['tid'], false, $post['releatcollectionnum'], $post['releatcollectionmore']);
					if($_G['group']['allowcommentcollection'] && $_GET['ctid']) {
						$ctid = dintval($_GET['ctid']);
						$post['sourcecollection'] = C::t('forum_collection')->fetch($ctid);
					}
				} else {
					$post['releatcollectionnum'] = 0;
				}
			}
		}
		$postlist[$post['pid']] = $post;
	}
}
unset($hotpostarr);
$seodata = array('forum' => $_G['forum']['name'], 'fup' => $_G['cache']['forums'][$fup]['name'], 'subject' => $_G['forum_thread']['subject'], 'summary' => $summary, 'tags' => @implode(',', $tagnames), 'page' => intval($_GET['page']));
if($_G['forum']['status'] != 3) {
	$seotype = 'viewthread';
} else {
	$seotype = 'viewthread_group';
	$seodata['first'] = $nav['first']['name'];
	$seodata['second'] = $nav['second']['name'];
}

list($navtitle, $metadescription, $metakeywords) = get_seosetting($seotype, $seodata);
if(!$navtitle) {
	$navtitle = helper_seo::get_title_page($_G['forum_thread']['subject'], $_G['page']).' - '.strip_tags($_G['forum']['name']);
	$nobbname = false;
} else {
	$nobbname = true;
}
if(!$metakeywords) {
	$metakeywords = strip_tags($thread['subject']);
}
if(!$metadescription) {
	$metadescription = $summary.' '.strip_tags($_G['forum_thread']['subject']);
}

$_G['allblocked'] = true;
$postno = & $_G['cache']['custominfo']['postno'];
$postnostick = str_replace(array('', ''), '', $postno[0]);
if($postusers) {
	$member_verify = $member_field_forum = $member_status = $member_count = $member_profile = $member_field_home = array();
	$uids = array_keys($postusers);
	$uids = array_filter($uids);

	$selfuids = $uids;
	if($_G['setting']['threadblacklist'] && $_G['uid'] && !in_array($_G['uid'], $selfuids)) {
		$selfuids[] = $_G['uid'];
	}
	if(!($_G['setting']['threadguestlite'] && !$_G['uid'])) {
		if($_G['setting']['verify']['enabled']) {
			$member_verify = C::t('common_member_verify')->fetch_all($uids);
			foreach($member_verify as $uid => $data) {
				foreach($_G['setting']['verify'] as $vid => $verify) {
					if($verify['available'] && $verify['showicon']) {
						if($data['verify'.$vid] == 1) {
							$member_verify[$uid]['verifyicon'][] = $vid;
						} elseif (!empty($verify['unverifyicon'])) {
							$member_verify[$uid]['unverifyicon'][] = $vid;
						}
					}
				}
			}
		}
		$member_count = C::t('common_member_count')->fetch_all($selfuids);
		$member_status = C::t('common_member_status')->fetch_all($uids);
		$member_field_forum = C::t('common_member_field_forum')->fetch_all($uids);
		$member_profile = C::t('common_member_profile')->fetch_all($uids);
		$member_field_home = C::t('common_member_field_home')->fetch_all($uids);
	}

	if($_G['setting']['threadblacklist'] && $_G['uid'] && $member_count[$_G['uid']]['blacklist']) {
		$member_blackList = C::t('home_blacklist')->fetch_all_by_uid_buid($_G['uid'], $uids);
	}

	foreach(C::t('common_member')->fetch_all($uids) as $uid => $postuser) {
		$member_field_home[$uid]['privacy'] = empty($member_field_home[$uid]['privacy']) ? array() : dunserialize($member_field_home[$uid]['privacy']);
		$postuser['memberstatus'] = $postuser['status'];
		$postuser['authorinvisible'] = $member_status[$uid]['invisible'];
		$postuser['signature'] = $member_field_forum[$uid]['sightml'];
		unset($member_field_home[$uid]['privacy']['feed'], $member_field_home[$uid]['privacy']['view'], $postuser['status'], $member_status[$uid]['invisible'], $member_field_forum[$uid]['sightml']);
		$postusers[$uid] = array_merge((array)$member_verify[$uid], (array)$member_field_home[$uid], (array)$member_profile[$uid], (array)$member_count[$uid], (array)$member_status[$uid], (array)$member_field_forum[$uid], $postuser);
		if($postusers[$uid]['regdate'] + $postusers[$uid]['oltime'] * 3600 > TIMESTAMP) {
			$postusers[$uid]['oltime'] = 0;
		}
		$postusers[$uid]['office'] = $postusers[$uid]['position'];
		$postusers[$uid]['inblacklist'] = $member_blackList[$uid] ? true : false;
		$postusers[$uid]['groupcolor'] = $_G['cache']['usergroups'][$postuser['groupid']]['color'];
		unset($postusers[$uid]['position']);
	}
	unset($member_field_forum, $member_status, $member_count, $member_profile, $member_field_home, $member_blackList);
	$_G['medal_list'] = array();
	foreach($postlist as $pid => $post) {
		if(getstatus($post['status'], 6)) {
			$locationpids[] = $pid;
		}
		$post = array_merge($postlist[$pid], (array)$postusers[$post['authorid']]);
		$postlist[$pid] = viewthread_procpost($post, $_G['member']['lastvisit'], $ordertype, $maxposition);
	}
}

if($_G['allblocked']) {
	$_G['blockedpids'] = array();
}

if($locationpids) {
	$locations = C::t('forum_post_location')->fetch_all($locationpids);
}

if($postlist && $rushids) {
	foreach($postlist as $pid => $post) {
		$post['number'] = $post['position'];
		$postlist[$pid] = checkrushreply($post);
	}
}

if($_G['setting']['repliesrank'] && $postlist) {
	if($postlist) {
		foreach(C::t('forum_hotreply_number')->fetch_all_by_pids(array_keys($postlist)) as $pid => $post) {
			$postlist[$pid]['postreview']['support'] = dintval($post['support']);
			$postlist[$pid]['postreview']['against'] = dintval($post['against']);
		}
	}
}

if($_G['forum_thread']['special'] > 0 && (empty($_GET['viewpid']) || $_GET['viewpid'] == $_G['forum_firstpid'])) {
	$_G['forum_thread']['starttime'] = gmdate($_G['forum_thread']['dateline']);
	$_G['forum_thread']['remaintime'] = '';
	switch($_G['forum_thread']['special']) {
		case 1: require_once libfile('thread/poll', 'include'); break;
		case 2: require_once libfile('thread/trade', 'include'); break;
		case 3: require_once libfile('thread/reward', 'include'); break;
		case 4: require_once libfile('thread/activity', 'include'); break;
		case 5: require_once libfile('thread/debate', 'include'); break;
		case 127:
			if($_G['forum_firstpid']) {
				$sppos = strpos($postlist[$_G['forum_firstpid']]['message'], chr(0).chr(0).chr(0));
				$specialextra = substr($postlist[$_G['forum_firstpid']]['message'], $sppos + 3);
				$postlist[$_G['forum_firstpid']]['message'] = substr($postlist[$_G['forum_firstpid']]['message'], 0, $sppos);
				if($specialextra) {
					if(array_key_exists($specialextra, $_G['setting']['threadplugins'])) {
						@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
						$classname = 'threadplugin_'.$specialextra;
						if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'viewthread')) {
							$threadplughtml = $threadpluginclass->viewthread($_G['tid']);
						}
					}
				}
			}
			break;
	}
}
if(empty($_GET['authorid']) && empty($postlist)) {
	if($rushreply) {
		dheader("Location: forum.php?mod=redirect&tid=$_G[tid]&goto=lastpost");
	} else {
		$replies = C::t('forum_post')->count_visiblepost_by_tid($_G['tid']);
		$replies = intval($replies) - 1;
		if($_G['forum_thread']['replies'] != $replies && $replies > 0) {
			C::t('forum_thread')->update($_G['tid'], array('replies' => $replies), false, false, $archiveid);
			dheader("Location: forum.php?mod=redirect&tid=$_G[tid]&goto=lastpost");
		}
	}
}

if($_G['forum_pagebydesc'] && (!$savepostposition || $_GET['ordertype'] == 1)) {
	$postlist = array_reverse($postlist, TRUE);
}

if(!empty($_G['setting']['sessionclose'])) {
	$_G['setting']['vtonlinestatus'] = 1;
}

if($_G['setting']['vtonlinestatus'] == 2 && $_G['forum_onlineauthors']) {
	foreach(C::app()->session->fetch_all_by_uid(array_keys($_G['forum_onlineauthors'])) as $author) {
		if(!$author['invisible']) {
			$_G['forum_onlineauthors'][$author['uid']] = 1;
		}
	}
} else {
	$_G['forum_onlineauthors'] = array();
}
$ratelogs = $comments = $commentcount = $totalcomment = array();
if($_G['forum_cachepid']) {
	foreach(C::t('forum_postcache')->fetch_all($_G['forum_cachepid']) as $postcache) {
		if($postcache['rate']) {
			$postcache['rate'] = dunserialize($postcache['rate']);
			$postlist[$postcache['pid']]['ratelog'] = $postcache['rate']['ratelogs'];
			$postlist[$postcache['pid']]['ratelogextcredits'] = $postcache['rate']['extcredits'];
			$postlist[$postcache['pid']]['totalrate'] = $postcache['rate']['totalrate'];
		}
		if($postcache['comment']) {
			$postcache['comment'] = dunserialize($postcache['comment']);
			$commentcount[$postcache['pid']] = $postcache['comment']['count'];
			$comments[$postcache['pid']] = $postcache['comment']['data'];
			$totalcomment[$postcache['pid']] = $postcache['comment']['totalcomment'];
		}
		unset($_G['forum_cachepid'][$postcache['pid']]);
	}
	$postcache = $ratelogs = array();
	if($_G['forum_cachepid']) {
		list($ratelogs, $postlist, $postcache) = C::t('forum_ratelog')->fetch_postrate_by_pid($_G['forum_cachepid'], $postlist, $postcache, $_G['setting']['ratelogrecord']);
	}
	foreach($postlist as $key => $val) {
		if(!empty($val['ratelogextcredits'])) {
			ksort($postlist[$key]['ratelogextcredits']);
		}
	}

	if($_G['forum_cachepid'] && $_G['setting']['commentnumber']) {
		list($comments, $postcache, $commentcount, $totalcomment) = C::t('forum_postcomment')->fetch_postcomment_by_pid($_G['forum_cachepid'], $postcache, $commentcount, $totalcomment, $_G['setting']['commentnumber']);
	}

	foreach($postcache as $pid => $data) {
		C::t('forum_postcache')->insert(array('pid' => $pid, 'rate' => serialize($data['rate']), 'comment' => serialize($data['comment']), 'dateline' => TIMESTAMP), false, true);
	}
}

if($_G['forum_attachpids'] && !defined('IN_ARCHIVER')) {
	require_once libfile('function/attachment');
	if(is_array($threadsortshow) && !empty($threadsortshow['sortaids'])) {
		$skipaids = $threadsortshow['sortaids'];
	}
	parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist, $skipaids);
}

if(empty($postlist)) {
	showmessage('post_not_found');
} elseif(!defined('IN_MOBILE_API')) {
	foreach($postlist as $pid => $post) {
		$postlist[$pid]['message'] = preg_replace("/\[attach\]\d+\[\/attach\]/i", '', $postlist[$pid]['message']);
	}
}

if(defined('IN_ARCHIVER')) {
	include loadarchiver('forum/viewthread');
	exit();
}

$_G['forum_thread']['heatlevel'] = $_G['forum_thread']['recommendlevel'] = 0;
if($_G['setting']['heatthread']['iconlevels']) {
	foreach($_G['setting']['heatthread']['iconlevels'] as $k => $i) {
		if($_G['forum_thread']['heats'] > $i) {
			$_G['forum_thread']['heatlevel'] = $k + 1;
			break;
		}
	}
}

if(!empty($_G['setting']['recommendthread']['status']) && $_G['forum_thread']['recommends']) {
	foreach($_G['setting']['recommendthread']['iconlevels'] as $k => $i) {
		if($_G['forum_thread']['recommends'] > $i) {
			$_G['forum_thread']['recommendlevel'] = $k+1;
			break;
		}
	}
}

$allowblockrecommend = $_G['group']['allowdiy'] || getstatus($_G['member']['allowadmincp'], 4) || getstatus($_G['member']['allowadmincp'], 5) || getstatus($_G['member']['allowadmincp'], 6);
if($_G['setting']['portalstatus']) {
	$allowpostarticle = $_G['group']['allowmanagearticle'] || $_G['group']['allowpostarticle'] || getstatus($_G['member']['allowadmincp'], 2) || getstatus($_G['member']['allowadmincp'], 3);
	$allowpusharticle = empty($_G['forum_thread']['special']) && empty($_G['forum_thread']['sortid']) && !$_G['forum_thread']['pushedaid'];
} else {
	$allowpostarticle = $allowpusharticle = false;
}
if($_G['forum_thread']['displayorder'] != -4) {
	$modmenu = array(
		'thread' => $_G['forum']['ismoderator'] || $allowblockrecommend || $allowpusharticle && $allowpostarticle,
		'post' => $_G['forum']['ismoderator'] && ($_G['group']['allowwarnpost'] || $_G['group']['allowbanpost'] || $_G['group']['allowdelpost'] || $_G['group']['allowstickreply']) || $_G['forum_thread']['pushedaid'] && $allowpostarticle || $_G['forum_thread']['authorid'] == $_G['uid']
	);
} else {
	$modmenu = array();
}

if($_G['forum']['alloweditpost'] && $_G['uid']) {
	$alloweditpost_status = getstatus($_G['setting']['alloweditpost'], $_G['forum_thread']['special'] + 1);
	if(!$alloweditpost_status) {
		$edittimelimit = $_G['group']['edittimelimit'] * 60;
	}
}

if($_G['forum_thread']['replies'] > $_G['forum_thread']['views']) {
	$_G['forum_thread']['views'] = $_G['forum_thread']['replies'];
}

require_once libfile('function/upload');
$swfconfig = getuploadconfig($_G['uid'], $_G['fid']);
$_G['forum_thread']['relay'] = 0;

if(getstatus($_G['forum_thread']['status'], 10)) {
	$preview = C::t('forum_threadpreview')->fetch($_G['tid']);
	$_G['forum_thread']['relay'] = $preview['relay'];
}

if(empty($_GET['viewpid'])) {
	$sufix = '';
	if($_GET['from'] == 'portal') {
		$_G['disabledwidthauto'] = 1;
		$_G['widthauto'] = 0;
		$sufix = '_portal';
		$post = &$postlist[$_G['forum_firstpid']];
	} elseif($_GET['from'] == 'preview') {
		$_G['disabledwidthauto'] = 1;
		$_G['widthauto'] = 0;
		$sufix = '_preview';
	} elseif($_GET['from'] == 'album') {
		$_G['disabledwidthauto'] = 1;
		$_G['widthauto'] = 0;
		$sufix = '_album';
		$post = &$postlist[$_G['forum_firstpid']];
		$post['message'] = cutstr(strip_tags(preg_replace('/(<ignore_js_op>.*<\/ignore_js_op>)/is', '', $post['message'])), 200);
		require_once libfile('thread/album', 'include');
	}
	include template('diy:forum/viewthread'.$sufix.':'.$_G['fid']);
} else {
	$_G['setting']['admode'] = 0;
	$post = $postlist[$_GET['viewpid']];
	if($maxposition) {
		$post['number'] = $post['position'];
	} else {
		$post['number'] = C::t('forum_post')->count_by_tid_dateline($posttableid, $post['tid'], $post['dbdateline']);
	}
	if($rushreply) {
		$post['number'] = $post['position'];
		$preg_str = rushreply_rule($rewardfloorarr);
		preg_match_all($preg_str, ",,".$post['number'].",,", $arr);
		if($post['number'] == str_replace(",", '', $arr['0']['0'])) {
			$post['rewardfloor'] = 1;
		}
	}
	include template('common/header_ajax');
	hookscriptoutput('viewthread');
	$postcount = 0;
	if($_GET['from']) {
		include template($_GET['from'] == 'preview' ? 'forum/viewthread_preview_node' : 'forum/viewthread_from_node');
	} else {
		include template('forum/viewthread_node');
	}
	include template('common/footer_ajax');
}

function viewthread_updateviews($tableid) {
	global $_G;

	if(!$_G['setting']['preventrefresh'] || $_G['cookie']['viewid'] != 'tid_'.$_G['tid']) {
		if(!$tableid && $_G['setting']['optimizeviews']) {
			if($_G['forum_thread']['addviews']) {
				if($_G['forum_thread']['addviews'] < 100) {
					C::t('forum_threadaddviews')->update_by_tid($_G['tid']);
				} else {
					if(!discuz_process::islocked('update_thread_view')) {
						$row = C::t('forum_threadaddviews')->fetch($_G['tid']);
						C::t('forum_threadaddviews')->update($_G['tid'], array('addviews' => 0));
						C::t('forum_thread')->increase($_G['tid'], array('views' => $row['addviews']+1), true);
						discuz_process::unlock('update_thread_view');
					}
				}
			} else {
				C::t('forum_threadaddviews')->insert(array('tid' => $_G['tid'], 'addviews' => 1), false, true);
			}
		} else {
			C::t('forum_thread')->increase($_G['tid'], array('views' => 1), true, $tableid);
		}
	}
	dsetcookie('viewid', 'tid_'.$_G['tid']);
}

function viewthread_procpost($post, $lastvisit, $ordertype, $maxposition = 0) {
	global $_G, $rushreply;

	if(!$_G['forum_newpostanchor'] && $post['dateline'] > $lastvisit) {
		$post['newpostanchor'] = '';
		$_G['forum_newpostanchor'] = 1;
	} else {
		$post['newpostanchor'] = '';
	}

	$post['lastpostanchor'] = ($ordertype != 1 && $_G['forum_numpost'] == $_G['forum_thread']['replies']) || ($ordertype == 1 && $_G['forum_numpost'] == $_G['forum_thread']['replies'] + 2) ? '' : '';

	if(!$post['hotrecommended']) {
		if($_G['forum_pagebydesc']) {
			if($ordertype != 1) {
				$post['number'] = $_G['forum_numpost'] + $_G['forum_ppp2']--;
			} else {
				$post['number'] = $post['first'] == 1 ? 1 : ($_G['forum_numpost'] - 1) - $_G['forum_ppp2']--;
			}
		} else {
			if($ordertype != 1) {
				$post['number'] = ++$_G['forum_numpost'];
			} else {
				$post['number'] = $post['first'] == 1 ? 1 : --$_G['forum_numpost'];
				$post['number'] = $post['number'] - 1;
			}
		}
	}

	if($post['existinfirstpage']) {
		if($_G['forum_pagebydesc']) {
			$_G['forum_ppp2']--;
		} else {
			if($ordertype != 1) {
				++$_G['forum_numpost'];
			} else {
				--$_G['forum_numpost'];
			}
		}
	}

	if($maxposition) {
		$post['number'] = $post['position'];
	}

	if($post['hotrecommended']) {
		$post['number'] = -1;
	}

	if(!$_G['forum_thread']['special'] && !$rushreply && !$hiddenreplies && $_G['setting']['threadfilternum'] && getstatus($post['status'], 11)) {
		$post['isWater'] = true;
		if($_G['setting']['hidefilteredpost'] && !$_G['forum']['noforumhidewater']) {
			$post['inblacklist'] = true;
		}
	} else {
		$_G['allblocked'] = false;
	}

	if($post['inblacklist']) {
		$_G['blockedpids'][] = $post['pid'];
	}

	$_G['forum_postcount']++;

	$post['dbdateline'] = $post['dateline'];
	$post['dateline'] = dgmdate($post['dateline'], 'u', '9999', getglobal('setting/dateformat').' H:i:s');
	$post['groupid'] = $_G['cache']['usergroups'][$post['groupid']] ? $post['groupid'] : 7;

	if($post['username']) {

		$_G['forum_onlineauthors'][$post['authorid']] = 0;
		$post['usernameenc'] = rawurlencode($post['username']);
		$post['readaccess'] = $_G['cache']['usergroups'][$post['groupid']]['readaccess'];
		if($_G['cache']['usergroups'][$post['groupid']]['userstatusby'] == 1) {
			$post['authortitle'] = $_G['cache']['usergroups'][$post['groupid']]['grouptitle'];
			$post['stars'] = $_G['cache']['usergroups'][$post['groupid']]['stars'];
		}
		$post['upgradecredit'] = false;
		if($_G['cache']['usergroups'][$post['groupid']]['type'] == 'member' && $_G['cache']['usergroups'][$post['groupid']]['creditslower'] != 999999999) {
			$post['upgradecredit'] = $_G['cache']['usergroups'][$post['groupid']]['creditslower'] - $post['credits'];
			$post['upgradeprogress'] = 100 - ceil($post['upgradecredit'] / ($_G['cache']['usergroups'][$post['groupid']]['creditslower'] - $_G['cache']['usergroups'][$post['groupid']]['creditshigher']) * 100);
			$post['upgradeprogress'] = min(max($post['upgradeprogress'], 2), 100);
		}

		$post['taobaoas'] = addslashes($post['taobao']);
		$post['regdate'] = dgmdate($post['regdate'], 'd');
		$post['lastdate'] = dgmdate($post['lastvisit'], 'd');

		$post['authoras'] = !$post['anonymous'] ? ' '.addslashes($post['author']) : '';

		if($post['medals']) {
			loadcache('medals');
			foreach($post['medals'] = explode("\t", $post['medals']) as $key => $medalid) {
				list($medalid, $medalexpiration) = explode("|", $medalid);
				if(isset($_G['cache']['medals'][$medalid]) && (!$medalexpiration || $medalexpiration > TIMESTAMP)) {
					$post['medals'][$key] = $_G['cache']['medals'][$medalid];
					$post['medals'][$key]['medalid'] = $medalid;
					$_G['medal_list'][$medalid] = $_G['cache']['medals'][$medalid];
				} else {
					unset($post['medals'][$key]);
				}
			}
		}

		$post['avatar'] = avatar($post['authorid']);
		$post['groupicon'] = $post['avatar'] ? g_icon($post['groupid'], 1) : '';
		$post['banned'] = $post['status'] & 1;
		$post['warned'] = ($post['status'] & 2) >> 1;

	} else {
		if(!$post['authorid']) {
			$post['useip'] = substr($post['useip'], 0, strrpos($post['useip'], '.')).'.x';
		}
	}
	$post['attachments'] = array();
	$post['imagelist'] = $post['attachlist'] = '';

	if($post['attachment']) {
		if((!empty($_G['setting']['guestviewthumb']['flag']) && !$_G['uid']) || $_G['group']['allowgetattach'] || $_G['group']['allowgetimage']) {
			$_G['forum_attachpids'][] = $post['pid'];
			$post['attachment'] = 0;
			if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $post['message'], $matchaids)) {
				$_G['forum_attachtags'][$post['pid']] = $matchaids[1];
			}
		} else {
			$post['message'] = preg_replace("/\[attach\](\d+)\[\/attach\]/i", '', $post['message']);
		}
	}

	if($_G['setting']['ratelogrecord'] && $post['ratetimes']) {
		$_G['forum_cachepid'][$post['pid']] = $post['pid'];
	}
	if($_G['setting']['commentnumber'] && ($post['first'] && $_G['setting']['commentfirstpost'] || !$post['first']) && $post['comment']) {
		$_G['forum_cachepid'][$post['pid']] = $post['pid'];
	}
	$post['allowcomment'] = $_G['setting']['commentnumber'] && in_array(1, $_G['setting']['allowpostcomment']) && ($_G['setting']['commentpostself'] || $post['authorid'] != $_G['uid']) &&
		($post['first'] && $_G['setting']['commentfirstpost'] && in_array($_G['group']['allowcommentpost'], array(1, 3)) ||
		(!$post['first'] && in_array($_G['group']['allowcommentpost'], array(2, 3))));
	$forum_allowbbcode = $_G['forum']['allowbbcode'] ? -$post['groupid'] : 0;
	$post['signature'] = $post['usesig'] ? ($_G['setting']['sigviewcond'] ? (strlen($post['message']) > $_G['setting']['sigviewcond'] ? $post['signature'] : '') : $post['signature']) : '';
	$imgcontent = $post['first'] ? getstatus($_G['forum_thread']['status'], 15) : 0;
	if(!defined('IN_ARCHIVER')) {
		if($post['first']) {
			if(!defined('IN_MOBILE')) {
				$messageindex = false;
				if(strpos($post['message'], '[/index]') !== FALSE) {
					$post['message'] = preg_replace("/\s?\[index\](.+?)\[\/index\]\s?/ies", "parseindex('\\1', '$post[pid]')", $post['message']);
					$messageindex = true;
					unset($_GET['threadindex']);
				}
				if(strpos($post['message'], '[page]') !== FALSE) {
					if($_GET['cp'] != 'all') {
						$postbg = '';
						if(strpos($post['message'], '[/postbg]') !== FALSE) {
							preg_match("/\s?\[postbg\]\s*([^\[\<\r\n;'\"\?\(\)]+?)\s*\[\/postbg\]\s?/is", $post['message'], $r);
							$postbg = $r[0];
						}
						$messagearray = explode('[page]', $post['message']);
						$cp = max(intval($_GET['cp']), 1);
						$post['message'] = $messagearray[$cp - 1];
						if($postbg && strpos($post['message'], '[/postbg]') === FALSE) {
							$post['message'] = $postbg.$post['message'];
						}
						unset($postbg);
					} else {
						$cp = 0;
						$post['message'] = preg_replace("/\s?\[page\]\s?/is", '', $post['message']);
					}
					if($_GET['cp'] != 'all' && strpos($post['message'], '[/index]') === FALSE && empty($_GET['threadindex']) && !$messageindex) {
						$_G['forum_posthtml']['footer'][$post['pid']] .= '

';
					}
				}
			}
		}
		if(!empty($_GET['threadindex'])) {
			$_G['forum_posthtml']['header'][$post['pid']] .= '

';
		}
		if(!$imgcontent) {
			$post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $_G['forum']['allowsmilies'], $forum_allowbbcode, ($_G['forum']['allowimgcode'] && $_G['setting']['showimages'] ? 1 : 0), $_G['forum']['allowhtml'], ($_G['forum']['jammer'] && $post['authorid'] != $_G['uid'] ? 1 : 0), 0, $post['authorid'], $_G['cache']['usergroups'][$post['groupid']]['allowmediacode'] && $_G['forum']['allowmediacode'], $post['pid'], $_G['setting']['lazyload'], $post['dbdateline'], $post['first']);
			if($post['first']) {
				$_G['relatedlinks'] = '';
				$relatedtype = !$_G['forum_thread']['isgroup'] ? 'forum' : 'group';
				if(!$_G['setting']['relatedlinkstatus']) {
					$_G['relatedlinks'] = get_related_link($relatedtype);
				} else {
					$post['message'] = parse_related_link($post['message'], $relatedtype);
				}
				if(strpos($post['message'], '[/begin]') !== FALSE) {
					$post['message'] = preg_replace("/\[begin(=\s*([^\[\<\r\n]*?)\s*,(\d*),(\d*),(\d*),(\d*))?\]\s*([^\[\<\r\n]+?)\s*\[\/begin\]/ies", $_G['cache']['usergroups'][$post['groupid']]['allowbegincode'] ? "parsebegin('\\2', '\\7', '\\3', '\\4', '\\5', '\\6');" : '', $post['message']);
				}
			}
		}
	}
	if(defined('IN_ARCHIVER') || defined('IN_MOBILE') || !$post['first']) {
		if(strpos($post['message'], '[page]') !== FALSE) {
			$post['message'] = preg_replace("/\s?\[page\]\s?/is", '', $post['message']);
		}
		if(strpos($post['message'], '[/index]') !== FALSE) {
			$post['message'] = preg_replace("/\s?\[index\](.+?)\[\/index\]\s?/is", '', $post['message']);
		}
		if(strpos($post['message'], '[/begin]') !== FALSE) {
			$post['message'] = preg_replace("/\[begin(=\s*([^\[\<\r\n]*?)\s*,(\d*),(\d*),(\d*),(\d*))?\]\s*([^\[\<\r\n]+?)\s*\[\/begin\]/ies", '', $post['message']);
		}
	}
	if($imgcontent) {
		$post['message'] = '';
	}
	$_G['forum_firstpid'] = intval($_G['forum_firstpid']);
	$post['numbercard'] = viewthread_numbercard($post);
	$post['mobiletype'] = getstatus($post['status'], 4) ? base_convert(getstatus($post['status'], 10).getstatus($post['status'], 9).getstatus($post['status'], 8), 2, 10) : 0;
	return $post;
}

function viewthread_loadcache() {
	global $_G;
	$_G['forum']['livedays'] = ceil((TIMESTAMP - $_G['forum']['dateline']) / 86400);
	$_G['forum']['lastpostdays'] = ceil((TIMESTAMP - $_G['forum']['lastthreadpost']) / 86400);
	$threadcachemark = 100 - (
	$_G['forum']['displayorder'] * 15 +
	$_G['thread']['digest'] * 10 +
	min($_G['thread']['views'] / max($_G['forum']['livedays'], 10) * 2, 50) +
	max(-10, (15 - $_G['forum']['lastpostdays'])) +
	min($_G['thread']['replies'] / $_G['setting']['postperpage'] * 1.5, 15));
	if($threadcachemark < $_G['forum']['threadcaches']) {

		$threadcache = getcacheinfo($_G['tid']);

		if(TIMESTAMP - $threadcache['filemtime'] > $_G['setting']['cachethreadlife']) {
			@unlink($threadcache['filename']);
			define('CACHE_FILE', $threadcache['filename']);
		} else {
			readfile($threadcache['filename']);

			viewthread_updateviews($_G['forum_thread']['threadtableid']);
			$_G['setting']['debug'] && debuginfo();
			$_G['setting']['debug'] ? die('') : die();
		}
	}
}

function viewthread_lastmod(&$thread) {
	global $_G;
	if(!$thread['moderated']) {
		return array();
	}
	$lastmod = array();
	$lastlog = C::t('forum_threadmod')->fetch_by_tid($thread['tid']);
	if($lastlog) {
		$lastmod = array(
					'moduid' => $lastlog['uid'],
					'modusername' => $lastlog['username'],
					'moddateline' => $lastlog['dateline'],
					'modaction' => $lastlog['action'],
					'magicid' => $lastlog['magicid'],
					'stamp' => $lastlog['stamp'],
					'reason' => $lastlog['reason']
				);
	}
	if($lastmod) {
		$modactioncode = lang('forum/modaction');
		$lastmod['modusername'] = $lastmod['modusername'] ? $lastmod['modusername'] : 'System';
		$lastmod['moddateline'] = dgmdate($lastmod['moddateline'], 'u');
		$lastmod['modactiontype'] = $lastmod['modaction'];
		if($modactioncode[$lastmod['modaction']]) {
			$lastmod['modaction'] = $modactioncode[$lastmod['modaction']].($lastmod['modaction'] != 'SPA' ? '' : ' '.$_G['cache']['stamps'][$lastmod['stamp']]['text']);
		} elseif(substr($lastmod['modaction'], 0, 1) == 'L' && preg_match('/L(\d\d)/', $lastmod['modaction'], $a)) {
			$lastmod['modaction'] = $modactioncode['SLA'].' '.$_G['cache']['stamps'][intval($a[1])]['text'];
		} else {
			$lastmod['modaction'] = '';
		}
		if($lastmod['magicid']) {
			loadcache('magics');
			$lastmod['magicname'] = $_G['cache']['magics'][$lastmod['magicid']]['name'];
		}
	} else {
		C::t('forum_thread')->update($thread['tid'], array('moderated' => 0), false, false, $thread['threadtableid']);
		$thread['moderated'] = 0;
	}
	return $lastmod;
}

function viewthread_baseinfo($post, $extra) {
	global $_G;
	list($key, $type) = $extra;
	$v = '';
	if(substr($key, 0, 10) == 'extcredits') {
		$i = substr($key, 10);
		$extcredit = $_G['setting']['extcredits'][$i];
		if($extcredit) {
			$v = $type ? ($extcredit['img'] ? $extcredit['img'].' ' : '').$extcredit['title'] : $post['extcredits'.$i].' '.$extcredit['unit'];
		}
	} elseif(substr($key, 0, 6) == 'field_') {
		$field = substr($key, 6);
		if(!empty($post['privacy']['profile'][$field])) {
			return '';
		}
		require_once libfile('function/profile');
		if($field != 'qq') {
			$v = profile_show($field, $post);
		} elseif(!empty($post['qq'])) {
			$v = '';
		}
		if($v) {
			if(!isset($_G['cache']['profilesetting'])) {
				loadcache('profilesetting');
			}
			$v = $type ? $_G['cache']['profilesetting'][$field]['title'] : $v;
		}
	} elseif($key == 'eccredit_seller') {
		$v = $type ? lang('space', 'viewthread_userinfo_sellercredit') : '';
	} elseif($key == 'eccredit_buyer') {
		$v = $type ? lang('space', 'viewthread_userinfo_buyercredit') : '';
	} else {
		$v = getLinkByKey($key, $post);
		if($v !== '') {
			$v = $type ? lang('space', 'viewthread_userinfo_'.$key) : $v;
		}
	}
	return $v;
}

function viewthread_profile_nodeparse($param) {
	list($name, $s, $e, $extra, $post) = $param;
	if(strpos($name, ':') === false) {
		if(function_exists('profile_node_'.$name)) {
			return call_user_func('profile_node_'.$name, $post, $s, $e, explode(',', $extra));
		} else {
			return '';
		}
	} else {
		list($plugin, $pluginid) = explode(':', $name);
		if($plugin == 'plugin') {
			global $_G;
			static $pluginclasses;
			if(isset($_G['setting']['plugins']['profile_node'][$pluginid])) {
				@include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['plugins']['profile_node'][$pluginid].'.class.php';
				$classkey = 'plugin_'.$pluginid;
				if(!class_exists($classkey, false)) {
					return '';
				}
				if(!isset($pluginclasses[$classkey])) {
					$pluginclasses[$classkey] = new $classkey;
				}
				return call_user_func(array($pluginclasses[$classkey], 'profile_node'), $post, $s, $e, explode(',', $extra));
			}
		}
	}
}

function viewthread_profile_node($type, $post) {
	global $_G;
	$tpid = false;
	if($post['verifyicon']) {
		$tpid = isset($_G['setting']['profilenode']['groupid'][-$post['verifyicon'][0]]) ? $_G['setting']['profilenode']['groupid'][-$post['verifyicon'][0]] : false;
	}
	if($tpid === false) {
		$tpid = isset($_G['setting']['profilenode']['groupid'][$post['groupid']]) ? $_G['setting']['profilenode']['groupid'][$post['groupid']] : 0;
	}
	$template = $_G['setting']['profilenode']['template'][$tpid][$type];
	$code = $_G['setting']['profilenode']['code'][$tpid][$type];
	include_once template('forum/viewthread_profile_node');
	foreach($code as $k => $p) {
		$p[] = $post;
		$template = str_replace($k, call_user_func('viewthread_profile_nodeparse', $p), $template);
	}
	echo $template;
}

function viewthread_numbercard($post) {
	global $_G;
	if(!is_array($_G['setting']['numbercard'])) {
		$_G['setting']['numbercard'] = dunserialize($_G['setting']['numbercard']);
	}

	$numbercard = array();
	foreach($_G['setting']['numbercard']['row'] as $key) {
		if(substr($key, 0, 10) == 'extcredits') {
			$numbercard[] = array('link' => 'home.php?mod=space&uid='.$post['uid'].'&do=profile', 'value' => $post[$key], 'lang' => $_G['setting']['extcredits'][substr($key, 10)]['title']);
		} else {
			$getLink = getLinkByKey($key, $post, 1);
			$numbercard[] = array('link' => $getLink['link'], 'value' => $getLink['value'], 'lang' => lang('space', 'viewthread_userinfo_'.$key));
		}
	}
	return $numbercard;
}
function getLinkByKey($key, $post, $returnarray = 0) {
	switch($key) {
		case 'uid': $v = array('link' => '?'.$post['uid'], 'value' => $post['uid']);break;
		case 'posts': $v = array('link' => 'home.php?mod=space&uid='.$post['uid'].'&do=thread&type=reply&view=me&from=space', 'value' => $post['posts']);break;
		case 'threads': $v = array('link' => 'home.php?mod=space&uid='.$post['uid'].'&do=thread&type=thread&view=me&from=space', 'value' => $post['threads']);break;
		case 'digestposts': $v = array('link' => 'home.php?mod=space&uid='.$post['uid'].'&do=thread&type=thread&view=me&from=space', 'value' => $post['digestposts']);break;
		case 'feeds': $v = array('link' => 'home.php?mod=follow&uid='.$post['uid'].'&do=view', 'value' => $post['feeds']);break;
		case 'doings': $v = array('link' => 'home.php?mod=space&uid='.$post['uid'].'&do=doing&view=me&from=space', 'value' => $post['doings']);break;
		case 'blogs': $v = array('link' => 'home.php?mod=space&uid='.$post['uid'].'&do=blog&view=me&from=space', 'value' => $post['blogs']);break;
		case 'albums': $v = array('link' => 'home.php?mod=space&uid='.$post['uid'].'&do=album&view=me&from=space', 'value' => $post['albums']);break;
		case 'sharings': $v = array('link' => 'home.php?mod=space&uid='.$post['uid'].'&do=share&view=me&from=space', 'value' => $post['sharings']);break;
		case 'friends': $v = array('link' => 'home.php?mod=space&uid='.$post['uid'].'&do=friend&view=me&from=space', 'value' => $post['friends']);break;
		case 'follower': $v = array('link' => 'home.php?mod=follow&do=follower&uid='.$post['uid'], 'value' => $post['follower']);break;
		case 'following': $v = array('link' => 'home.php?mod=follow&do=following&uid='.$post['uid'], 'value' => $post['following']);break;
		case 'credits': $v = array('link' => 'home.php?mod=space&uid='.$post['uid'].'&do=profile', 'value' => $post['credits']);break;
		case 'digest': $v = array('value' => $post['digestposts']);break;
		case 'readperm': $v = array('value' => $post['readaccess']);break;
		case 'regtime': $v = array('value' => $post['regdate']);break;
		case 'lastdate': $v = array('value' => $post['lastdate']);break;
		case 'oltime': $v = array('value' => $post['oltime'].' '.lang('space', 'viewthread_userinfo_hour'));break;
	}
	if(!$returnarray) {
		if($v['link']) {
			$v = ''.$v['value'].'';
		} else {
			$v = $v['value'];
		}
	}
	return $v;
}
function countlevel($usercredit) {
	global $_G;

	$rank = 0;
	if($usercredit){
		foreach($_G['setting']['ec_credit']['rank'] AS $level => $credit) {
			if($usercredit <= $credit) {
				$rank = $level;
				break;
			}
		}
	}
	return $rank;
}
function remaintime($time) {
	$days = intval($time / 86400);
	$time -= $days * 86400;
	$hours = intval($time / 3600);
	$time -= $hours * 3600;
	$minutes = intval($time / 60);
	$time -= $minutes * 60;
	$seconds = $time;
	return array((int)$days, (int)$hours, (int)$minutes, (int)$seconds);
}

function getrelateitem($tagarray, $tid, $relatenum, $relatetime, $relatecache = '', $type = 'tid') {
	$tagidarray = $relatearray = $relateitem = array();
	$updatecache = 0;
	$limit = $relatenum;
	if(!$limit) {
		return '';
	}
	foreach($tagarray as $var) {
		$tagidarray[] = $var['0'];
	}
	if(!$tagidarray) {
		return '';
	}
	if(empty($relatecache)) {
		$thread = C::t('forum_thread')->fetch($tid);
		$relatecache = $thread['relatebytag'];
	}
	if($relatecache) {
		$relatecache = explode("\t", $relatecache);
		if(TIMESTAMP > $relatecache[0] + $relatetime * 60) {
			$updatecache = 1;
		} else {
			if(!empty($relatecache[1])) {
				$relatearray = explode(',', $relatecache[1]);
			}
		}
	} else {
		$updatecache = 1;
	}
	if($updatecache) {
		$query = C::t('common_tagitem')->select($tagidarray, $tid, $type, 'itemid', 'DESC', $limit, 0, '<>');
		foreach($query as $result) {
			if($result['itemid']) {
				$relatearray[] = $result['itemid'];
			}
		}
		if($relatearray) {
			$relatebytag = implode(',', $relatearray);
		}
		C::t('forum_thread')->update($tid, array('relatebytag'=>TIMESTAMP."\t".$relatebytag));
	}

	if(!empty($relatearray)) {
		rsort($relatearray);
		foreach(C::t('forum_thread')->fetch_all_by_tid($relatearray) as $result) {
			if($result['displayorder'] >= 0) {
				$relateitem[] = $result;
			}
		}
	}
	return $relateitem;
}

function rushreply_rule () {
	global $rushresult;
	if(!empty($rushresult['rewardfloor'])) {
		$rushresult['rewardfloor'] = preg_replace('/\*+/', '*', $rushresult['rewardfloor']);
		$rewardfloorarr = explode(',', $rushresult['rewardfloor']);
		if($rewardfloorarr) {
			foreach($rewardfloorarr as $var) {
				$var = trim($var);
				if(strlen($var) > 1) {
					$var = str_replace('*', '[^,]?[\d]*', $var);
				} else {
					$var = str_replace('*', '\d+', $var);
				}
				$preg[] = "(,$var,)";
			}
			$preg_str = "/".implode('|', $preg)."/";
		}
	}
	return $preg_str;
}

function checkrushreply($post) {
	global $_G, $rushids;
	if($_GET['authorid']) {
		return $post;
	}
	if(in_array($post['number'], $rushids)) {
		$post['rewardfloor'] = 1;
	}
	return $post;
}

function parseindex($nodes, $pid) {
	global $_G;
	$nodes = dhtmlspecialchars($nodes);
	$nodes = preg_replace('/(\**?)\[#(\d+)\](.+?)[\r\n]/', "\\3", $nodes);
	$nodes = preg_replace('/(\**?)\[#(\d+),(\d+)\](.+?)[\r\n]/', "\\4", $nodes);
	$_G['forum_posthtml']['header'][$pid] .= '
'.$nodes.'
';
	return '';
}

function parsebegin($linkaddr, $imgflashurl, $w = 0, $h = 0, $type = 0, $s = 0) {
	static $begincontent;
	if($begincontent || $_GET['from'] == 'preview') {
		return '';
	}
	preg_match("/((https?){1}:\/\/|www\.)[^\[\"']+/i", $imgflashurl, $matches);
	$imgflashurl = $matches[0];
	$fileext = fileext($imgflashurl);
	$randomid = 'swf_'.random(3);
	$w = ($w >=400 && $w <=1024) ? $w : 900;
	$h = ($h >=300 && $h <=640) ? $h : 500;
	$s = $s ? $s*1000 : 5000;
	switch($fileext) {
		case 'jpg':
		case 'jpeg':
		case 'gif':
		case 'png':
			$content = '';
			break;
		case 'flv':
			$content = ''.
				'';
			break;
		case 'swf':
			$content = ''.
				'';
			break;
		default:
			$content = '';
	}
	if($content) {
		if($type == 1) {
			$content = '
'.
				'

'.lang('core', 'close').'

'.
				$content.'
'.
				'

'.
				'';
		} else {
			$content = '
'.
				'

'.lang('core', 'close').'

'.
				$content.'
'.
				'

'.
				'';
		}
	}
	$begincontent = $content;
	return $content;
}

function _checkviewgroup() {
	global $_G;
	$_G['action']['action'] = 3;
	require_once libfile('function/group');
	$status = groupperm($_G['forum'], $_G['uid']);
	if($status == 1) {
		showmessage('forum_group_status_off');
	} elseif($status == 2) {
		showmessage('forum_group_noallowed', 'forum.php?mod=group&fid='.$_G['fid']);
	} elseif($status == 3) {
		showmessage('forum_group_moderated', 'forum.php?mod=group&fid='.$_G['fid']);
	}
}

?>

redpajama_set_name: RedPajamaGithub


If you are a woman who loves to be fashionable, then you will need to get to know the C & A Winter Collection that was created in partnership with MOB, a brand from São Paulo.
In this collection you will see a lot of leather pieces, boho chic style, dark tones, super cheerful tones, and even pedrarias, sequins, and lots of shine.
But do not stop there, because the fashion of animal print prints, which are already considered classic, also come to color the station, now in stronger colors.
Velvet is also another sure bet of the brand, and you can choose from the strong colors that you like.
Those blouses or sweater via a2zdirectory and gipsy-dropped dresses are a strong trend, and are in the Winter C & A Collection, and you can bet without fear of making a mistake.
So too the flare pants that are a charm, and leave you extremely elegant woman.
On the catwalks, the brand bet on matching checked shirts with synthetic leather, T-shirts that resemble the 80s, leggings with mini prints, jeans in the most diverse washes, in short, an incredible collection with options for different tastes.
Fringes, feathers, tribal prints, country trend, hippie, indigenous, that refer to the 60s and 70s, studs and metals, are in garments and also in accessories.


Finding flights to Lithuania with our airfare widget is easy. To get the best Lithuania flights, use our tool to check out all the major travel sites for your air ticket.
Finding cheap flights to Lithuania with our cheap flight & airline tickets widget is easy. To get the best Lithuania flights, use our tool to check out all the major travel sites for your flight.
You can also use the same flight search tool to get the best airline coupons and promo codes for airline tickets to cities in Lithuania.
Many people book their cheap flights to Lithuania online and have saved a lot of money on airfare and vacations. I definitely recommend checking out as many of these sites as possible, compare prices, and then book your flight to Lithuania. It's fast, convenient, and I've never had any trouble with it.
Don't forget to book your hotel in Lithuania!


text:
For Release 06:00 EDT, September 17, 2018
Let's Quash the President's Twitter Insults: Twijitsu to the Rescue
Twitter Jujitsu, or Twijitsu, leverages the president's Twitter insults as a cause for celebration
Silicon Valley, CA — September 17, 2018 — We've all read the president's insults on Twitter. According to CNN, the president has attacked nearly 100 people on Twitter since taking office. Recently, he blasted the intelligence of NBA superstar LeBron James and CNN's Don Lemon (in a single tweet!). He labeled Omarosa Manigault "a crazed, crying lowlife" and a "dog." His weekend Twitter rants often feature "Crooked Hillary," "Lyin' James Comey," and "Discredited Robert Mueller." And Jeff Sessions — it seems there's always an opportunity for the president to insult the capabilities of Jeff Sessions.
Twijitsu, the Contest
Now imagine those insults as a cause for celebration. To win at Twijitsu is simple: the president must insult you on Twitter.
Simple, yes, but more difficult than it sounds. If all it took was a Twitter insult, too many people would unintentionally win. To ensure parity, entrants must start a new Twitter handle, and that is where the president must deliver his abuse. Winners cannot attract the president's attention by trolling. Instead, Twijitsu values contestants who confront the president with "a plausible campaign for meaningful improvement." Think Colin Kaepernick. Anybody can (and should) participate. Just tweet your entry to @SYPlify using #Twijitsu. Until further notice, contest winners get nothing more than social media bragging rights.
Much more important than crowning Twijitsu winners is the unintended impact of every insult. The bigger the contest gets, the more likely abusive tweets from the president will set off a social media flurry wondering, "Was that a #Twijitsu winner?" How might the president react knowing his invective could backfire? Perhaps he will stop the behavior. Perhaps not.
Twijitsu, the Book
Snider Vichon (a pseudonym) invented Twijitsu during a dinner debate with relatives. They were convinced that nothing could be done to alter the divisive discourse taking over our country and much of the globe. In response, Mr. Vichon literally wrote the book. Then he created the website and started the contest using the Twitter handle, @SYPlify.
The story is fiction, but the contest is real. The book, also titled Twijitsu, takes about an hour to read. Tension escalates between the anonymous contest creator, his family, a Washington DC news reporter, and the White House. A protest in disguise, the contest skyrockets in popularity and influence. The president's response is truly unthinkable. Readers — and the author, too — are left to wonder if fiction might predict reality.
Free Kindle eBook copies of Twijitsu will be available exclusively on Amazon (https://www.amazon.com/dp/B07CV4GPNZ/) from Tuesday, September 18, 2018 through Thursday, September 20, 2018. Reporters, reviewers, readers, and aspiring Twijitsu contestants: Please download the book while it is freely available.
Twijitsu's Creator
For security reasons, Snider Vichon's identity has not been disclosed. A quick read through Twijitsu — or just the story's opening sentence — will illuminate his rationale. What little has been shared on Mr. Vichon's Amazon author profile points to his background in missile defense systems and interactive media. Twijitsu is his first book. He hopes it is not his last.
Snider Vichon
SYPlify Press
SniderVichon@SYPlify.com
https://www.Twijitsu.com
Twitter: https://www.twitter.com/SYPlify
Facebook: https://www.facebook.com/twijitsu/
Twijitsu to the Rescue

redpajama_set_name: RedPajamaCommonCrawl


text:
Less cut and thrust more cut and paste
If academe is to tackle plagiarism, it must begin to levy tougher penalties on cheats and reward the honest, argues Sunny Bains.
It doesn't pay to be an honest student. Early penalties for plagiarism are so minor that if it is a choice between handing in nothing and handing in 15 paragraphs plucked from Wikipedia and HowStuffWorks, then you'd be mad not to cheat. There's a chance, of course, that you'll get caught and get zero. But then you were going to get zero for handing in nothing anyway.
I recently started a crackdown on plagiarism on an undergraduate course where I teach engineers how to write and give presentations. I told first-year students that using essays from cheating websites was a mistake and showed them how major changes in topic and writing style made it easy to tell where sources of text changed. I then gave the same class to graduate teaching assistants.
The GTAs did well: they caught a total of 16 plagiarising students out of about 160 in the class. Most of these had cut and pasted whole paragraphs from the web for an assignment.
Then I had a brainstorm. I told the class that we had found that 10 per cent of the essays were plagiarised and offered honest students (a relative term in this context) a lesser punishment if they admitted that they had cheated. I reminded them what cut-and-paste plagiarism was. Not only did several of those we'd already caught admit that they'd cheated, but so did ten others that we hadn't identified.
Here's what was supposed to happen. Those who came forward would get zero for their essay. However, they could avoid further punishment by rewriting it and would also get feedback on their writing (the main point of the exercise).
Those who had not come forward would get zero, plus only half marks for their next two assignments on my course (a small module worth 3 per cent of the year). It was a punishment determined from a logical stance: that it had to be worse being caught plagiarising than submitting nothing at all.
In addition, the offence might end up on their permanent record.
The department was great: my boss passed on the evidence that we presented concerning the students who had not admitted cheating to the college administration with the recommendations that we had agreed between us. He was confident that they would, as they had always done in the past, accept our plan, and was pleased that we'd made a big leap forward with this perennial issue.
What neither of us realised was that the college regulations (inherited from the University of London and adhered to by many UK universities) seem to prohibit punishment outside reprimand and a penalty on the single piece of work that was plagiarised. I say "seem to" because the wording is a little vague and open to interpretation. The department is figuring out what to do next. I've asked the college to take a new look at their regulations.
But just fixing things here is not enough - the culture has to change. I attended a plagiarism seminar a few years ago where we were encouraged to give plagiarists only moderate penalties - warnings - an approach based on the argument that cheating students are only depriving themselves in the long run.
However, this just doesn't wash: the honest students suffer as a vicious cycle develops. We set work for them. Some do the work; some copy it from others. However, because a significant proportion of the class is cheating, they're not learning. So the teaching does not appear to be effective. So we assign more work to try to get the information into the minds of the students. Now more of them are overwhelmed with the workload, more are likely to cheat, and so on. And those who are learning are likely to be getting worse grades than those who are not.
And let's not forget that our degrees are devalued by students who come out with poor minds and good grades. A pool of graduates becomes a lucky dip for employers: they have to hope they don't get the one who took all the shortcuts.
If you doubt that plagiarism is practised by a large minority, talk to my GTAs. Those who did their undergraduate degrees here will tell you about the cheating cartels and the groups with high-graded laboratory reports going back years for students to copy from. Anyone involved with teaching can confirm that there is a serious problem.
I want to end my story with a shocking twist. Of the essays that were resubmitted because of admitted plagiarism, almost half had plagiarised again. Obviously, this means there is a deep problem in secondary education, in our process of selecting university students and in our academic culture.
I would argue that being more punitive towards plagiarisers and more lenient towards honest students will be an important element in changing this culture.
Sunny Bains is a technical communication tutor at Imperial College London.
Postdoctoral Researcher Level 1 on DCU Research Career Framework
Associate Professor, Department of Chemical and Petroleum Engineering


crushing stacking reclaiming of limestone photos. crushing stacking reclaiming of limestone photos, ... Concrete Aggregate photos for stacking and reclaiming process of crushed limestone in cement plant ... Read more. crushing stacking reclaiming of line photos.
crushing stacking reclaiming of limestone photos. Job Interview Online Practice Test Question - hr … Job Interview Practice Test Why Do You Want This Job?
crushing stacking reclaiming of limestone photos. photos for stacking and reclaiming process of crushing stacking reclaiming of limestone photos. cement process mining and photos for stacking and reclaiming process of crushed limestone in cement plant.
crushing stacking reclaiming of line photos crusher . This new type dry process cement production line is a kind of process mainly used for sm. crushing plays an important role in the whole line.
crushing stacking reclaiming of limestone photos. crushing stacking reclaiming of line photos high efficiency crusher. cement stacking reclaiming IREACT crushing stacking reclaiming of limestone This page is about .
raclamation a process of crushing limestone. crushing stacking reclaiming of limestone photos -- China Mining Equipment. mining the cement manufacturing process starts from the mining of limestone, which is the main raw material for cement. superior quality limestone is available in uae .rock crushers and crushing equipment conquip. Read more.
Limestone Crushing Line in Algeria. Pebble and Basalt Production Line in Panama. Sand Making Plant Designed by SBM in UAE. Ultrafine Powder Milling Plant in India. ... pencil die grinder manufacturers amp amp suppliers. gold prospecting home. polysius hammer crusher in seoul korea.
L&T Machinery - Construction Equipment Rental Malaysia. L&T Machinery Enterprise Sdn Bhd providing its customer an option for Genset Rental and Sale in Malaysia, Load Bank rental, Used forklift rental in Malaysia, Power Generator Rental in Malaysia and Construction Equipment Rental in Malaysia.
The crushed limestone . limestone crusher process in cement plant. limestone crusher used in cement plant . crushing stacking reclaiming of limestone photos. Get Price And Support Online crushing stacking reclaiming of limestone photos 8240 . Check price. cross ties, split rail fence,landscape gravel .
Crushing Stacking Amp; Reclaiming Of Line Photos. photos for stacking and reclaiming process of crushed line crushing plant photos. line mines in cement process photos in line.


text:
Q: How can i move a lineString in OpenLayer3? I have to create buttons that enable me to move and rotate the my lineString.
This is my code:
var raster = new ol.layer.Tile({source: new ol.source.MapQuest({layer: 'sat'})});
var lineFeature = new ol.Feature(
new ol.geom.LineString([[-1e7, 1e6], [-1e6, 3e6]]));
var vector= new ol.layer.Vector({
  source: new ol.source.Vector({
    features: [lineFeature]
  }),
  style: new ol.style.Style({
    image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
      anchor: [0.5, 46],
      anchorXUnits: 'fraction',
      anchorYUnits: 'pixels',
      opacity: 0.95,
    })),
    stroke: new ol.style.Stroke({
      width: 3,
      color: [255, 0, 0, 1]
    }),
    fill: new ol.style.Fill({
      color: [0, 0, 255, 0.6]
    })
  })
})
var map = new ol.Map({
 layers: [raster,vector],
  target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
 })
});

I have to create 4 buttons that allow me to move the lineString in the 4 direction , how can i do this?

A: You can change the geometry of your line fetaures depending on the type of move. And do the same for the rotation.
here is the html to do so:

 <button id="movemeup" >move up</button>
 <button id="movemedown">move down</button>
 <button id="movemeright">move right</button>
 <button id="movemeleft">move left</button>
 <button id="rotate">rotate</button>

and your javascript (note that I use var stepMove = 1000000; which express how many meters to move) . For the rotation I was inspired from this
   var raster = new ol.layer.Tile({source: new ol.source.MapQuest({layer: 'sat'})});
var lineFeature = new ol.Feature(
new ol.geom.LineString([[-1e7, 1e6], [-1e6, 3e6]])
);
var vector= new ol.layer.Vector({
  source: new ol.source.Vector({
    features: [lineFeature]
  }),
  style: new ol.style.Style({
    image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
      anchor: [0.5, 46],
      anchorXUnits: 'fraction',
      anchorYUnits: 'pixels',
      opacity: 0.95,
    })),
    stroke: new ol.style.Stroke({
      width: 3,
      color: [255, 0, 0, 1]
    }),
    fill: new ol.style.Fill({
      color: [0, 0, 255, 0.6]
    })
  })
});

var map = new ol.Map({
 layers: [raster,vector],
  target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
 })
});

var stepMove = 1000000;
document.getElementById('movemeup').onclick = function (){
    moveit('up')
};
document.getElementById('movemedown').onclick = function (){
    moveit('down')
};
document.getElementById('movemeright').onclick = function (){
    moveit('right')
};
document.getElementById('movemeleft').onclick = function (){
    moveit('left')
};

document.getElementById('rotate').onclick = function (){
    rotateFeat();
};

function moveit(dir){

var lineCoords = lineFeature.getGeometry().getCoordinates();
var newLineCoords = new Array();
if (dir === 'up'){
    for(var i=0;i<lineCoords.length;i++){
    newLineCoords.push([lineCoords[i][0],lineCoords[i][1]+stepMove]);
    }
} else if (dir === 'down'){
    for(var i=0;i<lineCoords.length;i++){
    newLineCoords.push([lineCoords[i][0],lineCoords[i][1]-stepMove]);
    }
} else if (dir === 'right'){
    for(var i=0;i<lineCoords.length;i++){
    newLineCoords.push([lineCoords[i][0]+stepMove,lineCoords[i][1]]);
    }
} else if (dir === 'left'){
    for(var i=0;i<lineCoords.length;i++){
    newLineCoords.push([lineCoords[i][0]-stepMove,lineCoords[i][1]]);
    }
}
console.log("newLineCoords",newLineCoords);
var lineGeom = lineFeature.getGeometry();
var newGeom = new ol.geom.LineString(newLineCoords);
lineFeature.setGeometry( newGeom );
}

function rotateFeat(){
var lineGeom = lineFeature.getGeometry();
var lineExtent = lineGeom.getExtent();
var center = ol.extent.getCenter(lineExtent);
console.log("center",center);
lineGeom.applyTransform(rotateTransform(45, center[0], center[1]));
}

var getRotation = function(dx, dy) {
    var rot = 0;

    if (dx == 0 && dy == 0) return 0;

    if (dy == 0)
        rot = (dx > 0) ? 0 : Math.PI;
    else if (dx == 0)
        rot = (dy > 0) ? 0.5 * Math.PI : 1.5 * Math.PI;
    else {
        var rot = Math.atan(dy/dx);
        if (dx < 0 && dy > 0) rot += Math.PI;
        if (dx < 0 && dy < 0) rot += Math.PI;
        if (dx > 0 && dy < 0) rot += 2 * Math.PI;
    }
    return rot;
};
var rotateTransform = function (deg, x, y) {
    return function(inArr, outArr, dim) {
        for (var i = 0; i < inArr.length; i+=dim) {
            var ptx     = inArr[i];
            var pty     = inArr[i+1];
            var rot     = getRotation(ptx - x, pty - y);
            var rad     = Math.sqrt(Math.pow(ptx - x, 2) + Math.pow(pty - y, 2));
            var newRot  = rot + deg / 180 * Math.PI;
            outArr[i]   = (x + rad * Math.cos(newRot));
            outArr[i+1] = (y + rad * Math.sin(newRot));
        }
        return outArr;
    };
};

end a working fiddle here

redpajama_set_name: RedPajamaStackExchange


Figure 2. Excitation system of synchronous generator Another categorization of excitation systems is made by excitation energy source. Two major classes of this... Abstract. The brushless excitation system works in the absence of commutator, slip rings and brushes. Instead of these components we are using Permanent Magnet Exciter and three phase main Exciter with silicon diode rectifier the system has generated.
Mechanical coupling of the Synchronous generator and the Exciter is done by using speed as mechanical input for the Exciter machine. The Exciter is a small synchronous machine rated 8.1 kVA, 400 V, 50Hz, 1500 RPM.


Throw me a heaven around a child : song cycle for baritone and piano / Philip K. Bracanin.
From the CD Works by Philip Bracanin.
Throw a Heaven Around a Child, a song cycle of five songs for baritone and piano was composed in 1978 for Arthur Johnson and Bevan Crabtree. While in America on study leave in 1977, Bracanin befriended the English poet Tony Connor who wrote a poem signifying the initial awakening by his daughter Rebecca of her blossoming into early womanhood. As Tony asked for it to be set to music Bracanin decided to use his poem as the central piece in this cycle which traces the development of a female child to the stage where she leaves home to seek an independent lifestyle. The remaining four poems are by W. B. Yeats, J. Shaw Neilson and J. Wright.
A prayer for my daughter (text: W.B.Yeats) -- A child's nightmare (text: Judith Wright) -- For a little girl's birthday (text J.Shaw Neilson) -- A picture of R.C. in a prospect of blossom (text: T.Connor) -- The child we lost (text: J.Shaw Neilson).


text:
Links to CWI-sites
The economic impact of devastating floods
August 15, 2010 sander
Small farmers and peasants to suffer the most.
The full economic costs of the devastation caused by the floods- the worst in many years- in Khyber Pakhtoonkhwa, South Punjab, parts of Baluchistan and Sindh, will not be known for some time. But they are likely to be substantial, both for the people affected by the deluge and for Pakistan's cash-starved government.
Former federal Finance Minister, Dr Salman Shah, estimates that costs of rehabilitation of the flood-affected population and reconstruction of damaged infrastructure in different parts of the country could be in the range of $ 4 – 5 billion. Another economist put the figure between $ 3.5 and 4 billion. These losses are enormous when seen in the context of cumulative damages of about $ 6.5 billion in 14 floods since 1956.
According to another former Finance Minister and ex senior Vice President of the World Bank, Shahid Javid Burki, "we should get ready for another poor year for the economy, in the terms of the rate of the growth in the national product, pace of job creation and inter-personal and inter-regional income distribution. The government's prediction that GDP in 2010-11 would increase by 4.1% now seems extremely optimistic. Given some of the shocks the economy has received in last few days, it appears that the national product will not increase by more than 2.5 to 2.8% this year. This will be about the same as the revised rate of growth in 2009-10. If that came about, Pakistan's current economic expansion will be less than one half that of Bangladesh and one third that of India. Pakistan today is South Asia's "sickest" economy and will remain that way unless the policy makers move decisively".
The information minister of Khyber Pakhtoonkhwa Mian, Iftikhar Hussain, told reporters that "the infrastructure of this province was already destroyed by terrorism. Whatever was left was finished off by these floods". This is also the case with South Punjab. It will take years for economy to come out this pathetic state. According to the UN, "the emergency phase will require hundreds of millions of dollars and the recovery and reconstruction part will require billions of dollars". The government is looking for foreign aid and external help to overcome the present crisis, but the experience of Friends of Pakistan shows that an inflow of money from richer nations will not come so easily. If the government continues to depend mainly on foreign aid and assistance for the relief work, then the situation will become worst. Already affected people will be left to their own devices, to survive in the impossibly difficult situation. After this natural calamity, a man made crisis will unfold.
Agriculture hit the hardest
According to the spokesman of the World Food Programme, Amjad Jamal, "At least 1.4 million acres of crops were destroyed in Punjab. Many more crops were destroyed in North West and Sindh. The flooding has caused massive damage to crops and also to the reserves that people had in their houses. Khyber Pakhtoonkhwa was a 'food insecure' province even before the floods, and now in a lot of areas, people can't afford even one meal a day".
If we include the figures of Sindh and Khyber province, the total goes up to more than 2 million acres. This is massive damage. Sugar cane, rice and cotton crops have been badly damaged. Agriculture experts are saying that farm production in Pakistan, Asia's third-largest grower of wheat and the fourth biggest producer of cotton, may decline by 20 to 30% because of this damage. The losses to agriculture and livestock would have a spill over effect on industry and commercial activities to a great extent. This is because agriculture continues to play a central role in the national economy. Accounting for over 21% of GDP, agriculture remains by far the largest employer, engaging 45% of the country's labour force.
Damages, on the one hand, are likely to affect raw material supplies to the downstream industry that contributes to the export sector and, on the other hand, reduce the demand for industrial products like fertilizers, tractors, pesticides and other agriculture implements. And all this comes at a time when agricultural productivity has been falling over the years.
Since the flooding has been widespread, the damages to cotton crops may
Previous Post Unprecedented devastation caused by floods – poor suffer the most
Next Post Thousands of telecom workers on indefinite strike
Archives Select Month January 2018 November 2016 September 2016 August 2016 June 2016 March 2016 February 2016 January 2016 December 2015 June 2015 May 2015 April 2015 December 2014 August 2014 June 2014 May 2014 March 2014 February 2014 January 2014 September 2013 June 2013 May 2013 April 2013 January 2013 October 2012 September 2012 May 2012 December 2011 September 2011 July 2011 May 2011 April 2011 March 2011 February 2011 January 2011 December 2010 November 2010 October 2010 September 2010 August 2010 June 2010 April 2010 February 2010 January 2010 December 2009 November 2009 October 2009 September 2009 August 2009 July 2009 June 2009 May 2009 April 2009 March 2009 February 2009 January 2009 December 2008 November 2008 October 2008 September 2008 August 2008 July 2008 June 2008 May 2008 April 2008 March 2008 February 2008 January 2008 December 2007 November 2007 October 2007 September 2007 August 2007 July 2007 June 2007 May 2007 April 2007 March 2007 January 2007 December 2006 November 2006 October 2006 September 2006 August 2006 July 2006 May 2006 April 2006 March 2006 February 2006 December 2005 November 2005 October 2005 September 2005 August 2005 July 2005 June 2005 May 2005 April 2005 March 2005 February 2005 January 2005 December 2004 November 2004 October 2004 May 2004 April 2004 March 2004 February 2004 January 2004 September 2001 October 1999
Permanent Revolution
We publish a new introduction by Peter Taaffe to Leon Trotsky's 'Permanent Revolution', which the Socialist Movement Pakistan (CWI) are to translate into Urdu and publish.
-> Read more
1968 afghanistan al qaeda anti-privatization balochistan bangladesh benazir bhutto che china earthquake economy education egypt feudalism flood floods health workers hudood laws india indian occupied kashmir karachi kashmir may day military mirpur khas mma musharraf nepal nwfp pml-n pml-q ppp ptcl recession repression sindh socialist movement sri lanka taliban terrorism turcp venezuela women zardari