PHPBB brightside.me Yandex Translate BOT
Yandex translate kullanarak başlıkları türkçeye çevirmek ve phpbb ye açmak.
$api = ‘<yandex api kod>’; yandex api kodu
$api = ‘<yandex api kod>’; yandex api kodu
set_time_limit(0);
function getData($data,$startTag,$finishTag){
$data= explode($startTag,$data);
$data= $data[1];
$data= explode($finishTag,$data);
$data= $data[0];
return $data;
}
$site = "http://brightside.me/thebest/page1/";
$data = file_get_contents($site);
preg_match_all('/<h3 class="al-title">.*?>.*?<\/h3>/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', '');
$forum = 18; //hangi forumda olacağını burdaki id ile belirliyorsunuz
$time = time();
foreach($download as $d)
{
$toplam = 5;
for ($s = 0; $s <= $toplam; $s++) {
$sitegelen= getData($d[$s],'href="','"');
$sitegelen='http://www.brightside.me'.$sitegelen;
$verim = file_get_contents($sitegelen);
$baslik= getData($verim,'<meta property="og:title" content="','" />');
preg_match_all('/<div id=".*?>.*?<\/span>/si', $verim, $gc);
$text = trim($baslik);
$text = str_replace(' ','%20',$text);
$api = '<yandex api kod>';
$url1 = "https://translate.yandex.net/api/v1.5/tr.json/translate?key=$api&lang=en-tr&text=$text";
$url = file_get_contents($url1);
$json = json_decode($url);
$baslik_tr = $json->text[0];
$rawsubject =$baslik_tr; // Konu Başlığı
foreach($gc as $a)
{
$toplama = count($a);
$message = '';
for ($i = 1; $i <= $toplama; $i++) {
$message .= "[img]".getData($a[$i],'<img src="','"')."[/img]";
}
$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