Minor display cleanup
[mirrors/Kyberia-bloodline.git] / scripts / category2node.php
CommitLineData
b42b2bf9
H
1<?php
2//requiring main config file with path/database etc. constants
3require('../config/config.inc');
4
5//connecting to database and creating universal $db object
6require(SYSTEM_ROOT.'/inc/log.inc');
7require(SYSTEM_ROOT.'/inc/database.inc');
8require(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 category";
13$set=$db_old->query($q);
14$db->query("set autocommit=0");
15while ($set->next()) {
16
17$q="insert into nodes set ";
18$q.="node_name='".addslashes(strip_tags($set->getString('category_name')))."'";
19if ($set->getString('category_parent')>0) {
20 $q2="select node_id from nodes where old_type='category' and old_id='".$set->getString('category_parent')."'";
21 $res2=$db->query($q2);
22 $res2->next();
23 $q.=",node_parent='".$res2->getString('node_id')."'";
24 $q.=",node_thread_vector=';1;101;".$res2->getString('node_id')."'";
25}
26else {
27 $q.=",node_parent='101' ,node_thread_vector=';1;101'";
28}
29$q.="
30,node_creator='129'
31,node_type='2'
32,old_type='category'
33,node_system_access='".$set->getString('public')."'
34,old_id='".$set->getString('category_id')."'";
35$db->query($q);
36echo $q;
37//$q="insert into node_content set node_content='".AddSlashes($set->getString('description'))."',node_id=LAST_INSERT_ID()";
38
39
40}
41
42$db->query("commit");
43
44?>
This page took 0.328244 seconds and 4 git commands to generate.