-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnews.phpbb.php
More file actions
96 lines (70 loc) · 2.8 KB
/
news.phpbb.php
File metadata and controls
96 lines (70 loc) · 2.8 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
94
95
96
<?php
/*
* ==============================================================================
* Disney MMORPG News Parser - Post to PHPBB
*
* For DisneyMMO.com
* By Zach Knickerbocker
* ==============================================================================
*
* Coordinates posting of news articles to PHPBB.
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../../public_html/community/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
// Includes.
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
// Start session management.
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// Authenticate as a new user.
$sql= 'SELECT u.* FROM '. USERS_TABLE . ' u WHERE u.user_id = ' . $scraper_config['userid'];
$result= $db->sql_query($sql);
// Populate user data with fetched data.
if ($row= $db->sql_fetchrow($result)) {
foreach($row as $k1 => $v1) {
if(isset($user->data[$k1])) {
$user->data[$k1] = $v1;
}
}
};
$db->sql_freeresult($result);
$auth->acl($user->data); // permissions
function postArticlesToPHPBB($scraper_config, $new_articles) {
// Post articles to PHPBB.
foreach($new_articles as $new_article) {
// Note that multibyte support is enabled here.
$subject = utf8_normalize_nfc(request_var('subject', $new_article['title'], true));
$text = utf8_normalize_nfc(request_var('text', $new_article['body'], true));
// Variables to hold the parameters for submit_post.
$poll = $uid = $bitfield = $options = '';
generate_text_for_storage($subject, $uid, $bitfield, $options, false, false, false);
generate_text_for_storage($text, $uid, $bitfield, $options, true, true, true);
$data = array(
'forum_id' => $scraper_config['forumid'],
'icon_id' => false,
'enable_bbcode' => true,
'enable_smilies' => true,
'enable_urls' => true,
'enable_sig' => true,
'message' => $text,
'message_md5' => md5($text),
'bbcode_bitfield' => $bitfield,
'bbcode_uid' => $uid,
'post_edit_locked' => 0,
'topic_title' => $subject,
'notify_set' => false,
'notify' => false,
'post_time' => 0,
'forum_name' => '',
'enable_indexing' => true,
);
// Create the actual post on PHPBB.
submit_post('post', $subject, '', POST_NORMAL, $poll, $data);
// Sleep for a short while to prevent out of order posting.
sleep(5);
}
}
?>