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
|
<?php
define('IN_MYBB', true);
define('THIS_SCRIPT', "newthread.php");
global $current_page, $fid, $forum, $plugins, $cache, $_FILES, $mybb;
$fid = 50;
$current_page = "newthread.php";
$mybb->request_method = "post";
include 'global.php';
require_once MYBB_ROOT."inc/functions.php";
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/functions_user.php";
require_once MYBB_ROOT."inc/functions_indicators.php";
require_once MYBB_ROOT."inc/datahandlers/post.php";
$forum = get_forum($fid);
xthreads_gettfcache($fid);
foreach (glob("new_photos/*.txt") as $filename)
{
$data = unserialize(file_get_contents($filename));
$new_thread = array(
"fid" => $fid,
"xthreads_gal_cat" => $data['category'],
"xtasel_gal_img" => "url",
#"xthreads_gal_img" => 1,
"action" => "do_newthread",
"xtaurl_gal_img" => "file://" . $data['id'] .".".$data['ext'],
"subject" => $data['title'],
"icon" => -1,
"uid" => 878,
"username" => "Importer fotek",
"message" => $data['desc'],
"ipaddress" => get_ip(),
"posthash" => md5("878".random_str()),
'savedraft' => 0
);
$mybb->input = &$new_thread;
$plugins->run_hooks("newthread_do_newthread_start");
$posthandler = new PostDataHandler("insert");
$posthandler->action = "thread";
$posthandler->set_data($new_thread);
if($posthandler->validate_thread()) { $posthandler->insert_thread(); } else {var_dump($posthandler->get_errors());}
$plugins->run_hooks("newthread_do_newthread_end");
}
?>
|