if (!empty($f_comment_status)) { if ($f_comment_status == "enabled" || $f_comment_status == "locked") { $commentsEnabled = true; } else { $commentsEnabled = false; } // If status has changed, then you need to show/hide all the comments // as appropriate. if ($articleObj->commentsEnabled() != $commentsEnabled) { $articleObj->setCommentsEnabled($commentsEnabled); global $controller; $repository = $controller->getHelper('entity')->getRepository('Newscoop\\Entity\\Comment'); $repository->setArticleStatus($f_article_number, $f_language_selected, $commentsEnabled ? STATUS_APPROVED : STATUS_HIDDEN); $repository->flush(); } $articleObj->setCommentsLocked($f_comment_status == "locked"); } // Make sure that the time stamp is updated. $articleObj->setProperty('time_updated', 'NOW()', true, true); // Verify creation date is in the correct format. // If not, dont change it. if (preg_match("/\\d{4}-\\d{2}-\\d{2}/", $f_creation_date)) { $articleObj->setCreationDate($f_creation_date); } // Verify publish date is in the correct format. // If not, dont change it. if (preg_match("/\\d{4}-\\d{2}-\\d{2}/", $f_publish_date)) { $articleObj->setPublishDate($f_publish_date); } foreach ($articleFields as $dbColumnName => $text) { $articleTypeObj->setProperty($dbColumnName, $text);