2009-09-19 21:48:52 +00:00
|
|
|
|
<?php
|
|
|
|
|
/*
|
2009-11-17 13:48:46 +00:00
|
|
|
|
* e107 website system
|
|
|
|
|
*
|
2009-11-18 01:06:08 +00:00
|
|
|
|
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
2009-11-17 13:48:46 +00:00
|
|
|
|
* Released under the terms and conditions of the
|
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/news/other_news_menu.php,v $
|
2010-02-10 18:18:01 +00:00
|
|
|
|
* $Revision$
|
|
|
|
|
* $Date$
|
|
|
|
|
* $Author$
|
2009-11-17 13:48:46 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2009-09-19 21:48:52 +00:00
|
|
|
|
if (!defined('e107_INIT')) { exit; }
|
2015-04-01 23:02:17 -07:00
|
|
|
|
|
2009-09-19 21:48:52 +00:00
|
|
|
|
// Load Data
|
2012-12-16 21:05:54 -08:00
|
|
|
|
if($cacheData = e107::getCache()->retrieve("nq_othernews"))
|
2009-09-19 21:48:52 +00:00
|
|
|
|
{
|
|
|
|
|
echo $cacheData;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-04-01 23:02:17 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-19 21:48:52 +00:00
|
|
|
|
require_once(e_HANDLER."news_class.php");
|
|
|
|
|
unset($text);
|
|
|
|
|
global $OTHERNEWS_STYLE;
|
|
|
|
|
$ix = new news;
|
|
|
|
|
|
2013-11-03 21:47:26 -08:00
|
|
|
|
|
|
|
|
|
$caption = TD_MENU_L1;
|
|
|
|
|
|
2015-04-01 23:02:17 -07:00
|
|
|
|
if(!empty($parm))
|
|
|
|
|
{
|
2016-02-08 13:54:44 -08:00
|
|
|
|
if(is_string($parm))
|
|
|
|
|
{
|
|
|
|
|
parse_str($parm, $parms);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$parms = $parm;
|
|
|
|
|
}
|
2015-04-01 23:02:17 -07:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-19 21:48:52 +00:00
|
|
|
|
if(!$OTHERNEWS_STYLE)
|
|
|
|
|
{
|
2017-01-29 18:33:48 -08:00
|
|
|
|
if(THEME_LEGACY !== true) // v2.x
|
2013-11-03 21:47:26 -08:00
|
|
|
|
{
|
2016-04-19 16:57:44 -07:00
|
|
|
|
if(!defined("OTHERNEWS_COLS"))
|
|
|
|
|
{
|
|
|
|
|
define("OTHERNEWS_COLS",false);
|
|
|
|
|
}
|
2018-01-19 11:08:32 -08:00
|
|
|
|
$template = e107::getTemplate('news', 'news_menu', 'other', true, true);
|
2013-11-03 21:47:26 -08:00
|
|
|
|
|
2021-01-02 12:06:46 -08:00
|
|
|
|
$item_selector = '<div class="btn-group pull-right float-right float-end"><a class="btn btn-mini btn-sm btn-xs btn-default btn-secondary" href="#otherNews" data-slide="prev" data-bs-slide="prev">‹</a>
|
2021-01-01 12:29:43 -08:00
|
|
|
|
<a class="btn btn-sm btn-mini btn-xs btn-default btn-secondary" href="#otherNews" data-slide="next" data-bs-slide="next">›</a></div>';
|
2015-04-01 23:02:17 -07:00
|
|
|
|
|
|
|
|
|
if(!empty($parms['caption']))
|
|
|
|
|
{
|
2019-02-26 12:22:36 -08:00
|
|
|
|
$template['caption'] = e107::getParser()->toHTML($parms['caption'],true,'TITLE');
|
2015-04-01 23:02:17 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-02-16 07:13:11 -08:00
|
|
|
|
$caption = "<div class='inline-text'>".$template['caption']." ".$item_selector."</div>";
|
2013-11-03 21:47:26 -08:00
|
|
|
|
|
|
|
|
|
$OTHERNEWS_STYLE = $template['item'];
|
|
|
|
|
}
|
|
|
|
|
else //v1.x
|
|
|
|
|
{
|
2015-04-01 23:02:17 -07:00
|
|
|
|
|
|
|
|
|
if(!empty($parms['caption']))
|
|
|
|
|
{
|
2019-02-26 12:22:36 -08:00
|
|
|
|
$caption = e107::getParser()->toHTML($parms['caption'], true,'TITLE');
|
2015-04-01 23:02:17 -07:00
|
|
|
|
}
|
2013-11-03 21:47:26 -08:00
|
|
|
|
|
|
|
|
|
$template['start'] = '';
|
|
|
|
|
$template['end'] = '';
|
|
|
|
|
|
|
|
|
|
$OTHERNEWS_STYLE = "
|
|
|
|
|
<div style='padding:3px;width:100%'>
|
|
|
|
|
<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style='vertical-align:top;padding:3px;width:20px'>
|
|
|
|
|
{NEWSCATICON}
|
|
|
|
|
</td><td style='text-align:left;padding:3px;vertical-align:top'>
|
|
|
|
|
{NEWSTITLELINK}
|
|
|
|
|
</td></tr></table>
|
|
|
|
|
</div>\n";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-19 21:48:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!defined("OTHERNEWS_LIMIT")){
|
|
|
|
|
define("OTHERNEWS_LIMIT",10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!defined("OTHERNEWS_ITEMLINK")){
|
|
|
|
|
define("OTHERNEWS_ITEMLINK","");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!defined("OTHERNEWS_CATLINK")){
|
|
|
|
|
define("OTHERNEWS_CATLINK","");
|
|
|
|
|
}
|
|
|
|
|
if(!defined("OTHERNEWS_THUMB")){
|
|
|
|
|
define("OTHERNEWS_THUMB","border:0px");
|
|
|
|
|
}
|
|
|
|
|
if(!defined("OTHERNEWS_CATICON")){
|
|
|
|
|
define("OTHERNEWS_CATICON","border:0px");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!defined("OTHERNEWS_COLS")){
|
|
|
|
|
define("OTHERNEWS_COLS","1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!defined("OTHERNEWS_CELL")){
|
|
|
|
|
define("OTHERNEWS_CELL","padding:0px;vertical-align:top");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!defined("OTHERNEWS_SPACING")){
|
|
|
|
|
define("OTHERNEWS_SPACING","0");
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-20 14:53:43 -07:00
|
|
|
|
if(!isset($param))
|
|
|
|
|
{
|
|
|
|
|
$param = array();
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-16 21:05:54 -08:00
|
|
|
|
$param['itemlink'] = defset('OTHERNEWS_ITEMLINK');
|
|
|
|
|
$param['thumbnail'] = defset('OTHERNEWS_THUMB');
|
|
|
|
|
$param['catlink'] = defset('OTHERNEWS_CATLINK');
|
|
|
|
|
$param['caticon'] = defset('OTHERNEWS_CATICON');
|
2016-03-10 15:13:32 -08:00
|
|
|
|
$param['template_key'] = 'news_menu/other/item';
|
2009-09-19 21:48:52 +00:00
|
|
|
|
|
2012-12-16 21:05:54 -08:00
|
|
|
|
$style = defset('OTHERNEWS_CELL');
|
|
|
|
|
$nbr_cols = defset('OTHERNEWS_COLS');
|
2009-09-19 21:48:52 +00:00
|
|
|
|
|
2013-02-20 14:40:49 +02:00
|
|
|
|
$_t = time();
|
|
|
|
|
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon FROM #news AS n
|
2009-09-19 21:48:52 +00:00
|
|
|
|
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
|
|
|
|
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
2013-02-20 14:40:49 +02:00
|
|
|
|
WHERE n.news_class IN (".USERCLASS_LIST.") AND n.news_start < ".$_t." AND (n.news_end=0 || n.news_end>".$_t.") AND FIND_IN_SET(2, n.news_render_type) ORDER BY n.news_datestamp DESC LIMIT 0,".OTHERNEWS_LIMIT;
|
2009-09-19 21:48:52 +00:00
|
|
|
|
|
2013-11-03 22:39:19 -08:00
|
|
|
|
if ($sql->gen($query))
|
2012-12-16 21:05:54 -08:00
|
|
|
|
{
|
2013-11-03 21:47:26 -08:00
|
|
|
|
$text = $tp->parseTemplate($template['start'],true);
|
2012-12-16 21:05:54 -08:00
|
|
|
|
|
|
|
|
|
if(OTHERNEWS_COLS !== false)
|
|
|
|
|
{
|
|
|
|
|
$text .= "<table style='width:100%' cellpadding='0' cellspacing='".OTHERNEWS_SPACING."'>";
|
|
|
|
|
$t = 0;
|
|
|
|
|
|
|
|
|
|
$wid = floor(100/$nbr_cols);
|
2013-11-03 22:39:19 -08:00
|
|
|
|
while ($row = $sql->fetch())
|
2012-12-16 21:05:54 -08:00
|
|
|
|
{
|
|
|
|
|
$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++;
|
|
|
|
|
}
|
2009-09-19 21:48:52 +00:00
|
|
|
|
}
|
2012-12-16 21:05:54 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while ($t % $nbr_cols != 0)
|
|
|
|
|
{
|
|
|
|
|
$text .= "<td style='width:$wid'> </td>\n";
|
|
|
|
|
$text .= (($t+1) % $nbr_cols == 0) ? "</tr>" : "";
|
2009-09-19 21:48:52 +00:00
|
|
|
|
$t++;
|
2012-12-16 21:05:54 -08:00
|
|
|
|
|
2009-09-19 21:48:52 +00:00
|
|
|
|
}
|
2012-12-16 21:05:54 -08:00
|
|
|
|
|
|
|
|
|
$text .= "</table>";
|
2009-09-19 21:48:52 +00:00
|
|
|
|
}
|
2012-12-16 21:05:54 -08:00
|
|
|
|
else // perfect for divs.
|
|
|
|
|
{
|
2013-11-03 21:47:26 -08:00
|
|
|
|
$loop = 0;
|
|
|
|
|
while ($row = $sql->fetch())
|
2012-12-16 21:05:54 -08:00
|
|
|
|
{
|
2013-11-03 21:47:26 -08:00
|
|
|
|
$active = ($loop == 0) ? 'active' : '';
|
|
|
|
|
|
|
|
|
|
$TMPL = str_replace("{ACTIVE}", $active, $OTHERNEWS_STYLE);
|
|
|
|
|
|
|
|
|
|
$text .= $ix->render_newsitem($row, 'return', '', $TMPL, $param);
|
|
|
|
|
$loop++;
|
2012-12-16 21:05:54 -08:00
|
|
|
|
}
|
2009-09-19 21:48:52 +00:00
|
|
|
|
}
|
2012-12-16 21:05:54 -08:00
|
|
|
|
|
2013-11-03 21:47:26 -08:00
|
|
|
|
$text .= $tp->parseTemplate($template['end'], true);
|
2009-09-19 21:48:52 +00:00
|
|
|
|
|
|
|
|
|
// Save Data
|
|
|
|
|
ob_start();
|
|
|
|
|
|
2013-11-03 21:47:26 -08:00
|
|
|
|
$ns->tablerender($caption, $text, 'other_news');
|
2009-09-19 21:48:52 +00:00
|
|
|
|
|
|
|
|
|
$cache_data = ob_get_flush();
|
2012-12-16 21:05:54 -08:00
|
|
|
|
e107::getCache()->set("nq_othernews", $cache_data);
|
2009-09-19 21:48:52 +00:00
|
|
|
|
}
|
|
|
|
|
|