Browse Source

DAO 修正

sqlite
みてるぞ 9 months ago
parent
commit
dd3a9027d5
3 changed files with 21 additions and 4 deletions
  1. +9
    -0
      daos/thread.php
  2. +7
    -0
      import.php
  3. +5
    -4
      www/index.php

+ 9
- 0
daos/thread.php View File

@@ -51,6 +51,15 @@ Thread
} }




public static function
find (
int $id)
: \Dto\Thread
{
;
}


public static function public static function
create_thread ( create_thread (
SQLite3 $db, SQLite3 $db,


+ 7
- 0
import.php View File

@@ -0,0 +1,7 @@
<?php

require_once __DIR__ . '/daos/response.php';
require_once __DIR__ . '/daos/thread.php';
require_once __DIR__ . '/dtos/response.php';
require_once __DIR__ . '/dtos/thread.php';


+ 5
- 4
www/index.php View File

@@ -1,6 +1,7 @@
<?php <?php


use \Dao;
require_once __DIR__ . '/../import.php';

use \Dto; use \Dto;




@@ -28,7 +29,7 @@ else
$dir = './images/'; $dir = './images/';
$handle = opendir ($dir); $handle = opendir ($dir);


if ($row = Dao\Thread :: find ($thread))
if ($row = \Dao\Thread :: find ($thread))
{ {
$title = $row -> title; $title = $row -> title;
$explain = $row -> explain; $explain = $row -> explain;
@@ -38,13 +39,13 @@ if (isset ($_GET['id']))
{ {
if (($_GET['evaluate'] ?? '') === 'good') if (($_GET['evaluate'] ?? '') === 'good')
{ {
Dao\Response :: like ((int) $_GET['id']);
\Dao\Response :: like ((int) $_GET['id']);
header ("Location: ./?thread=$thread&sort=$sort"); header ("Location: ./?thread=$thread&sort=$sort");
} }


if (($_GET['evaluate'] ?? '') === 'bad') if (($_GET['evaluate'] ?? '') === 'bad')
{ {
Dao\Response :: dislike ((int) $_GET['id']);
\Dao\Response :: dislike ((int) $_GET['id']);
header ("Location: ./?thread=$thread&sort=$sort"); header ("Location: ./?thread=$thread&sort=$sort");
} }
} }


Loading…
Cancel
Save