Minor display cleanup
[mirrors/Kyberia-bloodline.git] / scripts / submission2node.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 * from nodes where node_type='7'";
13 $userset=$db->query($q);
14 while ($userset->next()) {
15 $users[$userset->getString('old_id')]=$userset->getString('node_id');
16 }
17
18 $q="select * from nodes where node_type='3'";
19 $set=$db->query($q);
20 $trigger=false;
21 while ($set->next()) {
22 if ($set->getString('old_id')=='64875') $trigger=true;
23 // if ($trigger==true) {
24 $q="select * from submissions where forum_id='".$set->getString('old_id')."' order by submission_id";
25 echo $q;
26 $subset=$db_old->query($q);
27 while ($subset->next()) {
28 $q="insert into nodes set old_id='".$subset->getString('submission_id')."'
29 ,node_parent='".$set->getString('node_id')."'
30 ,node_thread_vector='".$set->getString('node_thread_vector').";".$set->getString('node_id')."'
31 ,node_system_access='".$set->getString('node_system_access')."',
32 node_created='".$subset->getString('submission_timestamp')."',node_creator='".$users[$subset->getString('submission_owner')]."',
33 k='".$subset->getString('submission_k')."',node_type='4',old_owner_id='".$subset->getString('submission_owner')."',
34 node_name='".$subset->getString('submission_timestamp').$subset->getString('submission_id')."'";
35 //echo $q;
36 $db->query($q);
37 $db->query("insert into node_content set node_content='".addslashes($subset->getString('submission_text'))."',node_id=LAST_INSERT_ID()");
38 //}
39 }
40
41 }
This page took 0.443606 seconds and 4 git commands to generate.