예제 #1
0
</script>
</head>
<body>
<div id="mypanelbody">
<?php 
global $db, $current_user;
if (empty($db)) {
    $db = DBManagerFactory::getInstance();
}
$myTmp = mktime(5, 0, 0, date('m'), date('d') - 15, date('Y'));
require_once 'modules/let_Chat/helper.php';
$helper = new chatHelper();
$all = '';
//ALL MESS
$q = "SELECT mh.id, mh.id as sortid, mh.user as nickname, mh.msg as message, mh.time, mh.foruser, u1.first_name, u1.last_name\n\t\t\t\t\t\t FROM messages_history mh\n\t\t\t\t\t\t LEFT JOIN users u1 ON u1.user_name = mh.user AND u1.deleted = 0\n\t\t\t\t\t\t WHERE mh.foruser = '******' AND mh.time>=" . $myTmp . " ORDER BY sortid";
$q = $helper->escapeSQL($q);
//Taras 2012-12-21
$result = $db->query($q);
while (($message = $db->fetchByAssoc($result)) != null) {
    $message['message'] = htmlspecialchars(stripslashes($message['message']));
    $all .= '<div class="shoutbox-list">' . '<span class="shoutbox-list-time">' . date($GLOBALS['timedate']->get_date_time_format(), $message['time']) . '</span>' . '<span class="shoutbox-list-nick">' . $helper->format_display_name($message['nickname'], $message['first_name'], $message['last_name']) . ':</span>' . '<span class="shoutbox-list-message">' . $message['message'] . '</span>' . '</div>';
}
?>
	<ul class="tabs tabs1">
		<li class="t1 tab-current"><a>All (15 days)</a></li>
	</ul>

	<div id="panelt1" class="mypanel">
       <?php 
echo $all;
?>
예제 #2
0
else
{
  $otop=$_REQUEST['top'];
  $oleft=$_REQUEST['left'];
}       */
$q = "INSERT INTO messages_online (usr_id, usr_name, rtime, collapsed)  VALUES('" . $current_user->id . "','" . $current_user->user_name . "',{$timestamp}, '" . $_REQUEST['collapsed'] . "')";
$db->query($q);
if (!$_REQUEST['time']) {
    $_REQUEST['time'] = 0;
}
$myTmp = mktime(5, 0, 0, date('m'), date('d'), date('Y'));
//history
$currentDate = gmdate('Y-m-d');
if (!isset($_SESSION['let_Chat']['historyDate']) || $_SESSION['let_Chat']['historyDate'] != $currentDate) {
    $history_query = "SELECT * FROM messages WHERE time<" . $myTmp . " ORDER BY id ASC";
    $history_query = $helper->escapeSQL($history_query);
    //Taras 2012-12-21
    $history_result = $db->query($history_query);
    while (($history = $db->fetchByAssoc($history_result)) != null) {
        $h_query = "INSERT INTO messages_history (id, user, msg, time, foruser, del)\n\t        VALUES ('" . $history['id'] . "',\n\t         '" . $history['user'] . "',\n\t         '" . $db->quote($history['msg']) . "',\n\t          '" . $history['time'] . "',\n\t          '" . $history['foruser'] . "',\n\t          '" . $history['del'] . "'\n\t    ); ";
        $db->query($h_query);
        $del = "DELETE FROM messages WHERE id = " . $history['id'];
        // letrium v
        //$res=$db->limitQuery($del, 0, 1);
        $res = $db->query($del);
        // letrium v END
    }
    if (!isset($_SESSION['let_Chat'])) {
        $_SESSION['let_Chat'] = array();
    }
    $_SESSION['let_Chat']['historyDate'] = $currentDate;