]> git.wh0rd.org - tt-rss.git/blob - classes/pref_filters.php
c66e9e810db9562026c573caf258f15c4e9da632
[tt-rss.git] / classes / pref_filters.php
1 <?php
2 class Pref_Filters extends Protected_Handler {
3
4 function csrf_ignore($method) {
5 $csrf_ignored = array("index", "getfiltertree", "edit");
6
7 return array_search($method, $csrf_ignored) !== false;
8 }
9
10 function filter_test($filter_type, $reg_exp,
11 $action_id, $action_param, $filter_param, $inverse, $feed_id, $cat_id,
12 $cat_filter) {
13
14 $result = db_query($this->link, "SELECT name FROM ttrss_filter_types WHERE
15 id = " . $filter_type);
16 $type_name = db_fetch_result($result, 0, "name");
17
18 $result = db_query($this->link, "SELECT name FROM ttrss_filter_actions WHERE
19 id = " . $action_id);
20 $action_name = db_fetch_result($result, 0, "name");
21
22 $filter["reg_exp"] = $reg_exp;
23 $filter["action"] = $action_name;
24 $filter["type"] = $type_name;
25 $filter["action_param"] = $action_param;
26 $filter["filter_param"] = $filter_param;
27 $filter["inverse"] = $inverse;
28
29 $filters[$type_name] = array($filter);
30
31 if ($feed_id)
32 $feed = $feed_id;
33 else
34 $feed = -4;
35
36 $feed_title = getFeedTitle($this->link, $feed);
37
38 $qfh_ret = queryFeedHeadlines($this->link, $cat_filter ? $cat_id : $feed,
39 30, "", $cat_filter, false, false,
40 false, "date_entered DESC", 0, $_SESSION["uid"], $filter);
41
42 $result = $qfh_ret[0];
43
44 $articles = array();
45 $found = 0;
46
47 print __("Articles matching this filter:");
48
49 print "<div class=\"inactiveFeedHolder\">";
50 print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
51
52 while ($line = db_fetch_assoc($result)) {
53
54 $entry_timestamp = strtotime($line["updated"]);
55 $entry_tags = get_article_tags($this->link, $line["id"], $_SESSION["uid"]);
56
57 $content_preview = truncate_string(
58 strip_tags($line["content_preview"]), 100, '...');
59
60 if ($line["feed_title"])
61 $feed_title = $line["feed_title"];
62
63 print "<tr>";
64
65 print "<td width='5%' align='center'><input
66 dojoType=\"dijit.form.CheckBox\" checked=\"1\"
67 disabled=\"1\" type=\"checkbox\"></td>";
68 print "<td>";
69
70 print $line["title"];
71 print "&nbsp;(";
72 print "<b>" . $feed_title . "</b>";
73 print "):&nbsp;";
74 print "<span class=\"insensitive\">" . $content_preview . "</span>";
75 print " " . mb_substr($line["date_entered"], 0, 16);
76
77 print "</td></tr>";
78
79 $found++;
80 }
81
82 if ($found == 0) {
83 print "<tr><td align='center'>" .
84 __("No articles matching this filter has been found.") . "</td></tr>";
85 }
86
87 print "</table>";
88 print "</div>";
89
90 }
91
92 function getfiltertree() {
93 $root = array();
94 $root['id'] = 'root';
95 $root['name'] = __('Filters');
96 $root['items'] = array();
97
98 $result = db_query($this->link, "SELECT
99 ttrss_filters.id AS id,reg_exp,
100 ttrss_filter_types.name AS filter_type_name,
101 ttrss_filter_types.description AS filter_type_descr,
102 enabled,
103 inverse,
104 cat_filter,
105 feed_id,
106 ttrss_filters.cat_id,
107 action_id,
108 filter_param,
109 filter_type,
110 ttrss_filter_actions.description AS action_description,
111 ttrss_feeds.title AS feed_title,
112 ttrss_feed_categories.title AS cat_title,
113 ttrss_filter_actions.name AS action_name,
114 ttrss_filters.action_param AS action_param
115 FROM
116 ttrss_filter_types,ttrss_filter_actions,ttrss_filters LEFT JOIN
117 ttrss_feeds ON (ttrss_filters.feed_id = ttrss_feeds.id) LEFT JOIN
118 ttrss_feed_categories ON (ttrss_filters.cat_id = ttrss_feed_categories.id)
119 WHERE
120 filter_type = ttrss_filter_types.id AND
121 ttrss_filter_actions.id = action_id AND
122 ttrss_filters.owner_uid = ".$_SESSION["uid"]."
123 ORDER by action_description, reg_exp");
124
125 $cat = false;
126 $cur_action_description = "";
127
128 if (db_num_rows($result) > 0) {
129
130 while ($line = db_fetch_assoc($result)) {
131 if ($cur_action_description != $line['action_description']) {
132
133 if ($cat)
134 array_push($root['items'], $cat);
135
136 $cat = array();
137 $cat['id'] = 'ACTION:' . $line['action_id'];
138 $cat['name'] = $line['action_description'];
139 $cat['items'] = array();
140
141 $cur_action_description = $line['action_description'];
142 }
143
144 if (array_search($line["action_name"],
145 array("score", "tag", "label")) === false) {
146
147 $line["action_param"] = '';
148 } else {
149 if ($line['action_name'] == 'label') {
150
151 $tmp_result = db_query($this->link, "SELECT fg_color, bg_color
152 FROM ttrss_labels2 WHERE caption = '".
153 db_escape_string($line["action_param"])."' AND
154 owner_uid = " . $_SESSION["uid"]);
155
156 if (db_num_rows($tmp_result) != 0) {
157 $fg_color = db_fetch_result($tmp_result, 0, "fg_color");
158 $bg_color = db_fetch_result($tmp_result, 0, "bg_color");
159
160 $tmp = "<span class=\"labelColorIndicator\" style='color : $fg_color; background-color : $bg_color'>&alpha;</span> " . $line['action_param'];
161
162 $line['action_param'] = $tmp;
163 }
164 }
165 }
166
167 $filter = array();
168 $filter['id'] = 'FILTER:' . $line['id'];
169 $filter['bare_id'] = $line['id'];
170 $filter['name'] = $line['reg_exp'];
171 $filter['type'] = $line['filter_type'];
172 $filter['enabled'] = sql_bool_to_bool($line['enabled']);
173 $filter['param'] = $line['action_param'];
174 $filter['inverse'] = sql_bool_to_bool($line['inverse']);
175 $filter['checkbox'] = false;
176
177 if (sql_bool_to_bool($line['cat_filter']))
178 if ($line['cat_id'] != 0) {
179 $filter['feed'] = $line['cat_title'];
180 } else {
181 $filter['feed'] = __('Uncategorized');
182 }
183 else if ($line['feed_id'])
184 $filter['feed'] = $line['feed_title'];
185
186 array_push($cat['items'], $filter);
187 }
188
189 array_push($root['items'], $cat);
190 }
191
192 $fl = array();
193 $fl['identifier'] = 'id';
194 $fl['label'] = 'name';
195 $fl['items'] = array($root);
196
197 print json_encode($fl);
198 return;
199 }
200
201 function edit() {
202
203 $filter_id = db_escape_string($_REQUEST["id"]);
204
205 $result = db_query($this->link,
206 "SELECT * FROM ttrss_filters WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]);
207
208 $reg_exp = htmlspecialchars(db_fetch_result($result, 0, "reg_exp"));
209 $filter_type = db_fetch_result($result, 0, "filter_type");
210 $feed_id = db_fetch_result($result, 0, "feed_id");
211 $cat_id = db_fetch_result($result, 0, "cat_id");
212 $action_id = db_fetch_result($result, 0, "action_id");
213 $action_param = db_fetch_result($result, 0, "action_param");
214 $filter_param = db_fetch_result($result, 0, "filter_param");
215
216 $enabled = sql_bool_to_bool(db_fetch_result($result, 0, "enabled"));
217 $inverse = sql_bool_to_bool(db_fetch_result($result, 0, "inverse"));
218 $cat_filter = sql_bool_to_bool(db_fetch_result($result, 0, "cat_filter"));
219
220 print "<form id=\"filter_edit_form\" onsubmit='return false'>";
221
222 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">";
223 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$filter_id\">";
224 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"editSave\">";
225 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"csrf_token\" value=\"".$_SESSION['csrf_token']."\">";
226
227 $result = db_query($this->link, "SELECT id,description
228 FROM ttrss_filter_types ORDER BY description");
229
230 $filter_types = array();
231
232 while ($line = db_fetch_assoc($result)) {
233 //array_push($filter_types, $line["description"]);
234 $filter_types[$line["id"]] = __($line["description"]);
235 }
236
237 print "<div class=\"dlgSec\">".__("Match")."</div>";
238
239 print "<div class=\"dlgSecCont\">";
240
241 if ($filter_type != 5) {
242 $date_ops_invisible = 'style="display : none"';
243 }
244
245 print "<span id=\"filterDlg_dateModBox\" $date_ops_invisible>";
246 print __("Date") . " ";
247
248 $filter_params = array(
249 "before" => __("before"),
250 "after" => __("after"));
251
252 print_select_hash("filter_date_modifier", $filter_param,
253 $filter_params, 'dojoType="dijit.form.Select"');
254
255 print "&nbsp;</span>";
256
257 print "<input dojoType=\"dijit.form.ValidationTextBox\"
258 required=\"1\"
259 name=\"reg_exp\" style=\"font-size : 16px;\" value=\"$reg_exp\">";
260
261 print "<span id=\"filterDlg_dateChkBox\" $date_ops_invisible>";
262 print "&nbsp;<button dojoType=\"dijit.form.Button\" onclick=\"return filterDlgCheckDate()\">".
263 __('Check it')."</button>";
264 print "</span>";
265
266 print "<hr/> " . __("on field") . " ";
267 print_select_hash("filter_type", $filter_type, $filter_types,
268 'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"');
269
270 print "<hr/>";
271
272 print __("in") . " ";
273
274 $hidden = $cat_filter ? "style='display:none'" : "";
275
276 print "<span id='filterDlg_feeds' $hidden>";
277 print_feed_select($this->link, "feed_id", $feed_id,
278 'dojoType="dijit.form.FilteringSelect"');
279 print "</span>";
280
281 $hidden = $cat_filter ? "" : "style='display:none'";
282
283 print "<span id='filterDlg_cats' $hidden>";
284 print_feed_cat_select($this->link, "cat_id", $cat_id,
285 'dojoType="dijit.form.FilteringSelect"');
286 print "</span>";
287
288
289 print "</div>";
290
291 print "<div class=\"dlgSec\">".__("Perform Action")."</div>";
292
293 print "<div class=\"dlgSecCont\">";
294
295 print "<select name=\"action_id\" dojoType=\"dijit.form.Select\"
296 onchange=\"filterDlgCheckAction(this)\">";
297
298 $result = db_query($this->link, "SELECT id,description FROM ttrss_filter_actions
299 ORDER BY name");
300
301 while ($line = db_fetch_assoc($result)) {
302 $is_sel = ($line["id"] == $action_id) ? "selected=\"1\"" : "";
303 printf("<option value='%d' $is_sel>%s</option>", $line["id"], __($line["description"]));
304 }
305
306 print "</select>";
307
308 $param_hidden = ($action_id == 4 || $action_id == 6 || $action_id == 7) ? "" : "display : none";
309
310 print "<span id=\"filterDlg_paramBox\" style=\"$param_hidden\">";
311 print " " . __("with parameters:") . " ";
312
313 $param_int_hidden = ($action_id != 7) ? "" : "display : none";
314
315 print "<input style=\"$param_int_hidden\"
316 dojoType=\"dijit.form.TextBox\" id=\"filterDlg_actionParam\"
317 name=\"action_param\" value=\"$action_param\">";
318
319 $param_int_hidden = ($action_id == 7) ? "" : "display : none";
320
321 print_label_select($this->link, "action_param_label", $action_param,
322 "style=\"$param_int_hidden\"" .
323 'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"');
324
325 print "</span>";
326
327 print "&nbsp;"; // tiny layout hack
328
329 print "</div>";
330
331 print "<div class=\"dlgSec\">".__("Options")."</div>";
332 print "<div class=\"dlgSecCont\">";
333
334 print "<div style=\"line-height : 100%\">";
335
336 if ($enabled) {
337 $checked = "checked=\"1\"";
338 } else {
339 $checked = "";
340 }
341
342 print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"enabled\" id=\"enabled\" $checked>
343 <label for=\"enabled\">".__('Enabled')."</label><hr/>";
344
345 if ($inverse) {
346 $checked = "checked=\"1\"";
347 } else {
348 $checked = "";
349 }
350
351 print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\" $checked>
352 <label for=\"inverse\">".__('Inverse match')."</label><hr/>";
353
354 if ($cat_filter) {
355 $checked = "checked=\"1\"";
356 } else {
357 $checked = "";
358 }
359
360 print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"cat_filter\" id=\"cat_filter\" onchange=\"filterDlgCheckCat(this)\" $checked>
361 <label for=\"cat_filter\">".__('Apply to category')."</label><hr/>";
362
363 print "</div>";
364 print "</div>";
365
366 print "<div class=\"dlgButtons\">";
367
368 print "<div style=\"float : left\">";
369 print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').removeFilter()\">".
370 __('Remove')."</button>";
371 print "</div>";
372
373 print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').test()\">".
374 __('Test')."</button> ";
375
376 print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">".
377 __('Save')."</button> ";
378
379 print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">".
380 __('Cancel')."</button>";
381
382 print "</div>";
383 }
384
385 function editSave() {
386
387 global $memcache;
388
389 if ($memcache) $memcache->flush();
390
391 $savemode = db_escape_string($_REQUEST["savemode"]);
392 $reg_exp = db_escape_string(trim($_REQUEST["reg_exp"]));
393 $filter_type = db_escape_string(trim($_REQUEST["filter_type"]));
394 $filter_id = db_escape_string($_REQUEST["id"]);
395 $feed_id = db_escape_string($_REQUEST["feed_id"]);
396 $action_id = db_escape_string($_REQUEST["action_id"]);
397 $action_param = db_escape_string($_REQUEST["action_param"]);
398 $action_param_label = db_escape_string($_REQUEST["action_param_label"]);
399 $enabled = checkbox_to_sql_bool(db_escape_string($_REQUEST["enabled"]));
400 $inverse = checkbox_to_sql_bool(db_escape_string($_REQUEST["inverse"]));
401 $cat_filter = checkbox_to_sql_bool(db_escape_string($_REQUEST["cat_filter"]));
402 $cat_id = db_escape_string($_REQUEST['cat_id']);
403
404 # for the time being, no other filters use params anyway...
405 $filter_param = db_escape_string($_REQUEST["filter_date_modifier"]);
406
407 if (!$feed_id) {
408 $feed_id = 'NULL';
409 } else {
410 $feed_id = sprintf("'%s'", db_escape_string($feed_id));
411 }
412
413 if (!$cat_id) {
414 $cat_id = 'NULL';
415 } else {
416 $cat_id = sprintf("'%d'", db_escape_string($cat_id));
417 }
418
419 /* When processing 'assign label' filters, action_param_label dropbox
420 * overrides action_param */
421
422 if ($action_id == 7) {
423 $action_param = $action_param_label;
424 }
425
426 if ($action_id == 6) {
427 $action_param = (int) str_replace("+", "", $action_param);
428 }
429
430 if ($savemode != "test") {
431 $result = db_query($this->link, "UPDATE ttrss_filters SET
432 reg_exp = '$reg_exp',
433 feed_id = $feed_id,
434 cat_id = $cat_id,
435 action_id = '$action_id',
436 filter_type = '$filter_type',
437 enabled = $enabled,
438 inverse = $inverse,
439 cat_filter = $cat_filter,
440 action_param = '$action_param',
441 filter_param = '$filter_param'
442 WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]);
443 } else {
444
445 $this->filter_test($filter_type, $reg_exp,
446 $action_id, $action_param, $filter_param, sql_bool_to_bool($inverse),
447 (int) $_REQUEST["feed_id"], (int) $_REQUEST['cat_id'],
448 sql_bool_to_bool($cat_filter));
449
450 print "<div align='center'>";
451 print "<button dojoType=\"dijit.form.Button\"
452 onclick=\"return dijit.byId('filterTestDlg').hide()\">".
453 __('Close this window')."</button>";
454 print "</div>";
455
456 }
457 }
458
459 function remove() {
460
461 if ($memcache) $memcache->flush();
462
463 $ids = split(",", db_escape_string($_REQUEST["ids"]));
464
465 foreach ($ids as $id) {
466 db_query($this->link, "DELETE FROM ttrss_filters WHERE id = '$id' AND owner_uid = ". $_SESSION["uid"]);
467 }
468 }
469
470 function add() {
471
472 if ($memcache) $memcache->flush();
473
474 $savemode = db_escape_string($_REQUEST["savemode"]);
475 $regexp = db_escape_string(trim($_REQUEST["reg_exp"]));
476 $filter_type = db_escape_string(trim($_REQUEST["filter_type"]));
477 $feed_id = db_escape_string($_REQUEST["feed_id"]);
478 $cat_id = db_escape_string($_REQUEST["cat_id"]);
479 $action_id = db_escape_string($_REQUEST["action_id"]);
480 $action_param = db_escape_string($_REQUEST["action_param"]);
481 $action_param_label = db_escape_string($_REQUEST["action_param_label"]);
482 $inverse = checkbox_to_sql_bool(db_escape_string($_REQUEST["inverse"]));
483 $cat_filter = checkbox_to_sql_bool(db_escape_string($_REQUEST["cat_filter"]));
484
485 # for the time being, no other filters use params anyway...
486 $filter_param = db_escape_string($_REQUEST["filter_date_modifier"]);
487
488 if (!$regexp) return;
489
490 if (!$feed_id) {
491 $feed_id = 'NULL';
492 } else {
493 $feed_id = sprintf("'%s'", db_escape_string($feed_id));
494 }
495
496 if (!$cat_id) {
497 $cat_id = 'NULL';
498 } else {
499 $cat_id = sprintf("'%d'", db_escape_string($cat_id));
500 }
501
502 /* When processing 'assign label' filters, action_param_label dropbox
503 * overrides action_param */
504
505 if ($action_id == 7) {
506 $action_param = $action_param_label;
507 }
508
509 if ($action_id == 6) {
510 $action_param = (int) str_replace("+", "", $action_param);
511 }
512
513 if ($savemode != "test") {
514 $result = db_query($this->link,
515 "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id,
516 action_id, action_param, inverse, filter_param, cat_id, cat_filter)
517 VALUES
518 ('$regexp', '$filter_type','".$_SESSION["uid"]."',
519 $feed_id, '$action_id', '$action_param', $inverse,
520 '$filter_param', $cat_id, '$cat_filter')");
521
522 if (db_affected_rows($this->link, $result) != 0) {
523 print T_sprintf("Created filter <b>%s</b>", htmlspecialchars($regexp));
524 }
525
526 } else {
527
528 $this->filter_test($filter_type, $regexp,
529 $action_id, $action_param, $filter_param, sql_bool_to_bool($inverse),
530 (int) $_REQUEST["feed_id"], (int) $_REQUEST['cat_id'],
531 sql_bool_to_bool($cat_filter));
532
533 print "<div align='center'>";
534 print "<button dojoType=\"dijit.form.Button\"
535 onclick=\"return dijit.byId('filterTestDlg').hide()\">".
536 __('Close this window')."</button>";
537 print "</div>";
538
539 }
540 }
541
542 function index() {
543
544 $sort = db_escape_string($_REQUEST["sort"]);
545
546 if (!$sort || $sort == "undefined") {
547 $sort = "reg_exp";
548 }
549
550 $result = db_query($this->link, "SELECT id,description
551 FROM ttrss_filter_types ORDER BY description");
552
553 $filter_types = array();
554
555 while ($line = db_fetch_assoc($result)) {
556 //array_push($filter_types, $line["description"]);
557 $filter_types[$line["id"]] = $line["description"];
558 }
559
560
561 $filter_search = db_escape_string($_REQUEST["search"]);
562
563 if (array_key_exists("search", $_REQUEST)) {
564 $_SESSION["prefs_filter_search"] = $filter_search;
565 } else {
566 $filter_search = $_SESSION["prefs_filter_search"];
567 }
568
569 print "<div id=\"pref-filter-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">";
570 print "<div id=\"pref-filter-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">";
571 print "<div id=\"pref-filter-toolbar\" dojoType=\"dijit.Toolbar\">";
572
573 print "<div dojoType=\"dijit.form.DropDownButton\">".
574 "<span>" . __('Select')."</span>";
575 print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
576 print "<div onclick=\"dijit.byId('filterTree').model.setAllChecked(true)\"
577 dojoType=\"dijit.MenuItem\">".__('All')."</div>";
578 print "<div onclick=\"dijit.byId('filterTree').model.setAllChecked(false)\"
579 dojoType=\"dijit.MenuItem\">".__('None')."</div>";
580 print "</div></div>";
581
582 print "<button dojoType=\"dijit.form.Button\" onclick=\"return quickAddFilter()\">".
583 __('Create filter')."</button> ";
584
585 print "<button dojoType=\"dijit.form.Button\" onclick=\"return editSelectedFilter()\">".
586 __('Edit')."</button> ";
587
588 print "<button dojoType=\"dijit.form.Button\" onclick=\"return removeSelectedFilters()\">".
589 __('Remove')."</button> ";
590
591 if (defined('_ENABLE_FEED_DEBUGGING')) {
592 print "<button dojoType=\"dijit.form.Button\" onclick=\"rescore_all_feeds()\">".
593 __('Rescore articles')."</button> ";
594 }
595
596 print "</div>"; # toolbar
597 print "</div>"; # toolbar-frame
598 print "<div id=\"pref-filter-content\" dojoType=\"dijit.layout.ContentPane\" region=\"center\">";
599
600 print "<div id=\"filterlistLoading\">
601 <img src='images/indicator_tiny.gif'>".
602 __("Loading, please wait...")."</div>";
603
604 print "<div dojoType=\"dojo.data.ItemFileWriteStore\" jsId=\"filterStore\"
605 url=\"backend.php?op=pref-filters&method=getfiltertree\">
606 </div>
607 <div dojoType=\"lib.CheckBoxStoreModel\" jsId=\"filterModel\" store=\"filterStore\"
608 query=\"{id:'root'}\" rootId=\"root\" rootLabel=\"Feeds\"
609 childrenAttrs=\"items\" checkboxStrict=\"false\" checkboxAll=\"false\">
610 </div>
611 <div dojoType=\"fox.PrefFilterTree\" id=\"filterTree\"
612 model=\"filterModel\" openOnClick=\"true\">
613 <script type=\"dojo/method\" event=\"onLoad\" args=\"item\">
614 Element.hide(\"filterlistLoading\");
615 </script>
616 <script type=\"dojo/method\" event=\"onClick\" args=\"item\">
617 var id = String(item.id);
618 var bare_id = id.substr(id.indexOf(':')+1);
619
620 if (id.match('FILTER:')) {
621 editFilter(bare_id);
622 }
623 </script>
624
625 </div>";
626
627 print "</div>"; #pane
628 print "</div>"; #container
629
630 }
631 }
632 ?>