s.a arkadaşlar benim sizden bir ricam olucak

ben mybb forum scripti kullanıyorum onda bir plugin var ajax ile çalışıyor plugin shoutbox ben istiyorum ki shoutbox ta yazılan ş ç ğ ü gibi tr karakterler dbye böyle giderken db den siteye s c g u olarak yansısın bunu php de replace kodu ile yapıldığını biliyorum o yüzden konuyu buraya açtım sizden istediğim şey bunu nasıl bir replace ile istediğim şekle getirebileceğimdir
bir kaç tane denedim olmuyo orjinal dosya aşağıda şimdiden teşekkürler

<?php

/**
 * SpiceFuse ShoutBox for MyBB 1.2
 * Copyright © 2006 Asad Niazi, All Rights Reserved!
 *
 * Website: http://www.spicefuse.com
 * License: 
 * This plugin is offered "as is" with no guarantees.
 * You may redistribute it provided the code and credits 
 * remain intact with no changes. This is not distributed
 * under GPL, so you may NOT re-use the code in any other
 * module, plugin, or program. 
 * 
 * Free for non-commercial purposes!
 *
 */

$plugins->add_hook("global_end", "sb_init");
$plugins->add_hook("xmlhttp", "sb_load");
$plugins->add_hook("pre_output_page", "sb_output_control");

function spicefuse_shoutbox_info()
{
    return array(
        'name'            => 'SpiceFuse Shoutbox',
        'description'    => 'An elegant, fast, and resource friendly AJAX shoutbox.',
        'website'        => 'http://mods.mybboard.com/',
        'author'        => 'Asad Niazi',
        'authorsite'    => 'http://spicefuse.com/',
        'version'        => '1.0 Beta 2'
    );
}

function spicefuse_shoutbox_activate()
{
    global $db;
    
    // create table
    $db->query("CREATE TABLE `".TABLE_PREFIX."sf_shouts` (
      `id` int(10) NOT NULL auto_increment,
      `uid` int(10) NOT NULL,
      `shout_msg` text NOT NULL,
      `shout_date` int(10) NOT NULL,
      `shout_ip` varchar(30) NOT NULL,
      PRIMARY KEY  (`id`)
        ) TYPE=MyISAM");
        
    $db->query("INSERT INTO ".TABLE_PREFIX."sf_shouts VALUES (NULL, 1, 'Test Shout! Without any shout, shoutbox will display Loading... forever.. you need at least one shout, so here it is.', ".time().", '127.0.0.1')");
    
    // create a group
    $db->query("INSERT INTO `".TABLE_PREFIX."settinggroups` VALUES (NULL, 'sf_shoutbox', 'SpiceFuse Shoutbox', 'Settings for the AJAX shoutbox.', 1, '');");
    $id = $db->insert_id();
        
    // insert settings
    $db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'sf_sb_shouts_main', '# of Shouts to display', 'The maximum number of shouts you want to be displayed.', 'text', '10', 1, {$id})");
    $db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'sf_sb_refresh_interval', 'Refresh Interval', 'How many seconds before the shoutbox is reloaded using AJAX transparently. ', 'text', '30', 0, {$id})");
    $db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'sf_sb_allow_mycode', 'Allow MyCode?', 'Allow MyBB code in shouts to format text using [b], [i] etc..?', 'yesno', 'yes', 0, {$id})");
    $db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'sf_sb_allow_smilies', 'Allow Smilies?', 'Allow smilies in shouts?', 'yesno', 'yes', 0, {$id})");
    $db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'sf_sb_allow_imgcode', 'Allow IMGCode?', 'Allow images in shoutbox? Note: Some can post too big images and mess up your layout.', 'yesno', 'no', 0, {$id})");
    $db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'sf_sb_height', 'ShoutBox Height', 'Set the height for shoutbox here.', 'text', '125', 0, {$id})");
    $db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'sf_sb_datetime', 'ShoutBox Date/Time', 'PHP date time format for shoutbox. <a href=\"http://php.net/date\" target=\"_blank\">check here</a> for more info.', 'text', 'd-m-H:i', 0, {$id})");
    $db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'sf_sb_full_ppage', 'Shouts per page on full view?', 'The number of shouts you want to be displayed, per page, on the full shoutbox view.', 'text', '15', 0, {$id})");
    $db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'sf_sb_allow_smods', 'Allow super mods to delete?', 'Allow super mods to delete shouts in the shoutbox?', 'yesno', 'yes', 0, {$id})");
    $db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'sf_sb_guestview', 'Guests can View Shoutbox?', 'Are guests allowed to view shoutbox?', 'yesno', 'yes', 0, {$id})");
    
    // load templates
    $sf_shoutbox_tpl = addslashes(implode("", file('../inc/plugins/tpl_sf_shoutbox.txt')));
    $sf_sboxfull_tpl = addslashes(implode("", file('../inc/plugins/tpl_sf_sboxfull.txt')));
    
    // insert templates
    $db->query("INSERT INTO `".TABLE_PREFIX."templates` VALUES (NULL, 'sf_shoutbox', '{$sf_shoutbox_tpl}', '-1', '121', '', '1167510304')");
    $db->query("INSERT INTO `".TABLE_PREFIX."templates` VALUES (NULL, 'sf_shoutbox_full', '{$sf_sboxfull_tpl}', '-1', '121', '', '1167510304')");
    
    // rebuild settings...
    rebuildsettings();
    
    global $plugins_cache, $cache, $active_plugins, $plugins_cache;
    $plugins_cache['active'] = $active_plugins;
    $cache->update("plugins", $plugins_cache);
    
    cpmessage("Please follow the instructions at spicefuse.com and perform the next steps of editing the templates.");

}

