/** * Saves a story submission * * @param array $A Data for that submission * @return string HTML redirect * */ function savestory($A) { global $_CONF, $_TABLES; $retval = ''; $story = new Story(); $story->loadSubmission(); // pseudo-formatted story text for the spam check $result = PLG_checkforSpam($story->getSpamCheckFormat(), $_CONF['spamx']); if ($result > 0) { COM_updateSpeedlimit('submit'); COM_displayMessageAndAbort($result, 'spamx', 403, 'Forbidden'); } COM_updateSpeedlimit('submit'); $result = $story->saveSubmission(); if ($result == STORY_NO_ACCESS_TOPIC) { // user doesn't have access to this topic - bail COM_redirect($_CONF['site_url'] . '/index.php'); } elseif ($result == STORY_SAVED || $result == STORY_SAVED_SUBMISSION) { if (isset($_CONF['notification']) && in_array('story', $_CONF['notification'])) { sendNotification($_TABLES['storysubmission'], $story); } if ($result == STORY_SAVED) { COM_redirect(COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid())); } else { COM_redirect($_CONF['site_url'] . '/index.php?msg=2'); } } return $retval; }
public function testGetSpamCheckFormatEmpty() { $st = new Story(); $this->assertEquals('<h1></h1><p></p><p></p>', $st->getSpamCheckFormat()); }