-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloader.php
More file actions
93 lines (78 loc) · 2.15 KB
/
Copy pathloader.php
File metadata and controls
93 lines (78 loc) · 2.15 KB
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
<?php
include_once('bootstrap.php');
include_once('config.php');
include_once('twitter/client.php');
include_once('database/mysql/connection.php');
$twitter = new TwitterClient(
$twitLogin,
$twitPass,
$twitEncoding
);
$db = new DatabaseMysqlConnection(
$twitDb['host'],
$twitDb['user'],
$twitDb['pw'],
$twitDb['db']
);
$dbHelper = $db->getHelper();
$ids = $dbHelper->createDictionary(
$twitTable,
'twitId'
);
$twits = $twitter->getSearchResult('umarafon', 20);
$count = 0;
foreach ($twits as $i => $twit)
{
$text = strip_tags($twit->getText());
if (!isset($ids[$twit->getId()]))
{
$ban = array(
'herovina',
'404ok',
'404fest',
);
$isOk = true;
$userName = $twit->getFrom()->getName();
foreach ($ban as $i => $banName)
{
if (false === stripos($userName, $banName))
{
}
else
{
$isOk = false;
break;
}
}
if ($isOk)
{
if (preg_match('(^(.+?) \((.+?)\)$)', $userName, $userNameParts))
{
$messagePrepend = sprintf(
'<a href="http://twitter.com/%s">%s</a>: ',
$userNameParts[1],
$userNameParts[2]
);
}
else
{
$messagePrepend = null;
}
$item = array(
'crdate' => $twit->getDate('Y-m-d H:i:s'),
'name' => substr($text, 0, 50) . (strlen($text) > 50 ? '...' : ''),
'annot' => $messagePrepend . $twit->getText(),
'descr' => null,
'isHidden' => $text{0} == '@' ? true : false,
'twitId' => $twit->getId(),
'twitUrl' => $twit->getUrl()
);
$dbHelper->insertItem(
$twitTable,
$item
);
++$count;
}
}
}
printf('Èìïîðòèðîâàíî òâèòîâ: %d<br/>', $count);