/
collect.php
92 lines (84 loc) · 1.89 KB
/
collect.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
<?php
/*
[CYASK] (C)2007 Cyask.com QQ: 240508015
Revision: 3.0.0 for Discuz
Date: 2007/4/23
*/
define('CURSCRIPT', 'collect');
error_reporting(7);
require_once ('./include/common.inc.php');
$title=$site_name;
if(!$cyask_uid)
{
$url=get_referer();
show_message('user_nologin', '');
exit;
}
if($command=='collect')
{
if(check_submit($_POST['collectsubmit'], $_POST['formhash']))
{
$collect_url=trim($_POST['collect_url']);
$collect_title=trim($_POST['collect_title']);
$collect_content=empty($_POST['content']) ? '' : filters_content($_POST['content']);
$sortname=$_POST['sortname'];
$ctype=$_POST['ctype'];
$public=$_POST['public'];
$dblink->query("INSERT INTO {$dbprefix}collect SET uid=$cyask_uid,username='$cyask_user',sortname='$sortname',ctype='$ctype',title='$collect_title',content='$collect_content',url='$collect_url',public='$public',collecttime='$timestamp'");
$url=$_POST['url'];
show_message('collect_succeed', $url);
exit;
}
else
{
show_message('url_error', './');
exit;
}
}
else
{
$url=get_referer();
$neturl=empty($_POST['neturl']) ? trim($_GET['neturl']) : trim($_POST['neturl']);
$collect_url=empty($neturl) ? $url : $neturl;
$contents = '';
if($fid=@fopen($collect_url,"r"))
{
do
{
$data = fread($fid, 4096);
if (strlen($data) == 0)
{
break;
}
$contents .= $data;
}
while(true);
fclose($fid);
}
else
{
show_message('collect_url_error', '');
exit;
}
if(preg_match('/< *title *>(.*?)< *\/ *title *>/is',$contents,$titles))
{
$collect_title = trim($titles[1]);
}
else
{
$collect_title = '';
}
if($neturl)
{
$collect_content = trim($contents);
$collect_content =cut_tags($collect_content);
$collect_content =htmlspecialchars($collect_content);
}
else
{
$contents = '';
}
include template('collect_edit');
exit;
}
?>