示例#1
0
function getData($lastID)
{
    require_once "conn.php";
    # getting connection data
    include "../include/settings.php";
    # getting table prefix
    include "../include/offset.php";
    $sql = "SELECT * FROM {$TABLE_PREFIX}chat WHERE (" . $CURUSER['uid'] . " = toid OR " . $CURUSER['uid'] . "= fromid AND private='yes')  ORDER BY id DESC";
    $conn = getDBConnection();
    # establishes the connection to the database
    $results = mysqli_query($conn, $sql);
    # getting the data array
    while ($row = mysqli_fetch_array($results)) {
        # getting the data array
        $id = $row[id];
        $uid = $row[uid];
        $time = $row[time];
        $name = $row[name];
        $text = $row[text];
        # if no name is present somehow, $name and $text are set to the strings under
        # we assume all must be ok, othervise no post will be made by javascript check
        # if ($name == '') { $name = 'Anonymous'; $text = 'No message'; }
        # we put together our chat using some css
        $chatout = "\n                 <li><span class='name'>" . date("d/m/Y H:i:s", $time - $offset) . " | <a href=index.php?page=userdetails&id=" . $uid . ">" . $name . "</a>:</span></li>\n                            <div class='lista' style='text-align:right;\n                                      margin-top:-13px;\n                                    margin-bottom:0px;\n                                   /* color: #006699;*/\n                          '>\n                          # {$id}</div>\n                 \n                 <!-- # chat output -->\n                 <div class='chatoutput'>" . format_shout($text) . "</div>\n                 ";
        echo $chatout;
        # echo as known handles arrays very fast...
    }
}
示例#2
0
echo "<br />";
$msg = array();
function file_save($filename, $content, $flags = 0)
{
    if (!($file = fopen($filename, 'w'))) {
        return FALSE;
    }
    $n = fwrite($file, $content);
    fclose($file);
    return $n ? $n : FALSE;
}
if (!file_exists("chat.php")) {
    file_save("chat.php", "<?php\n\$msg = " . var_export($msg, TRUE) . "\n?>");
}
include "chat.php";
while (count($msg) >= 100) {
    array_shift($msg);
}
$msg2 = array_reverse($msg);
echo "<div align='center' class='chat'><table width='92%'>";
include INCL_PATH . 'offset.php';
for ($i = 0; $i < count($msg2); ++$i) {
    echo "<tr><td class='header' align='left'>" . security::html_safe($msg2[$i]['pseudo']) . "&nbsp;&nbsp;&nbsp;[" . date("d/m/y H:i:s", $msg2[$i]['date'] - $offset) . "]</td></tr><tr><td class='lista' align='left'>" . format_shout($msg2[$i]['texte']) . "</td></tr>";
}
echo "</table></div>";
file_save("chat.php", "<?php\n\$msg = " . var_export($msg, TRUE) . "\n?>");
print "<br />";
block_end();
print "<br />";
print "<div align='center'><a href='javascript: window.close()'>" . CLOSE . "</a></div>";
stdfoot(false);
示例#3
0
function getData($lastID)
{
    include "include/settings.php";
    # getting table prefix
    include "include/offset.php";
    # discard it if we are editing
    $sid = isset($_GET["sid"]) ? $_GET["sid"] : 0;
    # get shout id (sid)and set it to zero for bool
    $sql = "SELECT * FROM {$TABLE_PREFIX}chat WHERE id > " . $lastID . " AND id != " . $sid . " ORDER BY id DESC";
    $conn = his_getDBConnection();
    # establishes the connection to the database
    $results = mysqli_query($conn, $sql);
    # getting the data array
    while ($row = mysqli_fetch_array($results)) {
        # creating and naming array
        $id = $row[id];
        $uid = $row[uid];
        $time = $row[time];
        $name = $row[name];
        $text = $row[text];
        # if no name is present somehow, $name and $text are set to the strings under
        # we assume all must be ok, othervise no post will be made by javascript check
        # if ($name == '') { $name = 'Anonymous'; $text = 'No message'; }
        # we lego put together our chat using some conditions and css and javascript this time
        print "<span class='name'>" . date("d/m/Y H:i:s", $time - $offset) . " | <a href=\"javascript:windowunder('index.php?page=userdetails&amp;id=" . $uid . "')\">" . $name . "</a>:</span>";
        global $CURUSER;
        if ($CURUSER["admin_access"] != "yes" && $CURUSER["uid"] != "" . $uid . "") {
        } else {
            # edit/delete buttons -->
            print "<div style='text-align:right;\r\n                             margin-top:-13px;\r\n                             margin-bottom:-3.5px;\r\n                             '>\r\n                      <a href='index.php?page=allshout&amp;sid={$id}&amp;edit'><img border='0' class='EditSwap' src='images/canvas.gif' alt='' /></a>\r\n                      <a onclick=\"return confirm('" . str_replace("'", "\\'", DELETE_CONFIRM) . "')\" href='index.php?page=allshout&amp;sid={$id}&amp;delete'>\r\n                      <img border='0' class='DeleteSwap' src='images/canvas.gif' alt='' /></a>\r\n                 </div>";
        }
        # chat output -->
        print "<div class='chatoutput'>" . format_shout($text) . "</div>";
    }
}
示例#4
0
    // [size=4]Text[/size]
    $s = preg_replace("/\\[size=([1-7])\\]((\\s|.)+?)\\[\\/size\\]/i", "<font size=\\1>\\2</font>", $s);
    // [font=Arial]Text[/font]
    $s = preg_replace("/\\[font=([a-zA-Z ,]+)\\]((\\s|.)+?)\\[\\/font\\]/i", "<font face=\"\\1\">\\2</font>", $s);
    // Linebreaks
    $s = nl2br($s);
    // Maintain spacing
    $s = str_replace("  ", " &nbsp;", $s);
    reset($smilies);
    while (list($code, $url) = each($smilies)) {
        $s = str_replace($code, "<img border=\"0\" src=\"{$BASEURL}/images/smilies/{$url}\" alt=\"{$url}\" />", $s);
    }
    return $s;
}
$msg = array();
include dirname(__FILE__) . "/chat.php";
while (count($msg) >= 100) {
    array_shift($msg);
}
$msg2 = array_reverse($msg);
include "include/offset.php";
for ($i = 0; $i < count($msg2); ++$i) {
    $shout[$i]["date"] = date("d/m/y H:i:s", $msg2[$i]['date'] - $offset);
    $shout[$i]["user"] = $msg2[$i]['pseudo'];
    $shout[$i]["shout"] = format_shout($msg2[$i]['texte']);
}
unset($msg);
unset($msg2);
$tpl_shout = new bTemplate();
$tpl_shout->set("chat", $shout);
$tpl_shout->set("script", "<a href=\"javascript: window.close()\">" . $language["CLOSE"] . "</a>");
示例#5
0
        unset($_POST['pseudo']);
        unset($_POST['mess']);
    }
}
$msg2 = array_reverse($msg);
echo '<div align="left" class="chat"><table width="95%" align="center"> <tr><td>';
include "include/offset.php";
for ($i = 0; $i < 10 && $i < count($msg2); ++$i) {
    $sql = "SELECT u.id as uid,prefixcolor,suffixcolor FROM {$TABLE_PREFIX}users u INNER JOIN {$TABLE_PREFIX}users_level ul ON ul.id_level=u.id_level WHERE u.username='******'pseudo'] . "'";
    $res = do_sqlquery($sql);
    $result = mysqli_fetch_assoc($res);
    // user or level don't exit in db
    if (!$result) {
        echo '<b>' . '</b>&nbsp;&nbsp;&nbsp;[' . date("d/m/y H:i", $msg2[$i]['date'] - $offset) . ']' . '&nbsp;&nbsp;<b>' . $msg2[$i]['pseudo'] . '</b>:&nbsp;&nbsp;&nbsp;' . format_shout($msg2[$i]['texte']) . '<hr>';
    } else {
        echo '<b>' . '</b>&nbsp;&nbsp;&nbsp;[' . date("d/m/y H:i", $msg2[$i]['date'] - $offset) . ']' . "&nbsp;&nbsp;<a style='text-decoration:none' href='index.php?page=userdetails&amp;id=" . $result["uid"] . "'>" . unesc($result['prefixcolor']) . $msg2[$i]['pseudo'] . unesc($result['suffixcolor']) . '</a>:&nbsp;&nbsp;&nbsp;' . format_shout($msg2[$i]['texte']) . '<hr />';
        unset($result);
    }
    mysqli_free_result($res) || is_object($res) && get_class($res) == "mysqli_result" ? true : false;
}
echo "</td></tr></table></div>";
file_save("chat.php", "<?php\n\$msg = " . var_export($msg, TRUE) . "\n?>");
unset($_POST['pseudo']);
unset($_POST['mess']);
if ($CURUSER["uid"] > 1) {
    /*
    header("Expires: Mon, 1 Jan 1990 01:00:00 GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    */
示例#6
0
function getData($lastID)
{
    include "include/settings.php";
    # getting table prefix
    include "include/offset.php";
    # discard it if we are editing
    $sid = isset($_GET["sid"]) ? $_GET["sid"] : 0;
    # get shout id (sid)and set it to zero for bool
    $sql = "SELECT * FROM {$TABLE_PREFIX}chat WHERE id > " . $lastID . " AND id != " . $sid . " AND `private`='no' OR (" . $CURUSER['uid'] . " = `toid` OR " . $CURUSER['uid'] . "= `fromid` AND `private`='yes') ORDER BY id DESC";
    $conn = his_getDBConnection();
    # establishes the connection to the database
    $results = mysqli_query($conn, $sql);
    # getting the data array
    while ($row = mysqli_fetch_array($results)) {
        # creating and naming array
        $id = $row[id];
        $uid = $row[uid];
        $time = $row[time];
        $rd = mysqli_fetch_row(mysqli_query($GLOBALS["___mysqli_ston"], "SELECT donor,warn,immunity  FROM {$TABLE_PREFIX}users WHERE id={$uid}"));
        $row["donor"] = $rd[0];
        $row["warn"] = $rd[1];
        $row["immunity"] = $rd[2];
        unset($rd);
        if ($row["warn"] == "no" or $uid == 0) {
            $st = "";
        } else {
            $st = "<img src='images/warn.gif'>";
        }
        if ($row["immunity"] == "no" or $uid == 0) {
            $set = "";
        } else {
            $set = "<img src='images/shield.png'>";
        }
        $name = user_with_color($row[name]);
        $text = $row[text];
        $getsbox = @mysqli_fetch_array(@mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM {$TABLE_PREFIX}users WHERE id=" . $uid));
        $sbox = "{$getsbox['sbox']}";
        if ($sbox == "no" || $uid == "0") {
            //make sure system can still post
            # if no name is present somehow, $name and $text are set to the strings under
            # we assume all must be ok, othervise no post will be made by javascript check
            # if ($name == '') { $name = 'Anonymous'; $text = 'No message'; }
            //private chat
            if ($row["private"] == "yes") {
                $name = "<b><font color=orangered>[PM]</font></b>&nbsp;" . user_with_color($row["name"]) . "";
            }
            $name = $name . $st . $set . get_user_icons($row);
            # we lego put together our chat using some conditions and css and javascript this time
            print "<span class='name'>" . date("d/m/Y H:i:s", $time - $offset) . " | <a href=\"javascript:windowunder('index.php?page=userdetails&amp;id=" . $uid . "')\">" . $name . "</a>:</span>";
            global $CURUSER;
            if ($CURUSER["admin_access"] != "yes" && $CURUSER["uid"] != "" . $uid . "") {
            } else {
                # edit/delete buttons -->
                print "<div style='text-align:right;\n                             margin-top:-13px;\n                             margin-bottom:-3.5px;\n                             '>\n                      <a href='index.php?page=allshout&amp;sid={$id}&amp;edit'><img border='0' class='EditSwap' src='images/canvas.gif' alt='' /></a>\n                      <a onclick=\"return confirm('" . str_replace("'", "\\'", DELETE_CONFIRM) . "')\" href='index.php?page=allshout&amp;sid={$id}&amp;delete'>\n                      <img border='0' class='DeleteSwap' src='images/canvas.gif' alt='' /></a>\n                 </div>";
            }
            # chat output -->
            print "<div class='chatoutput'>" . format_shout($text) . "</div>";
        }
    }
}
示例#7
0
文件: chatter.php 项目: Karpec/gizd
        echo "<div align='left' style='float: left'>";
        $time = $row[time];
        echo date("d/m/Y H:i:s", $time - $offset);
        $bimg2 = @mysqli_fetch_array(@mysqli_query($GLOBALS["___mysqli_ston"], "SELECT avatar FROM {$TABLE_PREFIX}users  WHERE id={$row['userid']}"));
        $avatar = htmlspecialchars($bimg2["avatar"]);
        if (!$avatar) {
            $avatar = "" . $STYLEURL . "/images/default_avatar.gif";
        }
        echo '<center><img src="' . $avatar . '" width="75px"/></center>';
        echo "</div>";
        $colors = @mysqli_fetch_array(@mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ul.prefixcolor, ul.suffixcolor FROM {$TABLE_PREFIX}users u LEFT JOIN {$TABLE_PREFIX}users_level ul ON u.id_level=ul.id WHERE u.id={$row['userid']}")) or sqlerr();
        if ($CURUSER['edit_torrents'] >= "yes" || $CURUSER['username'] == $row['user']) {
            echo '<div align="right" style="float: right"><a href="' . $BASEURL . '/chatter.php?del=' . $row['msgid'] . '"><img src="' . $STYLEURL . '/images/delete.png" border="0" alt="Delete"></a>&nbsp;<a href="' . $BASEURL . '/shoutedit.php?action=edit&msgid=' . $row['msgid'] . '"><img src="' . $STYLEURL . '/images/edit.png" border="0" alt="Edit"></a><div>';
        }
        $name = stripslashes($colors[prefixcolor]) . $row[user] . stripslashes($colors[suffixcolor]);
        echo '</td><td style="font-size: 10pt; padding-left: 5px"><a href="' . $BASEURL . '/index.php?page=userdetails&id=' . $row['userid'] . '" target="_parent"><b>' . $name . ':</b></a>&nbsp;&nbsp;' . nl2br(format_shout($row['message']));
        echo '</td></tr>';
    }
    ?>
</table></td>
  </tr>
</table>
</div>
<br>

<?php 
    //if the user is logged in, show the shoutbox, if not, dont.
    if (!isset($_GET['history'])) {
        if (isset($CURUSER)) {
            echo "<script language=javascript>\n\nfunction GiveMsgBoxFocus()\n{\ndocument.shoutboxform.message.focus();\n}\nfunction PopMoreSmiles(form,name) {\n         newWin=window.open('{$BASEURL}/index.php?page=moresmiles&form='+form+'&text='+name,'moresmile','height=500,width=450,resizable=yes,scrollbars=yes');\n         if (window.focus) {newWin.focus()}\n}\nfunction ShowHistory() {\n  var HistoryWindow = window.open('{$BASEURL}/chatter.php?history=1', 'History','width=600,height=600,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no');\n}\n</script>";
            echo "<form name='shoutboxform' action='" . $BASEURL . "/chatter.php' method='post'>";
示例#8
0
function getData($lastID)
{
    require_once "conn.php";
    # getting connection data
    include "../include/settings.php";
    # getting table prefix
    include "../include/offset.php";
    global $CURUSER, $btit_settings;
    if ($CURUSER["view_users"] != "yes") {
        die("Sorry, Shoutbox is not available...");
    }
    $shoutline = $btit_settings["shoutline"];
    $sql = "SELECT * FROM {$TABLE_PREFIX}chat WHERE id > " . $lastID . " AND `private`='no' OR (" . $CURUSER['uid'] . " = `toid` OR " . $CURUSER['uid'] . "= `fromid` AND `private`='yes') ORDER BY id DESC LIMIT {$shoutline}";
    $conn = getDBConnection();
    # establishes the connection to the database
    $results = mysqli_query($conn, $sql);
    # getting the data array
    while ($row = mysqli_fetch_array($results)) {
        # getting the data array
        $id = $row[id];
        $uid = $row[uid];
        $rd = mysqli_fetch_row(mysqli_query($GLOBALS["___mysqli_ston"], "SELECT donor,warn,immunity,avatar FROM {$TABLE_PREFIX}users WHERE id={$uid}"));
        $row["donor"] = $rd[0];
        $row["warn"] = $rd[1];
        $row["immunity"] = $rd[2];
        $row["avatar"] = $rd[3];
        unset($rd);
        if ($row["warn"] == "no" or $uid == 0) {
            $st = "";
        } else {
            $st = "<img src='images/warn.gif'>";
        }
        if ($row["immunity"] == "no" or $uid == 0) {
            $set = "";
        } else {
            $set = "<img src='images/shield.png'>";
        }
        $time = $row[time];
        $name = "<a href='index.php?page=userdetails&id=" . $uid . "'> " . user_with_color($row["name"]) . $st . $set . get_user_icons($row) . "</a>";
        $text = $row[text];
        $shout_reply = "<a href='javascript:window.top.SmileIT(\"[b][color=crimson]@ " . htmlspecialchars($row['name']) . "...&nbsp;&nbsp;[/color][/b]\")'><img src='images/rep.gif' title='Reply' alt='Reply' /></a>";
        $name = $name . "&nbsp;<a href=\"javascript:PopPshout('" . $CURUSER["uid"] . "','" . $uid . "','" . $CURUSER["pchat"] . "');\"><img src='images/pchat.png'></a>";
        if ($row["private"] == "yes") {
            $name = "<b><span style='color:orangered;'><img src='images/privatec.png'></span></b>&nbsp;" . $name . "&nbsp;" . ($uid != $CURUSER["uid"] ? "<a href=\"javascript:PopPshout('" . $CURUSER["uid"] . "','" . $uid . "','" . $CURUSER["pchat"] . "');\"><b>[reply]</b></a>" : "") . "";
        }
        $getsbox = @mysqli_fetch_array(@mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM {$TABLE_PREFIX}users WHERE id=" . $uid));
        $sbox = "{$getsbox['sbox']}";
        if ($sbox == "no" || $uid == "0") {
            //make sure system can still post
            # if no name is present somehow, $name and $text are set to the strings under
            # we assume all must be ok, othervise no post will be made by javascript check
            # if ($name == '') { $name = 'Anonymous'; $text = 'No message'; }
            //online status
            $ol = @mysqli_fetch_array(@mysqli_query($GLOBALS["___mysqli_ston"], "SELECT u.lastconnect, o.lastaction FROM {$TABLE_PREFIX}users u LEFT JOIN {$TABLE_PREFIX}online o ON u.id = o.user_id WHERE u.id=" . $uid));
            is_null($ol["lastaction"]) ? $lastseen = $ol["lastconnect"] : ($lastseen = $ol["lastaction"]);
            time() - $lastseen > 900 ? $status = "<img src='images/button_offline.gif' border='0' title='Offline' alt='" . $language["OFFLINE"] . "'>" : ($status = "<img src='images/button_online.gif' border='0' title='Online' alt='" . $language["ONLINE"] . "'>");
            @(mysqli_free_result($ol) || is_object($ol) && get_class($ol) == "mysqli_result" ? true : false);
            // end online status
            if ($btit_settings["shoutdel"] == true and $CURUSER["edit_users"] == "yes") {
                $editt = "<a href='javascript:editup({$id},{$CURUSER['uid']});' style='font-size: 8px'><img src='images/edit.png' title='edit' alt='edit' border='0'></a>&nbsp;<a class=\"stdelete\" href=\"#\" id=\"" . $id . "\" title=\"Delete\"><img src='images/delete.png' border='0' title='del' alt='del'></a>&nbsp;";
            } else {
                $editt = "";
            }
            if ($btit_settings["shoutdt"] == true) {
                // avatar
                if ($btit_settings["shoutdtav"] == true) {
                    if ($row["avatar"] && $row["avatar"] != "") {
                        $av = "<img  width=40 height=40 border=0 src=" . unesc($row["avatar"]) . " />";
                    } else {
                        $av = "<img width=40 height=40 border=0 src=\"images/default_avatar.gif\">";
                        if ($uid == '0') {
                            $av = "<img width=40 height=40 border=0 src=\"images/system.png\">";
                        }
                    }
                } else {
                    $av = "";
                }
                // avatar
                if ($btit_settings["shoutdtz"] == true) {
                    $f = '2';
                } else {
                    $f = '1';
                }
                # we put together our dt chat
                $chatout = "\n                 <li><span>" . $av . "&nbsp;" . $editt . $status . " <font color = green size=" . $f . ">" . date("d/m/Y H:i:s", $time - $offset) . " </font> | <font size=" . $f . "><b><a href=index.php?page=userdetails&id=" . $uid . ">" . $name . "</a>: " . format_shout($text) . $shout_reply . "</b></font></span></li>";
            } else {
                # we put together our chat using some css
                $chatout = "\n                 <li><span class='name'>" . $editt . date("d/m/Y H:i:s", $time - $offset) . "&nbsp;" . $status . " | <a href=index.php?page=userdetails&id=" . $uid . ">" . $name . "</a>:</span></li>\n                            <div class='lista' style='text-align:right;\n                                      margin-top:-13px;\n                                    margin-bottom:0px;\n                                   /* color: #006699;*/\n                          '>\n                          # {$id}</div>\n \n                 <!-- # chat output -->\n                 <div class='chatoutput'>" . format_shout($text) . $shout_reply . "</div>\n                 ";
            }
            echo $chatout;
            # echo as known handles arrays very fast...
        }
    }
}