$published = $story->published(); if (isset($published) && $published > 0) { $approve = 1; } if ($story->published() != 0) { $published = $story->published(); } if ($story->expired() != 0) { $expired = $story->expired(); } else { $expired = 0; } $type = $story->type(); $topicdisplay = $story->topicdisplay(); $topicalign = $story->topicalign(false); if (!news_is_admin_group()) { include_once XOOPS_ROOT_PATH . '/modules/news/include/storyform.inc.php'; } else { include_once XOOPS_ROOT_PATH . '/modules/news/include/storyform.original.php'; } echo '</td></tr></table>'; break; case 'preview': $topic_id = intval($_POST['topic_id']); $xt = new NewsTopic($topic_id); if (isset($_GET['storyid'])) { $storyid = intval($_GET['storyid']); } else { if (isset($_POST['storyid'])) { $storyid = intval($_POST['storyid']); } else {
/** * Function used to prepare an article to be showned */ function prepare2show($filescount) { include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php'; global $xoopsUser, $xoopsConfig, $xoopsModuleConfig; $myts =& MyTextSanitizer::getInstance(); $infotips = news_getmoduleoption('infotips'); $story = array(); $story['id'] = $this->storyid(); $story['poster'] = $this->uname(); $story['author_name'] = $this->uname(); $story['author_uid'] = $this->uid(); if ($story['poster'] != false) { $story['poster'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $this->uid() . "'>" . $story['poster'] . "</a>"; } else { if ($xoopsModuleConfig['displayname'] != 3) { $story['poster'] = $xoopsConfig['anonymous']; } } if ($xoopsModuleConfig['ratenews']) { $story['rating'] = number_format($this->rating(), 2); if ($this->votes == 1) { $story['votes'] = _NW_ONEVOTE; } else { $story['votes'] = sprintf(_NW_NUMVOTES, $this->votes); } } $story['posttimestamp'] = $this->published(); $story['posttime'] = formatTimestamp($story['posttimestamp'], news_getmoduleoption('dateformat')); $story['topic_description'] = $myts->displayTarea($this->topic_description); $auto_summary = ''; $tmp = ''; $auto_summary = $this->auto_summary($this->bodytext(), $tmp); $story['text'] = $this->hometext(); $story['text'] = str_replace('[summary]', $auto_summary, $story['text']); $introcount = strlen($story['text']); $fullcount = strlen($this->bodytext()); $totalcount = $introcount + $fullcount; $morelink = ''; if ($fullcount > 1) { $morelink .= '<a href="' . XOOPS_URL . '/modules/news/article.php?storyid=' . $this->storyid() . ''; $morelink .= '">' . _NW_READMORE . '</a>'; $morelink .= ' | ' . sprintf(_NW_BYTESMORE, $totalcount); if (XOOPS_COMMENT_APPROVENONE != $xoopsModuleConfig['com_rule']) { $morelink .= ' | '; } } if (XOOPS_COMMENT_APPROVENONE != $xoopsModuleConfig['com_rule']) { $ccount = $this->comments(); $morelink .= '<a href="' . XOOPS_URL . '/modules/news/article.php?storyid=' . $this->storyid() . ''; $morelink2 = '<a href="' . XOOPS_URL . '/modules/news/article.php?storyid=' . $this->storyid() . ''; if ($ccount == 0) { $morelink .= '">' . _NW_COMMENTS . '</a>'; } else { if ($fullcount < 1) { if ($ccount == 1) { $morelink .= '">' . _NW_READMORE . '</a> | ' . $morelink2 . '">' . _NW_ONECOMMENT . '</a>'; } else { $morelink .= '">' . _NW_READMORE . '</a> | ' . $morelink2 . '">'; $morelink .= sprintf(_NW_NUMCOMMENTS, $ccount); $morelink .= '</a>'; } } else { if ($ccount == 1) { $morelink .= '">' . _NW_ONECOMMENT . '</a>'; } else { $morelink .= '">'; $morelink .= sprintf(_NW_NUMCOMMENTS, $ccount); $morelink .= '</a>'; } } } } $story['morelink'] = $morelink; $story['adminlink'] = ''; $approveprivilege = 0; if (news_is_admin_group()) { $approveprivilege = 1; } if ($xoopsModuleConfig['authoredit'] == 1 && (is_object($xoopsUser) && $xoopsUser->getVar('uid') == $this->uid())) { $approveprivilege = 1; } if ($approveprivilege) { $story['adminlink'] = $this->adminlink(); } $story['mail_link'] = 'mailto:?subject=' . sprintf(_NW_INTARTICLE, $xoopsConfig['sitename']) . '&body=' . sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/news/article.php?storyid=' . $this->storyid(); $story['imglink'] = ''; $story['align'] = ''; if ($this->topicdisplay()) { $story['imglink'] = $this->imglink(); $story['align'] = $this->topicalign(); } if ($infotips > 0) { $story['infotips'] = ' title="' . news_make_infotips($this->hometext()) . '"'; } else { $story['infotips'] = ''; } $story['title'] = "<a href='" . XOOPS_URL . "/modules/news/article.php?storyid=" . $this->storyid() . "'" . $story['infotips'] . ">" . $this->title() . "</a>"; $story['hits'] = $this->counter(); if ($filescount > 0) { $story['files_attached'] = true; $story['attached_link'] = "<a href='" . XOOPS_URL . '/modules/news/article.php?storyid=' . $this->storyid() . "' title='" . _NW_ATTACHEDLIB . "'><img src='" . XOOPS_URL . '/modules/news/images/attach.gif' . "' title='" . _NW_ATTACHEDLIB . "'></a>"; } else { $story['files_attached'] = false; $story['attached_link'] = ''; } return $story; }
} else { $groups = XOOPS_GROUP_ANONYMOUS; } if (!$gperm_handler->checkRight('news_view', $article->topicid(), $groups, $xoopsModule->getVar('mid'))) { redirect_header(XOOPS_URL . '/modules/news/index.php', 3, _NOPERM); exit; } $storypage = isset($_GET['page']) ? intval($_GET['page']) : 0; $dateformat = news_getmoduleoption('dateformat'); $hcontent = ''; /** * update counter only when viewing top page and when you are not the author or an admin */ if (empty($_GET['com_id']) && $storypage == 0) { if (is_object($xoopsUser)) { if ($xoopsUser->getVar('uid') == $article->uid() || news_is_admin_group()) { // nothing ! ;-) } else { $article->updateCounter(); } } else { $article->updateCounter(); } } $xoopsOption['template_main'] = 'news_article.html'; include_once XOOPS_ROOT_PATH . '/header.php'; $story['id'] = $storyid; $story['posttime'] = formatTimestamp($article->published(), $dateformat); $story['news_title'] = $article->title(); $story['title'] = $article->textlink() . ' : ' . $article->title(); $story['topic_title'] = $article->textlink();