function makenews($news, $attacharr, $itemid) { global $_SGLOBAL, $_SSCONFIG; //附件处理 if ($news['haveattach']) { foreach ($attacharr[$itemid] as $attach) { if (strpos($news['message'], $attach['thumbpath']) === false && strpos($news['message'], $attach['filepath']) === false && strpos($news['message'], 'batch.download.php?aid=' . $attach['aid']) === false) { $attach['filepath'] = A_URL . '/' . $attach['filepath']; $attach['thumbpath'] = A_URL . '/' . $attach['thumbpath']; $attach['url'] = S_URL . '/batch.download.php?aid=' . $attach['aid']; $news['attacharr'][] = $attach; } } } if (empty($news['newsauthor'])) { $news['newsauthor'] = $news['username']; } $description = str_replace(array(' ', "\r", "\n", '\'', '"'), '', cutstr(trim(strip_tags($news['message'])), 200)); //相关文章 if ($_SSCONFIG['newsjammer']) { mt_srand((double) microtime() * 1000000); $news['message'] = preg_replace("/(\\<br\\>|\\<br\\ \\/\\>|\\<br\\/\\>|\\<p\\>|\\<\\/p\\>)/ie", "sjammer('\\1')", $news['message']); } $newtagarr = array(); if (!empty($news['includetags'])) { $newtagarr = explode("\t", $news['includetags']); if (!empty($_SCONFIG['allowtagshow'])) { $news['message'] = tagshow($news['message'], $newtagarr); } } $relativetagarr = array(); if (!empty($news['relativetags'])) { $relativetagarr = unserialize($news['relativetags']); } //自定义字段 $news['custom'] = array('name' => '', 'key' => array(), 'value' => array()); if (!empty($news['customfieldid'])) { $news['custom']['value'] = unserialize($news['customfieldtext']); if (!empty($news['custom']['value'])) { foreach ($news['custom']['value'] as $key => $value) { if (is_array($value)) { $news['custom']['value'][$key] = implode(', ', $value); } } } $query = $_SGLOBAL['db']->query('SELECT name, customfieldtext FROM ' . tname('customfields') . ' WHERE customfieldid=\'' . $news['customfieldid'] . '\''); $value = $_SGLOBAL['db']->fetch_array($query); $news['custom']['name'] = $value['name']; $news['custom']['key'] = unserialize($value['customfieldtext']); } //标题样式 if (!empty($news['styletitle'])) { $news['subject'] = '<span style=\'' . mktitlestyle($news['styletitle']) . '\'>' . $news['subject'] . '</span>'; } return $news; }
} } } if (empty($news['newsauthor'])) { $news['newsauthor'] = $news['username']; } $description = str_replace(array(' ', "\r", "\n", '\'', '"'), '', cutstr(trim(strip_tags($news['message'])), 200)); if ($_SSCONFIG['newsjammer']) { mt_srand((double) microtime() * 1000000); $news['message'] = preg_replace("/(\\<br\\>|\\<br\\ \\/\\>|\\<br\\/\\>|\\<p\\>|\\<\\/p\\>)/ie", "sjammer('\\1')", $news['message']); } $newtagarr = array(); if (!empty($news['includetags'])) { $newtagarr = explode("\t", $news['includetags']); if (!empty($_SCONFIG['allowtagshow'])) { $news['message'] = tagshow($news['message'], $newtagarr); } } $relativetagarr = array(); if (!empty($news['relativetags'])) { $relativetagarr = unserialize($news['relativetags']); } $news['custom'] = array('name' => '', 'key' => array(), 'value' => array()); if ($page == 1 && !empty($news['customfieldid'])) { $news['custom']['value'] = unserialize($news['customfieldtext']); if (!empty($news['custom']['value'])) { foreach ($news['custom']['value'] as $key => $value) { if (is_array($value)) { $news['custom']['value'][$key] = implode(', ', $value); } }