} //Username + eMail if ($res['userid']) { $username = $res['username']; $email = iif(!$res['pub_hidemail'], $res['email']); } else { $username = $res['send_username']; $email = $res['send_email']; } //Datehead if ($laststamp != date('Y/m/d', $res['starttime'] - TIMEDIFF)) { $tabledata[$i]['DATEHEAD'] = $res['starttime']; } //Links if (in_array('NEWS.RELATED', $parse)) { $tabledata[$i]['RELATED'] = news_links($res['links']); } //Text $text = ''; if (in_array('NEWS.TEXT', $parse)) { $text = mediamanager_inline($res['text']); if ($apx->is_module('glossar')) { $text = glossar_highlight($text); } } //Teaser $teaser = ''; if (in_array('NEWS.TEASER', $parse) && $set['news']['teaser']) { $teaser = mediamanager_inline($res['teaser']); if ($apx->is_module('glossar')) { $teaser = glossar_highlight($teaser);
function news_once($id) { global $db; $anzahl = $db->result(DB_PRE . 'ecp_news', 'COUNT(newsID)', '(lang = "" OR lang LIKE ",%' . LANGUAGE . '%,") AND ' . DB_PRE . 'ecp_news.datum < ' . time() . ' AND (access = "" OR ' . $_SESSION['access_search'] . ') AND newsID = ' . $id); if (!isset($_SESSION['news'][(int) $_GET['id']])) { if ($db->query('UPDATE ' . DB_PRE . 'ecp_news SET hits = hits + 1 WHERE newsID = ' . (int) $_GET['id'])) { $_SESSION['news'][(int) $_GET['id']] = true; } } $sql = 'SELECT `newsID`, `' . DB_PRE . 'ecp_news`.`userID`, `topicID`, `' . DB_PRE . 'ecp_news`.`datum`, `headline`, `bodytext`, `extendtext`, `links`, `hits`, `username`, `topicname`, `topicbild`, `beschreibung` FROM ' . DB_PRE . 'ecp_news LEFT JOIN ' . DB_PRE . 'ecp_user ON (' . DB_PRE . 'ecp_news.userID = ID) LEFT JOIN ' . DB_PRE . 'ecp_topics ON (topicID = tID) WHERE (lang = "" OR lang LIKE ",%' . LANGUAGE . '%,") AND ' . DB_PRE . 'ecp_news.datum < ' . time() . ' AND (access = "" OR ' . $_SESSION['access_search'] . ') AND newsID = ' . $id . ' GROUP BY newsID'; if ($anzahl) { $db->query($sql); while ($row = $db->fetch_assoc()) { $tpl = new smarty(); $tpl->assign('comment', 1); $row['bodytext'] = bb_code($row['bodytext']); $row['extendtext'] = bb_code($row['extendtext']); $row['datum'] = date(LONG_DATE, $row['datum']); $row['links'] = news_links($row['links']); foreach ($row as $key => $value) { $tpl->assign($key, $value); } $tpl->assign('pic', file_exists('templates/' . DESIGN . '/images/topics/' . $row['topicbild']) ? 'templates/' . DESIGN . '/images/topics/' . $row['topicbild'] : 'images/topics/' . $row['topicbild']); ob_start(); $tpl->display(DESIGN . '/tpl/news/news.html'); $content = ob_get_contents(); ob_end_clean(); main_content('<a href="?section=news&action=topic&id=' . $row['topicID'] . '">' . $row['topicname'] . '</a>: ' . $row['headline'], $content, '', 0); } } else { table(INFO, NO_ENTRIES_ID); } }
function news_print($data, $template) { global $set, $db, $apx, $user; $tmpl = new tengine(); $apx->lang->drop('func', 'news'); //Verwendete Variablen auslesen $parse = $apx->tmpl->used_vars($template, 'news'); //Kategorien auslesen if (in_array('NEWS.CATID', $parse) || in_array('NEWS.CATTITLE', $parse) || in_array('NEWS.CATICON', $parse) || in_array('NEWS.CATLINK', $parse)) { $catinfo = news_catinfo(get_ids($data, 'catid')); } if (count($data)) { foreach ($data as $res) { ++$i; //Link $link = mklink('news.php?id=' . $res['id'], 'news,id' . $res['id'] . urlformat($res['title']) . '.html'); //Newspic if (in_array('NEWS.PICTURE', $parse) || in_array('NEWS.PICTURE_POPUP', $parse) || in_array('NEWS.PICTURE_POPUPPATH', $parse)) { list($picture, $picture_popup, $picture_popuppath) = news_newspic($res['newspic']); } //Username + eMail if ($res['userid']) { $username = $res['username']; $email = iif(!$res['pub_hidemail'], $res['email']); } else { $username = $res['send_username']; $email = $res['send_email']; } //Datehead if ($laststamp != date('Y/m/d', $res['starttime'] - TIMEDIFF)) { $tabledata[$i]['DATEHEAD'] = $res['starttime']; } //Links if (in_array('NEWS.RELATED', $parse)) { $tabledata[$i]['RELATED'] = news_links($res['links']); } //Text $text = ''; if (in_array('NEWS.TEXT', $parse)) { $text = mediamanager_inline($res['text']); if ($apx->is_module('glossar')) { $text = glossar_highlight($text); } } //Teaser $teaser = ''; if (in_array('NEWS.TEASER', $parse) && $set['news']['teaser']) { $teaser = mediamanager_inline($res['teaser']); if ($apx->is_module('glossar')) { $teaser = glossar_highlight($teaser); } } //Tags if (in_array('NEWS.TAG', $parse) || in_array('NEWS.TAG_IDS', $parse) || in_array('NEWS.KEYWORDS', $parse)) { list($tagdata, $tagids, $keywords) = news_tags($res['id']); } $tabledata[$i]['ID'] = $res['id']; $tabledata[$i]['SECID'] = $res['secid']; $tabledata[$i]['TITLE'] = $res['title']; $tabledata[$i]['SUBTITLE'] = $res['subtitle']; $tabledata[$i]['LINK'] = $link; $tabledata[$i]['TEASER'] = $teaser; $tabledata[$i]['TEXT'] = $text; $tabledata[$i]['TIME'] = $res['starttime']; $tabledata[$i]['PICTURE'] = $picture; $tabledata[$i]['PICTURE_POPUP'] = $picture_popup; $tabledata[$i]['PICTURE_POPUPPATH'] = $picture_popuppath; $tabledata[$i]['USERID'] = $res['userid']; $tabledata[$i]['USERNAME'] = replace($username); $tabledata[$i]['EMAIL'] = replace($email); $tabledata[$i]['EMAIL_ENCRYPTED'] = replace(cryptMail($email)); $tabledata[$i]['HITS'] = number_format($res['hits'], 0, '', '.'); $tabledata[$i]['TOP'] = $res['top']; $tabledata[$i]['RESTRICTED'] = $res['restricted']; //Tags $tabledata[$i]['TAG'] = $tagdata; $tabledata[$i]['TAG_IDS'] = $tagids; $tabledata[$i]['KEYWORDS'] = $keywords; //Kategorie $tabledata[$i]['CATID'] = $res['catid']; $tabledata[$i]['CATTITLE'] = $catinfo[$res['catid']]['title']; $tabledata[$i]['CATICON'] = $catinfo[$res['catid']]['icon']; $tabledata[$i]['CATLINK'] = $catinfo[$res['catid']]['link']; //Produkt $tabledata[$i]['PRODUCT_ID'] = $res['prodid']; //Galerie if ($apx->is_module('gallery') && $res['galid']) { $galinfo = gallery_info($res['galid']); $tabledata[$i]['GALLERY_ID'] = $galinfo['id']; $tabledata[$i]['GALLERY_TITLE'] = $galinfo['title']; $tabledata[$i]['GALLERY_LINK'] = mklink('gallery.php?id=' . $galinfo['id'], 'gallery,list' . $galinfo['id'] . ',1' . urlformat($galinfo['title']) . '.html'); } //Kommentare if ($apx->is_module('comments') && $set['news']['coms'] && $res['allowcoms']) { require_once BASEDIR . getmodulepath('comments') . 'class.comments.php'; if (!isset($coms)) { $coms = new comments('news', $res['id']); } else { $coms->mid = $res['id']; } $link = mklink('news.php?id=' . $res['id'], 'news,id' . $res['id'] . urlformat($res['title']) . '.html'); $tabledata[$i]['COMMENT_COUNT'] = $coms->count(); $tabledata[$i]['COMMENT_LINK'] = $coms->link($link); $tabledata[$i]['DISPLAY_COMMENTS'] = 1; if (in_template(array('NEWS.COMMENT_LAST_USERID', 'NEWS.COMMENT_LAST_NAME', 'NEWS.COMMENT_LAST_TIME'), $parse)) { $tabledata[$i]['COMMENT_LAST_USERID'] = $coms->last_userid(); $tabledata[$i]['COMMENT_LAST_NAME'] = $coms->last_name(); $tabledata[$i]['COMMENT_LAST_TIME'] = $coms->last_time(); } } //Bewertungen if ($apx->is_module('ratings') && $set['news']['ratings'] && $res['allowrating']) { require_once BASEDIR . getmodulepath('ratings') . 'class.ratings.php'; if (!isset($rate)) { $rate = new ratings('news', $res['id']); } else { $rate->mid = $res['id']; } $tabledata[$i]['RATING'] = $rate->display(); $tabledata[$i]['RATING_VOTES'] = $rate->count(); $tabledata[$i]['DISPLAY_RATING'] = 1; } $laststamp = date('Y/m/d', $res['starttime'] - TIMEDIFF); } } $tmpl->assign('NEWS', $tabledata); $tmpl->parse($template, 'news'); }