forked from chaosarium/lwt
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathedit_feeds.php
679 lines (656 loc) · 26.5 KB
/
edit_feeds.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
<?php
namespace Lwt\Interface\Edit_Feeds;
require_once 'inc/session_utility.php';
$currentlang = validateLang((string) processDBParam("filterlang", 'currentlanguage', '', false));
$currentsort = (int) processDBParam("sort", 'currentmanagefeedssort', '2', true);
$currentquery = (string) processSessParam("query", "currentmanagefeedsquery", '', false);
$currentpage = (int) processSessParam("page", "currentmanagefeedspage", '1', true);
$currentfeed = (string) processSessParam("selected_feed", "currentmanagefeedsfeed", '', false);
$wh_query = convert_string_to_sqlsyntax(str_replace("*", "%", $currentquery));
$wh_query = ($currentquery != '') ? (' and (NfName like ' . $wh_query . ')') : '';
pagestart('Manage ' . getLanguage($currentlang) . ' Feeds', true);
if (isset($_SESSION['wizard'])) {
unset($_SESSION['wizard']);
}
if (isset($_REQUEST['markaction'])) {
if ($_REQUEST['markaction'] == 'del') {
$message = runsql(
'delete from ' . $tbpref . 'feedlinks
where FlNfID in(' . $currentfeed . ')', "Article item(s) deleted"
);
$message.= runsql(
'delete from ' . $tbpref . 'newsfeeds
where NfID in(' . $currentfeed . ')', " / Newsfeed(s) deleted"
);
echo error_message_with_hide($message, false);
unset($message);
}
if ($_REQUEST['markaction']=='del_art') {
$message = runsql(
'delete from ' . $tbpref . 'feedlinks
where FlNfID in(' . $currentfeed . ')',
"Article item(s) deleted"
);
echo error_message_with_hide($message, false);
unset($message);
do_mysqli_query(
'UPDATE ' . $tbpref . 'newsfeeds SET NfUpdate="'.time().'"
where NfID in(' . $currentfeed . ')'
);
}
if ($_REQUEST['markaction']=='res_art') {
$message = runsql(
'UPDATE ' . $tbpref . 'feedlinks SET FlLink=TRIM(FlLink)
where FlNfID in (' . $currentfeed . ')',
"Article(s) reset"
);
echo error_message_with_hide($message, false);
unset($message);
}
}
if (isset($_SESSION['feed_loaded'])) {
foreach($_SESSION['feed_loaded'] as $lf){
echo "\n<div class=\"msgblue\"><p class=\"hide_message\">+++ ",$lf," +++</p></div>";
}
?>
<script type="text/javascript">
$(".hide_message").delay(2500).slideUp(1000);
</script>
<?php
unset($_SESSION['feed_loaded']);
}
if (isset($_REQUEST['update_feed'])) {
$currentfeed = $_REQUEST['NfID'];
runsql(
'UPDATE ' . $tbpref . 'newsfeeds SET
NfLgID=' . convert_string_to_sqlsyntax($_REQUEST['NfLgID']) .',
NfName=' . convert_string_to_sqlsyntax($_REQUEST['NfName']) .',
NfSourceURI=' . convert_string_to_sqlsyntax($_REQUEST['NfSourceURI']) .',
NfArticleSectionTags=' . convert_string_to_sqlsyntax($_REQUEST['NfArticleSectionTags']) .',
NfFilterTags=' . convert_string_to_sqlsyntax_nonull($_REQUEST['NfFilterTags']) .',
NfOptions=' . convert_string_to_sqlsyntax_nonull(rtrim($_REQUEST['NfOptions'], ',')) .'
where NfID='.$_REQUEST['NfID'],
""
);
}
if (isset($_REQUEST['save_feed'])) {
runsql(
'insert into ' . $tbpref . 'newsfeeds (
NfLgID, NfName, NfSourceURI, NfArticleSectionTags, NfFilterTags, NfOptions
)
VALUES (' . convert_string_to_sqlsyntax($_REQUEST['NfLgID']) .',' .
convert_string_to_sqlsyntax($_REQUEST['NfName']) .',' .
convert_string_to_sqlsyntax($_REQUEST['NfSourceURI']) .',' .
convert_string_to_sqlsyntax($_REQUEST['NfArticleSectionTags']) .',' .
convert_string_to_sqlsyntax_nonull($_REQUEST['NfFilterTags']) .',' .
convert_string_to_sqlsyntax_nonull(rtrim($_REQUEST['NfOptions'], ',')) .
')',
""
);
}
function display_new_feed($currentlang): void
{
global $tbpref;
$result = do_mysqli_query(
"SELECT LgName,LgID FROM " . $tbpref . "languages
where LgName<>'' ORDER BY LgName"
);
?>
<h2>New Feed</h2>
<a href="do_feeds.php?page=1">My Feeds</a>
<span class="nowrap"></span>
<a href="feed_wizard.php?step=1">
<img src="icn/wizard.png" title="new_feed_wizard" alt="new_feed_wizard" style="height: 20px;"/>
New Feed Wizard
</a>
<br></br>
<form class="validate" action="edit_feeds.php" method="post">
<table class="tab2" cellspacing="0" cellpadding="5">
<tr><td class="td1">Language: </td><td class="td1"><select name="NfLgID">
<?php
while($row_l = mysqli_fetch_assoc($result)){
echo '<option value="' . $row_l['LgID'] . '"';
if($currentlang===$row_l['LgID']) {
echo ' selected="selected"';
}
echo '>' . $row_l['LgName'] . '</option>';
}
mysqli_free_result($result);
?> </select></td></tr>
<tr><td class="td1">
Name: </td><td class="td1">
<input class="notempty" style="width:95%" type="text" name="NfName" />
<img src="icn/status-busy.png" title="Field must not be empty" alt="Field must not be empty" />
</td></tr>
<tr><td class="td1">Newsfeed url: </td>
<td class="td1"><input class="notempty" style="width:95%" type="text" name="NfSourceURI" />
<img src="icn/status-busy.png" title="Field must not be empty" alt="Field must not be empty" />
</td></tr>
<tr><td class="td1">Article Section: </td>
<td class="td1"><input class="notempty" style="width:95%" type="text" name="NfArticleSectionTags" />
<img src="icn/status-busy.png" title="Field must not be empty" alt="Field must not be empty" />
</td></tr>
<tr><td class="td1">Filter Tags: </td>
<td class="td1"><input type="text" style="width:95%" name="NfFilterTags" /></td></tr>
<tr><td class="td1">Options: </td>
<td class="td1"><table style="width:100%">
<tr><td style="width:35%"><input type="checkbox" name="edit_text" checked="checked" /> Edit Text </td>
<td>
<input type="checkbox" name="c_autoupdate" /> Auto Update Interval:
<input class="posintnumber" data_info="Auto Update Interval" type="number" min="0" size="4" name="autoupdate" disabled />
<select name="autoupdate" disabled><option value="h">Hour(s)</option>
<option value="d">Day(s)</option><option value="w">Week(s)</option></select>
</td></tr>
<tr><td>
<input type="checkbox" name="c_max_links" /> Max. Links:
<input class="posintnumber maxint_300" data_info="Max. Links" type="number" min="0" max="300" size="4" name="max_links" disabled /></td>
<td><input type="checkbox" name="c_charset" /> Charset:
<input type="text" data_info="Charset" size="20" name="charset" disabled /> </td></tr>
<tr><td>
<input type="checkbox" name="c_max_texts" /> Max. Texts:
<input class="posintnumber maxint_30" data_info="Max. Texts" ttype="number" min="0" max="30" size="4" name="max_texts" disabled /></td>
<td>
<input type="checkbox" name="c_tag" /> Tag:
<input type="text" data_info="Tag" size="20" name="tag" disabled />
</td>
</tr>
<tr><td colspan="2">
<input type="checkbox" name="c_article_source" /> Article Source:
<input data_info="Article Source" type="text" size="20" name="article_source" disabled /></td></tr>
</table></td></tr>
</table><input type="submit" value="Save" />
<input type="hidden" name="NfOptions" value="" />
<input type="hidden" name="save_feed" value="1" />
<input type="button" value="Cancel" onclick="location.href='edit_feeds.php';" />
</form>
<script type="text/javascript">
$('[name^="c_"]').change(function(){
if(this.checked){
$(this).parent().children('input[type="text"]')
.removeAttr('disabled').addClass("notempty");
$(this).parent().find('select').removeAttr('disabled');
} else {
$(this).parent().children('input[type="text"]')
.attr('disabled','disabled').removeClass("notempty");
$(this).parent().find('select').attr('disabled','disabled');
}
});
$('[type="submit"]').on('click', function(){
var str;
str=$('[name="edit_text"]:checked').length > 0?"edit_text=1,":"";
$('[name^="c_"]').each(function(){
str+=this.checked ? $(this).parent().children('input[type="text"]')
.attr('name') + '='
+ $(this).parent().children('input[type="text"]').val()
+ ($(this).attr('name')=='c_autoupdate' ? $(this).parent().find('select').val() + ',' : ','): '';
});
$('input[name="NfOptions"]').val(str);
});
</script>
<?php
}
function edit_feed($currentfeed): void
{
global $tbpref;
$result = do_mysqli_query(
"SELECT * FROM " . $tbpref . "newsfeeds WHERE NfID=$currentfeed"
);
$row = mysqli_fetch_assoc($result);
$result = do_mysqli_query(
"SELECT LgName,LgID FROM " . $tbpref . "languages
where LgName<>'' ORDER BY LgName"
);
?>
<h2>
Edit Feed
<a target="_blank" href="docs/info.html#new_feed">
<img src="icn/question-frame.png" title="Help" alt="Help" />
</a>
</h2>
<a href="do_feeds.php?page=1"> My Feeds</a>
<span class="nowrap"></span>
<a href="feed_wizard.php?step=2&edit_feed=<?php echo $currentfeed;?>">
<img src="icn/wizard.png" title="feed_wizard" alt="feed_wizard" />Feed Wizard</a>
<form class="validate" action="edit_feeds.php" method="post">
<table class="tab2" cellspacing="0" cellpadding="5">
<tr>
<td class="td1">Language: </td>
<td class="td1">
<select name="NfLgID">
<?php
while ($row_l = mysqli_fetch_assoc($result)) {
echo '<option value="' . $row_l['LgID'] . '"';
if($row['NfLgID']===$row_l['LgID']) {
echo ' selected="selected"';
}
echo '>' . $row_l['LgName'] . '</option>';
}
mysqli_free_result($result);
$auto_upd_i=get_nf_option($row['NfOptions'], 'autoupdate');
if($auto_upd_i==null) {
$auto_upd_v=null;
} else {
$auto_upd_v=substr($auto_upd_i, -1);
$auto_upd_i=substr($auto_upd_i, 0, -1);
}
?>
</select>
</td>
</tr>
<tr>
<td class="td1">Name: </td>
<td class="td1">
<input class="notempty" style="width:95%" type="text" name="NfName"
value="<?php echo tohtml($row['NfName']); ?>" />
<img src="icn/status-busy.png" title="Field must not be empty" alt="Field must not be empty" />
</td>
</tr>
<tr>
<td class="td1">Newsfeed url: </td>
<td class="td1">
<input class="notempty" style="width:95%" type="text" name="NfSourceURI"
value="<?php echo tohtml($row['NfSourceURI']); ?>" />
<img src="icn/status-busy.png" title="Field must not be empty" alt="Field must not be empty" />
</td>
</tr>
<tr>
<td class="td1">Article Section: </td>
<td class="td1">
<input class="notempty" style="width:95%" type="text"
name="NfArticleSectionTags" value="<?php echo tohtml($row['NfArticleSectionTags']); ?>" />
<img src="icn/status-busy.png" title="Field must not be empty" alt="Field must not be empty" />
</td>
</tr>
<tr>
<td class="td1">Filter Tags: </td>
<td class="td1">
<input type="text" style="width:95%" name="NfFilterTags"
value="<?php echo tohtml($row['NfFilterTags']); ?>" />
</td>
</tr>
<tr>
<td class="td1">Options: </td>
<td class="td1">
<table style="width:100%">
<tr>
<td style="width:35%">
<input type="checkbox" name="edit_text"<?php
if(get_nf_option($row['NfOptions'], 'edit_text')!==null) {
echo ' checked="checked"';
} ?> />
Edit Text
</td>
<td>
<input type="checkbox" name="c_autoupdate"<?php if($auto_upd_i!==null) {
echo ' checked="checked"';
} ?> />
Auto Update Interval: <input class="posintnumber<?php if(get_nf_option($row['NfOptions'], 'autoupdate')!==null) {
echo ' notempty';
} ?>" data_info="Auto Update Interval" type="number" min="0" size="4" name="autoupdate" value="<?php echo $auto_upd_i; ?>"
<?php
if ($auto_upd_i==null) {
echo ' disabled';
} ?> />
<select name="autoupdate" value="<?php
echo $auto_upd_v . '"';
if ($auto_upd_v==null) {
echo ' disabled';
} ?>>
<option value="h" <?php if($auto_upd_v=='h') {
echo ' selected="selected"';
}?>>Hour(s)</option>
<option value="d"<?php if($auto_upd_v=='d') {
echo ' selected="selected"';
}?>>Day(s)</option>
<option value="w"<?php if($auto_upd_v=='w') {
echo ' selected="selected"';
}?>>Week(s)</option>
</select>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="c_max_links"<?php if(get_nf_option($row['NfOptions'], 'max_links')!==null) {
echo ' checked="checked"';
} ?> />
Max. Links: <input class="<?php
if (get_nf_option($row['NfOptions'], 'max_links')!==null) {
echo 'notempty ';
} ?>posintnumber maxint_300" data_info="Max. Links" type="number" min="0" max="300" size="4" name="max_links" value="<?php echo get_nf_option($row['NfOptions'], 'max_links') . '"';
if(get_nf_option($row['NfOptions'], 'max_links')==null) {
echo ' disabled';
} ?> />
</td>
<td>
<input type="checkbox" name="c_charset"<?php
if (get_nf_option($row['NfOptions'], 'charset')!==null) {
echo ' checked="checked"';
} ?> />
Charset: <input <?php if(get_nf_option($row['NfOptions'], 'charset')!==null) {
echo 'class="notempty" ';
} ?>type="text" data_info="Charset" size="20" name="charset" value="<?php echo get_nf_option($row['NfOptions'], 'charset') . '"';
if (get_nf_option($row['NfOptions'], 'charset')==null) {
echo ' disabled';
} ?> />
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="c_max_texts"<?php if(get_nf_option($row['NfOptions'], 'max_texts')!==null) {
echo ' checked="checked"';
} ?> />
Max. Texts:
<input class="<?php if(get_nf_option($row['NfOptions'], 'max_texts')!==null) {
echo 'notempty ';
} ?>posintnumber maxint_30" data_info="Max. Texts" type="number" min="0" max="30"
size="4" name="max_texts"
value="<?php echo get_nf_option($row['NfOptions'], 'max_texts') . '"';if(get_nf_option($row['NfOptions'], 'max_texts')==null) {
echo ' disabled';
} ?> />
</td>
<td>
<input type="checkbox" name="c_tag"<?php if(get_nf_option($row['NfOptions'], 'tag')!==null) {
echo ' checked="checked"';
} ?> />
Tag: <input <?php if(get_nf_option($row['NfOptions'], 'tag')!==null) {
echo 'class="notempty" ';
} ?>type="text" data_info="Tag" size="20" name="tag" value="<?php echo get_nf_option($row['NfOptions'], 'tag') . '"';
if(get_nf_option($row['NfOptions'], 'tag')==null) {
echo ' disabled';
} ?> />
</td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" name="c_article_source"<?php if(get_nf_option($row['NfOptions'], 'article_source')!==null) {
echo ' checked="checked"';
} ?> />
Article Source: <input class="<?php if(get_nf_option($row['NfOptions'], 'article_source')!==null) {
echo 'notempty ';
} ?>" data_info="Article Source" type="text" size="20" name="article_source" value="<?php echo get_nf_option($row['NfOptions'], 'article_source') . '"';
if(get_nf_option($row['NfOptions'], 'article_source')==null) {
echo ' disabled';
} ?> />
</td>
</tr>
</table>
</td>
</tr>
</table>
<input type="submit" value="Update" />
<input type="hidden" name="NfID" value="<?php echo tohtml($row['NfID']); ?>" />
<input type="button" value="Cancel" onclick="location.href='edit_feeds.php';" />
<input type="hidden" name="NfOptions" value="" />
<input type="hidden" name="update_feed" value="1" />
</form>
<script type="text/javascript">
$('[name^="c_"]').change(function(){
if (this.checked){
$(this).parent().children('input[type="text"]')
.removeAttr('disabled').addClass("notempty");
$(this).parent().find('select').removeAttr('disabled');
} else {
$(this).parent().children('input[type="text"]')
.attr('disabled','disabled').removeClass("notempty");
$(this).parent().find('select').attr('disabled','disabled');
}
});
$('[type="submit"]').on('click', function(){
var str;
str=$('[name="edit_text"]:checked').length > 0?"edit_text=1,":"";
$('[name^="c_"]').each(function(){
str+=this.checked ? $(this).parent().children('input[type="text"]').attr('name') + '='
+ $(this).parent().children('input[type="text"]').val()
+ ($(this).attr('name')=='c_autoupdate' ? $(this).parent().find('select').val() + ',' : ','): '';
});
$('input[name="NfOptions"]').val(str);
});
</script>
<?php
}
function multi_load_feed($currentlang): void
{
global $tbpref;
if(!empty($currentlang)) {
$result = do_mysqli_query(
"SELECT NfName,NfID,NfUpdate FROM " . $tbpref . "newsfeeds
WHERE NfLgID=$currentlang ORDER BY NfUpdate DESC"
);
} else {
$result = do_mysqli_query(
"SELECT NfName,NfID,NfUpdate FROM " . $tbpref . "newsfeeds
ORDER BY NfUpdate DESC"
);
}
?>
<form name="form1" action="do_feeds.php" onsubmit="document.form1.querybutton.click(); return false;">
<table class="tab3" style="border-left: none;border-top: none; background-color:inherit" cellspacing="0" cellpadding="5">
<tr>
<th class="th1 borderleft" colspan="2">Language:<select name="filterlang" onchange="{setLang(document.form1.filterlang,'edit_feeds.php?multi_load_feed=1%26page=1');}">
<?php
echo get_languages_selectoptions($currentlang, '[Filter off]');
?>
</select>
</th>
<th class="th1 borderright" colspan="2">
<input type="button" value="Mark All" onclick="selectToggle(true,'form1');return false;" />
<input type="button" value="Mark None" onclick="selectToggle(false,'form1');return false;" /></th>
</tr>
<tr>
<td colspan="4" style="padding-left: 0px;padding-right: 0px;border-bottom: none;width: 100%;border-left: none;background-color: transparent;"><table class="sortable tab2" cellspacing="0" cellpadding="5">
<tr>
<th class="th1 sorttable_nosort">Mark</th>
<th class="th1 clickable" colspan="2">Newsfeeds</th>
<th class="th1 sorttable_numeric clickable">Last Update</th>
</tr>
<?php
$time=time();
while($row = mysqli_fetch_assoc($result)){
$diff= $time - (int) $row['NfUpdate'];
echo '<tr><td class="td1 center">
<input class="markcheck" type="checkbox" name="selected_feed[]" value="' . $row['NfID'] . '" checked="checked" />
</td>
<td class="td1 center" colspan="2">'.$row['NfName'].'</td>
<td class="td1 center" sorttable_customkey="'.$diff.'">';
if($row['NfUpdate']) {
print_last_feed_update($diff);
}
echo '</td></tr>';
}
mysqli_free_result($result);
?>
</table>
</td>
</tr>
<tr>
<th class="th1 borderleft" colspan="3"><input id="map" type="hidden" name="selected_feed" value="" />
<input type="hidden" name="load_feed" value="1" />
<button id="markaction">Update Marked Newsfeeds</button></th>
<th class="th1 borderright">
<input type="button" value="Cancel" onclick="location.href='do_feeds.php?selected_feed=0'; return false;" /></th></tr>
</table>
</form>
<script type="text/javascript">
$( "button" ).on('click', function() {
$("#map").val( $('input[type="checkbox"]:checked').map(function(){
return $(this).val();
}).get().join(", ") );
});
</script>
<?php
}
function display_main_page(
$currentlang, $currentquery, $currentpage, $currentsort, $wh_query
): void {
global $tbpref, $debug;
?>
<div class="flex-spaced">
<div><a href="do_feeds.php">My Feeds</a></div>
<div>
<a href="edit_feeds.php?new_feed=1">
<img src="icn/feed--plus.png" title="new feed" alt="new feed" />
New Feed...
</a>
</div>
</div>
<form name="form1" action="#" onsubmit="document.form1.querybutton.click(); return false;">
<table class="tab2" cellspacing="0" cellpadding="5"><tr>
<th class="th1" colspan="4">Filter <img src="icn/funnel.png" title="Filter" alt="Filter" />
<input type="button" value="Reset All" onclick="resetAll('edit_feeds.php');" /></th>
</tr>
<tr>
<td class="td1 center" colspan="2" style="width:30%;">
Language: <select name="filterlang" onchange="{setLang(document.form1.filterlang,'edit_feeds.php?manage_feeds=1');}">
<?php
echo get_languages_selectoptions($currentlang, '[Filter off]');
?>
</select>
</td>
<td class="td1 center" colspan="4">
Feed Name (Wildc.=*):
<input type="text" name="query" value="<?php echo tohtml($currentquery); ?>" maxlength="50" size="15" />
<input type="button" name="querybutton" value="Filter" onclick="{val=document.form1.query.value; location.href='edit_feeds.php?page=1&query=' + val;}" />
<input type="button" value="Clear" onclick="{location.href='edit_feeds.php?page=1&query=';}" />
</td>
</tr>
</table>
<input id="map" type="hidden" name="selected_feed" value="" />
<table class="tab2" cellspacing="0" cellpadding="5">
<tr>
<th class="th1" colspan="3">
Multi Actions <img src="icn/lightning.png" title="Multi Actions" alt="Multi Actions" />
</th>
</tr>
<tr><td class="td1 center" style="width:30%;">
<input type="button" value="Mark All" onclick="selectToggle(true,'form2');" />
<input type="button" value="Mark None" onclick="selectToggle(false,'form2');" />
</td><td class="td1 center" colspan="2">Marked Newsfeeds:
<select name="markaction" id="markaction" disabled="disabled" onchange="$('#map').val($('input:checked').map(function(){return $(this).val();}).get().join(', '));multiActionGo(document.form1, document.form1.markaction);return false;">
<option value="">[Choose...]</option>
<option disabled="disabled">------------</option>
<option value="update">Update</option>
<option disabled="disabled">------------</option>
<option value="res_art">Reset Unloadable Articles</option>
<option disabled="disabled">------------</option>
<option value="del_art">Delete All Articles</option>
<option disabled="disabled">------------</option>
<option value="del">Delete</option>
</select></td></tr>
<?php
$sql = 'select count(*) as value from ' . $tbpref . 'newsfeeds where ';
if ($currentlang>0) {
$sql .= 'NfLgID ='.$currentlang . $wh_query;
} else {
$sql .= '1=1' . $wh_query;
}
$recno = (int) get_first_value($sql);
if ($debug) {
echo $sql . ' ===> ' . $recno;
}
if ($recno) {
$maxperpage = (int) getSettingWithDefault('set-feeds-per-page');
$pages = $recno == 0 ? 0 : (intval(($recno-1) / $maxperpage) + 1);
if ($currentpage < 1) {
$currentpage = 1;
}
if ($currentpage > $pages) {
$currentpage = $pages;
}
$sorts = array('NfName','NfUpdate DESC','NfUpdate ASC');
$lsorts = count($sorts);
if ($currentsort < 1) {
$currentsort = 1;
}
if ($currentsort > $lsorts) {
$currentsort = $lsorts;
}
echo '<tr><th class="th1" style="width:30%;"> '. $total=$recno .' newsfeeds ';///
echo '</th><th class="th1">';
makePager($currentpage, $pages, 'edit_feeds.php', 'form1');
if (!empty($currentlang)) {
$result = do_mysqli_query(
"SELECT * FROM " . $tbpref . "newsfeeds
WHERE NfLgID=$currentlang $wh_query
ORDER BY " . $sorts[$currentsort-1]
);
} else {
$result = do_mysqli_query(
"SELECT * FROM " . $tbpref . "newsfeeds WHERE (1=1) $wh_query
ORDER BY " . $sorts[$currentsort-1]
);
}
?>
</th>
<th class="th1" colspan="1" nowrap="nowrap">
Sort Order:
<select name="sort" onchange="{val=document.form1.sort.options[document.form1.sort.selectedIndex].value; location.href='edit_feeds.php?page=1&sort=' + val;}"><?php echo get_textssort_selectoptions($currentsort); ?></select>
</th>
</table>
</form>
<form name="form2" action="" method="get">
<table class="sortable tab2" cellspacing="0" cellpadding="5">
<tr>
<th class="th1 sorttable_nosort">Mark</th>
<th class="th1 sorttable_nosort">Actions</th>
<th class="th1 clickable">Newsfeeds</th>
<th class="th1 sorttable_nosort">Options</th>
<th class="th1 sorttable_numeric clickable">Last Update</th>
</tr>
<?php
$time=time();
while($row = mysqli_fetch_assoc($result)) {
$diff = $time- (int) $row['NfUpdate'];
echo '<tr>
<td class="td1 center">
<input type="checkbox" name="marked[]" class="markcheck" value="' . $row['NfID'] . '" /></td>
<td style="white-space: nowrap" class="td1 center">
<a href="' . $_SERVER['PHP_SELF'] . '?edit_feed=1&selected_feed=' . $row['NfID'] . '">
<img src="icn/feed--pencil.png" title="Edit" alt="Edit" />
</a>
<a href="' . $_SERVER['PHP_SELF'] . '?manage_feeds=1&load_feed=1&selected_feed=' . $row['NfID'] . '">
<span title="Update Feed"><img src="icn/arrow-circle-135.png" alt="-" /></span></a>
<a href="' . $row['NfSourceURI'] . '" onclick="window.open(this.href); return false">
<img src="icn/external.png" title="Show Feed" alt="Link" /></a>
<span class="click" onclick="if (confirm (\'Are you sure?\')) location.href=\'' . $_SERVER['PHP_SELF'] . '?markaction=del&selected_feed=' . $row['NfID'] . '\';">
<img src="icn/minus-button.png" title="Delete" alt="Delete" /></span></td>
<td class="td1 center">'.$row['NfName'].'</td>
<td class="td1 center">'.str_replace(',', ', ', $row['NfOptions']).'</td>
<td class="td1 center" sorttable_customkey="'.$diff.'">';
if ($row['NfUpdate']) {
print_last_feed_update($diff);
}
echo '</td></tr>';
}
mysqli_free_result($result);
?>
</table>
</form>
<?php
if ($pages > 1) {
echo '<form name="form3" method="get" action ="">
<table class="tab2" cellspacing="0" cellpadding="5">
<tr><th class="th1" style="width:30%;">';
echo $total ;
echo '</th><th class="th1">';
makePager($currentpage, $pages, 'do_feeds.php', 'form3');
echo '</th></tr></table></form>';
}
}
}
if (isset($_REQUEST['load_feed']) || isset($_REQUEST['check_autoupdate'])
|| (isset($_REQUEST['markaction']) && $_REQUEST['markaction']=='update')
) {
load_feeds($currentfeed);
} elseif(isset($_REQUEST['new_feed'])) {
display_new_feed($currentlang);
} elseif (isset($_REQUEST['edit_feed'])) {
edit_feed($currentfeed);
} elseif (isset($_REQUEST['multi_load_feed'])) {
multi_load_feed($currentlang);
} else {
display_main_page(
$currentlang, $currentquery, $currentpage, $currentsort, $wh_query
);
}
pageend();
?>