Store author as contributor in wiki/blog

This commit is contained in:
Léo Serre 2018-11-05 22:31:20 +01:00
parent b5115182d5
commit 3ad4a6d08e
2 changed files with 20 additions and 4 deletions

View File

@ -179,10 +179,18 @@ class BlogArticle
$result = pg_execute($con, "prepare1", array($this->permalink, $this->locale, date('r'), date('r'), $user->id, $this->is_commentable, $this->name, $this->content))
or die ("Cannot execute statement\n");
pg_close($con);
$this->id = pg_fetch_assoc($result)['id'];
$query = "INSERT INTO content_contributors (content, contributor) VALUES
($1, $2)";
pg_prepare($con, "prepare2", $query)
or die ("Cannot prepare statement\n");
$result = pg_execute($con, "prepare2", array($this->id, $user->id))
or die ("Cannot execute statement\n");
pg_close($con);
error_log(
date('r')." \t".$user->name." (".$user->id.") \tINSERT \tCreate new blog article '".$this->url."'\r\n",
3,

View File

@ -204,10 +204,18 @@ class WikiPage
$result = pg_execute($con, "prepare1", array($this->permalink, $this->locale, date('r'), date('r'), $user->id, $this->name, $this->content))
or die ("Cannot execute statement\n");
pg_close($con);
$this->id = pg_fetch_assoc($result)['id'];
$query = "INSERT INTO content_contributors (content, contributor) VALUES
($1, $2)";
pg_prepare($con, "prepare2", $query)
or die ("Cannot prepare statement\n");
$result = pg_execute($con, "prepare2", array($this->id, $user->id))
or die ("Cannot execute statement\n");
pg_close($con);
error_log(
date('r')." \t".$user->name." (".$user->id.") \tINSERT \tCreate new wiki page '".$this->permalink."'\r\n",
3,