Modyfikacja do SMF 2 - posty na flakera
: 04 lis 2013, 16:28
Szukam rozwiązania,ktore pozwoli w SMF 2 wysyłać posty na flakera,wiecie takie cos z Social,
na forum SMF temat echo,nie tylko moj.
na forum SMF temat echo,nie tylko moj.
Forum dla administratorów stron WWW i developerów
https://www.adminzone.pl/
function createPost(&$msgOptions, &$topicOptions, &$posterOptions)
{
$context = stream_context_create([
'http' => [
'header' => 'Content-type: application/x-www-form-urlencoded; Authorization: Basic ' . base64_encode('login:haslo'),
'content' => http_build_query([
'text' => 'tekst...',
'link' => 'link do tematu/postu'
]),
'timeout' => 0.5,
'ignore_errors' => true
]
]);
file_get_contents('http://api.flaker.pl/api/type:submit', false, $context);
$context = stream_context_create([
'http' => [
'header' => 'Content-type: application/x-www-form-urlencoded; Authorization: Basic ' . base64_encode('login:haslo'),
'content' => http_build_query([
'text' => $msgOptions['body'],
'link' => $scripturl . '?topic=' . $topicOptions['id']
]),
'timeout' => 0.5,
'ignore_errors' => true
]
]);
file_get_contents('http://api.flaker.pl/api/type:submit', false, $context);
function createPost(&$msgOptions, &$topicOptions, &$posterOptions)
{
global $user_info, $txt, $modSettings, $smcFunc, $context;
function createPost(&$msgOptions, &$topicOptions, &$posterOptions)
{
global $user_info, $txt, $modSettings, $smcFunc, $context, $scripturl;
// Insert a new topic (if the topicID was left empty.)
if ($new_topic)
{
$smcFunc['db_insert']('',
'{db_prefix}topics',
array(
'id_board' => 'int', 'id_member_started' => 'int', 'id_member_updated' => 'int', 'id_first_msg' => 'int',
'id_last_msg' => 'int', 'locked' => 'int', 'is_sticky' => 'int', 'num_views' => 'int',
'id_poll' => 'int', 'unapproved_posts' => 'int', 'approved' => 'int',
),
array(
$topicOptions['board'], $posterOptions['id'], $posterOptions['id'], $msgOptions['id'],
$msgOptions['id'], $topicOptions['lock_mode'] === null ? 0 : $topicOptions['lock_mode'], $topicOptions['sticky_mode'] === null ? 0 : $topicOptions['sticky_mode'], 0,
$topicOptions['poll'] === null ? 0 : $topicOptions['poll'], $msgOptions['approved'] ? 0 : 1, $msgOptions['approved'],
),
array('id_topic')
);
$topicOptions['id'] = $smcFunc['db_insert_id']('{db_prefix}topics', 'id_topic');
$context = stream_context_create([
'http' => [
'header' => 'Content-type: application/x-www-form-urlencoded; Authorization: Basic ' . base64_encode('login:haslo'),
'content' => http_build_query([
'text' => $msgOptions['body'],
'link' => $scripturl . '?topic=' . $topicOptions['id']
]),
'timeout' => 0.5,
'ignore_errors' => true
]
]);
file_get_contents('http://api.flaker.pl/api/type:submit', false, $context);
base64_encode('login:haslo')