Probleme beim update in admin_smileys.php
Verfasst: 07.05.2006 15:47
Hey,
Ich hab mich jetzt doch ma zum update gezwungen, aber hab nun Probleme da ich ne Codestelle durch nen Mod verändert habe...
Ich soll das hier machen:
Bei mir sieht diese Stelle aber so aus:
Weiß jmd wie ich das ändern muss? 
Ich hab mich jetzt doch ma zum update gezwungen, aber hab nun Probleme da ich ne Codestelle durch nen Mod verändert habe...
Ich soll das hier machen:
Code: Alles auswählen
#-----[ OPEN ]---------------------------------------------
#
admin/admin_smilies.php
#
#-----[ FIND ]---------------------------------------------
# Line 314
$sql = "DELETE FROM " . SMILIES_TABLE . "
WHERE smilies_id = " . $smiley_id;
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't delete smiley", "", __LINE__, __FILE__, $sql);
}
$message = $lang['smiley_del_success'] . "<br /><br />" . sprintf($lang['Click_return_smileadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
#
#-----[ REPLACE WITH ]---------------------------------------------
#
$confirm = isset($HTTP_POST_VARS['confirm']);
if( $confirm )
{
$sql = "DELETE FROM " . SMILIES_TABLE . "
WHERE smilies_id = " . $smiley_id;
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't delete smiley", "", __LINE__, __FILE__, $sql);
}
$message = $lang['smiley_del_success'] . "<br /><br />" . sprintf($lang['Click_return_smileadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
else
{
// Present the confirmation screen to the user
$template->set_filenames(array(
'body' => 'admin/confirm_body.tpl')
);
$hidden_fields = '<input type="hidden" name="mode" value="delete" /><input type="hidden" name="id" value="' . $smiley_id . '" />';
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['Confirm'],
'MESSAGE_TEXT' => $lang['Confirm_delete_smiley'],
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_CONFIRM_ACTION' => append_sid("admin_smilies.$phpEx"),
'S_HIDDEN_FIELDS' => $hidden_fields)
);
$template->pparse('body');
}
Code: Alles auswählen
$sql = "DELETE FROM " . SMILIES_TABLE . "
WHERE cat_id = " . $cat_order;
$result = $db->sql_query($sql);
if( !$result ) { message_die(GENERAL_ERROR, "Couldn't delete current smilies.", "", __LINE__, __FILE__, $sql); }
$order_num = 0;
}
else
{
// Put all the codes for the category in an array.
$sql = "SELECT code
FROM " . SMILIES_TABLE . "
WHERE cat_id = " . $cat_order;
$result = $db->sql_query($sql);
if( !$result ) { message_die(GENERAL_ERROR, "Couldn't get current smilies.", "", __LINE__, __FILE__, $sql); }
$cur_smilies = $db->sql_fetchrowset($result);
$order_num = count($cur_smilies);
for( $i=0; $i<$order_num; $i++ )
{
$k = $cur_smilies[$i]['code'];
$smiles[$k] = 1;
}
}
// Open file, read contents.
$fcontents = @file($phpbb_root_path . $board_config['smilies_path'] . '/'. $smile_pak);
if( empty($fcontents) )
{
message_die(GENERAL_ERROR, "Couldn't read smiley pak file", "", __LINE__, __FILE__, $sql);
}
$replace_count = 0;
$add_count = 0;
for( $i=0; $i<count($fcontents); $i++ )
{
// Take each line and separate the fields.
$smile_data = explode($delimeter, trim(addslashes($fcontents[$i])));
for( $j=2; $j<count($smile_data); $j++ )
{
//
// Replace > and < with the proper html_entities for matching.
//
$smile_data[$j] = str_replace("<", "<", $smile_data[$j]);
$smile_data[$j] = str_replace(">", ">", $smile_data[$j]);
$k = $smile_data[$j];
if( $smiles[$k] == 1 )
{
// What should be done if there are conflicts?
if( $replace_existing )
{
// Replace existing smiley.
$sql = "UPDATE " . SMILIES_TABLE . "
SET smile_url = '" . str_replace("\'", "''", $smile_data[0]) . "', emoticon = '" . str_replace("\'", "''", $smile_data[1]) . "'
WHERE code = '" . str_replace("\'", "''", $smile_data[$j]) . "'
AND cat_id = " . $cat_order;
$result = $db->sql_query($sql);
if( !$result ) { message_die(GENERAL_ERROR, "Couldn't update smiley database", "", __LINE__, __FILE__, $sql); }
$replace_count++;
}
}
else
{
// Add new smiley.
$order_num++;
$sql = "INSERT INTO " . SMILIES_TABLE . " (code, smile_url, emoticon, cat_id, smilies_order)
VALUES('" . str_replace("\'", "''", $smile_data[$j]) . "', '" . str_replace("\'", "''", $smile_data[0]) . "', '" . str_replace("\'", "''", $smile_data[1]) . "', '" . $cat_order . "', '" . $order_num . "')";
$result = $db->sql_query($sql);
if( !$result ) { message_die(GENERAL_ERROR, "Couldn't insert smiley into database", "", __LINE__, __FILE__, $sql); }
$add_count++;
}
}
}
$smiles = ( $add_count == 0 || $add_count >= 2 ) ? $lang['smilies'] : $lang['smiley'];
$message = sprintf($lang['smiley_import_success1'], $add_count, $smiles, $replace_count) . "<br /><br />" . sprintf($lang['Click_return_catadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>");
}
else if( !empty($ext) && $ext == "pak2" )
{
// Delete all categories and smilies before importing.
if( $delete_all )
{
$sql = "TRUNCATE " . SMILIES_TABLE;
$result = $db->sql_query($sql);
if( !$result ) { message_die(GENERAL_ERROR, "Couldn't delete smilies.", "", __LINE__, __FILE__, $sql); }
$sql = "TRUNCATE " . SMILIES_CAT_TABLE;
$result = $db->sql_query($sql);
if( !$result ) { message_die(GENERAL_ERROR, "Couldn't delete categories.", "", __LINE__, __FILE__, $sql); }
$num_cats = 0;
}
// Open file, read contents.
$fcontents = @file($phpbb_root_path . $board_config['smilies_path'] . '/'. $smile_pak);
if( empty($fcontents) )
{
message_die(GENERAL_ERROR, "Couldn't read smiley pak file", "", __LINE__, __FILE__, $sql);
}
$cat_count = 0;
$order_array = array();
// Import the categories.
for( $i=0; $i<count($fcontents); $i++ )
{
if( ($fcontents[$i]{0} == '#') && ($fcontents[$i]{1} != '#') )
{
// Take each line and separate the fields.
$cat_data = explode($delimeter, trim(addslashes($fcontents[$i])));
$num_cats++;
$cat_data[0] = str_replace('#', '', $cat_data[0]);
$sql = "INSERT INTO " . SMILIES_CAT_TABLE . " (cat_name, description, cat_order, cat_perms, cat_forum, cat_category, cat_icon_url, smilies_per_page, smilies_popup)
VALUES ('" . str_replace("\'", "''", $cat_data[0]) . "','" . str_replace("\'", "''", $cat_data[1]) . "','" . $num_cats . "','" . $cat_data[3] . "','" . $cat_data[4] . "','" . $cat_data[5] . "','" . str_replace("\'", "''", $cat_data[6]) . "','" . $cat_data[7] . "','" . $cat_data[8] . "')";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert new category into database.", "", __LINE__, __FILE__, $sql);
}
else
{
$cat_count++;
$order_array[$cat_data[2]] = $num_cats;
}
}
}
$smiley_count = 0;
// Import the smilies.
for( $i=0; $i<count($fcontents); $i++ )
{
if( $fcontents[$i]{0} != '#' )
{
// Take each line and separate the fields.
$smile_data = explode($delimeter, trim(addslashes($fcontents[$i])));
$sql = "INSERT INTO " . SMILIES_TABLE . " (code, smile_url, emoticon, cat_id, smilies_order)
VALUES('" . str_replace("\'", "''", $smile_data[2]) . "', '" . str_replace("\'", "''", $smile_data[0]) . "', '" . str_replace("\'", "''", $smile_data[1]) . "', '" . $order_array[$smile_data[3]] . "', '" . $smile_data[4] . "')";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert smiley into database", "", __LINE__, __FILE__, $sql);
}
else
{
$smiley_count++;
}
}
}
$cats = ( $cat_count == 0 || $cat_count >= 2 ) ? $lang['categories'] : $lang['category'];
$smiles = ( $smiley_count == 0 || $smiley_count >= 2 ) ? $lang['smilies'] : $lang['smiley'];
$message = sprintf($lang['smiley_import_success2'], $cat_count, $cats, $smiley_count, $smiles) . "<br /><br />" . sprintf($lang['Click_return_catadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>");
}
else
{
$message = $lang['smiley_import_fail'] . "<br /><br />" . sprintf($lang['Click_return_catadmin'], "<a href=\"" . append_sid("admin_smilies.$phpEx") . "\">", "</a>");
}
message_die(GENERAL_MESSAGE, $message);
}
else if( isset($HTTP_POST_VARS['export_pack']) || isset($HTTP_GET_VARS['export_pack']) )
{
