diff --git a/application/modules/bulletin/controllers/AdminController.php b/application/modules/bulletin/controllers/AdminController.php index 0605845e349613c063e7b716ad63f7cf5bf378c4..1bd938929e2a8ca3bf0eb9e99f00df5faea2b267 100644 --- a/application/modules/bulletin/controllers/AdminController.php +++ b/application/modules/bulletin/controllers/AdminController.php @@ -145,6 +145,7 @@ class Bulletin_AdminController extends Creq_Controller_Action // get file content edits $fileContents = $in['file-contents']; + $fileContents = $this->cleanupHtml($fileContents); /* NOT USED // modify page title @@ -469,7 +470,7 @@ class Bulletin_AdminController extends Creq_Controller_Action // update major removed status in database $db = Zend_Registry::get('db'); $update_data = array('removed' => 'yes'); - $db->update('creqMajors', $update_data, 'majorId = '.$in['major']); + $db->update('creqMajors', $update_data, 'majorId = '.$in['major']); // merge branch into master Bulletin_RepositoryModel::getInstance()->mergeBranchToMaster($branch); @@ -480,7 +481,6 @@ class Bulletin_AdminController extends Creq_Controller_Action // success $this->_helper->getHelper('FlashMessenger')->addMessage("Major '" . $major . "' removed successfully."); $this->redirect('/bulletin/admin/remove-major'); - } protected function getCurrentEditingYear() @@ -492,4 +492,18 @@ class Bulletin_AdminController extends Creq_Controller_Action return $currentYear; } + + protected function cleanupHtml($html) + { + // replace ' & ' with '&' + $html = str_replace(' & ', ' & ', $html); + + // replace '&' with '&' + $html = str_replace('&', '&', $html); + + // replace CRLF with LF + $html = str_replace((chr(13).chr(10)), chr(10), $html); + + return $html; + } }