Browse Source

begin status confirm count

master
Robin Thoni 9 years ago
parent
commit
887bdb3079
1 changed files with 8 additions and 3 deletions
  1. 8
    3
      status.php

+ 8
- 3
status.php View File

@@ -9,12 +9,12 @@ function check_token()
9 9
   $date->add(new DateInterval("P1D"));
10 10
   if ($token === false || $date < new DateTime())
11 11
     error(401, "Invalid token");
12
-  return $token['token'];
12
+  return $token["token"];
13 13
 }
14 14
 
15 15
 function status_confirm($id)
16 16
 {
17
-  check_token();
17
+  $token = check_token();
18 18
 }
19 19
 
20 20
 function status_create()
@@ -67,7 +67,12 @@ function status_feed()
67 67
   if ($limit < 1)
68 68
     $limit = 15;
69 69
   $page = max((check_int(get_get("page", false), 1) - 1), 0) * $limit;
70
-  $s = database_query("SELECT * FROM status ORDER BY `id` DESC ".
70
+  $s = database_query("SELECT *, ".
71
+    "(SELECT COUNT(*) FROM confirms WHERE ".
72
+    "`status` = `status`.id and `confirmation` = 1) as 'up', ".
73
+    "(SELECT COUNT(*) FROM confirms WHERE ".
74
+    "`status` = `status`.id and `confirmation` = 0) as 'down' ".
75
+    "FROM status ORDER BY `id` DESC ".
71 76
     "LIMIT $page, $limit");
72 77
   $data = array();
73 78
   global $media_url;

Loading…
Cancel
Save