MVC-Pro/application/controllers/managepostscontroller.php
/**
	 * Description:
	 * This adds a post and sets a message for whether it was successful or not.
	 */
This adds a post and sets a message for whether it was successful or not.
This adds a post and sets a message for whether it was successful or not .
public function save()
	{
		if (empty($_POST)) {
			return;
		}
		$this->postObject = new Post();
		$u = new User();
		$data = array(
			'title'      => $_POST['post_title'],
			'content'    => $_POST['post_content'],
			'date'       => $_POST['post_date'],
			'categoryID' => $_POST['post_categoryID'],
			'uID'        => !empty($u->uID) ? $u->uID : 0 
		);
		if (empty($data['date'])) {
			$data['date'] = date('Y-m-d H:i:s');
		}
		$data['date'] = date('Y-m-d H:i:s', strtotime($data['date']));
		$result = $this->postObject->addPost($data);
		$this->set('message', $result);
		header('Location: /index.php/manageposts/');
		exit;
	}
public function save ( ) { if ( empty ( $ _POST ) ) { return ; } $ this -> postObject = new Post ( ) ; $ u = new User ( ) ; $ data = array ( 'title' => $ _POST [ 'post_title' ] , 'content' => $ _POST [ 'post_content' ] , 'date' => $ _POST [ 'post_date' ] , 'categoryID' => $ _POST [ 'post_categoryID' ] , 'uID' => ! empty ( $ u -> uID ) ? $ u -> uID : 0 ) ; if ( empty ( $ data [ 'date' ] ) ) { $ data [ 'date' ] = date ( 'Y-m-d H:i:s' ) ; } $ data [ 'date' ] = date ( 'Y-m-d H:i:s' , strtotime ( $ data [ 'date' ] ) ) ; $ result = $ this -> postObject -> addPost ( $ data ) ; $ this -> set ( 'message' , $ result ) ; header ( 'Location: /index.php/manageposts/' ) ; exit ; }
Description:
 This adds a post and sets a message for whether it was successful or not.
Description : This adds a post and sets a message for whether it was successful or not .
// if not adding a post // then don't by leaving this function // This should actually never store 0, the user should always be logged in. // safety precaution to make sure date is set // Send the message to the manageposts home page // $_SESSION['message'] = (! empty($this->postObject->getMessage())) ? 'alert-success' : 0;