Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Adding threads with xThreads fields (file0 with PHP
Victor Offline
Junior Member
**
Posts: 6
Joined: Aug 2012
Post: #5
RE: Adding threads with xThreads fields (file0 with PHP
uploads/xthreads_ul/admindrop (i've read in documentation) contains 1.jpg file.

PHP Code:
"xtaurl_gal_img" => "file://1.jpg"


Still not working...

Actual version of script:

PHP Code:
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));

	// Set the thread data that came from the input to the $thread array.
	$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");
}
?>


Quote:array(1) { ["threadfield_required__0"]=> array(2) { ["error_code"]=> string(23) "threadfield_required__0" ["data"]=> string(8) "Zdjęcie" } }
(This post was last modified: 11-15-2012 01:33 AM by Victor.)
11-15-2012 01:26 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
RE: Adding threads with xThreads fields (file0 with PHP - Victor - 11-15-2012 01:26 AM

 Standard Tools
Forum Jump: