Jump to content

smiley problem


Noskiw

Recommended Posts


<?php

function topic($input)
{
    $pattern[0] = "";
    $pattern[1] = "/\&/i";
    $pattern[2] = "/\</i";
    $pattern[3] = "/\>/i";
    $pattern[4] = "/\[b\](.*?)\[\/b\]/i";
    $pattern[5] = "/\[u\](.*?)\[\/u\]/i";
    $pattern[6] = "/\[i\](.*?)\[\/i\]/i";
    $pattern[7] = "/\[code\](.*?)\[\/code\]/i";
    $pattern[8] = "/\[url\](.*?)\[\/url\]/i";
    $pattern[9] = "/\[img\](.*?)\[\/img\]/i";
    $pattern[10] = "/\[url\=(.*)\](.*)\[\/url\]/i";
    
    $replace[0] = "<img src='/images/smiley1.gif'/>";
    $replace[1] = "&";
    $replace[2] = "<";
    $replace[3] = ">";
    $replace[4] = "<b>$1</b>";
    $replace[5] = "<u>$1</u>";
    $replace[6] = "<i>$1</i>";
    $replace[7] = "Code:<br><div id=\"code\"><tt>$1</tt></div>\n";
    $replace[8] = "<a href=$1>$1</a>";
    $replace[9] = "<img src = $1 />";
    $replace[10] = "<a href=$1>$2</a>";
    
    $bbcoded = preg_replace($pattern, $replace, $input);
    return nl2br($bbcoded && $some2);

    return nl2br(strip_tags(stripslashes(htmlspecialchars($input))));

}

?>

 

the posts i have won;t show up. and i have no idea why. help maybe?

Link to comment
https://forums.phpfreaks.com/topic/140830-smiley-problem/
Share on other sites


<?php

function topic($input)
{
    $pattern[0] = "";
    $pattern[1] = "/\&/i";
    $pattern[2] = "/\</i";
    $pattern[3] = "/\>/i";
    $pattern[4] = "/\[b\](.*?)\[\/b\]/i";
    $pattern[5] = "/\[u\](.*?)\[\/u\]/i";
    $pattern[6] = "/\[i\](.*?)\[\/i\]/i";
    $pattern[7] = "/\[code\](.*?)\[\/code\]/i";
    $pattern[8] = "/\[url\](.*?)\[\/url\]/i";
    $pattern[9] = "/\[img\](.*?)\[\/img\]/i";
    $pattern[10] = "/\[url\=(.*)\](.*)\[\/url\]/i";
    
    $replace[0] = "<img src='/images/smiley1.gif'/>";
    $replace[1] = "&";
    $replace[2] = "<";
    $replace[3] = ">";
    $replace[4] = "<b>$1</b>";
    $replace[5] = "<u>$1</u>";
    $replace[6] = "<i>$1</i>";
    $replace[7] = "Code:<br><div id=\"code\"><tt>$1</tt></div>\n";
    $replace[8] = "<a href=$1>$1</a>";
    $replace[9] = "<img src = $1 />";
    $replace[10] = "<a href=$1>$2</a>";
    
    $bbcoded = preg_replace($pattern, $replace, $input);
    //return nl2br($bbcoded && $some2);

    return nl2br(strip_tags(stripslashes(htmlspecialchars($bbcoded))));

}

?>

Link to comment
https://forums.phpfreaks.com/topic/140830-smiley-problem/#findComment-737114
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.