} // Legacy Styling.. $param = array(); $param['itemlink'] = defined("NEWSLIST_ITEMLINK") ? NEWSLIST_ITEMLINK : ""; $param['thumbnail'] = defined("NEWSLIST_THUMB") ? NEWSLIST_THUMB : "border:0px"; $param['catlink'] = defined("NEWSLIST_CATLINK") ? NEWSLIST_CATLINK : ""; $param['caticon'] = defined("NEWSLIST_CATICON") ? NEWSLIST_CATICON : defset('ICONSTYLE', ''); $param['current_action'] = $action; // NEW - allow news batch shortcode override (e.g. e107::getScBatch('news', 'myplugin', true); ) e107::getEvent()->trigger('news_list_parse', $newsList); $text = ''; if (vartrue($template['start'])) { $text .= $tp->parseTemplate($template['start'], true); } foreach ($newsList as $row) { $text .= $ix->render_newsitem($row, 'return', '', $template['item'], $param); } if (vartrue($template['end'])) { $text .= $tp->parseTemplate($template['end'], true); } $icon = $row['category_icon'] ? "<img src='" . e_IMAGE . "icons/" . $row['category_icon'] . "' alt='' />" : ""; // Deprecated. // $parms = $news_total.",".$amount.",".$newsfrom.",".$e107->url->getUrl('core:news', 'main', "action=nextprev&to_action={$action}&subaction={$category}"); // $parms = $news_total.",".$amount.",".$newsfrom.",".e_SELF.'?'.$action.".".$category.".[FROM]"; // // $text .= "<div class='nextprev'>".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>"; $amount = NEWSLIST_LIMIT; $nitems = defined('NEWS_NEXTPREV_NAVCOUNT') ? '&navcount=' . NEWS_NEXTPREV_NAVCOUNT : ''; $url = rawurlencode(e107::getUrl()->create($newsRoute, $newsUrlparms)); $parms = 'tmpl_prefix=' . deftrue('NEWS_NEXTPREV_TMPL', 'default') . '&total=' . $news_total . '&amount=' . $amount . '¤t=' . $newsfrom . $nitems . '&url=' . $url; $text .= $tp->parseTemplate("{NEXTPREV={$parms}}");
} $param['itemlink'] = OTHERNEWS_ITEMLINK; $param['thumbnail'] = OTHERNEWS_THUMB; $param['catlink'] = OTHERNEWS_CATLINK; $param['caticon'] = OTHERNEWS_CATICON; $style = OTHERNEWS_CELL; $nbr_cols = OTHERNEWS_COLS; $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n\nLEFT JOIN #user AS u ON n.news_author = u.user_id\nLEFT JOIN #news_category AS nc ON n.news_category = nc.category_id\nWHERE n.news_class IN (" . USERCLASS_LIST . ") AND n.news_start < " . time() . " AND (n.news_end=0 || n.news_end>" . time() . ") AND FIND_IN_SET(2, n.news_render_type) ORDER BY n.news_datestamp DESC LIMIT 0," . OTHERNEWS_LIMIT; if ($sql->db_Select_gen($query)) { $text = "<table style='width:100%' cellpadding='0' cellspacing='" . OTHERNEWS_SPACING . "'>"; $t = 0; $wid = floor(100 / $nbr_cols); while ($row = $sql->db_Fetch()) { $text .= $t % $nbr_cols == 0 ? "<tr>" : ""; $text .= "\n<td style='{$style} ; width:{$wid}%;'>\n"; $text .= $ix->render_newsitem($row, 'return', '', $OTHERNEWS_STYLE, $param); $text .= "\n</td>\n"; if (($t + 1) % $nbr_cols == 0) { $text .= "</tr>"; $t++; } else { $t++; } } while ($t % $nbr_cols != 0) { $text .= "<td style='width:{$wid}'> </td>\n"; $text .= ($t + 1) % $nbr_cols == 0 ? "</tr>" : ""; $t++; } $text .= "</table>"; // Save Data
$query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n\n\t\t\t\t\tLEFT JOIN #user AS u ON n.news_author = u.user_id\n\t\t\t\t\tLEFT JOIN #news_category AS nc ON n.news_category = nc.category_id\n\t\t\t\t\tLEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id\n\t\t\t\t\tWHERE n.news_class REGEXP '" . e_CLASS_REGEXP . "'\n\t\t\t\t\tAND n.news_id={$id}\n\t\t\t\t\tAND n.news_allow_comments=0\n\t\t\t\t\tGROUP by n.news_id"; } else { $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n\n\t\t\t\t\tLEFT JOIN #user AS u ON n.news_author = u.user_id\n\t\t\t\t\tLEFT JOIN #news_category AS nc ON n.news_category = nc.category_id\n\t\t\t\t\tWHERE n.news_class REGEXP '" . e_CLASS_REGEXP . "'\n\t\t\t\t\tAND n.news_id={$id}\n\t\t\t\t\tAND n.news_allow_comments=0"; } if (!$sql->db_Select_gen($query)) { e107::redirect(); exit; } else { $news = $sql->db_Fetch(); $subject = $tp->toForm($news['news_title']); define("e_PAGETITLE", "{$subject} - " . COMLAN_100 . " / " . LAN_COMMENTS); require_once HEADERF; ob_start(); $comment_ob_start = TRUE; $ix = new news(); $ix->render_newsitem($news, "extend"); // extend so that news-title-only news text is displayed in full when viewing comments. $field = $news['news_id']; } break; case 'poll': if (!$sql->db_Select("polls", "*", "poll_id='{$id}'")) { e107::redirect(); exit; } else { $row = $sql->db_Fetch(); $comments_poll = $row['poll_comment']; $subject = $row['poll_title']; define("e_PAGETITLE", $subject . ' - ' . COMLAN_101 . " / " . LAN_COMMENTS); $poll_to_show = $id; // Need to pass poll number through to display routine
<br /><br />". $news_body; if (!empty($news_extended)){ $print_text .= "<br /><br />".$news_extended; } if (!empty($news_extended)){ $print_text .= "<br /><br />".$news_extended; } if (!empty($news_source)){ $print_text .= "<br /><br />".$news_source; } if (!empty($news_url)){ $print_text .= "<br />".$news_url; } */ $tmp = e107::getTemplate('news', 'news', 'view'); $template = $tmp['item']; unset($tmp); // ob_start(); require_once e_HANDLER . "news_class.php"; $ix = new news(); $print_text = $ix->render_newsitem($row, 'return', '', $template, null); //$print_text = ob_get_flush(); $print_text .= "<br /><br /><hr />" . LAN_PRINT_303 . "<b>" . SITENAME . "</b>\n\t<br />\n\t" . $newsUrl . "\n\t"; } if (defined("TEXTDIRECTION") && TEXTDIRECTION == "rtl") { $align = 'right'; } else { $align = 'left'; } // Header down here to give us a chance to set a page title require_once HEADERF; //temporary solution - object of future cahges if (is_readable(THEME . 'print_template.php')) { include_once THEME . 'print_template.php'; echo $tp->parseTemplate($PRINT_TEMPLATE); } else {
function preview_item($id) { $ix = new news(); $e107 =& e107::getInstance(); $_POST['news_title'] = $e107->tp->toDB($_POST['news_title']); $_POST['news_summary'] = $e107->tp->toDB($_POST['news_summary']); $_POST['news_id'] = $id; if ($_POST['news_start']) { $tmp = explode("/", $_POST['news_start']); $_POST['news_start'] = mktime(0, 0, 0, $tmp[1], $tmp[0], $tmp[2]); } else { $_POST['news_start'] = 0; } if ($_POST['news_end']) { $tmp = explode("/", $_POST['news_end']); $_POST['news_end'] = mktime(0, 0, 0, $tmp[1], $tmp[0], $tmp[2]); } else { $_POST['news_end'] = 0; } $matches = array(); if (preg_match("#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)\$#", $_POST['news_datestamp'], $matches)) { $_POST['news_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); } else { $_POST['news_datestamp'] = time(); } if ($_POST['update_datestamp']) { $_POST['news_datestamp'] = time(); } $e107->sql->db_Select("news_category", "*", "category_id='" . intval($_POST['cat_id']) . "'"); list($_POST['category_id'], $_POST['category_name'], $_POST['category_icon']) = $e107->sql->db_Fetch(); list($_POST['user_id'], $_POST['user_name']) = explode(chr(35), $_POST['news_author']); $_POST['news_author'] = $_POST['user_id']; $_POST['comment_total'] = $id ? $e107->sql->db_Count("comments", "(*)", " WHERE comment_item_id={$id} AND comment_type='0'") : 0; $_PR = $_POST; $_PR['news_body'] = $e107->tp->post_toHTML($_PR['news_body'], FALSE); $_PR['news_title'] = $e107->tp->post_toHTML($_PR['news_title'], FALSE, "emotes_off, no_make_clickable"); $_PR['news_summary'] = $e107->tp->post_toHTML($_PR['news_summary']); $_PR['news_extended'] = $e107->tp->post_toHTML($_PR['news_extended']); $_PR['news_file'] = $_POST['news_file']; $_PR['news_thumbnail'] = basename($_POST['news_thumbnail']); //$ix->render_newsitem($_PR); return "\n\t\t\t\t<fieldset id='core-newspost-preview'>\n\t\t\t\t\t<legend>" . NWSLAN_27 . "</legend>\n\t\t\t\t\t<table class='admininfo'>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='2'>\n\t\t\t\t\t\t\t\t" . $e107->tp->parseTemplate('{NEWSINFO}') . $ix->render_newsitem($_PR, 'return') . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</fieldset>\n\t\t"; }
} if ($category_name) { define("e_PAGETITLE", $category_name); } require_once HEADERF; if (!$NEWSLISTSTYLE) { $NEWSLISTSTYLE = "\r\n\t\t<div style='padding:3px;width:100%'>\r\n\t\t<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>\r\n\t\t<tr>\r\n\t\t<td style='vertical-align:top;padding:3px;width:20px'>\r\n\t\t{NEWSCATICON}\r\n\t\t</td><td style='text-align:left;padding:3px'>\r\n\t\t{NEWSTITLELINK}\r\n\t\t<br />\r\n\t\t{NEWSSUMMARY}\r\n\t\t<span class='smalltext'>\r\n\t\t{NEWSDATE}\r\n\t\t{NEWSCOMMENTS}\r\n\t\t</span>\r\n\t\t</td><td style='width:55px'>\r\n\t\t{NEWSTHUMBNAIL}\r\n\t\t</td></tr></table>\r\n\t\t</div>\n"; } $param['itemlink'] = defined("NEWSLIST_ITEMLINK") ? NEWSLIST_ITEMLINK : ""; $param['thumbnail'] = defined("NEWSLIST_THUMB") ? NEWSLIST_THUMB : "border:0px"; $param['catlink'] = defined("NEWSLIST_CATLINK") ? NEWSLIST_CATLINK : ""; $param['caticon'] = defined("NEWSLIST_CATICON") ? NEWSLIST_CATICON : ICONSTYLE; $sql->db_Select_gen($query); $newsList = $sql->db_getList(); foreach ($newsList as $row) { $text .= $ix->render_newsitem($row, 'return', '', $NEWSLISTSTYLE, $param); } $amount = $action == "all" ? NEWSALL_LIMIT : NEWSLIST_LIMIT; $icon = $row['category_icon'] ? "<img src='" . e_IMAGE . "icons/" . $row['category_icon'] . "' alt='' />" : ""; $parms = $news_total . "," . $amount . "," . $from . "," . e_SELF . '?' . $action . "." . $sub_action . ".[FROM]"; $text .= $news_total > $amount ? LAN_NEWS_22 . " " . $tp->parseTemplate("{NEXTPREV={$parms}}") : ""; ob_start(); $ns->tablerender(LAN_82 . " '{$category_name}'", $text); $cache_data = ob_get_flush(); setNewsCache($cacheString, $cache_data); require_once FOOTERF; exit; } if ($action == "extend") { // --> Cache if ($tmp = checkCache($cacheString)) {