registration fix fixed
[mirrors/Kyberia-bloodline.git] / scripts / articles2node.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 articles";
13 $set=$db_old->query($q);
14 $db->query("set autocommit=0");
15 while ($set->next()) {
16
17 $q="insert into nodes set ";
18
19 if (!is_numeric($set->getString('autor'))) $node_name=$set->getString('autor')."::".$set->getString('nazov');
20 else $node_name=$set->getString('nazov');
21 $node_name=addslashes(strip_tags($node_name));
22
23 $q.="node_name='$node_name'";
24
25 $q2="select * from nodes where node_type='2' and old_id='".$set->getString('id_rubrika')."'";
26 $res2=$db->query($q2);
27 $res2->next();
28 $q.=",node_parent='".$res2->getString('node_id')."'";
29 $q.=",node_thread_vector='".$res2->getString('node_thread_vector').";".$res2->getString('node_id')."'";
30
31
32 if (is_numeric($set->getString('autor'))) {
33 $autor=nodes::getNodeByOldId($set->getString('autor'));
34 $q.=",node_creator='".$autor['node_id']."'";
35 }
36 else $q.=",node_creator='548'";
37
38 $q.="
39 ,node_type='5'
40 ,node_created='".$set->getString('datum')."'
41 ,node_views='".$set->getString('hits')."'
42 ,node_system_access='public'
43 ,node_external_access='yes'
44 ,node_children_count='".$set->getString('prispevky')."'
45 ,old_id_diskuse='".$set->getString('id_diskuse')."'
46 ,old_id='".$set->getString('id_article')."'";
47 $db->query($q);
48 echo $q;
49 $q="insert into node_content set node_content='".AddSlashes($set->getString('short_desc')).":::".AddSlashes($set->getString('text1'))."',node_id=LAST_INSERT_ID()";
50 $db->query($q);
51 $db->query("commit");
52 }
53
54 ?>
This page took 0.379395 seconds and 4 git commands to generate.