@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php |
2 | 2 | interface IAuthModule { |
3 | - public function authenticate($login, $password); // + optional third parameter: $service |
|
3 | + public function authenticate($login, $password); // + optional third parameter: $service |
|
4 | 4 | } |
@@ -1,23 +1,23 @@ |
||
1 | 1 | <?php |
2 | 2 | class PluginHandler extends Handler_Protected { |
3 | - public function csrf_ignore($method) { |
|
4 | - return true; |
|
5 | - } |
|
3 | + public function csrf_ignore($method) { |
|
4 | + return true; |
|
5 | + } |
|
6 | 6 | |
7 | - public function catchall($method) { |
|
8 | - $plugin_name = clean($_REQUEST["plugin"]); |
|
9 | - $plugin = PluginHost::getInstance()->get_plugin($plugin_name); |
|
7 | + public function catchall($method) { |
|
8 | + $plugin_name = clean($_REQUEST["plugin"]); |
|
9 | + $plugin = PluginHost::getInstance()->get_plugin($plugin_name); |
|
10 | 10 | |
11 | - if ($plugin) { |
|
12 | - if (method_exists($plugin, $method)) { |
|
13 | - $plugin->$method(); |
|
14 | - } else { |
|
15 | - user_error("PluginHandler: Requested unknown method '$method' of plugin '$plugin_name'.", E_USER_WARNING); |
|
16 | - print error_json(13); |
|
17 | - } |
|
18 | - } else { |
|
19 | - user_error("PluginHandler: Requested method '$method' of unknown plugin '$plugin_name'.", E_USER_WARNING); |
|
20 | - print error_json(14); |
|
21 | - } |
|
22 | - } |
|
11 | + if ($plugin) { |
|
12 | + if (method_exists($plugin, $method)) { |
|
13 | + $plugin->$method(); |
|
14 | + } else { |
|
15 | + user_error("PluginHandler: Requested unknown method '$method' of plugin '$plugin_name'.", E_USER_WARNING); |
|
16 | + print error_json(13); |
|
17 | + } |
|
18 | + } else { |
|
19 | + user_error("PluginHandler: Requested method '$method' of unknown plugin '$plugin_name'.", E_USER_WARNING); |
|
20 | + print error_json(14); |
|
21 | + } |
|
22 | + } |
|
23 | 23 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | class Debug { |
3 | - public static $LOG_DISABLED = -1; |
|
3 | + public static $LOG_DISABLED = -1; |
|
4 | 4 | public static $LOG_NORMAL = 0; |
5 | 5 | public static $LOG_VERBOSE = 1; |
6 | 6 | public static $LOG_EXTENDED = 2; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | private static $logfile = false; |
11 | 11 | private static $loglevel = 0; |
12 | 12 | |
13 | - public static function set_logfile($logfile) { |
|
13 | + public static function set_logfile($logfile) { |
|
14 | 14 | Debug::$logfile = $logfile; |
15 | 15 | } |
16 | 16 |
@@ -1,147 +1,147 @@ |
||
1 | 1 | <?php |
2 | 2 | class FeedItem_RSS extends FeedItem_Common { |
3 | - public function get_id() { |
|
4 | - $id = $this->elem->getElementsByTagName("guid")->item(0); |
|
3 | + public function get_id() { |
|
4 | + $id = $this->elem->getElementsByTagName("guid")->item(0); |
|
5 | 5 | |
6 | - if ($id) { |
|
7 | - return clean($id->nodeValue); |
|
8 | - } else { |
|
9 | - return clean($this->get_link()); |
|
10 | - } |
|
11 | - } |
|
6 | + if ($id) { |
|
7 | + return clean($id->nodeValue); |
|
8 | + } else { |
|
9 | + return clean($this->get_link()); |
|
10 | + } |
|
11 | + } |
|
12 | 12 | |
13 | - public function get_date() { |
|
14 | - $pubDate = $this->elem->getElementsByTagName("pubDate")->item(0); |
|
13 | + public function get_date() { |
|
14 | + $pubDate = $this->elem->getElementsByTagName("pubDate")->item(0); |
|
15 | 15 | |
16 | - if ($pubDate) { |
|
17 | - return strtotime($pubDate->nodeValue); |
|
18 | - } |
|
16 | + if ($pubDate) { |
|
17 | + return strtotime($pubDate->nodeValue); |
|
18 | + } |
|
19 | 19 | |
20 | - $date = $this->xpath->query("dc:date", $this->elem)->item(0); |
|
20 | + $date = $this->xpath->query("dc:date", $this->elem)->item(0); |
|
21 | 21 | |
22 | - if ($date) { |
|
23 | - return strtotime($date->nodeValue); |
|
24 | - } |
|
25 | - } |
|
22 | + if ($date) { |
|
23 | + return strtotime($date->nodeValue); |
|
24 | + } |
|
25 | + } |
|
26 | 26 | |
27 | - public function get_link() { |
|
28 | - $links = $this->xpath->query("atom:link", $this->elem); |
|
27 | + public function get_link() { |
|
28 | + $links = $this->xpath->query("atom:link", $this->elem); |
|
29 | 29 | |
30 | - foreach ($links as $link) { |
|
31 | - if ($link && $link->hasAttribute("href") && |
|
32 | - (!$link->hasAttribute("rel") |
|
33 | - || $link->getAttribute("rel") == "alternate" |
|
34 | - || $link->getAttribute("rel") == "standout")) { |
|
30 | + foreach ($links as $link) { |
|
31 | + if ($link && $link->hasAttribute("href") && |
|
32 | + (!$link->hasAttribute("rel") |
|
33 | + || $link->getAttribute("rel") == "alternate" |
|
34 | + || $link->getAttribute("rel") == "standout")) { |
|
35 | 35 | |
36 | - return clean(trim($link->getAttribute("href"))); |
|
37 | - } |
|
38 | - } |
|
36 | + return clean(trim($link->getAttribute("href"))); |
|
37 | + } |
|
38 | + } |
|
39 | 39 | |
40 | - $link = $this->elem->getElementsByTagName("guid")->item(0); |
|
40 | + $link = $this->elem->getElementsByTagName("guid")->item(0); |
|
41 | 41 | |
42 | - if ($link && $link->hasAttributes() && $link->getAttribute("isPermaLink") == "true") { |
|
43 | - return clean(trim($link->nodeValue)); |
|
44 | - } |
|
42 | + if ($link && $link->hasAttributes() && $link->getAttribute("isPermaLink") == "true") { |
|
43 | + return clean(trim($link->nodeValue)); |
|
44 | + } |
|
45 | 45 | |
46 | - $link = $this->elem->getElementsByTagName("link")->item(0); |
|
46 | + $link = $this->elem->getElementsByTagName("link")->item(0); |
|
47 | 47 | |
48 | - if ($link) { |
|
49 | - return clean(trim($link->nodeValue)); |
|
50 | - } |
|
51 | - } |
|
48 | + if ($link) { |
|
49 | + return clean(trim($link->nodeValue)); |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - public function get_title() { |
|
54 | - $title = $this->xpath->query("title", $this->elem)->item(0); |
|
53 | + public function get_title() { |
|
54 | + $title = $this->xpath->query("title", $this->elem)->item(0); |
|
55 | 55 | |
56 | - if ($title) { |
|
57 | - return clean(trim($title->nodeValue)); |
|
58 | - } |
|
56 | + if ($title) { |
|
57 | + return clean(trim($title->nodeValue)); |
|
58 | + } |
|
59 | 59 | |
60 | - // if the document has a default namespace then querying for |
|
61 | - // title would fail because of reasons so let's try the old way |
|
62 | - $title = $this->elem->getElementsByTagName("title")->item(0); |
|
60 | + // if the document has a default namespace then querying for |
|
61 | + // title would fail because of reasons so let's try the old way |
|
62 | + $title = $this->elem->getElementsByTagName("title")->item(0); |
|
63 | 63 | |
64 | - if ($title) { |
|
65 | - return clean(trim($title->nodeValue)); |
|
66 | - } |
|
67 | - } |
|
64 | + if ($title) { |
|
65 | + return clean(trim($title->nodeValue)); |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - public function get_content() { |
|
70 | - $contentA = $this->xpath->query("content:encoded", $this->elem)->item(0); |
|
71 | - $contentB = $this->elem->getElementsByTagName("description")->item(0); |
|
69 | + public function get_content() { |
|
70 | + $contentA = $this->xpath->query("content:encoded", $this->elem)->item(0); |
|
71 | + $contentB = $this->elem->getElementsByTagName("description")->item(0); |
|
72 | 72 | |
73 | - if ($contentA && !$contentB) { |
|
74 | - return $this->subtree_or_text($contentA); |
|
75 | - } |
|
73 | + if ($contentA && !$contentB) { |
|
74 | + return $this->subtree_or_text($contentA); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - if ($contentB && !$contentA) { |
|
79 | - return $this->subtree_or_text($contentB); |
|
80 | - } |
|
78 | + if ($contentB && !$contentA) { |
|
79 | + return $this->subtree_or_text($contentB); |
|
80 | + } |
|
81 | 81 | |
82 | - if ($contentA && $contentB) { |
|
83 | - $resultA = $this->subtree_or_text($contentA); |
|
84 | - $resultB = $this->subtree_or_text($contentB); |
|
82 | + if ($contentA && $contentB) { |
|
83 | + $resultA = $this->subtree_or_text($contentA); |
|
84 | + $resultB = $this->subtree_or_text($contentB); |
|
85 | 85 | |
86 | - return mb_strlen($resultA) > mb_strlen($resultB) ? $resultA : $resultB; |
|
87 | - } |
|
88 | - } |
|
86 | + return mb_strlen($resultA) > mb_strlen($resultB) ? $resultA : $resultB; |
|
87 | + } |
|
88 | + } |
|
89 | 89 | |
90 | - public function get_description() { |
|
91 | - $summary = $this->elem->getElementsByTagName("description")->item(0); |
|
90 | + public function get_description() { |
|
91 | + $summary = $this->elem->getElementsByTagName("description")->item(0); |
|
92 | 92 | |
93 | - if ($summary) { |
|
94 | - return $summary->nodeValue; |
|
95 | - } |
|
96 | - } |
|
93 | + if ($summary) { |
|
94 | + return $summary->nodeValue; |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | - public function get_categories() { |
|
99 | - $categories = $this->elem->getElementsByTagName("category"); |
|
100 | - $cats = []; |
|
98 | + public function get_categories() { |
|
99 | + $categories = $this->elem->getElementsByTagName("category"); |
|
100 | + $cats = []; |
|
101 | 101 | |
102 | - foreach ($categories as $cat) { |
|
103 | - array_push($cats, $cat->nodeValue); |
|
104 | - } |
|
102 | + foreach ($categories as $cat) { |
|
103 | + array_push($cats, $cat->nodeValue); |
|
104 | + } |
|
105 | 105 | |
106 | - $categories = $this->xpath->query("dc:subject", $this->elem); |
|
106 | + $categories = $this->xpath->query("dc:subject", $this->elem); |
|
107 | 107 | |
108 | - foreach ($categories as $cat) { |
|
109 | - array_push($cats, $cat->nodeValue); |
|
110 | - } |
|
108 | + foreach ($categories as $cat) { |
|
109 | + array_push($cats, $cat->nodeValue); |
|
110 | + } |
|
111 | 111 | |
112 | - return $this->normalize_categories($cats); |
|
113 | - } |
|
112 | + return $this->normalize_categories($cats); |
|
113 | + } |
|
114 | 114 | |
115 | - public function get_enclosures() { |
|
116 | - $enclosures = $this->elem->getElementsByTagName("enclosure"); |
|
115 | + public function get_enclosures() { |
|
116 | + $enclosures = $this->elem->getElementsByTagName("enclosure"); |
|
117 | 117 | |
118 | - $encs = array(); |
|
118 | + $encs = array(); |
|
119 | 119 | |
120 | - foreach ($enclosures as $enclosure) { |
|
121 | - $enc = new FeedEnclosure(); |
|
120 | + foreach ($enclosures as $enclosure) { |
|
121 | + $enc = new FeedEnclosure(); |
|
122 | 122 | |
123 | - $enc->type = clean($enclosure->getAttribute("type")); |
|
124 | - $enc->link = clean($enclosure->getAttribute("url")); |
|
125 | - $enc->length = clean($enclosure->getAttribute("length")); |
|
126 | - $enc->height = clean($enclosure->getAttribute("height")); |
|
127 | - $enc->width = clean($enclosure->getAttribute("width")); |
|
123 | + $enc->type = clean($enclosure->getAttribute("type")); |
|
124 | + $enc->link = clean($enclosure->getAttribute("url")); |
|
125 | + $enc->length = clean($enclosure->getAttribute("length")); |
|
126 | + $enc->height = clean($enclosure->getAttribute("height")); |
|
127 | + $enc->width = clean($enclosure->getAttribute("width")); |
|
128 | 128 | |
129 | - array_push($encs, $enc); |
|
130 | - } |
|
129 | + array_push($encs, $enc); |
|
130 | + } |
|
131 | 131 | |
132 | - $encs = array_merge($encs, parent::get_enclosures()); |
|
132 | + $encs = array_merge($encs, parent::get_enclosures()); |
|
133 | 133 | |
134 | - return $encs; |
|
135 | - } |
|
134 | + return $encs; |
|
135 | + } |
|
136 | 136 | |
137 | - public function get_language() { |
|
138 | - $languages = $this->doc->getElementsByTagName('language'); |
|
137 | + public function get_language() { |
|
138 | + $languages = $this->doc->getElementsByTagName('language'); |
|
139 | 139 | |
140 | - if (count($languages) == 0) { |
|
141 | - return ""; |
|
142 | - } |
|
140 | + if (count($languages) == 0) { |
|
141 | + return ""; |
|
142 | + } |
|
143 | 143 | |
144 | - return clean($languages[0]->textContent); |
|
145 | - } |
|
144 | + return clean($languages[0]->textContent); |
|
145 | + } |
|
146 | 146 | |
147 | 147 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | interface IDb { |
3 | - public function connect($host, $user, $pass, $db, $port); |
|
4 | - public function escape_string($s, $strip_tags = true); |
|
5 | - public function query($query, $die_on_error = true); |
|
6 | - public function fetch_assoc($result); |
|
7 | - public function num_rows($result); |
|
8 | - public function fetch_result($result, $row, $param); |
|
9 | - public function close(); |
|
10 | - public function affected_rows($result); |
|
11 | - public function last_error(); |
|
12 | - public function last_query_error(); |
|
3 | + public function connect($host, $user, $pass, $db, $port); |
|
4 | + public function escape_string($s, $strip_tags = true); |
|
5 | + public function query($query, $die_on_error = true); |
|
6 | + public function fetch_assoc($result); |
|
7 | + public function num_rows($result); |
|
8 | + public function fetch_result($result, $row, $param); |
|
9 | + public function close(); |
|
10 | + public function affected_rows($result); |
|
11 | + public function last_error(); |
|
12 | + public function last_query_error(); |
|
13 | 13 | } |
@@ -1,23 +1,23 @@ |
||
1 | 1 | <?php |
2 | 2 | class Handler implements IHandler { |
3 | - protected $pdo; |
|
4 | - protected $args; |
|
3 | + protected $pdo; |
|
4 | + protected $args; |
|
5 | 5 | |
6 | - public function __construct($args) { |
|
7 | - $this->pdo = Db::pdo(); |
|
8 | - $this->args = $args; |
|
9 | - } |
|
6 | + public function __construct($args) { |
|
7 | + $this->pdo = Db::pdo(); |
|
8 | + $this->args = $args; |
|
9 | + } |
|
10 | 10 | |
11 | - public function csrf_ignore($method) { |
|
12 | - return true; |
|
13 | - } |
|
11 | + public function csrf_ignore($method) { |
|
12 | + return true; |
|
13 | + } |
|
14 | 14 | |
15 | - public function before($method) { |
|
16 | - return true; |
|
17 | - } |
|
15 | + public function before($method) { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - public function after() { |
|
20 | - return true; |
|
21 | - } |
|
19 | + public function after() { |
|
20 | + return true; |
|
21 | + } |
|
22 | 22 | |
23 | 23 | } |
@@ -7,15 +7,15 @@ |
||
7 | 7 | <link rel="shortcut icon" type="image/png" href="images/favicon.png"> |
8 | 8 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
9 | 9 | <?php |
10 | - foreach (array("lib/prototype.js", |
|
11 | - "lib/dojo/dojo.js", |
|
12 | - "lib/dojo/tt-rss-layer.js", |
|
13 | - "js/common.js", |
|
14 | - "errors.php?mode=js") as $jsfile) { |
|
10 | + foreach (array("lib/prototype.js", |
|
11 | + "lib/dojo/dojo.js", |
|
12 | + "lib/dojo/tt-rss-layer.js", |
|
13 | + "js/common.js", |
|
14 | + "errors.php?mode=js") as $jsfile) { |
|
15 | 15 | |
16 | - echo javascript_tag($jsfile); |
|
16 | + echo javascript_tag($jsfile); |
|
17 | 17 | |
18 | - } ?> |
|
18 | + } ?> |
|
19 | 19 | |
20 | 20 | <script type="text/javascript"> |
21 | 21 | require({cache:{}}); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | __("Session failed to validate (schema version changed)"); |
43 | 43 | return false; |
44 | 44 | } |
45 | - $pdo = Db::pdo(); |
|
45 | + $pdo = Db::pdo(); |
|
46 | 46 | |
47 | 47 | if ($_SESSION["uid"]) { |
48 | 48 | |
@@ -56,21 +56,21 @@ discard block |
||
56 | 56 | |
57 | 57 | // user not found |
58 | 58 | if ($row = $sth->fetch()) { |
59 | - $pwd_hash = $row["pwd_hash"]; |
|
59 | + $pwd_hash = $row["pwd_hash"]; |
|
60 | 60 | |
61 | - if ($pwd_hash != $_SESSION["pwd_hash"]) { |
|
61 | + if ($pwd_hash != $_SESSION["pwd_hash"]) { |
|
62 | 62 | |
63 | - $_SESSION["login_error_msg"] = |
|
63 | + $_SESSION["login_error_msg"] = |
|
64 | 64 | __("Session failed to validate (password changed)"); |
65 | 65 | |
66 | - return false; |
|
67 | - } |
|
66 | + return false; |
|
67 | + } |
|
68 | 68 | } else { |
69 | 69 | |
70 | - $_SESSION["login_error_msg"] = |
|
71 | - __("Session failed to validate (user not found)"); |
|
70 | + $_SESSION["login_error_msg"] = |
|
71 | + __("Session failed to validate (user not found)"); |
|
72 | 72 | |
73 | - return false; |
|
73 | + return false; |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | } |
@@ -1,30 +1,30 @@ |
||
1 | 1 | <?php |
2 | 2 | class Swap_JK extends Plugin { |
3 | 3 | |
4 | - private $host; |
|
4 | + private $host; |
|
5 | 5 | |
6 | - public function about() { |
|
7 | - return array(1.0, |
|
8 | - "Swap j and k hotkeys (for vi brethren)", |
|
9 | - "fox"); |
|
10 | - } |
|
6 | + public function about() { |
|
7 | + return array(1.0, |
|
8 | + "Swap j and k hotkeys (for vi brethren)", |
|
9 | + "fox"); |
|
10 | + } |
|
11 | 11 | |
12 | - public function init($host) { |
|
13 | - $this->host = $host; |
|
12 | + public function init($host) { |
|
13 | + $this->host = $host; |
|
14 | 14 | |
15 | - $host->add_hook($host::HOOK_HOTKEY_MAP, $this); |
|
16 | - } |
|
15 | + $host->add_hook($host::HOOK_HOTKEY_MAP, $this); |
|
16 | + } |
|
17 | 17 | |
18 | - public function hook_hotkey_map($hotkeys) { |
|
18 | + public function hook_hotkey_map($hotkeys) { |
|
19 | 19 | |
20 | - $hotkeys["j"] = "next_feed"; |
|
21 | - $hotkeys["k"] = "prev_feed"; |
|
20 | + $hotkeys["j"] = "next_feed"; |
|
21 | + $hotkeys["k"] = "prev_feed"; |
|
22 | 22 | |
23 | - return $hotkeys; |
|
24 | - } |
|
23 | + return $hotkeys; |
|
24 | + } |
|
25 | 25 | |
26 | - public function api_version() { |
|
27 | - return 2; |
|
28 | - } |
|
26 | + public function api_version() { |
|
27 | + return 2; |
|
28 | + } |
|
29 | 29 | |
30 | 30 | } |