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 nodes where node_type='7'"; | |
13 | $userset=$db->query($q); | |
14 | while ($userset->next()) { | |
15 | $user_array[$userset->getString('old_id')]=$userset->getString('node_id'); | |
16 | } | |
17 | ||
18 | print_r($user_array); | |
19 | ||
20 | $q="select * from dennik"; | |
21 | $set=$db_old->query($q); | |
22 | ||
23 | while ($set->next()) { | |
24 | $node_creator=$user_array[$set->getString('autor')]; | |
25 | $q="insert into nodes set node_creator='$node_creator',"; | |
26 | if ($set->getString('type')=='public') { | |
27 | $ea='yes'; | |
28 | $sa='public'; | |
29 | } | |
30 | elseif ($set->getString('type')=='private') { | |
31 | $ea='no'; | |
32 | $sa='private'; | |
33 | } | |
34 | else { | |
35 | $ea='no'; | |
36 | $sa='public'; | |
37 | } | |
38 | ||
39 | $q.=" | |
40 | node_name='".addslashes(strip_tags($set->getString('nadpis')))."' | |
41 | ,node_parent='$node_creator' | |
42 | ,node_type='6' | |
43 | ,node_thread_vector=';1;7;$node_creator' | |
44 | ,node_created='".$set->getString('datum')."' | |
45 | ,node_views='".$set->getString('hits')."' | |
46 | ,node_system_access='".$sa."' | |
47 | ,node_external_access='".$ea."' | |
48 | ,old_id_diskuse='".$set->getString('id_diskuse')."' | |
49 | ,old_id='".$set->getString('id')."'"; | |
50 | if ($node_creator) $db->query($q); | |
51 | ||
52 | $q="insert into node_content set node_content='".AddSlashes($set->getString('zapis'))."',node_id=LAST_INSERT_ID()"; | |
53 | ||
54 | echo "inserted $node_creator<br>"; | |
55 | if ($node_creator) $db->query($q); | |
56 | ||
57 | } | |
58 | ||
59 | ?> |