diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index d7f1304b..b518d65b 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -564,10 +564,10 @@ class PostController if (!$this->context->loggedIn) throw new SimpleException('Not logged in'); - $p = R::findOne('post_score', 'post_id = ? AND user_id = ?', [$id, $this->context->user->id]); + $p = R::findOne('postscore', 'post_id = ? AND user_id = ?', [$post->id, $this->context->user->id]); if (!$p) { - $p = R::dispense('post_score'); + $p = R::dispense('postscore'); $p->post = $post; $p->user = $this->context->user; } @@ -648,7 +648,7 @@ class PostController if ($fav->user->id == $this->context->user->id) $favorite = true; - $s = R::findOne('post_score', 'post_id = ? AND user_id = ?', [$post->id, $this->context->user->id]); + $s = R::findOne('postscore', 'post_id = ? AND user_id = ?', [$post->id, $this->context->user->id]); if ($s) $score = intval($s->score); } diff --git a/src/Upgrades/Upgrade5.sql b/src/Upgrades/Upgrade5.sql new file mode 100644 index 00000000..04e70bee --- /dev/null +++ b/src/Upgrades/Upgrade5.sql @@ -0,0 +1 @@ +ALTER TABLE post_score RENAME TO postscore diff --git a/src/core.php b/src/core.php index f6c86b76..37cef1d8 100644 --- a/src/core.php +++ b/src/core.php @@ -48,7 +48,6 @@ $config = configFactory(); R::setup('sqlite:' . $config->main->dbPath); R::freeze(true); R::dependencies(['tag' => ['post'], 'favoritee' => ['post', 'user'], 'comment' => ['post', 'user']]); -R::setStrictTyping(false); //wire models \Chibi\AutoLoader::init([__DIR__ . '/../' . $config->chibi->userCodeDir, __DIR__]);