alex,
αρχείο: functions_post.php
search: function prepare_message
replace: global $board_config;
with: global $board_config, $userdata; // by GUS
μετά τα globals πρόσθεσε:
// GUS start
if( $userdata['user_level'] == ADMIN ) {
$html_entities_match = array();
$html_entities_replace = array();
$unhtml_specialchars_match = array();
$unhtml_specialchars_replace = array();
}
// end GUS
search: $tmp_message .= ( $length && !$tagallowed )
πριν από αυτό πρόσθεσε: if( $userdata['user_level'] == ADMIN ) $tagallowed = true; // by GUS
παρακάτω είναι όλη η function αλλαγμένη αλλά εσύ μπορεί να έχεις λίγο διαφορετική έκδοση:
//
// This function will prepare a posted message for
// entry into the database.
//
function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0)
{
global $board_config, $userdata; // by GUS
global $html_entities_match, $html_entities_replace;
global $code_entities_match, $code_entities_replace;
// GUS start
if( $userdata['user_level'] == ADMIN ) {
$html_entities_match = array();
$html_entities_replace = array();
$unhtml_specialchars_match = array();
$unhtml_specialchars_replace = array();
}
// end GUS
//
// Clean up the message
//
$message = trim($message);
if ( $html_on )
{
$allowed_html_tags = split(',', $board_config['allow_html_tags']);
$end_html = 0;
$start_html = 1;
$tmp_message = '';
$message = ' ' . $message . ' ';
while ( $start_html = strpos($message, '<', $start_html) )
{
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1, ( $start_html - $end_html - 1 )));
if ( $end_html = strpos($message, '>', $start_html) )
{
$length = $end_html - $start_html + 1;
$hold_string = substr($message, $start_html, $length);
if ( ( $unclosed_open = strrpos(' ' . $hold_string, '<') ) != 1 )
{
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($hold_string, 0, $unclosed_open - 1));
$hold_string = substr($hold_string, $unclosed_open - 1);
}
$tagallowed = false;
for($i = 0; $i < sizeof($allowed_html_tags); $i++)
{
$match_tag = trim($allowed_html_tags[$i]);
if ( preg_match('/^<\/?' . $match_tag . '\b/i', $hold_string) )
{
$tagallowed = true;
}
}
if( $userdata['user_level'] == ADMIN ) $tagallowed = true; // by GUS
$tmp_message .= ( $length && !$tagallowed ) ? preg_replace($html_entities_match, $html_entities_replace, $hold_string) : $hold_string;
$start_html += $length;
}
else
{
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $start_html, strlen($message)));
$start_html = strlen($message);
$end_html = $start_html;
}
}
if ( $end_html != strlen($message) && $tmp_message != '' )
{
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1));
}
$message = ( $tmp_message != '' ) ? trim($tmp_message) : trim($message);
}
else
{
$message = preg_replace($html_entities_match, $html_entities_replace, $message);
}
if( $bbcode_on && $bbcode_uid != '' )
{
$message = bbencode_first_pass($message, $bbcode_uid);
}
return $message;
}