forked from hans/lwt
-
Notifications
You must be signed in to change notification settings - Fork 9
/
feed_wizard.php
503 lines (496 loc) · 32.5 KB
/
feed_wizard.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
<?php
require_once( 'settings.inc.php' );
require_once( 'connect.inc.php' );
require_once( 'dbutils.inc.php' );
require_once( 'utilities.inc.php' );
if($_REQUEST['step']==4){
pagestart('Feed Wizard',false);
if(isset($_REQUEST['filter_tags']))$_SESSION['wizard']['filter_tags']=$_REQUEST['filter_tags'];
?><form class="validate" action="edit_feeds.php" method="post">
<table class="tab1" cellspacing="0" cellpadding="5">
<tr><td class="td1">Language: </td><td class="td1"><select name="NfLgID" class="notempty"><option value="">[Select...]</option>
<?php
$result = do_mysqli_query("SELECT LgName,LgID FROM " . $tbpref . "languages where LgName<>'' ORDER BY LgName");
while($row_l = mysqli_fetch_assoc($result)){
echo '<option value="' . $row_l['LgID'] . '"';
if($_SESSION['wizard']['lang']===$row_l['LgID']){
echo ' selected="selected"';
}
echo '>' . $row_l['LgName'] . '</option>';
}
mysqli_free_result($result);
$auto_upd_v;
$auto_upd_i=get_nf_option($_SESSION['wizard']['options'],'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> <img src="icn/status-busy.png" title="Field must not be empty" alt="Field must not be empty" /></td></tr>
<tr><td class="td1">
Name: </td><td class="td1"><input class="notempty" style="width:95%" type="text" name="NfName" value="<?php echo htmlspecialchars ($_SESSION['wizard']['feed']['feed_title'],ENT_COMPAT); ?>" /> <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 htmlspecialchars ($_SESSION['wizard']['rss_url']); ?>" /> <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 htmlspecialchars (preg_replace('/[ ]+/',' ',trim($_SESSION['wizard']['redirect'].$_SESSION['wizard']['article_section']))); ?>" /> <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 htmlspecialchars (preg_replace('/[ ]+/',' ',trim($_REQUEST['html']))); ?>" /></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($_SESSION['wizard']['options'],'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($_SESSION['wizard']['options'],'autoupdate')!==NULL)echo ' notempty'; ?>" data_info="Auto Update Interval" type="text" size="4" name="autoupdate" value="<?php echo $auto_upd_i . '"';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($_SESSION['wizard']['options'],'max_links')!==NULL)echo ' checked="checked"'; ?> /> Max. Links: <input class="<?php if(get_nf_option($_SESSION['wizard']['options'],'max_links')!==NULL)echo 'notempty '; ?>posintnumber maxint_300" data_info="Max. Links" type="text" size="4" name="max_links" value="<?php echo get_nf_option($_SESSION['wizard']['options'],'max_links') . '"';if(get_nf_option($_SESSION['wizard']['options'],'max_links')==NULL)echo ' disabled'; ?> /></td><td><input type="checkbox" name="c_charset"<?php if(get_nf_option($_SESSION['wizard']['options'],'charset')!==NULL)echo ' checked="checked"'; ?> /> Charset: <input <?php if(get_nf_option($_SESSION['wizard']['options'],'charset')!==NULL)echo 'class="notempty" '; ?>type="text" data_info="Charset" size="20" name="charset" value="<?php echo get_nf_option($_SESSION['wizard']['options'],'charset') . '"';if(get_nf_option($_SESSION['wizard']['options'],'charset')==NULL)echo ' disabled'; ?> /> </td></tr>
<tr><td><input type="checkbox" name="c_max_texts"<?php if(get_nf_option($_SESSION['wizard']['options'],'max_texts')!==NULL)echo ' checked="checked"'; ?> /> Max. Texts: <input class="<?php if(get_nf_option($_SESSION['wizard']['options'],'max_texts')!==NULL)echo 'notempty '; ?>posintnumber maxint_30" data_info="Max. Texts" type="text" size="4" name="max_texts" value="<?php echo get_nf_option($_SESSION['wizard']['options'],'max_texts') . '"';if(get_nf_option($_SESSION['wizard']['options'],'max_texts')==NULL)echo ' disabled'; ?> /></td><td><input type="checkbox" name="c_tag"<?php if(get_nf_option($_SESSION['wizard']['options'],'tag')!==NULL)echo ' checked="checked"'; ?> /> Tag: <input <?php if(get_nf_option($_SESSION['wizard']['options'],'tag')!==NULL)echo 'class="notempty" '; ?>type="text" data_info="Tag" size="20" name="tag" value="<?php echo get_nf_option($_SESSION['wizard']['options'],'tag') . '"';if(get_nf_option($_SESSION['wizard']['options'],'tag')==NULL)echo ' disabled'; ?> /> </td></tr>
</table>
</td></tr>
</table>
<?php if(isset($_SESSION['wizard']['edit_feed'])){echo '<input type="hidden" name="NfID" value="'.$_SESSION['wizard']['edit_feed'].'" />';}?>
<input type="button" value="Cancel" onclick="location.href='edit_feeds.php?del_wiz=1';" />
<input type="hidden" name="NfOptions" value="" />
<input type="hidden" name="article_source" value="<?php echo htmlspecialchars ($_SESSION['wizard']['feed']['feed_text']); ?>" />
<input type="hidden" name="save_feed" value="1" />
<input type="button" value="Back" onclick="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() + ',' : ','): '';});location.href='feed_wizard.php?step=3&NfOptions='+str+'&NfLgID='+$('select[name=\'NfLgID\']').val()+'&NfName='+$('input[name=\'NfName\']').val();return false;" />
<input type="submit" value="Save" />
</form>
<script type="text/javascript">
if(<?php if(isset($_SESSION['wizard']['edit_feed']))echo $_SESSION['wizard']['edit_feed'];else echo '0'; ?>){$('input[name="save_feed"]').attr('name','update_feed');$('input[type="submit"]').val('Update');}
$('h3').eq(-1).html('Feed Wizard | Step 4 - Edit Options <a href="info.htm#feed_wizard" target="_blank"><img alt="Help" title="Help" src="icn/question-frame.png"></img></a>').css('text-align','center');
$('[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"]').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() + ',' : ','): '';
});if($('input[name="article_source"]').val()!='')str=str+'article_source='+ $('input[name="article_source"]').val();
$('input[name="NfOptions"]').val(str);
});
</script>
<?php
}
elseif($_REQUEST['step']==3){
if(isset($_REQUEST['NfName']))$_SESSION['wizard']['feed']['feed_title']=$_REQUEST['NfName'];
if(isset($_REQUEST['NfArticleSection']))$_SESSION['wizard']['article_section']=$_REQUEST['NfArticleSection'];
if(isset($_REQUEST['article_selector']))$_SESSION['wizard']['article_selector']=$_REQUEST['article_selector'];
if(isset($_REQUEST['selected_feed']))$_SESSION['wizard']['selected_feed']=$_REQUEST['selected_feed'];
if(isset($_REQUEST['article_tags'])){
$_SESSION['wizard']['article_tags']=$_REQUEST['article_tags'];
}
if(isset($_REQUEST['html']))$_SESSION['wizard']['filter_tags']=$_REQUEST['html'];
if(isset($_REQUEST['NfOptions']))$_SESSION['wizard']['options']=$_REQUEST['NfOptions'];
if(isset($_REQUEST['NfLgID']))$_SESSION['wizard']['lang']=$_REQUEST['NfLgID'];
if(isset($_REQUEST['NfName']))$_SESSION['wizard']['feed']['feed_title']=$_REQUEST['NfName'];
if(!isset($_SESSION['wizard']['article_tags']))$_SESSION['wizard']['article_tags']='';
if(isset($_REQUEST['maxim']))$_SESSION['wizard']['maxim']=$_REQUEST['maxim'];
if(isset($_REQUEST['select_mode']))$_SESSION['wizard']['select_mode']=$_REQUEST['select_mode'];
if(isset($_REQUEST['hide_images']))$_SESSION['wizard']['hide_images']=$_REQUEST['hide_images'];
if(!isset($_SESSION['wizard']['select_mode']))$_SESSION['wizard']['select_mode']='';
if(!isset($_SESSION['wizard']['maxim']))$_SESSION['wizard']['maxim']=1;
if(!isset($_SESSION['wizard']['selected_feed']))$_SESSION['wizard']['selected_feed']=0;
if(!isset($_SESSION['wizard']['host2']))$_SESSION['wizard']['host2']='';
if(isset($_REQUEST['host_status']) and isset($_REQUEST['host_name'])){$host_name=$_REQUEST['host_name'];$_SESSION['wizard']['host'][$host_name]=$_REQUEST['host_status'];}
if(isset($_REQUEST['host_status2']) and isset($_REQUEST['host_name'])){$host_name=$_REQUEST['host_name'];$_SESSION['wizard']['host2'][$host_name]=$_REQUEST['host_status2'];}
$feed_len=count($_SESSION['wizard']['feed'])-2;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jquery.js" charset="utf-8"></script>
<script type="text/javascript" src="js/jquery.xpath.min.js" charset="utf-8"></script>
<script type="text/javascript" src="js/jq_feedwizard.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="<?php print_file_path('css/feed_wizard.css');?>" />
<style>
.lwt_selected_text
{
background-color:#FFFFFF;
color:#FFAAAA ! important;
}
.lwt_marked_text
{
background-color:rgb(111, 111, 111) ! important;color:rgb(170, 170, 170) ! important;
}
.lwt_highlighted_text
{
border-style:dashed ! important;
}
.delete_selection{
cursor:crosshair;
}
#lwt_last ~ *{
color:#000000;
position:static ! important;
cursor: pointer;
}
#lwt_last ~ * *{
color:#000000;
position:static ! important;
cursor: pointer;
}
.lwt_filtered_text
{
background-color:#FFFFFF ! important;color:#DDDDDD ! important;
cursor: default ! important;
}
</style>
<title>LWT :: Feed Wizard</title>
</head>
<body>
<script type="text/javascript">$(function(){<?php if($_SESSION['wizard']['hide_images']=='yes'){
echo '$("img").not($("#lwt_header").find("*")).css("display","none");';}?>
});filter_Array = [];
$(function(){ArticleSection='<?php echo str_replace ("'","\'",$_SESSION['wizard']['article_selector']); ?>';
$('#lwt_header').nextAll().find('*').addBack().not($(document).xpath(ArticleSection).find('*').addBack()).not($('#lwt_header').find('*').addBack()).each(function(){
$(this).addClass('lwt_filtered_text');filter_Array.push(this);
});
});
</script>
<div id="lwt_header"><form name="lwt_form1" class="validate" action="feed_wizard.php" method="post">
<div id="adv" style="display: none;">
<button onclick="$('#adv').hide();$('#lwt_last').css('margin-top',$('#lwt_header').height());return false;">Cancel</button>
<button id="adv_get_button">Get</button>
</div>
<div id="settings" style="display: none;"><p><b>Feed Wizard | Settings</b></p><div style="margin-left:150px;text-align:left">
Selection Mode: <select name="select_mode" onchange="$('*').removeClass('lwt_marked_text');$('*[class=\'\']').removeAttr( 'class' );$('#get_button').prop('disabled', true);$('#mark_action').empty();$('<option/>').val('').text('[Click On Text]').appendTo('#mark_action');return false;">
<option value="0"<?php if($_SESSION['wizard']['select_mode']=='0')echo ' selected';?>>Smart Selection</option>
<option value="all"<?php if($_SESSION['wizard']['select_mode']=='all')echo ' selected';?>>Get All Attributes</option>
<option value="adv"<?php if($_SESSION['wizard']['select_mode']=='adv')echo ' selected';?>>Advanced Selection</option>
</select><br />
Hide Images: <select name="hide_images" onchange="if($(this).val()=='no')$('img').not($('#lwt_header').find('*')).css('display','');else $('img').not($('#lwt_header').find('*')).css('display','none');return false;">
<option value="yes"<?php if($_SESSION['wizard']['hide_images']=='yes')echo ' selected';?>>Yes</option>
<option value="no"<?php if($_SESSION['wizard']['hide_images']=='no')echo ' selected';?>>No</option>
</select></div>
<button style="position:relative;left:150px;" onclick="$('#settings').hide();return false;">OK</button></div>
<div id="lwt_container"><?php echo_lwt_logo();?><b>Feed Wizard | Step 3 - Filter Text</b> <a href="info.htm#feed_wizard" target="_blank"><img alt="Help" title="Help" src="icn/question-frame.png"></img></a>
<ol id="lwt_sel" style="margin-left:77px"><?php echo $_SESSION['wizard']['filter_tags']; ?></ol>
<table class="tab1" style="margin-left:77px" cellspacing="0" cellpadding="5">
<tr><td class="td1" style="text-align:left">
Name: </td><td class="td1" style="text-align:left"><?php echo htmlspecialchars ($_SESSION['wizard']['feed']['feed_title'],ENT_COMPAT); ?></td></tr>
<tr><td class="td1" style="text-align:left">Newsfeed url: </td><td class="td1" style="text-align:left"><?php echo $_SESSION['wizard']['rss_url']; ?></td></tr>
<tr><td class="td1" style="text-align:left">Article Section: </td><td class="td1" style="text-align:left"><?php echo $_SESSION['wizard']['article_section']; ?></td></tr>
<tr><td class="td1" style="text-align:left">Article Source: </td><td class="td1" style="text-align:left"><?php echo $_SESSION['wizard']['feed']['feed_text'];if($_SESSION['wizard']['feed']['feed_text']=='')echo 'Webpage Link'; ?></td></tr>
</table></div>
<table style="width:100%;">
<tr><td>
<input type="button" value="Cancel" onclick="location.href='edit_feeds.php?del_wiz=1';return false;" />
</td><td>
<span>
<select name="selected_feed" style="width:250px;max-width:200px;" onchange="{var html = $('#lwt_sel').html();$('input[name=\'html\']').val(html);document.lwt_form1.submit();}">
<?php
$current_host='';
$current_status='';
for($i=0;$i<$feed_len;$i++){
$feed_host=parse_url($_SESSION['wizard']['feed'][$i]['link']);
$feed_host=$feed_host['host'];
if(!isset($_SESSION['wizard']['host2'][$feed_host]))$_SESSION['wizard']['host2'][$feed_host]='-';
echo '<option value="'.$i.'" title="'. $_SESSION['wizard']['feed'][$i]['title'] .'"';
if($i==$_SESSION['wizard']['selected_feed']){
echo ' selected="selected"';
$current_host=$feed_host;
$current_status=$_SESSION['wizard']['host2'][$feed_host];
}
echo '>'.((isset($_SESSION['wizard']['feed'][$i]['html'])||$i==$_SESSION['wizard']['selected_feed'])?('▸ '):('- ')).($i+1) .' '.$_SESSION['wizard']['host2'][$feed_host].' host: '.$feed_host.'</option>';
}
?>
</select>
<input type="hidden" name="host_name" value="<?php echo $current_host ?>" />
<?php if(count($_SESSION['wizard']['host'])>1){ ?>
<select id="host_status" name="host_status2"><option value=" - " <?php if($current_status==' - ')echo 'selected="selected"'; ?>> - </option><option value="☆" <?php if($current_status=='☆')echo 'selected="selected"'; ?>>☆</option><option value="★" <?php if($current_status=='★')echo 'selected="selected"'; ?>>★</option></select>
<?php } ?>
</span></td><td style="width:280px;text-align: right;">
<select name="mark_action" id="mark_action" ><option value="">[Click On Text]</option></select>
<button id="filter_button" name="button" disabled>Filter</button>
<img src="icn/wrench-screwdriver.png" title="Settings" alt="-" onclick="$('#settings').show();return false;" /></td><td>
<span>
<input type="button" value="Back" onclick="location.href='feed_wizard.php?step=2&article_tags=1&maxim='+ $('#maxim').val() +'&filter_tags='+encodeURIComponent($('#lwt_sel').html())+'&select_mode='+encodeURIComponent($('select[name=\'select_mode\']').val())+'&hide_images='+encodeURIComponent($('select[name=\'hide_images\']').val());return false;" />
<button id="next">Next</button>
</span></td><td style="width:63px"></td></tr></table>
<button style="position:absolute;right:10px;top:10px" onclick="$('#lwt_container').toggle();if($('#lwt_container').css('display')=='none'){$('input[name=\'maxim\']').val(0);}else{$('input[name=\'maxim\']').val(1);}$('#lwt_last').css('margin-top',$('#lwt_header').height());return false;">min/max</button>
<input type="hidden" id="filter_tags" name="filter_tags" disabled />
<input type="hidden" name="html" />
<input type="hidden" name="step" value="3" />
<input type="hidden" id="maxim" name="maxim" value="1" />
</form></div>
<?php
echo '<br /><p id="lwt_last"></p>';
$i=$_SESSION['wizard']['selected_feed'];
if(!isset($_SESSION['wizard']['feed'][$i]['html'])){
$a_feed[0]=$_SESSION['wizard']['feed'][$i];
$_SESSION['wizard']['feed'][$i]['html']=get_text_from_rsslink($a_feed,$_SESSION['wizard']['redirect'] . 'new','iframe!?!script!?!noscript!?!head!?!meta!?!link!?!style',get_nf_option($_SESSION['wizard']['options'],'charset'));
}
echo $_SESSION['wizard']['feed'][$i]['html'];
?>
<script type="text/javascript">
<?php
if($_SESSION['wizard']['maxim']==0){
?>
$(function(){
$('#lwt_container').hide();
$('#lwt_last').css('margin-top',$('#lwt_header').height());
if($('#lwt_container').css('display')=='none'){$('input[name=\'maxim\']').val(0);}
else{$('input[name=\'maxim\']').val(1);}
});
<?php
}
?>
</script>
<?php
}
elseif($_REQUEST['step']==2){
if(isset($_REQUEST['edit_feed']) && !isset($_SESSION['wizard'])){
$_SESSION['wizard']['edit_feed']=$_REQUEST['edit_feed'];
$result = do_mysqli_query("SELECT * FROM " . $tbpref . "newsfeeds WHERE NfID=".$_REQUEST['edit_feed']);
$row = mysqli_fetch_assoc($result);
mysqli_free_result($result);
$_SESSION['wizard']['rss_url']=$row['NfSourceURI'];
$article_tags=explode('|',str_replace('!?!','|',$row['NfArticleSectionTags']));
$_SESSION['wizard']['article_tags']='';
foreach($article_tags as $tag){
if(substr_compare(trim($tag), "redirect", 0, 8)==0){
$_SESSION['wizard']['redirect']=trim($tag).' | ';
}
else $_SESSION['wizard']['article_tags'].='<li style="text-align: left"><img class="delete_selection" src="icn/cross.png" title="Delete Selection" alt="-" />'.$tag.'</li>';
}
$filter_tags=explode('|',str_replace('!?!','|',$row['NfFilterTags']));
$_SESSION['wizard']['filter_tags']='';
foreach($filter_tags as $tag){
if(trim($tag)!='')
$_SESSION['wizard']['filter_tags'].='<li style="text-align: left"><img class="delete_selection" src="icn/cross.png" title="Delete Selection" alt="-" />'.$tag.'</li>';
}
$_SESSION['wizard']['feed']=get_links_from_new_feed($row['NfSourceURI']);
if(empty($_SESSION['wizard']['feed'])){
unset($_SESSION['wizard']['feed']);
header("Location: feed_wizard.php?step=1&err=1");
exit();
}
$_SESSION['wizard']['feed']['feed_title']=$row['NfName'];
$_SESSION['wizard']['options']=$row['NfOptions'];
if(empty($_SESSION['wizard']['feed']['feed_text'])){
$_SESSION['wizard']['feed']['feed_text']='';
$_SESSION['wizard']['detected_feed']='Detected: «Webpage Link»';
}
$_SESSION['wizard']['lang']=$row['NfLgID'];
if($_SESSION['wizard']['feed']['feed_text']!=''){
$_SESSION['wizard']['detected_feed']='Detected: «'.$_SESSION['wizard']['feed']['feed_text'] .'»';
}
else $_SESSION['wizard']['detected_feed']='Detected: «Webpage Link»';
if($_SESSION['wizard']['feed']['feed_text']!=get_nf_option($_SESSION['wizard']['options'],'article_source')){
$source=get_nf_option($_SESSION['wizard']['options'],'article_source');
$_SESSION['wizard']['feed']['feed_text']=$source;
$feed_len=count($_SESSION['wizard']['feed'])-2;
for ($i=0;$i<$feed_len;$i++){
$_SESSION['wizard']['feed'][$i]['text']=$_SESSION['wizard']['feed'][$i][$source];
}
}
}
else if(isset($_REQUEST['rss_url'])){
if(!isset($_SESSION['wizard']) || empty($_SESSION['wizard']['feed'])||$_REQUEST['rss_url']!==$_SESSION['wizard']['rss_url']){
$_SESSION['wizard']['feed']=get_links_from_new_feed($_REQUEST['rss_url']);
$_SESSION['wizard']['rss_url']=$_REQUEST['rss_url'];
if(empty($_SESSION['wizard']['feed'])){
unset($_SESSION['wizard']['feed']);
header("Location: feed_wizard.php?step=1&err=1");
exit();
}
if(!isset($_SESSION['wizard']['article_tags']))$_SESSION['wizard']['article_tags']='';
if(!isset($_SESSION['wizard']['filter_tags']))$_SESSION['wizard']['filter_tags']='';
if(!isset($_SESSION['wizard']['options']))$_SESSION['wizard']['options']='edit_text=1';
if(!isset($_SESSION['wizard']['lang']))$_SESSION['wizard']['lang']='';
if($_SESSION['wizard']['feed']['feed_text']!=''){
$_SESSION['wizard']['detected_feed']='Detected: «'.$_SESSION['wizard']['feed']['feed_text'] .'»';
}
else $_SESSION['wizard']['detected_feed']='Detected: «Webpage Link»';
}
}
if(isset($_REQUEST['filter_tags']))$_SESSION['wizard']['filter_tags']=$_REQUEST['filter_tags'];
if(isset($_REQUEST['selected_feed']))$_SESSION['wizard']['selected_feed']=$_REQUEST['selected_feed'];
if(isset($_REQUEST['maxim']))$_SESSION['wizard']['maxim']=$_REQUEST['maxim'];
if(!isset($_SESSION['wizard']['maxim']))$_SESSION['wizard']['maxim']=1;
if(isset($_REQUEST['select_mode']))$_SESSION['wizard']['select_mode']=$_REQUEST['select_mode'];
if(!isset($_SESSION['wizard']['select_mode']))$_SESSION['wizard']['select_mode']='0';
if(isset($_REQUEST['hide_images']))$_SESSION['wizard']['hide_images']=$_REQUEST['hide_images'];
if(!isset($_SESSION['wizard']['hide_images']))$_SESSION['wizard']['hide_images']='yes';
if(!isset($_SESSION['wizard']['redirect']))$_SESSION['wizard']['redirect']='';
if(!isset($_SESSION['wizard']['selected_feed']))$_SESSION['wizard']['selected_feed']=0;
if(!isset($_SESSION['wizard']['host']))$_SESSION['wizard']['host']='';
if(isset($_REQUEST['host_status']) && isset($_REQUEST['host_name'])){$host_name=$_REQUEST['host_name'];$_SESSION['wizard']['host'][$host_name]=$_REQUEST['host_status'];}
$feed_len=count($_SESSION['wizard']['feed'])-2;
if(isset($_REQUEST['NfName']))$_SESSION['wizard']['feed']['feed_title']=$_REQUEST['NfName'];
if(isset($_REQUEST['NfArticleSection']) && ($_REQUEST['NfArticleSection']!=$_SESSION['wizard']['feed']['feed_text'])){
$_SESSION['wizard']['feed']['feed_text']=$_REQUEST['NfArticleSection'];
$source=$_SESSION['wizard']['feed']['feed_text'];
for ($i=0;$i<$feed_len;$i++){
if($_SESSION['wizard']['feed']['feed_text']!=''){
$_SESSION['wizard']['feed'][$i]['text']=$_SESSION['wizard']['feed'][$i][$source];
}
else unset($_SESSION['wizard']['feed'][$i]['text']);
unset($_SESSION['wizard']['feed'][$i]['html']);
}
$_SESSION['wizard']['host']='';
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jquery.js" charset="utf-8"></script>
<script type="text/javascript" src="js/jquery.xpath.min.js" charset="utf-8"></script>
<script type="text/javascript" src="js/jq_feedwizard.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="<?php print_file_path('css/feed_wizard.css');?>" />
<style>
.lwt_selected_text
{
background-color:#00FF00;color:#FF0000;
}
.lwt_marked_text
{
background-color:#FFFF66;color:#003070;
}
.lwt_highlighted_text
{
border-style:dashed ! important;
}
.delete_selection{
cursor:crosshair;
}
#lwt_last ~ *{
position:static ! important;
cursor: pointer;
}
#lwt_last ~ * *{
position:static ! important;
cursor: pointer;
}
</style>
<title>LWT :: Feed Wizard</title>
</head>
<body>
<script type="text/javascript">
$(function(){<?php if($_SESSION['wizard']['hide_images']=='yes'){
echo '$("img").not($("#lwt_header").find("*")).css("display","none");';}?>
});filter_Array = [];
</script>
<div id="lwt_header"><form name="lwt_form1" class="validate" action="feed_wizard.php" method="post">
<div id="adv" style="display: none;">
<button onclick="$('#adv').hide();$('#lwt_last').css('margin-top',$('#lwt_header').height());return false;">Cancel</button>
<button id="adv_get_button">Get</button>
</div>
<div id="settings" style="display: none;"><p><b>Feed Wizard | Settings</b></p><div style="margin-left:150px;text-align:left">
Selection Mode: <select name="select_mode" onchange="$('*').removeClass('lwt_marked_text');$('*[class=\'\']').removeAttr( 'class' );$('#get_button').prop('disabled', true);$('#mark_action').empty();$('<option/>').val('').text('[Click On Text]').appendTo('#mark_action');return false;">
<option value="0"<?php if($_SESSION['wizard']['select_mode']=='0')echo ' selected';?>>Smart Selection</option>
<option value="all"<?php if($_SESSION['wizard']['select_mode']=='all')echo ' selected';?>>Get All Attributes</option>
<option value="adv"<?php if($_SESSION['wizard']['select_mode']=='adv')echo ' selected';?>>Advanced Selection</option>
</select><br />
Hide Images: <select name="hide_images" onchange="if($(this).val()=='no')$('img').not($('#lwt_header').find('*')).css('display','');else $('img').not($('#lwt_header').find('*')).css('display','none');return false;">
<option value="yes"<?php if($_SESSION['wizard']['hide_images']=='yes')echo ' selected';?>>Yes</option>
<option value="no"<?php if($_SESSION['wizard']['hide_images']=='no')echo ' selected';?>>No</option>
</select></div>
<button style="position:relative;left:150px;" onclick="$('#settings').hide();return false;">OK</button></div>
<div id="lwt_container"><?php echo_lwt_logo();?><b>Feed Wizard | Step 2 - Select Article Text</b> <a href="info.htm#feed_wizard" target="_blank"><img alt="Help" title="Help" src="icn/question-frame.png"></img></a>
<ol id="lwt_sel" style="margin-left:77px"><?php if(isset($_REQUEST['html']))echo $_REQUEST['html'];if(isset($_REQUEST['article_tags']) || isset($_REQUEST['edit_feed']))echo $_SESSION['wizard']['article_tags']; ?></ol>
<table class="tab1" style="margin-left:77px" cellspacing="0" cellpadding="5">
<tr><td class="td1" style="text-align:left">
Name: </td><td class="td1"><input class="notempty" size="50" type="text" name="NfName" value="<?php echo htmlspecialchars ($_SESSION['wizard']['feed']['feed_title'],ENT_COMPAT); ?>" /><img src="icn/status-busy.png" title="Field must not be empty" alt="Field must not be empty" /></td></tr>
<tr><td class="td1" style="text-align:left">Newsfeed url: </td><td class="td1" style="text-align:left"><?php echo $_SESSION['wizard']['rss_url']; ?></td></tr>
<tr><td class="td1" style="text-align:left">Article Source: </td>
<td class="td1" style="text-align:left"><select name="NfArticleSection" onchange="{var html = $('#lwt_sel').html();$('input[name=\'html\']').val(html);document.lwt_form1.submit();}"><option value=""<?php if($_SESSION['wizard']['feed']['feed_text']=='')echo ' selected="selected"'; ?>>Webpage Link</option><?php $sources=array('description','encoded','content');foreach($sources as $source){ if(isset($_SESSION['wizard']['feed'][0][$source])){echo '<option value="'.$source.'"';if($_SESSION['wizard']['feed']['feed_text']==$source)echo ' selected="selected"';echo '>'. $source .'</option>';}} ?></select>
<?php echo '('.$_SESSION['wizard']['detected_feed'].')'; ?></td></tr>
</table></div>
<table style="width:100%;">
<tr><td>
<input type="hidden" name="rss_url" value="<?php echo $_SESSION['wizard']['rss_url']; ?>" />
<input type="button" value="Cancel" onclick="location.href='edit_feeds.php?del_wiz=1';return false;" />
</td><td><span>
<select name="selected_feed" style="width:250px;max-width:200px;" onchange="{var html = $('#lwt_sel').html();$('input[name=\'html\']').val(html);document.lwt_form1.submit();}">
<?php
$current_host='';
$current_status='';
for($i=0;$i<$feed_len;$i++){
$feed_host=parse_url($_SESSION['wizard']['feed'][$i]['link']);
$feed_host=$feed_host['host'];
if(!isset($_SESSION['wizard']['host'][$feed_host]))$_SESSION['wizard']['host'][$feed_host]='-';
echo '<option value="'.$i.'" title="'. $_SESSION['wizard']['feed'][$i]['title'] .'"';
if($i==$_SESSION['wizard']['selected_feed']){
echo ' selected="selected"';
$current_host=$feed_host;
$current_status=$_SESSION['wizard']['host'][$feed_host];
}
echo '>'.((isset($_SESSION['wizard']['feed'][$i]['html'])||$i==$_SESSION['wizard']['selected_feed'])?('▸ '):('- ')).($i+1) .' '.$_SESSION['wizard']['host'][$feed_host].' host: '.$feed_host.'</option>';
}
?>
</select>
<input type="hidden" name="host_name" value="<?php echo $current_host ?>" />
<?php if(count($_SESSION['wizard']['host'])>1){ ?>
<select id="host_status" name="host_status"><option value=" - " <?php if($current_status==' - ')echo 'selected="selected"'; ?>> - </option><option value="☆" <?php if($current_status=='☆')echo 'selected="selected"'; ?>>☆</option><option value="★" <?php if($current_status=='★')echo 'selected="selected"'; ?>>★</option></select>
<?php } ?>
</span>
</td><td style="width:270px;text-align: right;"><select name="mark_action" id="mark_action" ><option value="">[Click On Text]</option></select>
<button id="get_button" name="button" disabled>Get</button>
<img src="icn/wrench-screwdriver.png" title="Settings" alt="-" onclick="$('#settings').show();return false;" /></td><td>
<span><input type="button" value="Back" onclick="location.href='feed_wizard.php?step=1&select_mode='+encodeURIComponent($('select[name=\'select_mode\']').val())+'&hide_images='+encodeURIComponent($('select[name=\'hide_images\']').val());return false;" />
<button id="next">Next</button>
</span></td><td style="width:63px"></td></tr></table>
<button style="position:absolute;right:10px;top:10px" onclick="$('#lwt_container').toggle();if($('#lwt_container').css('display')=='none'){$('input[name=\'maxim\']').val(0);}else{$('input[name=\'maxim\']').val(1);}$('#lwt_last').css('margin-top',$('#lwt_header').height());return false;">min/max</button>
<input type="hidden" name="step" value="2" />
<input type="hidden" name="html" />
<input type="hidden" id="article_tags" name="article_tags" disabled />
<input type="hidden" name="maxim" value="1" />
</form></div>
<?php
echo '<br /><p id="lwt_last"></p>';
$i=$_SESSION['wizard']['selected_feed'];
if(!isset($_SESSION['wizard']['feed'][$i]['html'])){
$a_feed[0]=$_SESSION['wizard']['feed'][$i];
$_SESSION['wizard']['feed'][$i]['html']=get_text_from_rsslink($a_feed,$_SESSION['wizard']['redirect'] . 'new','iframe!?!script!?!noscript!?!head!?!meta!?!link!?!style',get_nf_option($_SESSION['wizard']['options'],'charset'));
}
echo $_SESSION['wizard']['feed'][$i]['html'];
?>
<script type="text/javascript">
<?php
if($_SESSION['wizard']['maxim']==0){
?>
$(function(){
$('#lwt_container').hide();$('#lwt_last').css('margin-top',$('#lwt_header').height());
if($('#lwt_container').css('display')=='none'){$('input[name=\'maxim\']').val(0);}
else{$('input[name=\'maxim\']').val(1);}
});
<?php
}
?>
</script>
<?php
}
else{
if(isset($_REQUEST['select_mode']))$_SESSION['wizard']['select_mode']=$_REQUEST['select_mode'];
if(isset($_REQUEST['hide_images']))$_SESSION['wizard']['hide_images']=$_REQUEST['hide_images'];
pagestart('Feed Wizard',false);
if(isset($_REQUEST['err']))echo '<div class="red"><p>+++ ERROR: PLEASE CHECK YOUR NEWSFEED URI!!! +++</p></div>';
?>
<form class="validate" action="feed_wizard.php" method="post">
<table class="tab1" cellspacing="0" cellpadding="5">
<tr><td class="td1">Feed URI: </td>
<td class="td1"><input class="notempty" style="width:90%" type="text" name="rss_url" <?php if(isset($_SESSION['wizard']['rss_url']))echo 'value="' . $_SESSION['wizard']['rss_url'] .'" ';?>/> <img src="icn/status-busy.png" title="Field must not be empty" alt="Field must not be empty" />
</td></tr></table>
<input type="hidden" name="step" value="2" />
<input type="hidden" name="selected_feed" value="0" />
<input type="hidden" name="article_tags" value="1" />
<input type="button" value="Cancel" onclick="location.href='edit_feeds.php?del_wiz=1';return false;" />
<button>Next</button>
</form>
<script type="text/javascript">
$('h3').eq(-1).html('Feed Wizard | Step 1 - Insert Newsfeed URI <a href="info.htm#feed_wizard" target="_blank"><img alt="Help" title="Help" src="icn/question-frame.png"></img></a>').css('text-align','center');
</script>
<?php
}
pageend();
?>