public function _CommitNews($NewsId = 0) { // Commit the details for the news post to the database include_once ISC_BASE_PATH . '/lib/api/news.api.php'; $news = new API_NEWS(); if ($NewsId == 0) { if (isset($_POST['wysiwyg_html'])) { $_POST['newscontent'] = $_POST['wysiwyg_html']; } else { $_POST['newscontent'] = $_POST['wysiwyg']; } $_POST['newsdate'] = time(); $NewsId = $news->create(); } else { if (isset($_POST['wysiwyg_html'])) { $_POST['newscontent'] = $_POST['wysiwyg_html']; } else { $_POST['newscontent'] = $_POST['wysiwyg']; } if (isset($_POST['newsvisible'])) { $_POST['newsvisible'] = 1; } else { $_POST['newsvisible'] = 0; } $news->load($NewsId); $news->save(); } if (!$news->error) { // Log this action $GLOBALS['ISC_CLASS_LOG']->LogAdminAction($NewsId, $_POST['newstitle']); } return $news->error; }
public function _CommitNews($NewsId=0) { // Commit the details for the news post to the database include_once(ISC_BASE_PATH.'/lib/api/news.api.php'); $news = new API_NEWS(); if ($NewsId == 0) { if(isset($_POST['wysiwyg_html'])) { $_POST['newscontent'] = $_POST['wysiwyg_html']; } else { $_POST['newscontent'] = $_POST['wysiwyg']; } $_POST['newsdate'] = time(); $NewsId = $news->create(); } else { if(isset($_POST['wysiwyg_html'])) { $_POST['newscontent'] = $_POST['wysiwyg_html']; } else { $_POST['newscontent'] = $_POST['wysiwyg']; } if(isset($_POST['newsvisible'])) { $_POST['newsvisible' ] = 1; } else { $_POST['newsvisible'] = 0; } $news->load($NewsId); $news->save(); } if(!$news->error) { // Log this action $GLOBALS['ISC_CLASS_LOG']->LogAdminAction($NewsId, $_POST['newstitle']); $savedata = array( "newsid" => $NewsId, "newstitle" => $_POST["newstitle"], "newscontent" => stripHTMLForSearchTable($_POST["newscontent"]), "newssearchkeywords" => $_POST["newssearchkeywords"] ); $query = "SELECT newssearchid FROM [|PREFIX|]news_search WHERE newsid=" . (int)$NewsId; $searchId = $GLOBALS["ISC_CLASS_DB"]->FetchOne($query); if (isId($searchId)) { $GLOBALS["ISC_CLASS_DB"]->UpdateQuery("news_search", $savedata, "newssearchid=" . (int)$searchId); } else { $GLOBALS["ISC_CLASS_DB"]->InsertQuery("news_search", $savedata); } // Save the words to the news_words table for search spelling suggestions Store_SearchSuggestion::manageSuggestedWordDatabase("news", $NewsId, $_POST["newstitle"]); } return $news->error; }