function spicefuse_shoutbox_deactivate()
{
    global $db;
    
    $db->query("DROP TABLE ".TABLE_PREFIX."sf_shouts");
    $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name = 'sf_shoutbox'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN('sf_sb_shouts_main','sf_sb_refresh_interval','sf_sb_allow_mycode',
                            'sf_sb_allow_smilies','sf_sb_allow_imgcode','sf_sb_height','sf_sb_datetime','sf_sb_full_ppage','sf_sb_allow_smods',
                            'sf_sb_guestview')");
    $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title IN('sf_shoutbox','sf_shoutbox_full') AND sid='-1'");
}

function sb_init()
{
    global $mybb, $lang;
    
    $lang->load("sf_shoutbox");

    if ($mybb->input['action'] == 'full_shoutbox') {
        return sb_show_full();
    }
}

function sb_show_full()
{
    global $db, $mybb, $templates, $lang, $footer, $headerinclude, $header, $charset;

    if (!sb_can_view()) {
        return;
    }
    
    // Send our headers.
    header("Content-type: text/html; charset={$charset}");
    
    // Make navigation
    add_breadcrumb($lang->sf_sb_shoutbox, "index.php?action=full_shoutbox");
    $per_page = intval($mybb->settings['sf_sb_full_ppage']);

    // pagination
    $query = $db->simple_select(TABLE_PREFIX."sf_shouts", "COUNT(*) as shouts_count");
    $shouts_count = $db->fetch_field($query, 'shouts_count');
    
    $page = intval($mybb->input['page']);
    $pages = ceil($shouts_count / $per_page);

    if ($page > $pages) {
        $page = 1;
    }

    if ($page) {
        $start = ($page-1) * $per_page;
    } else {
        $start = 0;
        $page = 1;
    }
    
    // multi-page
    if ($shouts_count > $per_page) {
        $multipage = multipage($shouts_count, $per_page, $page, "index.php?action=full_shoutbox");        
    }
    
    // get data
    require_once MYBB_ROOT.'inc/class_parser.php';
    $parser = new postParser;
    
    $query = $db->query("SELECT s.*, u.username, u.usergroup, u.displaygroup FROM ".TABLE_PREFIX."sf_shouts s 
                            LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = s.uid) 
                         ORDER by s.id DESC LIMIT {$start}, {$per_page}");
    
    while ($row = $db->fetch_array($query))
    {
        $parser_options = array(
                'allow_mycode' => $mybb->settings['sf_sb_allow_mycode'],
                'allow_smilies' => $mybb->settings['sf_sb_allow_smilies'],
                'allow_imgcode' => $mybb->settings['sf_sb_allow_imgcode'],
                'me_username' => $row['username']
            );        
            
        $message  = $parser->parse_message($row['shout_msg'], $parser_options);
        $row['username'] = format_name($row['username'], $row['usergroup'], $row['displaygroup']);

        $extra = ($mybb->usergroup['cancp'] == "yes" ? "title='{$row[shout_ip]}'" : "");
        
        $username = '<a href="member.php?action=profile&uid='.intval($row['uid']).'"'.$extra.'>'.$row['username'].'</a>';
        $date_time = my_date($mybb->settings['sf_sb_datetime'], $row['shout_date']);
        $class = alt_trow();
        
        if (sb_can_delete()) {
            $delete = "(<a onClick='return confirm(\"{$lang->sf_sb_delconfirm}\");' href='javascript: ShoutBox.deleteShout({$row[id]}, 2);'>{$lang->sf_sb_delete}</a>) ";
        }
        
        $sf_shoutbox_data .= "<tr id='shout-{$row[id]}'><td class='{$class}'>&raquo; {$delete}{$username} - {$date_time} -- {$message}</td></tr>";
    }
    
    
    eval("\$shoutbox_full = \"".$templates->get("sf_shoutbox_full")."\";");
    
    $db->query("SELECT * FROM ".TABLE_PREFIX."sf_shouts ORDER by id DESC LIMIT 10");
    
    output_page($shoutbox_full);
    exit;
}

