|
@@ -0,0 +1,66 @@
|
|
1
|
+<?php
|
|
2
|
+function starts_with($haystack, $needle)
|
|
3
|
+{
|
|
4
|
+ return ($needle === ""
|
|
5
|
+ || strrpos($haystack, $needle, -strlen($haystack)) !== false);
|
|
6
|
+}
|
|
7
|
+
|
|
8
|
+function ends_with($haystack, $needle)
|
|
9
|
+{
|
|
10
|
+ return ($needle === ""
|
|
11
|
+ || strpos($haystack, $needle, strlen($haystack) - strlen($needle))
|
|
12
|
+ !== false);
|
|
13
|
+}
|
|
14
|
+
|
|
15
|
+function error($code, $message)
|
|
16
|
+{
|
|
17
|
+ header("HTTP/ $code $message");
|
|
18
|
+ die(json_encode(array("code" => intval($code), "message" => $message)));
|
|
19
|
+}
|
|
20
|
+
|
|
21
|
+function status_confirm($id)
|
|
22
|
+{
|
|
23
|
+}
|
|
24
|
+
|
|
25
|
+function status_create()
|
|
26
|
+{
|
|
27
|
+}
|
|
28
|
+
|
|
29
|
+function status_feed()
|
|
30
|
+{
|
|
31
|
+}
|
|
32
|
+
|
|
33
|
+function user_create()
|
|
34
|
+{
|
|
35
|
+}
|
|
36
|
+
|
|
37
|
+function user_login()
|
|
38
|
+{
|
|
39
|
+}
|
|
40
|
+
|
|
41
|
+function main()
|
|
42
|
+{
|
|
43
|
+ $m_get = ($_SERVER['REQUEST_METHOD'] == "GET");
|
|
44
|
+ $m_post = ($_SERVER['REQUEST_METHOD'] == "POST");
|
|
45
|
+ $matches = array();
|
|
46
|
+
|
|
47
|
+ $path = rtrim($_GET['_url'], "/");
|
|
48
|
+ if ($path === "")
|
|
49
|
+ $path = "/";
|
|
50
|
+ echo hash_pbkdf2(
|
|
51
|
+ if (preg_match($path, "^/status/([0-9]+)/confirm$", $matches) && $m_post)
|
|
52
|
+ status_confirm($matches[1]);
|
|
53
|
+ else if ($path === "/status" && $m_post)
|
|
54
|
+ status_create();
|
|
55
|
+ else if ($path === "/status/feed" && $m_get)
|
|
56
|
+ status_feed();
|
|
57
|
+ else if ($path === "/user" && $m_post)
|
|
58
|
+ user_create();
|
|
59
|
+ else if ($path === "/user/login" && $m_post)
|
|
60
|
+ user_login();
|
|
61
|
+ else
|
|
62
|
+ error(501, "Not Implemented");
|
|
63
|
+}
|
|
64
|
+
|
|
65
|
+main();
|
|
66
|
+?>
|