@@ -1003,22 +1003,22 @@ discard block |
||
1003 | 1003 | $req .= pack("N", $filter["type"]); |
1004 | 1004 | switch ($filter["type"]) |
1005 | 1005 | { |
1006 | - case SPH_FILTER_VALUES: |
|
1007 | - $req .= pack("N", count($filter["values"])); |
|
1008 | - foreach ($filter["values"] as $value) |
|
1009 | - $req .= sphPackI64($value); |
|
1010 | - break; |
|
1011 | - |
|
1012 | - case SPH_FILTER_RANGE: |
|
1013 | - $req .= sphPackI64($filter["min"]).sphPackI64($filter["max"]); |
|
1014 | - break; |
|
1015 | - |
|
1016 | - case SPH_FILTER_FLOATRANGE: |
|
1017 | - $req .= $this->_PackFloat($filter["min"]).$this->_PackFloat($filter["max"]); |
|
1018 | - break; |
|
1019 | - |
|
1020 | - default: |
|
1021 | - assert(0 && "internal error: unhandled filter type"); |
|
1006 | + case SPH_FILTER_VALUES: |
|
1007 | + $req .= pack("N", count($filter["values"])); |
|
1008 | + foreach ($filter["values"] as $value) |
|
1009 | + $req .= sphPackI64($value); |
|
1010 | + break; |
|
1011 | + |
|
1012 | + case SPH_FILTER_RANGE: |
|
1013 | + $req .= sphPackI64($filter["min"]).sphPackI64($filter["max"]); |
|
1014 | + break; |
|
1015 | + |
|
1016 | + case SPH_FILTER_FLOATRANGE: |
|
1017 | + $req .= $this->_PackFloat($filter["min"]).$this->_PackFloat($filter["max"]); |
|
1018 | + break; |
|
1019 | + |
|
1020 | + default: |
|
1021 | + assert(0 && "internal error: unhandled filter type"); |
|
1022 | 1022 | } |
1023 | 1023 | $req .= pack("N", $filter["exclude"]); |
1024 | 1024 | } |
@@ -1073,9 +1073,9 @@ discard block |
||
1073 | 1073 | $req .= sphPackU64($id); |
1074 | 1074 | switch ($entry["type"]) |
1075 | 1075 | { |
1076 | - case SPH_ATTR_FLOAT: $req .= $this->_PackFloat($val); break; |
|
1077 | - case SPH_ATTR_BIGINT: $req .= sphPackI64($val); break; |
|
1078 | - default: $req .= pack("N", $val); break; |
|
1076 | + case SPH_ATTR_FLOAT: $req .= $this->_PackFloat($val); break; |
|
1077 | + case SPH_ATTR_BIGINT: $req .= sphPackI64($val); break; |
|
1078 | + default: $req .= pack("N", $val); break; |
|
1079 | 1079 | } |
1080 | 1080 | } |
1081 | 1081 | } |
@@ -1,96 +1,96 @@ |
||
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 | } |
@@ -55,141 +55,141 @@ |
||
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']); |
@@ -1071,70 +1071,70 @@ |
||
1071 | 1071 | $qpart = ""; |
1072 | 1072 | |
1073 | 1073 | switch ($k) { |
1074 | - case "title": |
|
1075 | - $qpart = "title = ".$this->pdo->quote($feed_title); |
|
1076 | - break; |
|
1077 | - |
|
1078 | - case "feed_url": |
|
1079 | - $qpart = "feed_url = ".$this->pdo->quote($feed_url); |
|
1080 | - break; |
|
1081 | - |
|
1082 | - case "update_interval": |
|
1083 | - $qpart = "update_interval = ".$this->pdo->quote($upd_intl); |
|
1084 | - break; |
|
1085 | - |
|
1086 | - case "purge_interval": |
|
1087 | - $qpart = "purge_interval =".$this->pdo->quote($purge_intl); |
|
1088 | - break; |
|
1089 | - |
|
1090 | - case "auth_login": |
|
1091 | - $qpart = "auth_login = ".$this->pdo->quote($auth_login); |
|
1092 | - break; |
|
1093 | - |
|
1094 | - case "auth_pass": |
|
1095 | - $qpart = "auth_pass =".$this->pdo->quote($auth_pass).", auth_pass_encrypted = false"; |
|
1096 | - break; |
|
1097 | - |
|
1098 | - case "private": |
|
1099 | - $qpart = "private = ".$this->pdo->quote($private); |
|
1100 | - break; |
|
1101 | - |
|
1102 | - case "include_in_digest": |
|
1103 | - $qpart = "include_in_digest = ".$this->pdo->quote($include_in_digest); |
|
1104 | - break; |
|
1105 | - |
|
1106 | - case "always_display_enclosures": |
|
1107 | - $qpart = "always_display_enclosures = ".$this->pdo->quote($always_display_enclosures); |
|
1108 | - break; |
|
1109 | - |
|
1110 | - case "mark_unread_on_update": |
|
1111 | - $qpart = "mark_unread_on_update = ".$this->pdo->quote($mark_unread_on_update); |
|
1112 | - break; |
|
1113 | - |
|
1114 | - case "cache_images": |
|
1115 | - $qpart = "cache_images = ".$this->pdo->quote($cache_images); |
|
1116 | - break; |
|
1117 | - |
|
1118 | - case "hide_images": |
|
1119 | - $qpart = "hide_images = ".$this->pdo->quote($hide_images); |
|
1120 | - break; |
|
1121 | - |
|
1122 | - case "cat_id": |
|
1123 | - if (get_pref('ENABLE_FEED_CATS')) { |
|
1124 | - if ($cat_id) { |
|
1125 | - $qpart = "cat_id = ".$this->pdo->quote($cat_id); |
|
1126 | - } else { |
|
1127 | - $qpart = 'cat_id = NULL'; |
|
1128 | - } |
|
1074 | + case "title": |
|
1075 | + $qpart = "title = ".$this->pdo->quote($feed_title); |
|
1076 | + break; |
|
1077 | + |
|
1078 | + case "feed_url": |
|
1079 | + $qpart = "feed_url = ".$this->pdo->quote($feed_url); |
|
1080 | + break; |
|
1081 | + |
|
1082 | + case "update_interval": |
|
1083 | + $qpart = "update_interval = ".$this->pdo->quote($upd_intl); |
|
1084 | + break; |
|
1085 | + |
|
1086 | + case "purge_interval": |
|
1087 | + $qpart = "purge_interval =".$this->pdo->quote($purge_intl); |
|
1088 | + break; |
|
1089 | + |
|
1090 | + case "auth_login": |
|
1091 | + $qpart = "auth_login = ".$this->pdo->quote($auth_login); |
|
1092 | + break; |
|
1093 | + |
|
1094 | + case "auth_pass": |
|
1095 | + $qpart = "auth_pass =".$this->pdo->quote($auth_pass).", auth_pass_encrypted = false"; |
|
1096 | + break; |
|
1097 | + |
|
1098 | + case "private": |
|
1099 | + $qpart = "private = ".$this->pdo->quote($private); |
|
1100 | + break; |
|
1101 | + |
|
1102 | + case "include_in_digest": |
|
1103 | + $qpart = "include_in_digest = ".$this->pdo->quote($include_in_digest); |
|
1104 | + break; |
|
1105 | + |
|
1106 | + case "always_display_enclosures": |
|
1107 | + $qpart = "always_display_enclosures = ".$this->pdo->quote($always_display_enclosures); |
|
1108 | + break; |
|
1109 | + |
|
1110 | + case "mark_unread_on_update": |
|
1111 | + $qpart = "mark_unread_on_update = ".$this->pdo->quote($mark_unread_on_update); |
|
1112 | + break; |
|
1113 | + |
|
1114 | + case "cache_images": |
|
1115 | + $qpart = "cache_images = ".$this->pdo->quote($cache_images); |
|
1116 | + break; |
|
1117 | + |
|
1118 | + case "hide_images": |
|
1119 | + $qpart = "hide_images = ".$this->pdo->quote($hide_images); |
|
1120 | + break; |
|
1121 | + |
|
1122 | + case "cat_id": |
|
1123 | + if (get_pref('ENABLE_FEED_CATS')) { |
|
1124 | + if ($cat_id) { |
|
1125 | + $qpart = "cat_id = ".$this->pdo->quote($cat_id); |
|
1129 | 1126 | } else { |
1130 | - $qpart = ""; |
|
1127 | + $qpart = 'cat_id = NULL'; |
|
1131 | 1128 | } |
1129 | + } else { |
|
1130 | + $qpart = ""; |
|
1131 | + } |
|
1132 | 1132 | |
1133 | - break; |
|
1133 | + break; |
|
1134 | 1134 | |
1135 | - case "feed_language": |
|
1136 | - $qpart = "feed_language = ".$this->pdo->quote($feed_language); |
|
1137 | - break; |
|
1135 | + case "feed_language": |
|
1136 | + $qpart = "feed_language = ".$this->pdo->quote($feed_language); |
|
1137 | + break; |
|
1138 | 1138 | |
1139 | 1139 | } |
1140 | 1140 |
@@ -172,26 +172,26 @@ |
||
172 | 172 | $value = $_POST[$pref_name]; |
173 | 173 | |
174 | 174 | switch ($pref_name) { |
175 | - case 'DIGEST_PREFERRED_TIME': |
|
176 | - if (get_pref('DIGEST_PREFERRED_TIME') != $value) { |
|
175 | + case 'DIGEST_PREFERRED_TIME': |
|
176 | + if (get_pref('DIGEST_PREFERRED_TIME') != $value) { |
|
177 | 177 | |
178 | - $sth = $this->pdo->prepare("UPDATE ttrss_users SET |
|
178 | + $sth = $this->pdo->prepare("UPDATE ttrss_users SET |
|
179 | 179 | last_digest_sent = NULL WHERE id = ?"); |
180 | - $sth->execute([$_SESSION['uid']]); |
|
180 | + $sth->execute([$_SESSION['uid']]); |
|
181 | 181 | |
182 | - } |
|
183 | - break; |
|
184 | - case 'USER_LANGUAGE': |
|
185 | - if (!$need_reload) { |
|
186 | - $need_reload = $_SESSION["language"] != $value; |
|
187 | - } |
|
188 | - break; |
|
182 | + } |
|
183 | + break; |
|
184 | + case 'USER_LANGUAGE': |
|
185 | + if (!$need_reload) { |
|
186 | + $need_reload = $_SESSION["language"] != $value; |
|
187 | + } |
|
188 | + break; |
|
189 | 189 | |
190 | - case 'USER_CSS_THEME': |
|
191 | - if (!$need_reload) { |
|
192 | - $need_reload = get_pref($pref_name) != $value; |
|
193 | - } |
|
194 | - break; |
|
190 | + case 'USER_CSS_THEME': |
|
191 | + if (!$need_reload) { |
|
192 | + $need_reload = get_pref($pref_name) != $value; |
|
193 | + } |
|
194 | + break; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | set_pref($pref_name, $value); |
@@ -1,48 +1,48 @@ |
||
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 | } |
@@ -412,21 +412,21 @@ discard block |
||
412 | 412 | $message = $query_error_override; |
413 | 413 | } else { |
414 | 414 | switch ($view_mode) { |
415 | - case "unread": |
|
416 | - $message = __("No unread articles found to display."); |
|
417 | - break; |
|
418 | - case "updated": |
|
419 | - $message = __("No updated articles found to display."); |
|
420 | - break; |
|
421 | - case "marked": |
|
422 | - $message = __("No starred articles found to display."); |
|
423 | - break; |
|
424 | - default: |
|
425 | - if ($feed < LABEL_BASE_INDEX) { |
|
426 | - $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter."); |
|
427 | - } else { |
|
428 | - $message = __("No articles found to display."); |
|
429 | - } |
|
415 | + case "unread": |
|
416 | + $message = __("No unread articles found to display."); |
|
417 | + break; |
|
418 | + case "updated": |
|
419 | + $message = __("No updated articles found to display."); |
|
420 | + break; |
|
421 | + case "marked": |
|
422 | + $message = __("No starred articles found to display."); |
|
423 | + break; |
|
424 | + default: |
|
425 | + if ($feed < LABEL_BASE_INDEX) { |
|
426 | + $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter."); |
|
427 | + } else { |
|
428 | + $message = __("No articles found to display."); |
|
429 | + } |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | |
@@ -893,29 +893,29 @@ discard block |
||
893 | 893 | // TODO: all this interval stuff needs some generic generator function |
894 | 894 | |
895 | 895 | switch ($mode) { |
896 | - case "1day": |
|
897 | - if (DB_TYPE == "pgsql") { |
|
898 | - $date_qpart = "date_entered < NOW() - INTERVAL '1 day' "; |
|
899 | - } else { |
|
900 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) "; |
|
901 | - } |
|
902 | - break; |
|
903 | - case "1week": |
|
904 | - if (DB_TYPE == "pgsql") { |
|
905 | - $date_qpart = "date_entered < NOW() - INTERVAL '1 week' "; |
|
906 | - } else { |
|
907 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 WEEK) "; |
|
908 | - } |
|
909 | - break; |
|
910 | - case "2week": |
|
911 | - if (DB_TYPE == "pgsql") { |
|
912 | - $date_qpart = "date_entered < NOW() - INTERVAL '2 week' "; |
|
913 | - } else { |
|
914 | - $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 2 WEEK) "; |
|
915 | - } |
|
916 | - break; |
|
917 | - default: |
|
918 | - $date_qpart = "true"; |
|
896 | + case "1day": |
|
897 | + if (DB_TYPE == "pgsql") { |
|
898 | + $date_qpart = "date_entered < NOW() - INTERVAL '1 day' "; |
|
899 | + } else { |
|
900 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 DAY) "; |
|
901 | + } |
|
902 | + break; |
|
903 | + case "1week": |
|
904 | + if (DB_TYPE == "pgsql") { |
|
905 | + $date_qpart = "date_entered < NOW() - INTERVAL '1 week' "; |
|
906 | + } else { |
|
907 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 WEEK) "; |
|
908 | + } |
|
909 | + break; |
|
910 | + case "2week": |
|
911 | + if (DB_TYPE == "pgsql") { |
|
912 | + $date_qpart = "date_entered < NOW() - INTERVAL '2 week' "; |
|
913 | + } else { |
|
914 | + $date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 2 WEEK) "; |
|
915 | + } |
|
916 | + break; |
|
917 | + default: |
|
918 | + $date_qpart = "true"; |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | if (is_numeric($feed)) { |
@@ -1237,28 +1237,28 @@ discard block |
||
1237 | 1237 | |
1238 | 1238 | public static function getFeedIcon($id) { |
1239 | 1239 | switch ($id) { |
1240 | - case 0: |
|
1241 | - return "archive"; |
|
1242 | - case -1: |
|
1243 | - return "star"; |
|
1244 | - case -2: |
|
1245 | - return "rss_feed"; |
|
1246 | - case -3: |
|
1247 | - return "whatshot"; |
|
1248 | - case -4: |
|
1249 | - return "inbox"; |
|
1250 | - case -6: |
|
1251 | - return "restore"; |
|
1252 | - default: |
|
1253 | - if ($id < LABEL_BASE_INDEX) { |
|
1254 | - return "label"; |
|
1255 | - } else { |
|
1256 | - $icon = self::getIconFile($id); |
|
1240 | + case 0: |
|
1241 | + return "archive"; |
|
1242 | + case -1: |
|
1243 | + return "star"; |
|
1244 | + case -2: |
|
1245 | + return "rss_feed"; |
|
1246 | + case -3: |
|
1247 | + return "whatshot"; |
|
1248 | + case -4: |
|
1249 | + return "inbox"; |
|
1250 | + case -6: |
|
1251 | + return "restore"; |
|
1252 | + default: |
|
1253 | + if ($id < LABEL_BASE_INDEX) { |
|
1254 | + return "label"; |
|
1255 | + } else { |
|
1256 | + $icon = self::getIconFile($id); |
|
1257 | 1257 | |
1258 | - if ($icon && file_exists($icon)) { |
|
1259 | - return ICONS_URL."/".basename($icon)."?".filemtime($icon); |
|
1260 | - } |
|
1258 | + if ($icon && file_exists($icon)) { |
|
1259 | + return ICONS_URL."/".basename($icon)."?".filemtime($icon); |
|
1261 | 1260 | } |
1261 | + } |
|
1262 | 1262 | } |
1263 | 1263 | |
1264 | 1264 | return false; |
@@ -2263,104 +2263,104 @@ discard block |
||
2263 | 2263 | $commandpair = explode(":", mb_strtolower($k), 2); |
2264 | 2264 | |
2265 | 2265 | switch ($commandpair[0]) { |
2266 | - case "title": |
|
2267 | - if ($commandpair[1]) { |
|
2268 | - array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
|
2269 | - $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2270 | - } else { |
|
2271 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2266 | + case "title": |
|
2267 | + if ($commandpair[1]) { |
|
2268 | + array_push($query_keywords, "($not (LOWER(ttrss_entries.title) LIKE ". |
|
2269 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2270 | + } else { |
|
2271 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2272 | 2272 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2273 | - array_push($search_words, $k); |
|
2274 | - } |
|
2275 | - break; |
|
2276 | - case "author": |
|
2277 | - if ($commandpair[1]) { |
|
2278 | - array_push($query_keywords, "($not (LOWER(author) LIKE ". |
|
2279 | - $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2280 | - } else { |
|
2281 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2273 | + array_push($search_words, $k); |
|
2274 | + } |
|
2275 | + break; |
|
2276 | + case "author": |
|
2277 | + if ($commandpair[1]) { |
|
2278 | + array_push($query_keywords, "($not (LOWER(author) LIKE ". |
|
2279 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2280 | + } else { |
|
2281 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2282 | 2282 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2283 | - array_push($search_words, $k); |
|
2284 | - } |
|
2285 | - break; |
|
2286 | - case "note": |
|
2287 | - if ($commandpair[1]) { |
|
2288 | - if ($commandpair[1] == "true") |
|
2289 | - array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2290 | - else if ($commandpair[1] == "false") |
|
2291 | - array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2292 | - else |
|
2293 | - array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2294 | - $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2295 | - } else { |
|
2296 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2283 | + array_push($search_words, $k); |
|
2284 | + } |
|
2285 | + break; |
|
2286 | + case "note": |
|
2287 | + if ($commandpair[1]) { |
|
2288 | + if ($commandpair[1] == "true") |
|
2289 | + array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))"); |
|
2290 | + else if ($commandpair[1] == "false") |
|
2291 | + array_push($query_keywords, "($not (note IS NULL OR note = ''))"); |
|
2292 | + else |
|
2293 | + array_push($query_keywords, "($not (LOWER(note) LIKE ". |
|
2294 | + $pdo->quote('%'.mb_strtolower($commandpair[1]).'%')."))"); |
|
2295 | + } else { |
|
2296 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2297 | 2297 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2298 | - if (!$not) array_push($search_words, $k); |
|
2299 | - } |
|
2300 | - break; |
|
2301 | - case "star": |
|
2302 | - |
|
2303 | - if ($commandpair[1]) { |
|
2304 | - if ($commandpair[1] == "true") |
|
2305 | - array_push($query_keywords, "($not (marked = true))"); |
|
2306 | - else |
|
2307 | - array_push($query_keywords, "($not (marked = false))"); |
|
2308 | - } else { |
|
2309 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2298 | + if (!$not) array_push($search_words, $k); |
|
2299 | + } |
|
2300 | + break; |
|
2301 | + case "star": |
|
2302 | + |
|
2303 | + if ($commandpair[1]) { |
|
2304 | + if ($commandpair[1] == "true") |
|
2305 | + array_push($query_keywords, "($not (marked = true))"); |
|
2306 | + else |
|
2307 | + array_push($query_keywords, "($not (marked = false))"); |
|
2308 | + } else { |
|
2309 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2310 | 2310 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2311 | - if (!$not) array_push($search_words, $k); |
|
2312 | - } |
|
2313 | - break; |
|
2314 | - case "pub": |
|
2315 | - if ($commandpair[1]) { |
|
2316 | - if ($commandpair[1] == "true") |
|
2317 | - array_push($query_keywords, "($not (published = true))"); |
|
2318 | - else |
|
2319 | - array_push($query_keywords, "($not (published = false))"); |
|
2311 | + if (!$not) array_push($search_words, $k); |
|
2312 | + } |
|
2313 | + break; |
|
2314 | + case "pub": |
|
2315 | + if ($commandpair[1]) { |
|
2316 | + if ($commandpair[1] == "true") |
|
2317 | + array_push($query_keywords, "($not (published = true))"); |
|
2318 | + else |
|
2319 | + array_push($query_keywords, "($not (published = false))"); |
|
2320 | 2320 | |
2321 | - } else { |
|
2322 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2321 | + } else { |
|
2322 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%') |
|
2323 | 2323 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2324 | - if (!$not) array_push($search_words, $k); |
|
2325 | - } |
|
2326 | - break; |
|
2327 | - case "unread": |
|
2328 | - if ($commandpair[1]) { |
|
2329 | - if ($commandpair[1] == "true") |
|
2330 | - array_push($query_keywords, "($not (unread = true))"); |
|
2331 | - else |
|
2332 | - array_push($query_keywords, "($not (unread = false))"); |
|
2324 | + if (!$not) array_push($search_words, $k); |
|
2325 | + } |
|
2326 | + break; |
|
2327 | + case "unread": |
|
2328 | + if ($commandpair[1]) { |
|
2329 | + if ($commandpair[1] == "true") |
|
2330 | + array_push($query_keywords, "($not (unread = true))"); |
|
2331 | + else |
|
2332 | + array_push($query_keywords, "($not (unread = false))"); |
|
2333 | 2333 | |
2334 | - } else { |
|
2335 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2334 | + } else { |
|
2335 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2336 | 2336 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2337 | - if (!$not) array_push($search_words, $k); |
|
2338 | - } |
|
2339 | - break; |
|
2340 | - default: |
|
2341 | - if (strpos($k, "@") === 0) { |
|
2337 | + if (!$not) array_push($search_words, $k); |
|
2338 | + } |
|
2339 | + break; |
|
2340 | + default: |
|
2341 | + if (strpos($k, "@") === 0) { |
|
2342 | 2342 | |
2343 | - $user_tz_string = get_pref('USER_TIMEZONE', $_SESSION['uid']); |
|
2344 | - $orig_ts = strtotime(substr($k, 1)); |
|
2345 | - $k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC')); |
|
2343 | + $user_tz_string = get_pref('USER_TIMEZONE', $_SESSION['uid']); |
|
2344 | + $orig_ts = strtotime(substr($k, 1)); |
|
2345 | + $k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC')); |
|
2346 | 2346 | |
2347 | - //$k = date("Y-m-d", strtotime(substr($k, 1))); |
|
2347 | + //$k = date("Y-m-d", strtotime(substr($k, 1))); |
|
2348 | 2348 | |
2349 | - array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')"); |
|
2350 | - } else { |
|
2349 | + array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')"); |
|
2350 | + } else { |
|
2351 | 2351 | |
2352 | - if (DB_TYPE == "pgsql") { |
|
2353 | - $k = mb_strtolower($k); |
|
2354 | - array_push($search_query_leftover, $not ? "!$k" : $k); |
|
2355 | - } else { |
|
2356 | - array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2352 | + if (DB_TYPE == "pgsql") { |
|
2353 | + $k = mb_strtolower($k); |
|
2354 | + array_push($search_query_leftover, $not ? "!$k" : $k); |
|
2355 | + } else { |
|
2356 | + array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER(".$pdo->quote("%$k%").") |
|
2357 | 2357 | OR UPPER(ttrss_entries.content) $not LIKE UPPER(".$pdo->quote("%$k%")."))"); |
2358 | - } |
|
2358 | + } |
|
2359 | 2359 | |
2360 | - if (!$not) { |
|
2361 | - array_push($search_words, $k); |
|
2362 | - } |
|
2360 | + if (!$not) { |
|
2361 | + array_push($search_words, $k); |
|
2363 | 2362 | } |
2363 | + } |
|
2364 | 2364 | } |
2365 | 2365 | } |
2366 | 2366 |
@@ -24,14 +24,14 @@ |
||
24 | 24 | $er = error_reporting(E_ALL); |
25 | 25 | |
26 | 26 | switch (DB_TYPE) { |
27 | - case "mysql": |
|
28 | - $this->adapter = new Db_Mysqli(); |
|
29 | - break; |
|
30 | - case "pgsql": |
|
31 | - $this->adapter = new Db_Pgsql(); |
|
32 | - break; |
|
33 | - default: |
|
34 | - die("Unknown DB_TYPE: ".DB_TYPE); |
|
27 | + case "mysql": |
|
28 | + $this->adapter = new Db_Mysqli(); |
|
29 | + break; |
|
30 | + case "pgsql": |
|
31 | + $this->adapter = new Db_Pgsql(); |
|
32 | + break; |
|
33 | + default: |
|
34 | + die("Unknown DB_TYPE: ".DB_TYPE); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | if (!$this->adapter) { |
@@ -1364,35 +1364,35 @@ |
||
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | switch ($rule["type"]) { |
1367 | - case "title": |
|
1368 | - $match = @preg_match("/$reg_exp/iu", $title); |
|
1369 | - break; |
|
1370 | - case "content": |
|
1371 | - // we don't need to deal with multiline regexps |
|
1372 | - $content = preg_replace("/[\r\n\t]/", "", $content); |
|
1367 | + case "title": |
|
1368 | + $match = @preg_match("/$reg_exp/iu", $title); |
|
1369 | + break; |
|
1370 | + case "content": |
|
1371 | + // we don't need to deal with multiline regexps |
|
1372 | + $content = preg_replace("/[\r\n\t]/", "", $content); |
|
1373 | 1373 | |
1374 | - $match = @preg_match("/$reg_exp/iu", $content); |
|
1375 | - break; |
|
1376 | - case "both": |
|
1377 | - // we don't need to deal with multiline regexps |
|
1378 | - $content = preg_replace("/[\r\n\t]/", "", $content); |
|
1374 | + $match = @preg_match("/$reg_exp/iu", $content); |
|
1375 | + break; |
|
1376 | + case "both": |
|
1377 | + // we don't need to deal with multiline regexps |
|
1378 | + $content = preg_replace("/[\r\n\t]/", "", $content); |
|
1379 | 1379 | |
1380 | - $match = (@preg_match("/$reg_exp/iu", $title) || @preg_match("/$reg_exp/iu", $content)); |
|
1381 | - break; |
|
1382 | - case "link": |
|
1383 | - $match = @preg_match("/$reg_exp/iu", $link); |
|
1384 | - break; |
|
1385 | - case "author": |
|
1386 | - $match = @preg_match("/$reg_exp/iu", $author); |
|
1387 | - break; |
|
1388 | - case "tag": |
|
1389 | - foreach ($tags as $tag) { |
|
1390 | - if (@preg_match("/$reg_exp/iu", $tag)) { |
|
1391 | - $match = true; |
|
1392 | - break; |
|
1393 | - } |
|
1380 | + $match = (@preg_match("/$reg_exp/iu", $title) || @preg_match("/$reg_exp/iu", $content)); |
|
1381 | + break; |
|
1382 | + case "link": |
|
1383 | + $match = @preg_match("/$reg_exp/iu", $link); |
|
1384 | + break; |
|
1385 | + case "author": |
|
1386 | + $match = @preg_match("/$reg_exp/iu", $author); |
|
1387 | + break; |
|
1388 | + case "tag": |
|
1389 | + foreach ($tags as $tag) { |
|
1390 | + if (@preg_match("/$reg_exp/iu", $tag)) { |
|
1391 | + $match = true; |
|
1392 | + break; |
|
1394 | 1393 | } |
1395 | - break; |
|
1394 | + } |
|
1395 | + break; |
|
1396 | 1396 | } |
1397 | 1397 | |
1398 | 1398 | if ($rule_inverse) { |