Commit | Line | Data |
---|---|---|
b42b2bf9 H |
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 rubriky"; | |
13 | $set=$db_old->query($q); | |
14 | $db->query("set autocommit=0"); | |
15 | while ($set->next()) { | |
16 | ||
17 | $q="insert into nodes set "; | |
18 | $q.="node_name='".AddSlashes($set->getString('nazov'))."'"; | |
19 | ||
20 | if ($set->getString('id_parent')>1) { | |
21 | $q2="select node_id from nodes where old_type='rubrika' and old_id='".$set->getString('id_parent')."'"; | |
22 | $res2=$db->query($q2); | |
23 | $res2->next(); | |
24 | ||
25 | $q.=",node_parent='".$res2->getString('node_id')."'"; | |
26 | $q.=",node_thread_vector='".$res2->getString('node_thread_vector').$res2->getString('node_id').";'"; | |
27 | } | |
28 | else { | |
29 | $q.=",node_parent='101' ,node_thread_vector=';1;101;'"; | |
30 | } | |
31 | $q.=" | |
32 | ,node_creator='117' | |
33 | ,node_type='2' | |
34 | ,node_views='".$set->getString('hits')."' | |
35 | ,node_system_access='".$set->getString('public')."' | |
36 | ,old_type='rubrika' | |
37 | ,old_id='".$set->getString('id_rubriky')."'"; | |
38 | ||
39 | $db->query($q); | |
40 | echo $q; | |
41 | $q="insert into node_content set node_content='".AddSlashes($set->getString('description'))."',node_id=LAST_INSERT_ID()"; | |
42 | $db->query($q); | |
43 | $db->query("commit"); | |
44 | } | |
45 | ||
46 | ||
47 | ||
48 | ?> |