Passed
Push — master ( 164b32...402455 )
by Cody
03:43 queued 19s
created
plugins/mailto/init.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,96 +1,96 @@
 block discarded – undo
1 1
 <?php
2 2
 class MailTo extends Plugin {
3
-	private $host;
3
+    private $host;
4 4
 
5
-	public function about() {
6
-		return array(1.0,
7
-			"Share article via email (using mailto: links, invoking your mail client)",
8
-			"fox");
9
-	}
5
+    public function about() {
6
+        return array(1.0,
7
+            "Share article via email (using mailto: links, invoking your mail client)",
8
+            "fox");
9
+    }
10 10
 
11
-	public function init($host) {
12
-		$this->host = $host;
11
+    public function init($host) {
12
+        $this->host = $host;
13 13
 
14
-		$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
15
-	}
14
+        $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
15
+    }
16 16
 
17
-	public function get_js() {
18
-		return file_get_contents(dirname(__FILE__)."/init.js");
19
-	}
17
+    public function get_js() {
18
+        return file_get_contents(dirname(__FILE__)."/init.js");
19
+    }
20 20
 
21
-	public function hook_article_button($line) {
22
-		return "<i class='material-icons' style=\"cursor : pointer\"
21
+    public function hook_article_button($line) {
22
+        return "<i class='material-icons' style=\"cursor : pointer\"
23 23
 					onclick=\"Plugins.Mailto.send(".$line["id"].")\"
24 24
 					title='".__('Forward by email')."'>mail_outline</i>";
25
-	}
25
+    }
26 26
 
27
-	public function emailArticle() {
27
+    public function emailArticle() {
28 28
 
29
-		$ids = explode(",", $_REQUEST['param']);
30
-		$ids_qmarks = arr_qmarks($ids);
29
+        $ids = explode(",", $_REQUEST['param']);
30
+        $ids_qmarks = arr_qmarks($ids);
31 31
 
32
-		require_once "lib/MiniTemplator.class.php";
32
+        require_once "lib/MiniTemplator.class.php";
33 33
 
34
-		$tpl = new MiniTemplator;
34
+        $tpl = new MiniTemplator;
35 35
 
36
-		$tpl->readTemplateFromFile("templates/email_article_template.txt");
36
+        $tpl->readTemplateFromFile("templates/email_article_template.txt");
37 37
 
38
-		$tpl->setVariable('USER_NAME', $_SESSION["name"], true);
39
-		//$tpl->setVariable('USER_EMAIL', $user_email, true);
40
-		$tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
38
+        $tpl->setVariable('USER_NAME', $_SESSION["name"], true);
39
+        //$tpl->setVariable('USER_EMAIL', $user_email, true);
40
+        $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
41 41
 
42 42
 
43
-		$sth = $this->pdo->prepare("SELECT DISTINCT link, content, title
43
+        $sth = $this->pdo->prepare("SELECT DISTINCT link, content, title
44 44
 			FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND
45 45
 			id IN ($ids_qmarks) AND owner_uid = ?");
46
-		$sth->execute(array_merge($ids, [$_SESSION['uid']]));
46
+        $sth->execute(array_merge($ids, [$_SESSION['uid']]));
47 47
 
48
-		if (count($ids) > 1) {
49
-			$subject = __("[Forwarded]")." ".__("Multiple articles");
50
-		} else {
51
-			$subject = "";
52
-		}
48
+        if (count($ids) > 1) {
49
+            $subject = __("[Forwarded]")." ".__("Multiple articles");
50
+        } else {
51
+            $subject = "";
52
+        }
53 53
 
54
-		while ($line = $sth->fetch()) {
54
+        while ($line = $sth->fetch()) {
55 55
 
56
-			if (!$subject) {
57
-							$subject = __("[Forwarded]")." ".htmlspecialchars($line["title"]);
58
-			}
56
+            if (!$subject) {
57
+                            $subject = __("[Forwarded]")." ".htmlspecialchars($line["title"]);
58
+            }
59 59
 
60
-			$tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"]));
61
-			$tpl->setVariable('ARTICLE_URL', strip_tags($line["link"]));
60
+            $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"]));
61
+            $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"]));
62 62
 
63
-			$tpl->addBlock('article');
64
-		}
63
+            $tpl->addBlock('article');
64
+        }
65 65
 
66
-		$tpl->addBlock('email');
66
+        $tpl->addBlock('email');
67 67
 
68
-		$content = "";
69
-		$tpl->generateOutputToString($content);
68
+        $content = "";
69
+        $tpl->generateOutputToString($content);
70 70
 
71
-		$mailto_link = htmlspecialchars("mailto:?subject=".rawurlencode($subject).
72
-			"&body=".rawurlencode($content));
71
+        $mailto_link = htmlspecialchars("mailto:?subject=".rawurlencode($subject).
72
+            "&body=".rawurlencode($content));
73 73
 
74
-		print __("Clicking the following link to invoke your mail client:");
74
+        print __("Clicking the following link to invoke your mail client:");
75 75
 
76
-		print "<div class='panel text-center'>";
77
-		print "<a target=\"_blank\" href=\"$mailto_link\">".
78
-			__("Forward selected article(s) by email.")."</a>";
79
-		print "</div>";
76
+        print "<div class='panel text-center'>";
77
+        print "<a target=\"_blank\" href=\"$mailto_link\">".
78
+            __("Forward selected article(s) by email.")."</a>";
79
+        print "</div>";
80 80
 
81
-		print __("You should be able to edit the message before sending in your mail client.");
81
+        print __("You should be able to edit the message before sending in your mail client.");
82 82
 
83
-		print "<p>";
83
+        print "<p>";
84 84
 
85
-		print "<footer class='text-center'>";
86
-		print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Close this dialog')."</button>";
87
-		print "</footer>";
85
+        print "<footer class='text-center'>";
86
+        print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Close this dialog')."</button>";
87
+        print "</footer>";
88 88
 
89
-		//return;
90
-	}
89
+        //return;
90
+    }
91 91
 
92
-	public function api_version() {
93
-		return 2;
94
-	}
92
+    public function api_version() {
93
+        return 2;
94
+    }
95 95
 
96 96
 }
Please login to merge, or discard this patch.
plugins/mail/init.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -55,141 +55,141 @@
 block discarded – undo
55 55
 			}
56 56
 			</script>";
57 57
 
58
-			print_hidden("op", "pluginhandler");
59
-			print_hidden("method", "save");
60
-			print_hidden("plugin", "mail");
58
+            print_hidden("op", "pluginhandler");
59
+            print_hidden("method", "save");
60
+            print_hidden("plugin", "mail");
61 61
 
62
-			$addresslist = $this->host->get($this, "addresslist");
62
+            $addresslist = $this->host->get($this, "addresslist");
63 63
 
64
-			print "<textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 50%' rows=\"3\"
64
+            print "<textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 50%' rows=\"3\"
65 65
 				name='addresslist'>$addresslist</textarea>";
66 66
 
67
-			print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
68
-				__("Save")."</button>";
67
+            print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
68
+                __("Save")."</button>";
69 69
 
70
-			print "</form>";
70
+            print "</form>";
71 71
 
72
-		print "</div>";
73
-	}
72
+        print "</div>";
73
+    }
74 74
 
