Beispiel #1
0
 /**
  * Adds an article to the blog
  *
  * @param $user string
  *        	the name of the user
  * @param $title string
  *        	the title of the article
  * @param $keyword_string string
  *        	a string containing the keywords separated with space
  * @param $content string
  *        	the content of the article in block code
  */
 public function add_article($user, $title, $keyword_string, $content)
 {
     $time = time();
     $user_id = AuthenticationService::get_current_user_id();
     $query = "INSERT INTO `webinfo`.`article` (`id`, `title`, `author`, `creation_date`, `change_date`, `text`) ";
     $query .= "VALUES (NULL, '{$title}', '{$user_id}', '{$time}', '{$time}', '{$content}')";
     //insert article
     $this->sql_con->query($query);
     //get created id
     $id = mysqli_insert_id($this->sql_con);
     $this->updateKeywords($id, $keyword_string);
 }