1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
| 1. / 2. / ...
<?php <?php
// ClanSphere 2007 - www.clansphere.net
// $Id: index.php 101 2006-07-12 09:36:29Z hajo $
@error_reporting(E_ALL);
@ini_set('arg_separator.output','&');
@ini_set('register_globals','off');
@ini_set('session.use_trans_sid','0');
@ini_set('session.use_cookies','1');
@ini_set('session.use_only_cookies','1');
@ini_set('display_errors','on');
@ini_set('magic_quotes_runtime','off');
$cs_logs = array('errors' => '', 'sql' => '', 'queries' => 0, 'dir' => 'logs');
require('system/core/functions.php');
require('setup.php');
require('system/database/' . $cs_db['type'] . '.php');
$cs_db['con'] = cs_sql_connect($cs_db);
$cs_prefix = $cs_db['prefix'];
$phpbb_prefix = 'phpbb';
$cs_main = @cs_sql_option(__FILE__,'clansphere') OR die($install_link . ' or database error');
$now = cs_time();
/** Copy data **/
function cs_userid () {
global $cs_db, $usercells, $cs_prefix, $user;
$exists = cs_sql_select(__FILE__,'users','users_id','users_nick = \'' . $user['username'] . '\'');
if (!empty($exists))
return $exists['users_id'];
$lang = $user['user_lang'] == 'english' ? 'English' : 'German';
$uservalues = array('2',$user['username'],$user['user_password'],$lang,$user['user_icq'],$user['user_email'],
$user['user_website'],$user['user_active'],'20',$user['user_regdate'],$user['user_lastvisit'],'8','fam');
cs_sql_insert(__FILE__,'users',$usercells,$uservalues);
return cs_sql_insertid(__FILE__);
}
function cs_resettext ($text) {
$text = html_entity_decode($text);
$text = preg_replace('=\[quote:(.*?)\](.*?)\[/quote:(.*?)\]=si','[quote]\\2[/quote]',$text);
$text = preg_replace('=\[code:(.*?)\](.*?)\[/code:(.*?)\]=si','[code]\\2[/code]',$text);
$text = preg_replace('=\[b:(.*?)\](.*?)\[/b:(.*?)\]=si','[b]\\2[/b]',$text);
$text = preg_replace('=\[i:(.*?)\](.*?)\[/i:(.*?)\]=si','[i]\\2[/i]',$text);
$text = preg_replace('=\[u:(.*?)\](.*?)\[/u:(.*?)\]=si','[u]\\2[/u]',$text);
$text = preg_replace('=\[color\=(.*?):(.*?)\](.*?)\[/color:(.*?)\]=si','[color=\\1]\\3[/color]',$text);
$text = preg_replace('=\[size\=(.*?):(.*?)\](.*?)\[/size:(.*?)\]=si','[size=\\1]\\3[/size]',$text);
return $text;
}
$categories = cs_sql_select(__FILE__,'categories','cat_id','cat_title','cat_order');
$catcells = array('categories_name','categories_order','categories_mod');
$forumselect = 'forum_id, forum_name, forum_order, forum_topics, forum_posts';
$boardcells = array('categories_id','board_name','board_order','board_time','board_threads','board_comments');
$topicselect = 'topic_id, topic_poster, topic_title, topic_time, topic_views, topic_replies, topic_status, topic_type, topic_first_post_id';
$threadcells = array('board_id','users_id','threads_headline','threads_text','threads_time','threads_view','threads_important','threads_close','threads_comments');
$userselect = 'username, user_password, user_lang, user_icq, user_email, user_website, user_active, user_regdate, user_lastvisit';
$usercells = array('access_id','users_nick','users_pwd','users_lang','users_icq','users_email','users_url','users_active','users_limit','users_register','users_laston','users_homelimit','users_country');
$postselect = 'poster_id, post_time, post_id';
$commentcells = array('users_id','comments_fid','comments_mod','comments_time','comments_text');
// Categories
foreach ($categories AS $cat) {
$forums = phpbb_sql_select(__FILE__,'forums',$forumselect,'cat_id = \''.$cat['cat_id'].'\'',0,0,0);
$catvalues = array($cat['cat_title'],$cat['cat_order'],'board');
cs_sql_insert(__FILE__,'categories',$catcells,$catvalues);
// Forums
if (!empty($forums)) {
$catid = cs_sql_insertid(__FILE__);
foreach ($forums AS $forum) {
$boardvalues = array($catid,$forum['forum_name'],$forum['forum_order'],$now,$forum['forum_topics'],$forum['forum_posts']);
cs_sql_insert(__FILE__,'board',$boardcells,$boardvalues);
$boardid = cs_sql_insertid(__FILE__);
$topics = phpbb_sql_select(__FILE__,'topics',$topicselect,'forum_id = \''.$forum['forum_id'].'\'',0,0,0);
if (!empty($topics)) {
foreach ($topics AS $topic) {
// Get the user
$user = phpbb_sql_select(__FILE__,'users',$userselect,'user_id = \''.$topic['topic_poster'].'\'');
// Get the text of the topic
$text = phpbb_sql_select(__FILE__,'posts_text','post_text','post_id = \''.$topic['topic_first_post_id'].'\'');
$text = phpbb_resettext($text['post_text']);
$users_id = cs_userid();
$threadvalues = array($boardid,$users_id,$topic['topic_title'],$text,$topic['topic_time'],$topic['topic_views'],$topic['topic_type'],$topic['topic_status'],$topic['topic_replies']);
cs_sql_insert(__FILE__,'threads',$threadcells,$threadvalues);
$threads_id = cs_sql_insertid(__FILE__);
$posts = phpbb_sql_select(__FILE__,'posts',$postselect,'topic_id = \''.$topic['topic_id'].'\'',0,0,0);
if (!empty($posts)) {
$run = 0;
foreach ($posts AS $post) {
$run++;
if ($run == 1)
continue;
$user = phpbb_sql_select(__FILE__,'users',$userselect,'user_id = \''.$post['poster_id'].'\'');
$users_id = cs_userid();
$text = phpbb_sql_select(__FILE__,'posts_text','post_text','post_id = \''.$post['post_id'].'\'');
$text = phpbb_resettext($text['post_text']);
$commentvalues = array($users_id,$threads_id,'board',$post['post_time'],$text);
cs_sql_insert(__FILE__,'comments',$commentcells,$commentvalues);
}
$updatecells = array('threads_last_user','threads_last_time');
$updatevalues = array($users_id,$post['post_time']);
cs_sql_update(__FILE__,'threads',$updatecells,$updatevalues,$threads_id);
}
}
}
}
}
}
// Get the users that werent created yet
$users = cs_sql_select(__FILE__,'users',$userselect,0,0,0,0);
foreach ($users AS $user) {
cs_userid();
}
if (!empty($cs_logs['errors'])) {
echo nl2br($cs_logs['errors']);
} else {
echo 'Daten erfolgreich übertragen.';
}
?>
?> |