Minor display cleanup
[mirrors/Kyberia-bloodline.git] / scripts / forum2node.php
1 <?php
2 //requiring main config file with path/database etc. constants
3 require('../config/config.inc');
4
5 //connecting to database and creating universal $db object
6 require(SYSTEM_ROOT.'/inc/log.inc');
7 require(SYSTEM_ROOT.'/inc/database.inc');
8 require(SYSTEM_ROOT.'/inc/nodes.inc');
9 $db=new CLASS_DATABASE();
10 $db_old=new CLASS_DATABASE("kyberia","kyberia","cyb3ry","127.0.0.1");
11
12 $q="select forum.*,forum_info.*,forum.forum_id as forum_id from forum left join forum_info on forum.forum_id=forum_info.forum_id";
13 $set=$db_old->query($q);
14
15 $categoryset=$db->query("select node_id,old_id,node_thread_vector from nodes where old_type='category'");
16 while ($categoryset->next()) {
17 $categories[$categoryset->getString('old_id')]=array("id"=>$categoryset->getString('node_id'),"thread"=>$categoryset->getString('node_thread_vector'));
18 }
19 print_r($categories);
20
21 $creatorset=$db->query("select old_id,node_id from nodes where node_type='7'");
22 while ($creatorset->next()) {
23 $users[$creatorset->getString('old_id')]=$creatorset->getString('node_id');
24 }
25
26 while ($set->next()) {
27 if ($set->getString('forum_type')=='kyberia') $a=",node_system_access='public',node_external_access='no'";
28 elseif ($set->getString('forum_type')=='public') $a=",node_system_access='public',node_external_access='yes'";
29 elseif ($set->getString('forum_type')=='private') $a=",node_system_access='private',node_external_access='no'";
30 $q="insert into nodes set ";
31 $q.="node_name='".AddSlashes($set->getString('forum_name'))."'";
32 $q.="
33 ,node_creator='".$users[$set->getString('forum_owner')]."'
34 ,node_parent='".$categories[$set->getString('forum_category')]['id']."'
35 ,node_thread_vector='".$categories[$set->getString('forum_category')]['thread'].";".$categories[$set->getString('forum_category')]['id']."'
36 ,node_type='3'
37 ,old_id='".$set->getString('forum_id')."'";
38 $q.=$a;
39 $db->query($q);
40 echo $q;
41 $q="insert into node_content set node_content='".AddSlashes($set->getString('forum_info'))."',node_id=LAST_INSERT_ID()";
42 $db->query($q);
43
44
45 }
46
47
48
49 ?>
This page took 1.027642 seconds and 4 git commands to generate.