fixed old bugs regarding changed db specs
Deploy vintagecoding.net / deploy (push) Canceled after 0s
Deploy vintagecoding.net / deploy (push) Canceled after 0s
This commit is contained in:
+1
-1
@@ -267,7 +267,7 @@ class Thought extends Post
|
|||||||
$this->thought = $thought;
|
$this->thought = $thought;
|
||||||
|
|
||||||
if ($id < 0) {
|
if ($id < 0) {
|
||||||
$stmt = 'INSERT INTO post (id, parentSpace, creator, postType, status, thought) VALUES (?, ?, ?, ?, ?, ?)';
|
$stmt = 'INSERT INTO post (id, space, creator, postType, status, thought) VALUES (?, ?, ?, ?, ?, ?)';
|
||||||
parent::setId($id * -1);
|
parent::setId($id * -1);
|
||||||
$space = isset($space) ? $space->getId() : $creator->getHomeSpace()->getId();
|
$space = isset($space) ? $space->getId() : $creator->getHomeSpace()->getId();
|
||||||
exec_stmt($stmt, 'iiiiis', $id * -1, $space, $creator->getId(), 3, 2, $this->thought);
|
exec_stmt($stmt, 'iiiiis', $id * -1, $space, $creator->getId(), 3, 2, $this->thought);
|
||||||
|
|||||||
+6
-7
@@ -27,7 +27,7 @@ class Space
|
|||||||
$this->id = $id * -1;
|
$this->id = $id * -1;
|
||||||
error_log('ID: ' . $this->id);
|
error_log('ID: ' . $this->id);
|
||||||
|
|
||||||
$stmt = 'INSERT INTO space (id, name, description, visibility, parentSpace) VALUES (?, ?, ?, ?, ?)';
|
$stmt = 'INSERT INTO space (id, name, description, visibility, parent) VALUES (?, ?, ?, ?, ?)';
|
||||||
exec_stmt($stmt, 'issii', $this->id, $name, $description, $visibility, (isset($parent) ? $parent->getId() : null));
|
exec_stmt($stmt, 'issii', $this->id, $name, $description, $visibility, (isset($parent) ? $parent->getId() : null));
|
||||||
error_log('Added space in DB');
|
error_log('Added space in DB');
|
||||||
} else
|
} else
|
||||||
@@ -57,13 +57,12 @@ class Space
|
|||||||
|
|
||||||
public function getSubSpaces(): ?array
|
public function getSubSpaces(): ?array
|
||||||
{
|
{
|
||||||
$stmt = 'SELECT id FROM space WHERE parentSpace = ?';
|
$stmt = 'SELECT id FROM space WHERE parent = ?';
|
||||||
$rawSubSpaces = exec_stmt($stmt, 'i', $this->id);
|
$rawSubSpaces = exec_stmt($stmt, 'i', $this->id);
|
||||||
|
|
||||||
$subSpaces = [];
|
$subSpaces = [];
|
||||||
foreach ($rawSubSpaces as $ss) {
|
foreach ($rawSubSpaces as $ss)
|
||||||
$subSpaces[] = Space::retrieveFromDB($ss['id']);
|
$subSpaces[] = Space::retrieveFromDB($ss['id']);
|
||||||
}
|
|
||||||
|
|
||||||
return $subSpaces;
|
return $subSpaces;
|
||||||
}
|
}
|
||||||
@@ -136,8 +135,8 @@ class Space
|
|||||||
$rawSpace = exec_stmt($stmt, 'i', $space)->fetch_assoc();
|
$rawSpace = exec_stmt($stmt, 'i', $space)->fetch_assoc();
|
||||||
|
|
||||||
if ($rawSpace) {
|
if ($rawSpace) {
|
||||||
if (!empty($rawSpace['parentSpace']))
|
if (!empty($rawSpace['parent']))
|
||||||
$parent = Space::retrieveFromDB($rawSpace['parentSpace'], $user);
|
$parent = Space::retrieveFromDB($rawSpace['parent'], $user);
|
||||||
else
|
else
|
||||||
$parent = null;
|
$parent = null;
|
||||||
|
|
||||||
@@ -147,7 +146,7 @@ class Space
|
|||||||
foreach ($rawMembers as $m)
|
foreach ($rawMembers as $m)
|
||||||
$members[] = User::retrieveFromDB($m['user']);
|
$members[] = User::retrieveFromDB($m['user']);
|
||||||
|
|
||||||
$stmt = 'SELECT post FROM spacePosts INNER JOIN post ON spacePosts.post = post.id WHERE space = ? ORDER BY post.createdAt DESC';
|
$stmt = 'SELECT post FROM spacePosts INNER JOIN post ON spacePosts.post = post.id WHERE spacePosts.space = ? ORDER BY post.createdAt DESC';
|
||||||
$posts = [];
|
$posts = [];
|
||||||
$rawPosts = exec_stmt($stmt, 'i', $rawSpace['id']);
|
$rawPosts = exec_stmt($stmt, 'i', $rawSpace['id']);
|
||||||
while ($row = $rawPosts->fetch_assoc())
|
while ($row = $rawPosts->fetch_assoc())
|
||||||
|
|||||||
Reference in New Issue
Block a user