Posts content can be updated

This commit is contained in:
Pierre 2018-01-16 06:39:52 +01:00
parent de69f4861f
commit bdea05d9c0

View File

@ -372,6 +372,37 @@ class Posts {
"niveau_visibilite" => $level "niveau_visibilite" => $level
); );
//Perform update
return $this->perform_update($postID, $new_values);
}
/**
* Update the content of a post
*
* @param int $postID The ID of the post to update
* @param string $new_content The new content for the post
* @return bool TRUE in case of success / FALSE else
*/
public function update_content(int $postID, string $new_content) : bool {
//Make a request on the database
$new_values = array(
"texte" => $new_content
);
//Perform update
return $this->perform_update($postID, $new_values);
}
/**
* Perform the update of some informations of a post
*
* @param int $postID The ID of the post to update
* @param array $new_values The informations to change in the post
* @return bool TRUE for a success / FALSE for a failure
*/
private function perform_update(int $postID, array $new_values) : bool {
//Set the conditions //Set the conditions
$conditions = "ID = ?"; $conditions = "ID = ?";
$condValues = array($postID); $condValues = array($postID);