PHPBB independent.co.uk BOT
independent.co.uk haber sitesinden ingilizce olarak haber içeriklerini
almanıza ve phpbb de belirlediğiniz foruma başlık açmayı sağlayan bot.
function getData($data,$startTag,$finishTag){
$data= explode($startTag,$data);
$data= $data[1];
$data= explode($finishTag,$data);
$data= $data[0];
return $data;
}
$site = "http://www.independent.co.uk/googlenewssitemap";
$data = file_get_contents($site);
preg_match_all('/<url>.*?>.*?<\/url>/si', $data, $download);
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpbb_admin_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup('common');
$gname = request_var('gname', '');
$steamid = request_var('steamid', '');
$realname = request_var('realname', '');
$age = request_var('age', '');
$gender = request_var('gender', '');
$location = request_var('location', '');
$games = request_var('games', '');
$often = request_var('often', '');
$ever = request_var('ever', '');
$why = request_var('why', '');
$offer = request_var('offer', '');
$willing = request_var('willing', '');
$active = request_var('active', '');
$other = request_var('other', '');
foreach($download as $d)
{
$toplam = count ($d);
for ($i = 0; $i <= $toplam; $i++) {
$sitegelen= getData($d[$i],'<loc>','</loc>');
$verim = file_get_contents($sitegelen);
$baslik= getData($verim,'"headline": "','"');
$spot= getData($verim,'"description": "','"');
$resim_kaynak= getData($verim,'"image":','"width"');
$resim = getData($resim_kaynak,'"url": "','"');
$detay= getData($verim,'<div class="body-content">','<aside class="tags">');
$detay = strip_tags($detay);
$detay = nl2br($detay);
$detay = str_replace('<br />', '', $detay);
$detay = str_replace(' ', ' ', $detay);
$message = "[img]".$resim."[/img]".$detay;
$forum = 18; //hangi forumda olacağını burdaki id ile belirliyorsunuz
$time = time();
$rawsubject =$baslik; // Konu Başlığı
$my_subject = utf8_normalize_nfc($rawsubject, '', true);
$my_text = utf8_normalize_nfc($message, '', true);
$poll = $uid = $bitfield = $options = '';
generate_text_for_display($my_subject, $uid, $bitfield, $options, false, false, false);
generate_text_for_storage($my_text, $uid, $bitfield, $options, true, true, true);
$data = array(
'forum_id' => $forum,
'icon_id' => false,
'enable_bbcode' => true,
'enable_smilies' => true,
'enable_urls' => true,
'enable_sig' => true,
'message' => $my_text,
'message_md5' => md5($my_text),
'bbcode_bitfield' => $bitfield,
'bbcode_uid' => $uid,
'post_edit_locked' => 0,
'topic_title' => $my_subject,
'notify_set' => false,
'notify' => false,
'post_time' => 0,
'forum_name' => '',
'enable_indexing' => true,
);
submit_post('post', $my_subject, $user->data['username'], POST_NORMAL, $poll, $data);
$redirect_url = append_sid("{$phpbb_root_path}/viewforum.$phpEx?f=$forum", false, true, $user->session_id);
meta_refresh(2, $redirect_url);
}
}
trigger_error('Message Posted' . '<br /><br />Taking you back to the forum ' . sprintf('<a href="' . $redirect_url . '">', '</a>'));
Yorumlar