mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
- fix some convertor bugs.
- added support for the validated birthday mod and fixed the integration of nils' birthday mod git-svn-id: file:///svn/phpbb/trunk@6851 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
09ce0caad6
commit
3c352ba4ef
7 changed files with 131 additions and 34 deletions
|
@ -327,7 +327,7 @@ p a {
|
|||
|
||||
<p>If you are unable to get phpBB3 installed even after reading this guide, please look at the support section to find out where you can ask for further assistance.</p>
|
||||
|
||||
<p>At this point if you are upgrading from phpBB 2.0.x, you should refer to the <a href="#convert">conversion steps</a> for further information. If not, you should remove the install directory from your server as you will only be able to access the Administration Control Panel whilst it is present.</p>
|
||||
<p>At this point if you are converting from phpBB 2.0.x, you should refer to the <a href="#convert">conversion steps</a> for further information. If not, you should remove the install directory from your server as you will only be able to access the Administration Control Panel whilst it is present.</p>
|
||||
|
||||
</div>
|
||||
<a href="#top">Top</a>
|
||||
|
|
|
@ -258,7 +258,7 @@ p a {
|
|||
|
||||
<p><strong>Please remember</strong> that any bugs or other issues that occur after you have added any modification should <strong>NOT</strong> be reported to the bug tracker (see below). First remove the modification and see if the problem is resolved.</p>
|
||||
|
||||
<p>Also remember that any modifications which modify the database in any way may render upgrading your forum to future versions more difficult unless we state otherwise. With all this said many users have and continue to utilise many of the mods already available with great success</p>
|
||||
<p>Also remember that any modifications which modify the database in any way may render upgrading your forum to future versions more difficult unless we state otherwise. With all this said many users have and continue to utilise many of the mods already available with great success.</p>
|
||||
|
||||
</div>
|
||||
<a href="#top">Top</a>
|
||||
|
@ -268,7 +268,7 @@ p a {
|
|||
|
||||
<a name="help"></a><h1>3. Getting help with phpBB3</h1>
|
||||
|
||||
<p>phpBB 2 can seem a little daunting to new users in places, particularly with regard the permission system. The first thing you should do is check the <a href="FAQ.html">FAQ</a> which covers a few basic getting started questions. If you need additional help there are several places you should look.</p>
|
||||
<p>phpBB3 can seem a little daunting to new users in places, particularly with regard the permission system. The first thing you should do is check the <a href="FAQ.html">FAQ</a> which covers a few basic getting started questions. If you need additional help there are several places you should look.</p>
|
||||
|
||||
<a name="userguide"></a><b>3.i. phpBB3 Userguide</b>
|
||||
<br /><br />
|
||||
|
|
|
@ -444,7 +444,7 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false
|
|||
{
|
||||
while ($entry = readdir($handle))
|
||||
{
|
||||
if ($entry[0] == '.')
|
||||
if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false
|
|||
{
|
||||
while ($entry = $dir->read())
|
||||
{
|
||||
if (substr($entry, 0, 1) == '.')
|
||||
if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -2173,7 +2173,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_
|
|||
{
|
||||
while ($entry = readdir($handle))
|
||||
{
|
||||
if ($entry[0] == '.')
|
||||
if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -2193,7 +2193,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_
|
|||
{
|
||||
while ($entry = $dir->read())
|
||||
{
|
||||
if (substr($entry, 0, 1) == '.')
|
||||
if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -142,12 +142,19 @@ $test_file = 'modcp.php';
|
|||
if (!$get_info)
|
||||
{
|
||||
// Test to see if the birthday MOD is installed on the source forum
|
||||
// @todo Check the relevant MODs - I believe there are 2 that add this, but am not sure if their data is compatible or not
|
||||
// Nils' birthday mod
|
||||
if (get_config_value('birthday_required') !== false)
|
||||
{
|
||||
define('MOD_BIRTHDAY', true);
|
||||
}
|
||||
|
||||
// TerraFrost's validated birthday mod
|
||||
if (get_config_value('bday_required') !== false)
|
||||
{
|
||||
define('MOD_BIRTHDAY', true);
|
||||
define('MOD_BIRTHDAY_TERRA', true);
|
||||
}
|
||||
|
||||
// Test to see if the attachment MOD is installed on the source forum
|
||||
// If it is, we will convert this data as well
|
||||
$db->sql_return_on_error(true);
|
||||
|
|
|
@ -96,6 +96,56 @@ function phpbb_insert_forums()
|
|||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// There may be installations having forums with non-existant category ids.
|
||||
// We try to catch them and add them to an "unknown" category instead of leaving them out.
|
||||
$sql = 'SELECT cat_id
|
||||
FROM ' . $convert->src_table_prefix . 'forums
|
||||
GROUP BY cat_id';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$unknown_cat_id = false;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
// Catch those categories not been added before
|
||||
if (!isset($cats_added[$row['cat_id']]))
|
||||
{
|
||||
$unknown_cat_id = true;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Is there at least one category not known?
|
||||
if ($unknown_cat_id === true)
|
||||
{
|
||||
$unknown_cat_id = 'ghost';
|
||||
|
||||
$sql_ary = array(
|
||||
'forum_id' => $max_forum_id,
|
||||
'forum_name' => $user->lang['CATEGORY'],
|
||||
'parent_id' => 0,
|
||||
'forum_parents' => '',
|
||||
'forum_desc' => '',
|
||||
'forum_type' => FORUM_CAT,
|
||||
'forum_status' => ITEM_UNLOCKED,
|
||||
'forum_rules' => '',
|
||||
);
|
||||
|
||||
$sql = 'SELECT MAX(right_id) AS right_id
|
||||
FROM ' . FORUMS_TABLE;
|
||||
$_result = $db->sql_query($sql);
|
||||
$cat_row = $db->sql_fetchrow($_result);
|
||||
$db->sql_freeresult($_result);
|
||||
|
||||
$sql_ary['left_id'] = $cat_row['right_id'] + 1;
|
||||
$sql_ary['right_id'] = $cat_row['right_id'] + 2;
|
||||
|
||||
$sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$cats_added[$unknown_cat_id] = $max_forum_id;
|
||||
$max_forum_id++;
|
||||
}
|
||||
|
||||
// Now insert the forums
|
||||
$sql = 'SELECT f.*, fp.prune_days, fp.prune_freq FROM ' . $convert->src_table_prefix . 'forums f
|
||||
LEFT JOIN ' . $convert->src_table_prefix . 'forum_prune fp ON f.forum_id = fp.forum_id
|
||||
|
@ -105,6 +155,18 @@ function phpbb_insert_forums()
|
|||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
// Some might have forums here with an id not being "possible"...
|
||||
// To be somewhat friendly we "change" the category id for those to a previously created ghost category
|
||||
if (!isset($cats_added[$row['cat_id']]) && $unknown_cat_id !== false)
|
||||
{
|
||||
$row['cat_id'] = $unknown_cat_id;
|
||||
}
|
||||
|
||||
if (!isset($cats_added[$row['cat_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Define the new forums sql ary
|
||||
$sql_ary = array(
|
||||
'forum_id' => (int) $row['forum_id'],
|
||||
|
@ -179,40 +241,56 @@ function phpbb_insert_forums()
|
|||
|
||||
function phpbb_set_encoding($text)
|
||||
{
|
||||
global $lang_enc_array, $config;
|
||||
global $lang_enc_array;
|
||||
|
||||
if (!isset($lang_enc_array[$config['default_lang']]))
|
||||
$default_lang = trim(get_config_value('default_lang'));
|
||||
|
||||
if (!isset($lang_enc_array[$default_lang]))
|
||||
{
|
||||
global $phpEx, $convert;
|
||||
|
||||
include($convert->convertor_status['forum_path'] . '/language/lang_' . $config['default_lang'] . '/lang_main.' . $phpEx);
|
||||
$lang_enc_array[$config['default_lang']] = $lang['ENCODING'];
|
||||
include($convert->convertor_status['forum_path'] . '/language/lang_' . $default_lang . '/lang_main.' . $phpEx);
|
||||
$lang_enc_array[$default_lang] = $lang['ENCODING'];
|
||||
unset($lang);
|
||||
}
|
||||
|
||||
return utf8_recode($text, $lang_enc_array[$user_lang]);
|
||||
return utf8_recode($text, $lang_enc_array[$default_lang]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert Birthday from Birthday MOD to phpBB Format
|
||||
* @todo See which birthday MOD's this supports - there appear to be several
|
||||
*/
|
||||
function phpbb_get_birthday($birthday = '')
|
||||
{
|
||||
$birthday = (int) $birthday;
|
||||
|
||||
if (!$birthday || $birthday == 999999)
|
||||
if (defined('MOD_BIRTHDAY_TERRA'))
|
||||
{
|
||||
return ' 0- 0- 0';
|
||||
// stored as month, day, year
|
||||
if (!$birthday)
|
||||
{
|
||||
return ' 0- 0- 0';
|
||||
}
|
||||
|
||||
$birthday = (string) $birthday;
|
||||
|
||||
$month = substr($birthday, 0, 2);
|
||||
$day = substr($birthday, 2, 2);
|
||||
$year = substr($birthday, -4);
|
||||
|
||||
return sprintf('%02d-%02d-%04d', $day, $month, $year);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$birthday || $birthday == 999999 || $birthday < 0)
|
||||
{
|
||||
return ' 0- 0- 0';
|
||||
}
|
||||
|
||||
// @todo Can't this be done with one call to create_date?
|
||||
$bday_day = create_date('j', $birthday * 86400 + 1, 0);
|
||||
$bday_month = create_date('n', $birthday * 86400 + 1, 0);
|
||||
$bday_year = create_date('Y', $birthday * 86400 + 1, 0);
|
||||
|
||||
return sprintf('%2d-%2d-%4d', $bday_day, $bday_month, $bday_year);
|
||||
// The birthday mod from niels is using this code to transform to day/month/year
|
||||
return gmdate('d-m-Y', $birthday * 86400 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -718,13 +796,16 @@ function phpbb_convert_authentication($mode)
|
|||
}
|
||||
}
|
||||
|
||||
// Now make sure the user is able to read these forums
|
||||
$hold_ary = $auth->acl_group_raw_data(get_group_id('guests'), 'f_list', $forum_ids);
|
||||
|
||||
if (!empty($hold_ary))
|
||||
if (sizeof($forum_ids))
|
||||
{
|
||||
mass_auth('group', $row['forum_id'], 'guests', 'f_list', ACL_YES);
|
||||
mass_auth('group', $row['forum_id'], 'registered', 'f_list', ACL_YES);
|
||||
// Now make sure the user is able to read these forums
|
||||
$hold_ary = $auth->acl_group_raw_data(get_group_id('guests'), 'f_list', $forum_ids);
|
||||
|
||||
if (!empty($hold_ary))
|
||||
{
|
||||
mass_auth('group', $row['forum_id'], 'guests', 'f_list', ACL_YES);
|
||||
mass_auth('group', $row['forum_id'], 'registered', 'f_list', ACL_YES);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -897,7 +978,7 @@ function phpbb_prepare_message($message)
|
|||
FROM ' . $convert->src_table_prefix . 'users
|
||||
WHERE user_id = ' . (int) $user_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$user_lang = $db->sql_fetchfield('user_lang');
|
||||
$user_lang = (string) $db->sql_fetchfield('user_lang');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (empty($lang_enc_array))
|
||||
|
@ -905,13 +986,15 @@ function phpbb_prepare_message($message)
|
|||
$lang_enc_array = array();
|
||||
}
|
||||
|
||||
$user_lang = (!trim($user_lang)) ? trim(get_config_value('default_lang')) : trim($user_lang);
|
||||
|
||||
if (!isset($lang_enc_array[$user_lang]))
|
||||
{
|
||||
$filename = $convert->convertor_status['forum_path'] . '/language/lang_' . $user_lang . '/lang_main.' . $phpEx;
|
||||
|
||||
if (!file_exists($filename))
|
||||
{
|
||||
$user_lang = $config['default_lang'];
|
||||
$user_lang = trim(get_config_value('default_lang'));
|
||||
}
|
||||
|
||||
if (!isset($lang_enc_array[$user_lang]))
|
||||
|
@ -1243,7 +1326,12 @@ function phpbb_import_attach_config()
|
|||
$db->sql_freeresult($result);
|
||||
|
||||
set_config('allow_attachments', 1);
|
||||
set_config('display_order', $attach_config['display_order']);
|
||||
|
||||
// old attachment mod? Must be very old if this entry do not exist...
|
||||
if (!empty($attach_config['display_order']))
|
||||
{
|
||||
set_config('display_order', $attach_config['display_order']);
|
||||
}
|
||||
set_config('max_filesize', $attach_config['max_filesize']);
|
||||
set_config('max_filesize_pm', $attach_config['max_filesize_pm']);
|
||||
set_config('attachment_quota', $attach_config['attachment_quota']);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<td class="gensmall" align="center"> </td>
|
||||
<td class="gensmall" align="center" nowrap="nowrap">
|
||||
<!-- IF admin.U_GROUP -->
|
||||
<a<!-- IF admin.GROUP_COLOR --> style="color:#{admin.GROUP_COLOR}"<!-- ENDIF --> href="{admin.U_GROUP}">{admin.GROUP_NAME}</a>
|
||||
<a<!-- IF admin.GROUP_COLOR --> style="font-weight: bold; color:#{admin.GROUP_COLOR}"<!-- ENDIF --> href="{admin.U_GROUP}">{admin.GROUP_NAME}</a>
|
||||
<!-- ELSE -->
|
||||
{admin.GROUP_NAME}
|
||||
<!-- ENDIF -->
|
||||
|
@ -43,7 +43,7 @@
|
|||
<td align="center"><!-- IF not mod.FORUMS -->{L_ALL_FORUMS}<!-- ELSE --><select style="width: 200px;">{mod.FORUMS}</select><!-- ENDIF --> </td>
|
||||
<td class="gensmall" align="center" nowrap="nowrap">
|
||||
<!-- IF mod.U_GROUP -->
|
||||
<a<!-- IF mod.GROUP_COLOR --> style="color:#{mod.GROUP_COLOR}"<!-- ENDIF --> href="{mod.U_GROUP}">{mod.GROUP_NAME}</a>
|
||||
<a<!-- IF mod.GROUP_COLOR --> style="font-weight: bold; color:#{mod.GROUP_COLOR}"<!-- ENDIF --> href="{mod.U_GROUP}">{mod.GROUP_NAME}</a>
|
||||
<!-- ELSE -->
|
||||
{mod.GROUP_NAME}
|
||||
<!-- ENDIF -->
|
||||
|
|
|
@ -139,7 +139,9 @@ switch ($mode)
|
|||
foreach ($_COOKIE as $cookie_name => $cookie_data)
|
||||
{
|
||||
$cookie_name = str_replace($config['cookie_name'] . '_', '', $cookie_name);
|
||||
if (strpos($cookie_name, '_poll') === false)
|
||||
|
||||
// Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_
|
||||
if (strpos($cookie_name, 'poll_') !== 0)
|
||||
{
|
||||
$user->set_cookie($cookie_name, '', $set_time);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue