include_once NW_MODULE_PATH . '/include/functions.php'; $storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0; if ( empty($storyid) ) { redirect_header(NW_MODULE_URL . '/index.php',2,_MA_NW_NOSTORY); } // Verify that the article is published $story = new nw_NewsStory($storyid); // Not yet published if ( $story->published() == 0 || $story->published() > time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } // Expired if ( $story->expired() != 0 && $story->expired() < time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_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('nw_view', $story->topicid(), $groups, $xoopsModule->getVar('mid'))) { redirect_header(NW_MODULE_URL . '/index.php', 3, _NOPERM); exit();
$storyid = intval($_GET['storyid']); } else { if(isset($_POST['storyid'])) { $storyid = intval($_POST['storyid']); } } if(!empty($storyid)) { $article = new nw_NewsStory($storyid); if ( $article->published() == 0 || $article->published() > time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } // Expired if ( $article->expired() != 0 && $article->expired() < time() ) { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_NW_NOSTORY); exit(); } } else { redirect_header(NW_MODULE_URL . '/index.php', 2, _MA_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; }
$story->Setkeywords($_POST['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 {