本文整理汇总了PHP中messagecutstr函数的典型用法代码示例。如果您正苦于以下问题:PHP messagecutstr函数的具体用法?PHP messagecutstr怎么用?PHP messagecutstr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了messagecutstr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_cache_heats
function build_cache_heats()
{
global $_G;
$data = array();
if ($_G['setting']['indexhot']['status']) {
require_once libfile('function/post');
$_G['setting']['indexhot'] = array('status' => 1, 'limit' => intval($_G['setting']['indexhot']['limit'] ? $_G['setting']['indexhot']['limit'] : 10), 'days' => intval($_G['setting']['indexhot']['days'] ? $_G['setting']['indexhot']['days'] : 7), 'expiration' => intval($_G['setting']['indexhot']['expiration'] ? $_G['setting']['indexhot']['expiration'] : 900), 'messagecut' => intval($_G['setting']['indexhot']['messagecut'] ? $_G['setting']['indexhot']['messagecut'] : 200));
$heatdateline = TIMESTAMP - 86400 * $_G['setting']['indexhot']['days'];
$query = DB::query("SELECT t.tid,t.posttableid,t.views,t.dateline,t.replies,t.author,t.authorid,t.subject,t.price\r\n\t\t\tFROM " . DB::table('forum_thread') . " t\r\n\t\t\tWHERE t.dateline>'{$heatdateline}' AND t.heats>'0' AND t.displayorder>='0' ORDER BY t.heats DESC LIMIT " . $_G['setting']['indexhot']['limit'] * 2);
$messageitems = 2;
$limit = $_G['setting']['indexhot']['limit'];
while ($heat = DB::fetch($query)) {
$posttable = $heat['posttableid'] ? "forum_post_{$heat['posttableid']}" : 'forum_post';
$post = DB::fetch_first("SELECT p.pid, p.message FROM " . DB::table($posttable) . " p WHERE p.tid='{$heat['tid']}' AND p.first='1'");
$heat = array_merge($heat, (array) $post);
if ($limit == 0) {
break;
}
if ($messageitems > 0) {
$heat['message'] = !$heat['price'] ? messagecutstr($heat['message'], $_G['setting']['indexhot']['messagecut']) : '';
$data['message'][$heat['tid']] = $heat;
} else {
unset($heat['message']);
$data['subject'][$heat['tid']] = $heat;
}
$messageitems--;
$limit--;
}
$data['expiration'] = TIMESTAMP + $_G['setting']['indexhot']['expiration'];
}
save_syscache('heats', $data);
}
示例2: updatersscache
function updatersscache($num)
{
global $_G;
$processname = 'portal_rss_cache';
if (discuz_process::islocked($processname, 600)) {
return false;
}
C::t('portal_rsscache')->truncate();
require_once libfile('function/post');
foreach ($_G['cache']['portalcategory'] as $catid => $catarray) {
$query = C::t('portal_article_title')->fetch_all_for_cat($catid, 0, 1, 0, $num);
$catarray['catname'] = addslashes($catarray['catname']);
foreach ($query as $article) {
$article['author'] = $article['author'] != '' ? addslashes($article['author']) : ($article['username'] ? addslashes($article['username']) : 'Anonymous');
$article['title'] = addslashes($article['title']);
$articleattach = C::t('portal_attachment')->fetch_by_aid_image($article['aid']);
$attachdata = '';
if (!empty($articleattach)) {
$attachdata = "\t" . $articleattach['remote'] . "\t" . $articleattach['attachment'] . "\t" . $articleattach['filesize'];
}
$article['description'] = addslashes(messagecutstr($article['summary'], 250 - strlen($attachdata)) . $attachdata);
C::t('portal_rsscache')->insert(array('lastupdate' => $_G['timestamp'], 'catid' => $catid, 'aid' => $article['aid'], 'dateline' => $article['dateline'], 'catname' => $catarray['catname'], 'author' => $article['author'], 'subject' => $article['title'], 'description' => $article['description']));
}
}
discuz_process::unlock($processname);
return true;
}
示例3: build_cache_heats
function build_cache_heats()
{
global $_G;
$addsql = '';
$data = array();
if (discuz_process::islocked('update_heats_list')) {
return false;
}
if ($_G['setting']['indexhot']['status']) {
require_once libfile('function/post');
$_G['setting']['indexhot'] = array('status' => 1, 'limit' => intval($_G['setting']['indexhot']['limit'] ? $_G['setting']['indexhot']['limit'] : 10), 'days' => intval($_G['setting']['indexhot']['days'] ? $_G['setting']['indexhot']['days'] : 7), 'expiration' => intval($_G['setting']['indexhot']['expiration'] ? $_G['setting']['indexhot']['expiration'] : 900), 'messagecut' => intval($_G['setting']['indexhot']['messagecut'] ? $_G['setting']['indexhot']['messagecut'] : 200));
$messageitems = 2;
$limit = $_G['setting']['indexhot']['limit'];
foreach (C::t('forum_thread')->fetch_all_heats() as $heat) {
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($heat['tid']);
$heat = array_merge($heat, (array) $post);
if ($limit == 0) {
break;
}
if ($messageitems > 0) {
$heat['message'] = !$heat['price'] ? messagecutstr($heat['message'], $_G['setting']['indexhot']['messagecut']) : '';
$data['message'][$heat['tid']] = $heat;
} else {
unset($heat['message']);
$data['subject'][$heat['tid']] = $heat;
}
$messageitems--;
$limit--;
}
$data['expiration'] = TIMESTAMP + $_G['setting']['indexhot']['expiration'];
}
savecache('heats', $data);
discuz_process::unlock('update_heats_list');
}
示例4: updatersscache
function updatersscache($num)
{
global $_G;
$processname = 'portal_rss_cache';
if (discuz_process::islocked($processname, 600)) {
return false;
}
DB::query("DELETE FROM " . DB::table('portal_rsscache') . "");
require_once libfile('function/post');
foreach ($_G['cache']['portalcategory'] as $catid => $catarray) {
$query = DB::query("SELECT aid, username, author, dateline, title, summary\r\n\t\t\tFROM " . DB::table('portal_article_title') . "\r\n\t\t\tWHERE catid='{$catid}' AND status=0\r\n\t\t\tORDER BY aid DESC LIMIT {$num}");
$catarray['catname'] = addslashes($catarray['catname']);
while ($article = DB::fetch($query)) {
$article['author'] = $article['author'] != '' ? addslashes($article['author']) : ($article['username'] ? addslashes($article['username']) : 'Anonymous');
$article['title'] = addslashes($article['title']);
$articleattach = DB::fetch_first("SELECT * FROM " . DB::table('portal_attachment') . " WHERE aid='" . $article['aid'] . "' AND isimage=1");
$attachdata = '';
if (!empty($articleattach)) {
$attachdata = "\t" . $articleattach['remote'] . "\t" . $articleattach['attachment'] . "\t" . $articleattach['filesize'];
}
$article['description'] = addslashes(messagecutstr($article['summary'], 250 - strlen($attachdata)) . $attachdata);
DB::query("REPLACE INTO " . DB::table('portal_rsscache') . " (lastupdate, catid, aid, dateline, catname, author, subject, description)\r\n\t\t\t\tVALUES ('{$_G['timestamp']}', '{$catid}', '{$article['aid']}', '{$article['dateline']}', '{$catarray['catname']}', '{$article['author']}', '{$article['title']}', '{$article['description']}')");
}
}
discuz_process::unlock($processname);
return true;
}
示例5: before_feed
public function before_feed()
{
$message = !$this->param['price'] && !$this->param['readperm'] ? $this->param['message'] : '';
$this->feed['icon'] = 'debate';
$this->feed['title_template'] = 'feed_thread_debate_title';
$this->feed['body_template'] = 'feed_thread_debate_message';
$this->feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$this->tid}\">{$this->param['subject']}</a>", 'message' => messagecutstr($message, 150), 'affirmpoint' => messagecutstr($this->affirmpoint, 150), 'negapoint' => messagecutstr($this->negapoint, 150));
}
示例6: before_newreply
public function before_newreply($parameters)
{
global $nauthorid;
list(, $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
if ($this->thread['displayorder'] == -4) {
$this->param['modnewreplies'] = 0;
}
$pinvisible = $parameters['modnewreplies'] ? -2 : ($this->thread['displayorder'] == -4 ? -3 : 0);
$this->postcomment = in_array(2, $this->setting['allowpostcomment']) && $this->group['allowcommentreply'] && !$pinvisible && !empty($_GET['reppid']) && ($nauthorid != $this->member['uid'] || $this->setting['commentpostself']) ? messagecutstr($parameters['message'], 200, ' ') : '';
}
示例7: misc_mobile_message
function misc_mobile_message($message)
{
global $_G, $thread;
if (!in_array($message, array('recommend_succed', 'recommend_daycount_succed'))) {
return;
}
$thaquote = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
$quote = $thaquote['message'];
$quote = messagecutstr($quote, 100);
$quote = implode("\n", array_slice(explode("\n", $quote), 0, 3));
}
示例8: before_feed
public function before_feed()
{
$message = !$this->param['price'] && !$this->param['readperm'] ? $this->param['message'] : '';
$this->feed['icon'] = 'activity';
$this->feed['title_template'] = 'feed_thread_activity_title';
$this->feed['body_template'] = 'feed_thread_activity_message';
$this->feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$this->tid}\">{$this->param['subject']}</a>", 'starttimefrom' => $_GET['starttimefrom'][$this->activitytime], 'activityplace' => $this->activity['place'], 'message' => messagecutstr($message, 150));
if ($_GET['activityaid']) {
$this->feed['images'] = array(getforumimg($_GET['activityaid']));
$this->feed['image_links'] = array("forum.php?mod=viewthread&do=tradeinfo&tid={$this->tid}&pid={$this->pid}");
}
}
示例9: before_feed
public function before_feed()
{
$pvs = explode("\t", messagecutstr($this->polloptionpreview, 150));
$s = '';
$i = 1;
foreach ($pvs as $pv) {
$s .= $i . '. ' . $pv . '<br />';
}
$s .= ' ...';
$this->feed['icon'] = 'poll';
$this->feed['title_template'] = 'feed_thread_poll_title';
$this->feed['body_template'] = 'feed_thread_poll_message';
$this->feed['body_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$this->tid}\">" . $this->param['subject'] . "</a>", 'message' => $s);
}
示例10: foreach
foreach ($posts as $pid => $post) {
$delrow = false;
if ($post['anonymous'] && $post['authorid'] != $_G['uid']) {
$delrow = true;
} elseif ($viewuserthread && $post['authorid'] != $_G['uid']) {
if ($_G['adminid'] != 1 && !empty($viewfids) && !in_array($post['fid'], $viewfids)) {
$delrow = true;
}
}
if ($delrow) {
unset($posts[$pid]);
$hiddennum++;
continue;
} else {
$tids[$post['tid']][] = $pid;
$post['message'] = !getstatus($post['status'], 2) || $post['authorid'] == $_G['uid'] ? messagecutstr($post['message'], 100) : '';
$posts[$pid] = $post;
}
}
if (!empty($tids)) {
$threads = C::t('forum_thread')->fetch_all_by_tid_displayorder(array_keys($tids), $displayorder, $dglue, array(), $closed);
foreach ($threads as $tid => $thread) {
$delrow = false;
if ($_G['adminid'] != 1 && $thread['displayorder'] < 0) {
$delrow = true;
} elseif ($_G['adminid'] != 1 && $_G['uid'] != $thread['authorid'] && getstatus($thread['status'], 2)) {
$delrow = true;
} elseif (!isset($_G['cache']['forums'][$thread['fid']])) {
if (!$_G['setting']['groupstatus']) {
$delrow = true;
} else {
示例11: messagecutstr
</a></div>
<div class="yjgl_li_tit_other">
<span class="yjglico">
<span class="view"><?php
echo $item['views'];
?>
</span><span class="view_fx"><?php
echo $item['replies'];
?>
</span>
</span>
</div>
</div>
<div class="clear"></div>
<div class="yjgl_li_des"><?php
echo messagecutstr($item['message'], 130);
?>
</div>
</div>
</li>
<?php
}
?>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
<?php
$this->load->view('foot_v1');
?>
示例12: getranklist_blog
function getranklist_blog($num = 20, $view = 'hot', $orderby = 'all')
{
$dateline = $timestamp = '';
if ($orderby == 'today') {
$timestamp = TIMESTAMP - 86400;
$dateline = "AND b.dateline>='{$timestamp}'";
} elseif ($orderby == 'thisweek') {
$timestamp = TIMESTAMP - 604800;
$dateline = "AND b.dateline>='{$timestamp}'";
} elseif ($orderby == 'thismonth') {
$timestamp = TIMESTAMP - 2592000;
$dateline = "AND b.dateline>='{$timestamp}'";
}
$data = array();
$query = DB::query("SELECT b.blogid, b.uid, b.username, b.subject, b.dateline, b.viewnum, b.replynum, b.hot, b.sharetimes, b.favtimes,\n\t\tb.click1, b.click2, b.click3, b.click4, b.click5, b.click6, b.click7, b.click8, bf.message\n\t\tFROM " . DB::table('home_blog') . " b\n\t\tLEFT JOIN " . DB::table('home_blogfield') . " bf ON bf.blogid=b.blogid\n\t\tWHERE b.friend='0' AND status = '0' {$dateline}\n\t\tORDER BY b.{$view} DESC\n\t\tLIMIT 0, {$num}");
require_once libfile('function/forum');
require_once libfile('function/post');
$rank = 0;
while ($blog = DB::fetch($query)) {
++$rank;
$blog['rank'] = $rank;
$blog['dateline'] = dgmdate($blog['dateline']);
$blog['avatar'] = avatar($blog['uid'], 'small');
$blog['message'] = preg_replace('/<([^>]*?)>/', '', $blog['message']);
$blog['message'] = messagecutstr($blog['message'], 140);
$data[] = $blog;
}
return $data;
}
示例13: array
if (!($thapost && ($thapost['invisible'] == 0 || $thapost['authorid'] == $_G['uid'] && $thapost['invisible'] == -2))) {
$thapost = array();
}
if ($thapost['tid'] != $_G['tid']) {
showmessage('targetpost_donotbelongto_thisthread', NULL);
}
$thapost['useip'] = substr($thapost['useip'], 0, strrpos($thapost['useip'], '.')) . '.x';
if ($thapost['author'] && $thapost['anonymous']) {
$thapost['author'] = '[color=Olive]' . lang('forum/misc', 'anonymoususer') . '[/color]';
} elseif (!$thapost['author']) {
$thapost['author'] = '[color=Olive]' . lang('forum/misc', 'guestuser') . '[/color] ' . $thapost['useip'];
} else {
$thapost['author'] = '[color=Olive]' . $thapost['author'] . '[/color]';
}
$quotemessage = discuzcode($message, 0, 0);
$noticeauthormsg = dhtmlspecialchars(messagecutstr($thapost['message'], 100));
$noticeauthor = dhtmlspecialchars(authcode('r|' . $thapost['authorid'], 'ENCODE'));
$noticetrimstr = dhtmlspecialchars($message);
$message = '';
$reppid = $_GET['reppost'];
}
if (isset($_GET['addtrade']) && $thread['special'] == 2 && $_G['group']['allowposttrade'] && $thread['authorid'] == $_G['uid']) {
$expiration_7days = date('Y-m-d', TIMESTAMP + 86400 * 7);
$expiration_14days = date('Y-m-d', TIMESTAMP + 86400 * 14);
$trade['expiration'] = $expiration_month = date('Y-m-d', mktime(0, 0, 0, date('m') + 1, date('d'), date('Y')));
$expiration_3months = date('Y-m-d', mktime(0, 0, 0, date('m') + 3, date('d'), date('Y')));
$expiration_halfyear = date('Y-m-d', mktime(0, 0, 0, date('m') + 6, date('d'), date('Y')));
$expiration_year = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1));
}
if ($thread['replies'] <= $_G['ppp']) {
$postlist = array();
示例14: updatepostcredits
if (getstatus($post['status'], 3) == 0) {
updatepostcredits('+', $post['authorid'], 'reply', $post['fid']);
$attachcount = C::t('forum_attachment_n')->count_by_id('tid:' . $post['tid'], 'pid', $post['pid']);
updatecreditbyaction('postattach', $post['authorid'], array(), '', $attachcount, 1, $post['fid']);
}
$threads[$post['tid']]['posts']++;
if ($post['dateline'] > $post['lastpost'] && $post['dateline'] > $lastpost[$post['tid']]) {
$threads[$post['tid']]['lastpost'] = $post['dateline'];
$threads[$post['tid']]['lastposter'] = $post['anonymous'] && $post['dateline'] != $post['lastpost'] ? '' : addslashes($post[author]);
}
if ($threads[$post['tid']]['attachadd'] || $post['attachment']) {
$threads[$post['tid']]['attachment'] = 1;
}
$pm = 'pm_' . $post['pid'];
if ($post['authorid'] && $post['authorid'] != $_G['uid']) {
$pmlist[] = array('act' => 'modreplies_validate', 'notevar' => array('reason' => dhtmlspecialchars($_GET['reason']), 'pid' => $post['pid'], 'tid' => $post['tid'], 'post' => messagecutstr($post['message'], 30), 'from_id' => 0, 'from_idtype' => 'modreplies'), 'authorid' => $post['authorid']);
}
}
unset($postlist, $tids, $threadlist);
foreach ($threads as $tid => $thread) {
$updatedata = array('replies' => $thread['posts']);
if (isset($thread['lastpost'])) {
$updatedata['lastpost'] = array($thread['lastpost']);
$updatedata['lastposter'] = array($thread['lastposter']);
}
if (isset($thread['attachment'])) {
$updatedata['attachment'] = $thread['attachment'];
}
C::t('forum_thread')->increase($tid, $updatedata);
}
if ($_G['fid']) {
示例15: trim
$focus['title'] = trim($focus_title);
$focus['title'] = empty($focus['title']) ? lang('misc_focus') : $focus['title'];
$db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('focus', '" . addslashes(serialize($focus)) . "')");
updatecache('focus');
cpmsg('focus_conf_succeed', $BASESCRIPT . '?action=misc&operation=focus&do=config', 'succeed');
}
} elseif ($do == 'fetchthread' && $id) {
$thread = $db->fetch_first("SELECT pid, subject, message, attachment FROM {$tablepre}posts WHERE tid='{$id}' AND first='1'");
ajaxshowheader();
if (!$thread) {
echo '<script type="text/JavaScript">alert(\'' . lang('misc_focus_nothread') . '\');</script>';
ajaxshowfooter();
exit;
}
showsetting('misc_focus_topic_subject', 'focus_subject', $thread['subject'], 'text');
showsetting('misc_focus_topic_msg', 'focus_summary', messagecutstr($thread['message'], 150), 'textarea');
if ($thread['attachment']) {
$attachlist = $attachkeys = array();
$attachlist[] = array('', lang('select'));
$attachlist[] = array(0, lang('misc_focus_noimage'));
$query = $db->query("SELECT aid, filename FROM {$tablepre}attachments WHERE pid='{$thread['pid']}' AND isimage IN ('1', '-1')");
while ($attach = $db->fetch_array($query)) {
$attachlist[] = array($attach['aid'], $attach['filename']);
$attachkeys[$attach['aid']] = rawurlencode(authcode("{$attach['aid']}\t58\t58", 'ENCODE', $_DCACHE['settings']['authkey']));
}
if ($attachkeys) {
showsetting('misc_focus_image', array('focus_aid', $attachlist), '', 'select');
showsetting('', 'focus_img', '', '<div id="focus_img_preview"></div><input type="hidden" name="focus_filename" value="" />');
}
}
echo '<script type="text/JavaScript">var attachkeys = [];';