/**
 * Add shoutbox template before output 
 */
function sb_output_control($page_data)
{
    global $mybb, $templates, $sf_shoutbox, $lang, $theme;
    
    if (sb_can_view()) {
    
        // no shout button for guests
        if ($mybb->user['usergroup'] == 1) {
            $extra_js = "ShoutBox.disableShout();";
        } else {
            $extra_js = "";
        }
        
        eval("\$sf_shoutbox = \"".$templates->get("sf_shoutbox")."\";");
    }
    
    return str_replace('<sf_shoutbox>', $sf_shoutbox, $page_data);
}

function sb_load()
{
    global $mybb, $lang, $charset;

    $lang->load("sf_shoutbox");
    
    // Send our headers.
    header("Content-type: text/html; charset={$charset}");
    
    switch ($mybb->input['action'])
    {
        case 'show_shouts':
            sb_show_shouts(intval($mybb->input['last_id']));
            break;
            
        case 'add_shout':
            sb_add_shout();
            break;
        
        case 'delete_shout':
            sb_delete_shout(intval($mybb->input['id']));
            break;
    }
}

function sb_show_shouts($last_id = 0)
{
    global $db, $mybb, $parser, $charset, $lang;
    
    require_once MYBB_ROOT.'inc/class_parser.php';
    $parser = new postParser;

    $query = $db->query("SELECT s.*, u.username, u.usergroup, u.displaygroup FROM ".TABLE_PREFIX."sf_shouts s 
                            LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = s.uid) 
                        WHERE s.id>{$last_id} ORDER by s.id DESC LIMIT {$mybb->settings[sf_sb_shouts_main]}");
    
    // fetch results 
    $messages = ""; $entries = 0;
    while ($row = $db->fetch_array($query))
    {
        $parser_options = array(
                'allow_mycode' => $mybb->settings['sf_sb_allow_mycode'],
                'allow_smilies' => $mybb->settings['sf_sb_allow_smilies'],
                'allow_imgcode' => $mybb->settings['sf_sb_allow_imgcode'],
                'me_username' => $row['username']
            );        
            
        $message  = $parser->parse_message($row['shout_msg'], $parser_options);
        $row['username'] = format_name($row['username'], $row['usergroup'], $row['displaygroup']);
        
        $extra = ($mybb->usergroup['cancp'] == "yes" ? "title='{$row[shout_ip]}'" : "");
        
        $username = '<a href="member.php?action=profile&uid='.intval($row['uid']).'"'.$extra.'>'.$row['username'].'</a>';
        $date_time = my_date($mybb->settings['sf_sb_datetime'], $row['shout_date']);

        if (sb_can_delete()) {
            $delete = "(<a onClick='return confirm(\"{$lang->sf_sb_delconfirm}\");' href='javascript: ShoutBox.deleteShout({$row[id]}, 1);'>{$lang->sf_sb_delete}</a>) ";
        }
        
        $messages .= "&raquo; {$delete}{$username} - {$date_time} -- {$message}<br>\r\n";
        
        $entries++;
        
        if ($entries == 1) {
            $maxid = $row['id'];
        }
    }
    
    if (!$maxid) {
        $maxid = $last_id;
    }
    
    echo "{$maxid}^--^{$entries}^--^{$messages}";
    exit;
}

function sb_add_shout()
{
    global $db, $mybb;
    
    // guests not allowed!
    if ($mybb->user['usergroup'] == 1 OR $mybb->user['uid'] < 1 OR !sb_can_view()) {
        die("failed!");
    }
    
    $shout_data = array(
            'uid' => $mybb->user['uid'],
            'shout_msg' => $db->escape_string(str_replace('^--^', '-', $mybb->input['shout_data'])),
            'shout_date' => time(),
            'shout_ip' => get_ip()
        );
        
    if ($db->insert_query(TABLE_PREFIX.'sf_shouts', $shout_data)) {
        echo "success!!";
    } else {
        echo "failed!";
    }
    
    exit;
}

function sb_delete_shout($shout_id)
{
    global $db;
    
    if (sb_can_delete()) {
        $db->query("DELETE FROM ".TABLE_PREFIX."sf_shouts WHERE id = {$shout_id}");
        echo "success!";
    } else {
        echo "failed!";
    }
    
    exit;
}

function sb_can_delete()
{
    global $mybb;

    if ($mybb->usergroup['cancp'] == "yes" OR ($mybb->settings['sf_sb_allow_smods'] == "yes" && $mybb->usergroup['issupermod'] == "yes"))
    {
        return true;
    }
    
    return false;
}

function sb_can_view()
{
    global $mybb;
    
    if ($mybb->usergroup['canview'] == "no" OR ($mybb->settings['sf_sb_guestview'] == "no" && $mybb->user['usergroup'] == 1)) {
        return false;
    } else {
        return true;
    }
}

?>