include_once '../../mainfile.php'; include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php'; $storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0; if (empty($storyid)) { redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY); } // Verify that the article is published $story = new NewsStory($storyid); // Not yet published if ($story->published() == 0 || $story->published() > time()) { redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY); exit; } // Expired if ($story->expired() != 0 && $story->expired() < time()) { redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY); exit; } // Verify permissions $gperm_handler =& xoops_gethandler('groupperm'); if (is_object($xoopsUser)) { $groups = $xoopsUser->getGroups(); } else { $groups = XOOPS_GROUP_ANONYMOUS; } if (!$gperm_handler->checkRight('news_view', $story->topicid(), $groups, $xoopsModule->getVar('mid'))) { redirect_header(XOOPS_URL . '/modules/news/index.php', 3, _NOPERM); exit; } $xoops_meta_keywords = '';
$story->setTopicdisplay($_POST['topicdisplay']); // Display Topic Image ? (Yes or No) $story->setTopicalign($_POST['topicalign']); // Topic Align, 'Right' or 'Left' $story->setIhome($_POST['ihome']); // Publish in home ? (Yes or No) if (isset($_POST['bodytext'])) { $story->setBodytext($_POST['bodytext']); } else { $story->setBodytext(' '); } $approve = isset($_POST['approve']) ? intval($_POST['approve']) : 0; if (!$story->published() && $approve) { $story->setPublished(time()); } if (!$story->expired()) { $story->setExpired(0); } if (!$approve) { $story->setPublished(0); } } elseif ($xoopsModuleConfig['autoapprove'] == 1 && !$approveprivilege) { if (empty($storyid)) { $approve = 1; } else { $approve = isset($_POST['approve']) ? intval($_POST['approve']) : 0; } if ($approve) { $story->setPublished(time()); } else { $story->setPublished(0);
$storyid = 0; if (isset($_GET['storyid'])) { $storyid = intval($_GET['storyid']); } else { if (isset($_POST['storyid'])) { $storyid = intval($_POST['storyid']); } } if (!empty($storyid)) { $article = new NewsStory($storyid); if ($article->published() == 0 || $article->published() > time()) { redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY); exit; } // Expired if ($article->expired() != 0 && $article->expired() < time()) { redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY); exit; } } else { redirect_header(XOOPS_URL . '/modules/news/index.php', 2, _NW_NOSTORY); exit; } // 3) Does the user can see this news ? If he can't see it, he can't vote for $gperm_handler =& xoops_gethandler('groupperm'); if (is_object($xoopsUser)) { $groups = $xoopsUser->getGroups(); } else { $groups = XOOPS_GROUP_ANONYMOUS; } if (!$gperm_handler->checkRight('news_view', $article->topicid(), $groups, $xoopsModule->getVar('mid'))) {
lastStories(); expStories(); echo "<br />"; echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">"; echo "<h4>" . _AM_POSTNEWARTICLE . "</h4>"; $type = "admin"; include "storyform.inc.php"; echo "</td></tr></table>"; break; case "preview": xoops_cp_header(); echo "<h4>" . _AM_CONFIG . "</h4>"; if (isset($storyid)) { $story = new NewsStory($storyid); $published = $story->published(); $expired = $story->expired(); } else { $story = new NewsStory(); } $story->setTitle($_POST['title']); $story->setHomeText($_POST['hometext']); $story->setBodyText($_POST['bodytext']); if (isset($_POST['nohtml']) && ($_POST['nohtml'] == 0 || $_POST['nohtml'] == 1)) { $story->setNohtml($_POST['nohtml']); } if (isset($_POST['nosmiley']) && ($_POST['nosmiley'] == 0 || $_POST['nosmiley'] == 1)) { $story->setNosmiley($_POST['nosmiley']); } $xt = new XoopsTopic($xoopsDB->prefix("topics")); $p_title = $story->title("Preview"); $p_hometext = $story->hometext("Preview");