
ich hab da momentan etwas leichte Koordinationschwierigkeiten bei einem Upgrade von Smilie Categories 2.0.4.

Ich soll da einen Teil in der viewtopic bearbeiten, der schon vom CPS angefasst wird, bzw. eine Stelle ausgeklammert und durch einen anderen Teil des CPS ersetzt wurde. Naja... Zusätzlich habe ich noch in diesem Abschnitt drin, daß die Signatur begrenzt wird.


Also bin ich wieder mal planlos.

Hier mal der zu änderende Teil:
- Code: Alles auswählen
#
#-----[ OPEN ]-------------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]-------------------------------------------------
#
if ( $board_config['allow_smilies'] )
{
if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
{
$user_sig = smilies_pass($user_sig);
}
if ( $postrow[$i]['enable_smilies'] )
{
$message = smilies_pass($message);
}
}
#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $board_config['allow_smilies'] )
{
if( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
{
$user_sig = smilies_pass($user_sig, $forum_id);
}
if( $postrow[$i]['enable_smilies'] )
{
$message = smilies_pass($message, $forum_id);
}
}
else
{
if( $board_config['smilie_removal1'] )
{
$message = smilies_code_removal($message);
}
}
Ich zeige dir mal den Abschnitt meiner viewtopic.php bevor ich dran rumgepfuscht habe:
- Code: Alles auswählen
if ( $board_config['allow_smilies'] )
{
if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' && $board_config['sig_allow_smilies'] != 0 )
{
$user_sig = smilies_pass($user_sig);
}
(!$parsed || !$board_config['enable_post_cache']) ? (($postrow[$i]['enable_smilies']) ? $message = smilies_pass($message) : '') : ''; // Cache Posts
/* if ( $postrow[$i]['enable_smilies'] )
{
$message = smilies_pass($message);
}*/
}
// Cache Posts
if (!$parsed && $board_config['enable_post_cache'] && ($postrow[$i]['enable_bbcode'] || $postrow[$i]['enable_html']) && !$postrow[$i]['dont_cache'] && !$forum_topic_data['topic_cache_lock'])
{
$cstyle = ($userdata['session_logged_in'] && $userdata['user_style'] != $board_config['default_style'] && $board_config['cache_each_template']) ? $userdata['user_style'].'_' : '';
$cachefile = 'cache/posts/'.$cstyle.'post_'.$postrow[$i]['post_id'].'.gz';
$handle = @fopen($phpbb_root_path.$cachefile, 'w');
@flock($handle, LOCK_EX);
$packed = gzdeflate($message, 9);
$cf_size = @fwrite($handle, $packed);
@flock($handle, LOCK_UN);
@fclose($handle);
@chmod($phpbb_root_path.$cachefile, 0666);
if ($cf_size)
{
if ($cf_size > $board_config['min_post_cache_size'])
{
$parsed = 1;
$sql = "UPDATE " . POSTS_TABLE . "
SET parsed = 1, cache_file_md5 = '".md5_file($cachefile)."'
WHERE post_id = ".$postrow[$i]['post_id'];
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
}
}
else
{
$parsed = 0;
$postrow[$i]['dont_cache'] = 1;
foreach (glob($phpbb_root_path.'cache/posts/*post_'.$postrow[$i]['post_id'].'.gz') as $cachefile)
{
@unlink($cachefile);
}
$sql = "UPDATE " . POSTS_TABLE . "
SET parsed = 0, dont_cache = 1, cache_file_md5 = NULL
WHERE post_id = ".$postrow[$i]['post_id'];
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
}
}
}
else if ($postrow[$i]['parsed'])
{
$parsed = 0;
$sql = "UPDATE " . POSTS_TABLE . "
SET parsed = 0, cache_file_md5 = NULL
WHERE post_id = ".$postrow[$i]['post_id'];
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
}
}
$postrow[$i]['parsed'] = $parsed;
}
else if ( $forum_topic_data['topic_cache_lock'] )
{
$parsed = 0;
$postrow[$i]['dont_cache'] = 1;
$sql = "UPDATE " . POSTS_TABLE . "
SET parsed = 0, dont_cache = 1, cache_file_md5 = NULL
WHERE post_id = ".$postrow[$i]['post_id'];
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
}
$postrow[$i]['parsed'] = $parsed;
}
if ($board_config['enable_post_cache'])
{
$parse_status = ($parsed) ? $CPS_Indicator['cached'] : (($postrow[$i]['dont_cache']) ? $CPS_Indicator['dont_cache'] : ((!$postrow[$i]['enable_bbcode'] && !$postrow[$i]['enable_html']) ? $CPS_Indicator['not_cached'] : $CPS_Indicator['error']));
$cps_img = (!$forum_topic_data['topic_cache_lock']) ? '<a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=recycle&'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_recycle'].'" alt="'.$lang['CPS_recycle'].'" title="'.$lang['CPS_recycle'].'" border="0" /></a>' : '';
$cps_img .= ($parsed) ? ' <a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=deactivate&'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_deactivate'].'" alt="'.$lang['CPS_dont_cache'].'" title="'.$lang['CPS_dont_cache'].'" border="0" /></a>' : '';
} else {
$parse_status = ($postrow[$i]['parsed']) ? $CPS_Indicator['off_but_cached'] : $CPS_Indicator['off'] ;
$cps_img = ($postrow[$i]['parsed'] && $userdata['user_level'] == ADMIN) ? '<a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=delete&'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_delete'].'" alt="'.$lang['CPS_delete'].'" title="'.$lang['CPS_delete'].'" border="0" /></a>' : '';
}
// Cache Posts
Und jetzt nach meinem Kunstwerk:
- Code: Alles auswählen
if ( $board_config['allow_smilies'] )
{
if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' && $board_config['sig_allow_smilies'] != 0 )
{
$user_sig = smilies_pass($user_sig, $forum_id);
}
(!$parsed || !$board_config['enable_post_cache']) ? (($postrow[$i]['enable_smilies']) ? $message = smilies_pass($message, $forum_id) : '') : ''; // Cache Posts
/* if ( $postrow[$i]['enable_smilies'] )
{
$message = smilies_pass($message);
}*/
}
else
{
if( $board_config['smilie_removal1'] )
{
$message = smilies_code_removal($message);
}
}
// Cache Posts
if (!$parsed && $board_config['enable_post_cache'] && ($postrow[$i]['enable_bbcode'] || $postrow[$i]['enable_html']) && !$postrow[$i]['dont_cache'] && !$forum_topic_data['topic_cache_lock'])
{
$cstyle = ($userdata['session_logged_in'] && $userdata['user_style'] != $board_config['default_style'] && $board_config['cache_each_template']) ? $userdata['user_style'].'_' : '';
$cachefile = 'cache/posts/'.$cstyle.'post_'.$postrow[$i]['post_id'].'.gz';
$handle = @fopen($phpbb_root_path.$cachefile, 'w');
@flock($handle, LOCK_EX);
$packed = gzdeflate($message, 9);
$cf_size = @fwrite($handle, $packed);
@flock($handle, LOCK_UN);
@fclose($handle);
@chmod($phpbb_root_path.$cachefile, 0666);
if ($cf_size)
{
if ($cf_size > $board_config['min_post_cache_size'])
{
$parsed = 1;
$sql = "UPDATE " . POSTS_TABLE . "
SET parsed = 1, cache_file_md5 = '".md5_file($cachefile)."'
WHERE post_id = ".$postrow[$i]['post_id'];
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
}
}
else
{
$parsed = 0;
$postrow[$i]['dont_cache'] = 1;
foreach (glob($phpbb_root_path.'cache/posts/*post_'.$postrow[$i]['post_id'].'.gz') as $cachefile)
{
@unlink($cachefile);
}
$sql = "UPDATE " . POSTS_TABLE . "
SET parsed = 0, dont_cache = 1, cache_file_md5 = NULL
WHERE post_id = ".$postrow[$i]['post_id'];
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
}
}
}
else if ($postrow[$i]['parsed'])
{
$parsed = 0;
$sql = "UPDATE " . POSTS_TABLE . "
SET parsed = 0, cache_file_md5 = NULL
WHERE post_id = ".$postrow[$i]['post_id'];
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
}
}
$postrow[$i]['parsed'] = $parsed;
}
else if ( $forum_topic_data['topic_cache_lock'] )
{
$parsed = 0;
$postrow[$i]['dont_cache'] = 1;
$sql = "UPDATE " . POSTS_TABLE . "
SET parsed = 0, dont_cache = 1, cache_file_md5 = NULL
WHERE post_id = ".$postrow[$i]['post_id'];
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
}
$postrow[$i]['parsed'] = $parsed;
}
if ($board_config['enable_post_cache'])
{
$parse_status = ($parsed) ? $CPS_Indicator['cached'] : (($postrow[$i]['dont_cache']) ? $CPS_Indicator['dont_cache'] : ((!$postrow[$i]['enable_bbcode'] && !$postrow[$i]['enable_html']) ? $CPS_Indicator['not_cached'] : $CPS_Indicator['error']));
$cps_img = (!$forum_topic_data['topic_cache_lock']) ? '<a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=recycle&'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_recycle'].'" alt="'.$lang['CPS_recycle'].'" title="'.$lang['CPS_recycle'].'" border="0" /></a>' : '';
$cps_img .= ($parsed) ? ' <a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=deactivate&'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_deactivate'].'" alt="'.$lang['CPS_dont_cache'].'" title="'.$lang['CPS_dont_cache'].'" border="0" /></a>' : '';
} else {
$parse_status = ($postrow[$i]['parsed']) ? $CPS_Indicator['off_but_cached'] : $CPS_Indicator['off'] ;
$cps_img = ($postrow[$i]['parsed'] && $userdata['user_level'] == ADMIN) ? '<a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=delete&'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_delete'].'" alt="'.$lang['CPS_delete'].'" title="'.$lang['CPS_delete'].'" border="0" /></a>' : '';
}
// Cache Posts
Also optisch ist mir die viewtopic ja sehr gut gelungen find ich und ich krieg nicht mal ne Fehlermeldung.

Aber ob das so richtig eingebaut ist, entzieht sich meiner Kenntnis. Will ja nicht, daß das CPS dadurch irgendwie ausgehebelt wird.

Ich hoffe du kannst mir irgendwie helfen.

Danke schon mal.
