-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcopyforum.php
74 lines (55 loc) · 1.55 KB
/
copyforum.php
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'fetchnews.php');
define("IN_SYNCOM", 1);
$basepath = dirname($_SERVER["SCRIPT_FILENAME"]);
require_once $basepath."/../global.php";
require MYBB_ROOT.'/syncom/config.php';
require_once "mybbapi.php";
global $db, $syncom;
$query = $db->simple_select("alt_forums", "*", "");
while ($forum = $db->fetch_array($query)) {
echo $forum['forum_name']."\r\n";
$data = array("fid" => $forum['forum_id'],
"name" => $forum['forum_name'],
"description" => $forum['forum_desc'],
"pid" => $forum['parent_id'],
"syncom_newsgroup" => $forum['newsgroup'],
"active" => 1,
"open" => 1,
"allowmycode" => 1,
"allowsmilies" => 1,
"allowimgcode" => 1,
"allowvideocode" => 1,
"allowpicons" => 1,
"allowtratings" => 1,
"status" => 1,
"usepostcounts" => 1,
"showinjump" => 1,
);
if ($forum['forum_type'] == 0)
$data['type'] = 'c';
else
$data['type'] = 'f';
//print_r($data);
$db->insert_query("forums", $data);
}
$query = $db->simple_select("forums", "*", "parentlist = ''");
while ($forum = $db->fetch_array($query)) {
echo $forum['name'];
$parent = '';
//if ($forum['pid'] != 0)
// $parent = $forum['pid'].',';
$parent .= $forum['fid'];
$pid = $forum['pid'];
while ($pid != 0) {
$query2 = $db->simple_select("forums", "*", "fid = ".$pid);
if ($forum2 = $db->fetch_array($query2)) {
$parent = $forum2['fid'].','.$parent;
$pid = $forum2['pid'];
}
}
echo " - ".$parent."\n";
$db->update_query("forums", array('parentlist'=>$parent), "fid=".$forum['fid']);
}
?>