75
-	public function hook_article_button($line) {
76
-		return "<i class='material-icons' style=\"cursor : pointer\"
75
+    public function hook_article_button($line) {
76
+        return "<i class='material-icons' style=\"cursor : pointer\"
77 77
 					onclick=\"Plugins.Mail.send(".$line["id"].")\"
78 78
 					title='".__('Forward by email')."'>mail</i>";
79
-	}
79
+    }
80 80
 
81
-	public function emailArticle() {
81
+    public function emailArticle() {
82 82
 
83
-		$ids = explode(",", $_REQUEST['param']);
84
-		$ids_qmarks = arr_qmarks($ids);
83
+        $ids = explode(",", $_REQUEST['param']);
84
+        $ids_qmarks = arr_qmarks($ids);
85 85
 
86
-		print_hidden("op", "pluginhandler");
87
-		print_hidden("plugin", "mail");
88
-		print_hidden("method", "sendEmail");
86
+        print_hidden("op", "pluginhandler");
87
+        print_hidden("plugin", "mail");
88
+        print_hidden("method", "sendEmail");
89 89
 
90
-		$sth = $this->pdo->prepare("SELECT email, full_name FROM ttrss_users WHERE
90
+        $sth = $this->pdo->prepare("SELECT email, full_name FROM ttrss_users WHERE
91 91
 			id = ?");
92
-		$sth->execute([$_SESSION['uid']]);
92
+        $sth->execute([$_SESSION['uid']]);
93 93
 
94
-		if ($row = $sth->fetch()) {
95
-			$user_email = htmlspecialchars($row['email']);
96
-			$user_name = htmlspecialchars($row['full_name']);
97
-		}
94
+        if ($row = $sth->fetch()) {
95
+            $user_email = htmlspecialchars($row['email']);
96
+            $user_name = htmlspecialchars($row['full_name']);
97
+        }
98 98
 
99
-		if (!$user_name) {
100
-		    $user_name = $_SESSION['name'];
101
-		}
99
+        if (!$user_name) {
100
+            $user_name = $_SESSION['name'];
101
+        }
102 102
 
103
-		print_hidden("from_email", "$user_email");
104
-		print_hidden("from_name", "$user_name");
103
+        print_hidden("from_email", "$user_email");
104
+        print_hidden("from_name", "$user_name");
105 105
 
106
-		require_once "lib/MiniTemplator.class.php";
106
+        require_once "lib/MiniTemplator.class.php";
107 107
 
108
-		$tpl = new MiniTemplator;
108
+        $tpl = new MiniTemplator;
109 109
 
110
-		$tpl->readTemplateFromFile("templates/email_article_template.txt");
110
+        $tpl->readTemplateFromFile("templates/email_article_template.txt");
111 111
 
112
-		$tpl->setVariable('USER_NAME', $_SESSION["name"], true);
113
-		$tpl->setVariable('USER_EMAIL', $user_email, true);
114
-		$tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
112
+        $tpl->setVariable('USER_NAME', $_SESSION["name"], true);
113
+        $tpl->setVariable('USER_EMAIL', $user_email, true);
114
+        $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
115 115
 
116
-		$sth = $this->pdo->prepare("SELECT DISTINCT link, content, title, note
116
+        $sth = $this->pdo->prepare("SELECT DISTINCT link, content, title, note
117 117
 			FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND
118 118
 			id IN ($ids_qmarks) AND owner_uid = ?");
119
-		$sth->execute(array_merge($ids, [$_SESSION['uid']]));
119
+        $sth->execute(array_merge($ids, [$_SESSION['uid']]));
120 120
 
121
-		if (count($ids) > 1) {
122
-			$subject = __("[Forwarded]")." ".__("Multiple articles");
123
-		}
121
+        if (count($ids) > 1) {
122
+            $subject = __("[Forwarded]")." ".__("Multiple articles");
123
+        }
124 124
 
125
-		while ($line = $sth->fetch()) {
125
+        while ($line = $sth->fetch()) {
126 126
 
127
-			if (!$subject) {
128
-							$subject = __("[Forwarded]")." ".htmlspecialchars($line["title"]);
129
-			}
127
+            if (!$subject) {
128
+                            $subject = __("[Forwarded]")." ".htmlspecialchars($line["title"]);
129
+            }
130 130
 
131
-			$tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"]));
132
-			$tnote = strip_tags($line["note"]);
133
-			if ($tnote != '') {
134
-				$tpl->setVariable('ARTICLE_NOTE', $tnote, true);
135
-				$tpl->addBlock('note');
136
-			}
137
-			$tpl->setVariable('ARTICLE_URL', strip_tags($line["link"]));
131
+            $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"]));
132
+            $tnote = strip_tags($line["note"]);
133
+            if ($tnote != '') {
134
+                $tpl->setVariable('ARTICLE_NOTE', $tnote, true);
135
+                $tpl->addBlock('note');
136
+            }
137
+            $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"]));
138 138
 
139
-			$tpl->addBlock('article');
140
-		}
139
+            $tpl->addBlock('article');
140
+        }
141 141
 
142
-		$tpl->addBlock('email');
142
+        $tpl->addBlock('email');
143 143
 
144
-		$content = "";
145
-		$tpl->generateOutputToString($content);
144
+        $content = "";
145
+        $tpl->generateOutputToString($content);
146 146
 
147
-		print "<table width='100%'><tr><td>";
147
+        print "<table width='100%'><tr><td>";
148 148
 
149
-		$addresslist = explode(",", $this->host->get($this, "addresslist"));
149
+        $addresslist = explode(",", $this->host->get($this, "addresslist"));
150 150
 
151
-		print __('To:');
151
+        print __('To:');
152 152
 
153
-		print "</td><td>";
153
+        print "</td><td>";
154 154
 
155 155
 /*		print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"
156 156
 				style=\"width : 30em;\"
157 157
 				name=\"destination\" id=\"emailArticleDlg_destination\">"; */
158 158
 
159
-		print_select("destination", "", $addresslist, 'style="width: 30em" dojoType="dijit.form.ComboBox"');
159
+        print_select("destination", "", $addresslist, 'style="width: 30em" dojoType="dijit.form.ComboBox"');
160 160
 
161 161
 /*		print "<div class=\"autocomplete\" id=\"emailArticleDlg_dst_choices\"
162 162
 	style=\"z-index: 30; display : none\"></div>"; */
163 163
 
164
-		print "</td></tr><tr><td>";
164
+        print "</td></tr><tr><td>";
165 165
 
166
-		print __('Subject:');
166
+        print __('Subject:');
167 167
 
168
-		print "</td><td>";
168
+        print "</td><td>";
169 169
 
170
-		print "<input dojoType='dijit.form.ValidationTextBox' required='true'
170
+        print "<input dojoType='dijit.form.ValidationTextBox' required='true'
171 171
 				style='width : 30em;' name='subject' value=\"$subject\" id='subject'>";
172 172
 
173
-		print "</td></tr>";
173
+        print "</td></tr>";
174 174
 
175
-		print "<tr><td colspan='2'><textarea dojoType='dijit.form.SimpleTextarea'
175
+        print "<tr><td colspan='2'><textarea dojoType='dijit.form.SimpleTextarea'
176 176
 			style='height : 200px; font-size : 12px; width : 98%' rows=\"20\"
177 177
 			name='content'>$content</textarea>";
178 178
 
179
-		print "</td></tr></table>";
179
+        print "</td></tr></table>";
180 180
 
181
-		print "<footer>";
182
-		print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('emailArticleDlg').execute()\">".__('Send e-mail')."</button> ";
183
-		print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Cancel')."</button>";
184
-		print "</footer>";
181
+        print "<footer>";
182
+        print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('emailArticleDlg').execute()\">".__('Send e-mail')."</button> ";
183
+        print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Cancel')."</button>";
184
+        print "</footer>";
185 185
 
186
-		//return;
187
-	}
186
+        //return;
187
+    }
188 188
 
189
-	public function sendEmail() {
190
-		$reply = array();
189
+    public function sendEmail() {
190
+        $reply = array();
191 191
 
192
-		/*$mail->AddReplyTo(strip_tags($_REQUEST['from_email']),
192
+        /*$mail->AddReplyTo(strip_tags($_REQUEST['from_email']),
193 193
 			strip_tags($_REQUEST['from_name']));
194 194
 		//$mail->AddAddress($_REQUEST['destination']);
195 195
 		$addresses = explode(';', $_REQUEST['destination']);
Please login to merge, or discard this patch.
classes/logger/sql.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,48 +1,48 @@
 block discarded – undo
1 1
 <?php
2 2
 class Logger_SQL {
3 3
 
4
-	private $pdo;
4
+    private $pdo;
5 5
 
6
-	public function log_error($errno, $errstr, $file, $line, $context) {
6
+    public function log_error($errno, $errstr, $file, $line, $context) {
7 7
 
8
-		// separate PDO connection object is used for logging
9
-		if (!$this->pdo) {
10
-		    $this->pdo = Db::instance()->pdo_connect();
11
-		}
8
+        // separate PDO connection object is used for logging
9
+        if (!$this->pdo) {
10
+            $this->pdo = Db::instance()->pdo_connect();
11
+        }
12 12
 
13
-		if ($this->pdo && get_schema_version() > 117) {
13
+        if ($this->pdo && get_schema_version() > 117) {
14 14
 
15
-			$owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : null;
15
+            $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : null;
16 16
 
17
-			// limit context length, DOMDocument dumps entire XML in here sometimes, which may be huge
18
-			$context = mb_substr($context, 0, 8192);
17
+            // limit context length, DOMDocument dumps entire XML in here sometimes, which may be huge
18
+            $context = mb_substr($context, 0, 8192);
19 19
 
20
-			$server_params = [
21
-				"IP" => "REMOTE_ADDR",
22
-				"Request URI" => "REQUEST_URI",
23
-				"User agent" => "HTTP_USER_AGENT",
24
-			];
20
+            $server_params = [
21
+                "IP" => "REMOTE_ADDR",
22
+                "Request URI" => "REQUEST_URI",
23
+                "User agent" => "HTTP_USER_AGENT",
24
+            ];
25 25
 
26
-			foreach ($server_params as $n => $p) {
27
-				if (isset($_SERVER[$p])) {
28
-									$context .= "\n$n: ".$_SERVER[$p];
29
-				}
30
-			}
26
+            foreach ($server_params as $n => $p) {
27
+                if (isset($_SERVER[$p])) {
28
+                                    $context .= "\n$n: ".$_SERVER[$p];
29
+                }
30
+            }
31 31
 
32
-			// passed error message may contain invalid unicode characters, failing to insert an error here
33
-			// would break the execution entirely by generating an actual fatal error instead of a E_WARNING etc
34
-			$errstr = UConverter::transcode($errstr, 'UTF-8', 'UTF-8');
35
-			$context = UConverter::transcode($context, 'UTF-8', 'UTF-8');
32
+            // passed error message may contain invalid unicode characters, failing to insert an error here
33
+            // would break the execution entirely by generating an actual fatal error instead of a E_WARNING etc
34
+            $errstr = UConverter::transcode($errstr, 'UTF-8', 'UTF-8');
35
+            $context = UConverter::transcode($context, 'UTF-8', 'UTF-8');
36 36
 
37
-			$sth = $this->pdo->prepare("INSERT INTO ttrss_error_log
37
+            $sth = $this->pdo->prepare("INSERT INTO ttrss_error_log
38 38
 				(errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
39 39
 				(?, ?, ?, ?, ?, ?, NOW())");
40
-			$sth->execute([$errno, $errstr, $file, $line, $context, $owner_uid]);
40
+            $sth->execute([$errno, $errstr, $file, $line, $context, $owner_uid]);
41 41
 
42
-			return $sth->rowCount();
43
-		}
42
+            return $sth->rowCount();
43
+        }
44 44
 
45
-		return false;
46
-	}
45
+        return false;
46
+    }
47 47
 
48 48
 }
Please login to merge, or discard this patch.
classes/handler/public.php 1 patch
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -765,101 +765,101 @@
 block discarded – undo
765 765
 					<a href="index.php"><?php echo __("Return to Tiny Tiny RSS") ?></a>
766 766
 				</form>
767 767
 				<?php
768
-			} else {
769
-
770
-				$rc = Feeds::subscribe_to_feed($feed_url);
771
-				$feed_urls = false;
772
-
773
-				switch ($rc['code']) {
774
-				case 0:
775
-					print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url));
776
-					break;
777
-				case 1:
778
-					print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url));
779
-					break;
780
-				case 2:
781
-					print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url));
782
-					break;
783
-				case 3:
784
-					print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url));
785
-					break;
786
-				case 4:
787
-					$feed_urls = $rc["feeds"];
788
-					break;
789
-				case 5:
790
-					print_error(T_sprintf("Could not subscribe to <b>%s</b>.<br>Can't download the Feed URL.", $feed_url));
791
-					break;
792
-				}
768
+            } else {
793 769
 
794
-				if ($feed_urls) {
770
+                $rc = Feeds::subscribe_to_feed($feed_url);
771
+                $feed_urls = false;
772
+
773
+                switch ($rc['code']) {
774
+                case 0:
775
+                    print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url));
776
+                    break;
777
+                case 1:
778
+                    print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url));
779
+                    break;
780
+                case 2:
781
+                    print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url));
782
+                    break;
783
+                case 3:
784
+                    print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url));
785
+                    break;
786
+                case 4:
787
+                    $feed_urls = $rc["feeds"];
788
+                    break;
789
+                case 5:
790
+                    print_error(T_sprintf("Could not subscribe to <b>%s</b>.<br>Can't download the Feed URL.", $feed_url));
791
+                    break;
792
+                }
795 793
 
796
-					print "<form action='public.php'>";
797
-					print "<input type='hidden' name='op' value='subscribe'>";
794
+                if ($feed_urls) {
798 795
 
799
-					print "<fieldset>";
800
-					print "<label style='display : inline'>".__("Multiple feed URLs found:")."</label>";
801
-					print "<select name='feed_url' dojoType='dijit.form.Select'>";
796
+                    print "<form action='public.php'>";
797
+                    print "<input type='hidden' name='op' value='subscribe'>";
802 798
 
803
-					foreach ($feed_urls as $url => $name) {
804
-						$url = htmlspecialchars($url);
805
-						$name = htmlspecialchars($name);
799
+                    print "<fieldset>";
800
+                    print "<label style='display : inline'>".__("Multiple feed URLs found:")."</label>";
801
+                    print "<select name='feed_url' dojoType='dijit.form.Select'>";
806 802
 
807
-						print "<option value=\"$url\">$name</option>";
808
-					}
803
+                    foreach ($feed_urls as $url => $name) {
804
+                        $url = htmlspecialchars($url);
805
+                        $name = htmlspecialchars($name);
809 806
 
810
-					print "</select>";
811
-					print "</fieldset>";
807
+                        print "<option value=\"$url\">$name</option>";
808
+                    }
812 809
 
813
-					print "<button class='alt-primary' dojoType='dijit.form.Button' type='submit'>".__("Subscribe to selected feed")."</button>";
814
-					print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>";
810
+                    print "</select>";
811
+                    print "</fieldset>";
815 812
 
816
-					print "</form>";
817
-				}
813
+                    print "<button class='alt-primary' dojoType='dijit.form.Button' type='submit'>".__("Subscribe to selected feed")."</button>";
814
+                    print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>";
818 815
 
819
-				$tp_uri = get_self_url_prefix()."/prefs.php";
816
+                    print "</form>";
817
+                }
818
+
819
+                $tp_uri = get_self_url_prefix()."/prefs.php";
820 820
 
821
-				if ($rc['code'] <= 2) {
822
-					$sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE
821
+                if ($rc['code'] <= 2) {
822
+                    $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE
823 823
 					feed_url = ? AND owner_uid = ?");
824
-					$sth->execute([$feed_url, $_SESSION['uid']]);
825
-					$row = $sth->fetch();
824
+                    $sth->execute([$feed_url, $_SESSION['uid']]);
825
+                    $row = $sth->fetch();
826 826
 
827
-					$feed_id = $row["id"];
828
-				} else {
829
-					$feed_id = 0;
830
-				}
827
+                    $feed_id = $row["id"];
828
+                } else {
829
+                    $feed_id = 0;
830
+                }
831 831
 
832
-				if ($feed_id) {
833
-					print "<form method='GET' action=\"$tp_uri\">
832
+                if ($feed_id) {
833
+                    print "<form method='GET' action=\"$tp_uri\">
834 834
 					<input type='hidden' name='tab' value='feedConfig'>
835 835
 					<input type='hidden' name='method' value='editfeed'>
836 836
 					<input type='hidden' name='methodparam' value='$feed_id'>
837 837
 					<button dojoType='dijit.form.Button' class='alt-info' type='submit'>".__("Edit subscription options")."</button>
838 838
 					<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>
839 839
 					</form>";
840
-				}
841
-			}
840
+                }
841
+            }
842 842
 
843
-			print "</div></div></body></html>";
843
+            print "</div></div></body></html>";
844 844
 
845
-		} else {
846
-			render_login_form();
847
-		}
848
-	}
845
+        } else {
846
+            render_login_form();
847
+        }
848
+    }
849 849
 
850
-	public function index() {
851
-		header("Content-Type: text/plain");
852
-		print error_json(13);
853
-	}
850
+    public function index() {
851
+        header("Content-Type: text/plain");
852
+        print error_json(13);
853
+    }
854 854
 
855
-	public function forgotpass() {
856
-		startup_gettext();
857
-		session_start();
855
+    public function forgotpass() {
856
+        startup_gettext();
857
+        session_start();
858 858
 
859
-		@$hash = clean($_REQUEST["hash"]);
859
+        @$hash = clean($_REQUEST["hash"]);
860 860
 
861
-		header('Content-Type: text/html; charset=utf-8');
862
-		?>
861
+        header('Content-Type: text/html; charset=utf-8');
862
+        ?>
863 863
 		<!DOCTYPE html>
864 864
 		<html>
865 865
 		<head>
Please login to merge, or discard this patch.
classes/feeditem/common.php 1 patch
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -1,210 +1,210 @@
 block discarded – undo
1 1
 <?php
2 2
 abstract class FeedItem_Common extends FeedItem {
3
-	protected $elem;
4
-	protected $xpath;
5
-	protected $doc;
6
-
7
-	public function __construct($elem, $doc, $xpath) {
8
-		$this->elem = $elem;
9
-		$this->xpath = $xpath;
10
-		$this->doc = $doc;
11
-
12
-		try {
3
+    protected $elem;
4
+    protected $xpath;
5
+    protected $doc;
6
+
7
+    public function __construct($elem, $doc, $xpath) {
8
+        $this->elem = $elem;
9
+        $this->xpath = $xpath;
10
+        $this->doc = $doc;
11
+
12
+        try {
13 13
 
14
-			$source = $elem->getElementsByTagName("source")->item(0);
14
+            $source = $elem->getElementsByTagName("source")->item(0);
15 15
 
16
-			// we don't need <source> element
17
-			if ($source) {
18
-							$elem->removeChild($source);
19
-			}
20
-		} catch (DOMException $e) {
21
-			//
22
-		}
23
-	}
16
+            // we don't need <source> element
17
+            if ($source) {
18
+                            $elem->removeChild($source);
19
+            }
20
+        } catch (DOMException $e) {
21
+            //
22
+        }
23
+    }
24 24
 
25
-	public function get_element() {
26
-		return $this->elem;
27
-	}
25
+    public function get_element() {
26
+        return $this->elem;
27
+    }
28 28
 
29
-	public function get_author() {
30
-		$author = $this->elem->getElementsByTagName("author")->item(0);
29
+    public function get_author() {
30
+        $author = $this->elem->getElementsByTagName("author")->item(0);
31 31
 
32
-		if ($author) {
33
-			$name = $author->getElementsByTagName("name")->item(0);
32
+        if ($author) {
33
+            $name = $author->getElementsByTagName("name")->item(0);
34 34
 
35
-			if ($name) {
36
-			    return clean($name->nodeValue);
37
-			}
38
-
39
-			$email = $author->getElementsByTagName("email")->item(0);
40
-
41
-			if ($email) {
42
-			    return clean($email->nodeValue);
43
-			}
44
-
45
-			if ($author->nodeValue) {
46
-							return clean($author->nodeValue);
47
-			}
48
-		}
49
-
50
-		$author_elems = $this->xpath->query("dc:creator", $this->elem);
51
-		$authors = [];
52
-
53
-		foreach ($author_elems as $author) {
54
-			array_push($authors, clean($author->nodeValue));
55
-		}
56
-
57
-		return implode(", ", $authors);
58
-	}
59
-
60
-	public function get_comments_url() {
61
-		//RSS only. Use a query here to avoid namespace clashes (e.g. with slash).
62
-		//might give a wrong result if a default namespace was declared (possible with XPath 2.0)
63
-		$com_url = $this->xpath->query("comments", $this->elem)->item(0);
35
+            if ($name) {
36
+                return clean($name->nodeValue);
37
+            }
38
+
39
+            $email = $author->getElementsByTagName("email")->item(0);
40
+
41
+            if ($email) {
42
+                return clean($email->nodeValue);
43
+            }
44
+
45
+            if ($author->nodeValue) {
46
+                            return clean($author->nodeValue);
47
+            }
48
+        }
49
+
50
+        $author_elems = $this->xpath->query("dc:creator", $this->elem);
51
+        $authors = [];
52
+
53
+        foreach ($author_elems as $author) {
54
+            array_push($authors, clean($author->nodeValue));
55
+        }
56
+
57
+        return implode(", ", $authors);
58
+    }
59
+
60
+    public function get_comments_url() {
61
+        //RSS only. Use a query here to avoid namespace clashes (e.g. with slash).
62
+        //might give a wrong result if a default namespace was declared (possible with XPath 2.0)
63
+        $com_url = $this->xpath->query("comments", $this->elem)->item(0);
64 64
 
65
-		if ($com_url) {
66
-					return clean($com_url->nodeValue);
67
-		}
65
+        if ($com_url) {
66
+                    return clean($com_url->nodeValue);
67
+        }
68 68
 
69
-		//Atom Threading Extension (RFC 4685) stuff. Could be used in RSS feeds, so it's in common.
70
-		//'text/html' for type is too restrictive?
71
-		$com_url = $this->xpath->query("atom:link[@rel='replies' and contains(@type,'text/html')]/@href", $this->elem)->item(0);
72
-
73
-		if ($com_url) {
74
-					return clean($com_url->nodeValue);
75
-		}
76
-	}
77
-
78
-	public function get_comments_count() {
79
-		//also query for ATE stuff here
80
-		$query = "slash:comments|thread:total|atom:link[@rel='replies']/@thread:count";
81
-		$comments = $this->xpath->query($query, $this->elem)->item(0);
82
-
83
-		if ($comments) {
84
-			return clean($comments->nodeValue);
85
-		}
86
-	}
69
+        //Atom Threading Extension (RFC 4685) stuff. Could be used in RSS feeds, so it's in common.
70
+        //'text/html' for type is too restrictive?
71
+        $com_url = $this->xpath->query("atom:link[@rel='replies' and contains(@type,'text/html')]/@href", $this->elem)->item(0);
72
+
73
+        if ($com_url) {
74
+                    return clean($com_url->nodeValue);
75
+        }
76
+    }
77
+
78
+    public function get_comments_count() {
79
+        //also query for ATE stuff here
80
+        $query = "slash:comments|thread:total|atom:link[@rel='replies']/@thread:count";
81
+        $comments = $this->xpath->query($query, $this->elem)->item(0);
82
+
83
+        if ($comments) {
84
+            return clean($comments->nodeValue);
85
+        }
86
+    }
87 87
 
88
-	// this is common for both Atom and RSS types and deals with various media: elements
89
-	public function get_enclosures() {
90
-		$encs = [];
91
-
92
-		$enclosures = $this->xpath->query("media:content", $this->elem);
88
+    // this is common for both Atom and RSS types and deals with various media: elements
89
+    public function get_enclosures() {
90
+        $encs = [];
91
+
92
+        $enclosures = $this->xpath->query("media:content", $this->elem);
93 93
 
94
-		foreach ($enclosures as $enclosure) {
95
-			$enc = new FeedEnclosure();
94
+        foreach ($enclosures as $enclosure) {
95
+            $enc = new FeedEnclosure();
96 96
 
97
-			$enc->type = clean($enclosure->getAttribute("type"));
98
-			$enc->link = clean($enclosure->getAttribute("url"));
99
-			$enc->length = clean($enclosure->getAttribute("length"));
100
-			$enc->height = clean($enclosure->getAttribute("height"));
101
-			$enc->width = clean($enclosure->getAttribute("width"));
97
+            $enc->type = clean($enclosure->getAttribute("type"));
98
+            $enc->link = clean($enclosure->getAttribute("url"));
99
+            $enc->length = clean($enclosure->getAttribute("length"));
100
+            $enc->height = clean($enclosure->getAttribute("height"));
101
+            $enc->width = clean($enclosure->getAttribute("width"));
102 102
 
103
-			$medium = clean($enclosure->getAttribute("medium"));
104
-			if (!$enc->type && $medium) {
105
-				$enc->type = strtolower("$medium/generic");
106
-			}
103
+            $medium = clean($enclosure->getAttribute("medium"));
104
+            if (!$enc->type && $medium) {
105
+                $enc->type = strtolower("$medium/generic");
106
+            }
107 107
 
108
-			$desc = $this->xpath->query("media:description", $enclosure)->item(0);
109
-			if ($desc) {
110
-			    $enc->title = clean($desc->nodeValue);
111
-			}
108
+            $desc = $this->xpath->query("media:description", $enclosure)->item(0);
109
+            if ($desc) {
110
+                $enc->title = clean($desc->nodeValue);
111
+            }
112 112
 
113
-			array_push($encs, $enc);
114
-		}
113
+            array_push($encs, $enc);
114
+        }
115 115
 
116
-		$enclosures = $this->xpath->query("media:group", $this->elem);
116
+        $enclosures = $this->xpath->query("media:group", $this->elem);
117 117
 
118
-		foreach ($enclosures as $enclosure) {
119
-			$enc = new FeedEnclosure();
118
+        foreach ($enclosures as $enclosure) {
119
+            $enc = new FeedEnclosure();
120 120
 
121
-			$content = $this->xpath->query("media:content", $enclosure)->item(0);
121
+            $content = $this->xpath->query("media:content", $enclosure)->item(0);
122 122
 
123
-			if ($content) {
124
-				$enc->type = clean($content->getAttribute("type"));
125
-				$enc->link = clean($content->getAttribute("url"));
126
-				$enc->length = clean($content->getAttribute("length"));
127
-				$enc->height = clean($content->getAttribute("height"));
128
-				$enc->width = clean($content->getAttribute("width"));
123
+            if ($content) {
124
+                $enc->type = clean($content->getAttribute("type"));
125
+                $enc->link = clean($content->getAttribute("url"));
126
+                $enc->length = clean($content->getAttribute("length"));
127
+                $enc->height = clean($content->getAttribute("height"));
128
+                $enc->width = clean($content->getAttribute("width"));
129 129
 
130
-				$medium = clean($content->getAttribute("medium"));
131
-				if (!$enc->type && $medium) {
132
-					$enc->type = strtolower("$medium/generic");
133
-				}
130
+                $medium = clean($content->getAttribute("medium"));
131
+                if (!$enc->type && $medium) {
132
+                    $enc->type = strtolower("$medium/generic");
133
+                }
134 134
 
135
-				$desc = $this->xpath->query("media:description", $content)->item(0);
136
-				if ($desc) {
137
-					$enc->title = clean($desc->nodeValue);
138
-				} else {
139
-					$desc = $this->xpath->query("media:description", $enclosure)->item(0);
140
-					if ($desc) {
141
-					    $enc->title = clean($desc->nodeValue);
142
-					}
143
-				}
135
+                $desc = $this->xpath->query("media:description", $content)->item(0);
136
+                if ($desc) {
137
+                    $enc->title = clean($desc->nodeValue);
138
+                } else {
139
+                    $desc = $this->xpath->query("media:description", $enclosure)->item(0);
140
+                    if ($desc) {
141
+                        $enc->title = clean($desc->nodeValue);
142
+                    }
143
+                }
144 144
 
145
-				array_push($encs, $enc);
146
-			}
147
-		}
145
+                array_push($encs, $enc);
146
+            }
147
+        }
148 148
 
149
-		$enclosures = $this->xpath->query("media:thumbnail", $this->elem);
149
+        $enclosures = $this->xpath->query("media:thumbnail", $this->elem);
150 150
 
151
-		foreach ($enclosures as $enclosure) {
152
-			$enc = new FeedEnclosure();
151
+        foreach ($enclosures as $enclosure) {
152
+            $enc = new FeedEnclosure();
153 153
 
154
-			$enc->type = "image/generic";
155
-			$enc->link = clean($enclosure->getAttribute("url"));
156
-			$enc->height = clean($enclosure->getAttribute("height"));
157
-			$enc->width = clean($enclosure->getAttribute("width"));
154
+            $enc->type = "image/generic";
155
+            $enc->link = clean($enclosure->getAttribute("url"));
156
+            $enc->height = clean($enclosure->getAttribute("height"));
157
+            $enc->width = clean($enclosure->getAttribute("width"));
158 158
 
159
-			array_push($encs, $enc);
160
-		}
159
+            array_push($encs, $enc);
160
+        }
161 161
 
162
-		return $encs;
163
-	}
162
+        return $encs;
163
+    }
164 164
 
165
-	public function count_children($node) {
166
-		return $node->getElementsByTagName("*")->length;
167
-	}
165
+    public function count_children($node) {
166
+        return $node->getElementsByTagName("*")->length;
167
+    }
168 168
 
169
-	public function subtree_or_text($node) {
170
-		if ($this->count_children($node) == 0) {
171
-			return $node->nodeValue;
172
-		} else {
173
-			return $node->c14n();
174
-		}
175
-	}
169
+    public function subtree_or_text($node) {
170
+        if ($this->count_children($node) == 0) {
171
+            return $node->nodeValue;
172
+        } else {
173
+            return $node->c14n();
174
+        }
175
+    }
176 176
 
177
-	public static function normalize_categories($cats) {
177
+    public static function normalize_categories($cats) {
178 178
 
179
-		$tmp = [];
179
+        $tmp = [];
180 180
 
181
-		foreach ($cats as $rawcat) {
182
-			$tmp = array_merge($tmp, explode(",", $rawcat));
183
-		}
181
+        foreach ($cats as $rawcat) {
182
+            $tmp = array_merge($tmp, explode(",", $rawcat));
183
+        }
184 184
 
185
-		$tmp = array_map(function($srccat) {
186
-			$cat = clean(trim(mb_strtolower($srccat)));
185
+        $tmp = array_map(function($srccat) {
186
+            $cat = clean(trim(mb_strtolower($srccat)));
187 187
 
188
-			// we don't support numeric tags
189
-			if (is_numeric($cat)) {
190
-							$cat = 't:'.$cat;
191
-			}
188
+            // we don't support numeric tags
189
+            if (is_numeric($cat)) {
190
+                            $cat = 't:'.$cat;
191
+            }
192 192
 
193
-			$cat = preg_replace('/[,\'\"]/', "", $cat);
193
+            $cat = preg_replace('/[,\'\"]/', "", $cat);
194 194
 
195
-			if (DB_TYPE == "mysql") {
196
-				$cat = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $cat);
197
-			}
195
+            if (DB_TYPE == "mysql") {
196
+                $cat = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $cat);
197
+            }
198 198
 
199
-			if (mb_strlen($cat) > 250) {
200
-							$cat = mb_substr($cat, 0, 250);
201
-			}
199
+            if (mb_strlen($cat) > 250) {
200
+                            $cat = mb_substr($cat, 0, 250);
201
+            }
202 202
 
203
-			return $cat;
204
-		}, $tmp);
203
+            return $cat;
204
+        }, $tmp);
205 205
 
206
-		asort($tmp);
206
+        asort($tmp);
207 207
 
208
-		return array_unique($tmp);
209
-	}
208
+        return array_unique($tmp);
209
+    }
210 210
 }
Please login to merge, or discard this patch.