Esempio n. 1
0
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;
?>
	</div>
    <?php 
// letrium v
$q = "SELECT DISTINCT mh.foruser, u1.first_name, u1.last_name FROM messages_history mh\n\t\t\t\t\t\t LEFT JOIN users u1 ON u1.user_name = mh.foruser AND u1.deleted = 0\n                         WHERE  mh.user='******'  AND mh.foruser<>'" . $current_user->user_name . "'\n                         AND mh.foruser<>'null' AND mh.foruser<>'all'\n                         AND mh.time>=" . $myTmp . "\n                         ORDER BY mh.foruser";
// letrium v
Esempio n. 2
0
     $q = "SELECT rez1.* FROM (SELECT id,user as nickname,msg as message,time,foruser
     					 FROM messages
     					 WHERE id>".$_REQUEST['time']." AND ((foruser = '******') OR (foruser = '******')
     					 	OR user='******') AND time>=".$myTmp."  ORDER BY id DESC)
     				AS rez1,
     				messages WHERE rez1.id=messages.id ORDER BY id ASC";
     */
     // letrium v
     // add display name format
     $q = "SELECT m.id, m.id as sortid, m.user as nickname, m.msg as message, m.time, m.foruser, u.first_name as from_first_name, u.last_name as from_last_name, foru.first_name as to_first_name, foru.last_name as to_last_name\n\t\t\t\t\t\t FROM messages m\n\t\t\t\t\t\t LEFT JOIN users u ON u.user_name = m.user AND u.deleted = 0\n\t\t\t\t\t\t LEFT JOIN users foru ON foru.user_name = m.foruser  AND foru.deleted = 0\n\t\t\t\t\t\t WHERE m.id>" . $_REQUEST['time'] . " AND ((m.foruser = '******') OR (m.foruser = '******')\n\t\t\t\t\t\t \tOR m.user='******') AND m.time>=" . $myTmp . "\n\t\t\t\t\t\t ORDER BY sortid ASC";
     $q = $helper->escapeSQL($q);
     //Taras 2012-12-21
     $result = $db->limitQuery($q, 0, $display_num);
     while (($message = $db->fetchByAssoc($result)) != null) {
         $message['message'] = htmlspecialchars(stripslashes($message['message']));
         $message['display_from_name'] = $helper->format_display_name($message['nickname'], $message['from_first_name'], $message['from_last_name']);
         $message['display_to_name'] = $helper->format_display_name($message['foruser'], $message['to_first_name'], $message['to_last_name']);
         $data[] = $message;
     }
     // letrium v END
     break;
 case 'view':
     //letrium tanya
     //TARAS 2012-12-20: MSSQL fix
     /*$q = "SELECT rez1.* FROM (SELECT id,user as nickname,msg as message,time,foruser
     	 FROM messages
     	 WHERE id>".$_REQUEST['time']." AND foruser = '******' AND time>=".$myTmp."  ORDER BY id DESC)
     	  AS rez1,messages  WHERE rez1.id=messages.id ORDER BY id ASC";*/
     // letrium v
     // add display name format
     $q = "SELECT m.id, m.id as sortid, m.user as nickname, m.msg as message, m.time, m.foruser, u.first_name as from_first_name, u.last_name as from_last_name, foru.first_name as to_first_name, foru.last_name as to_last_name\n\t\t\t\t\t\t FROM messages m\n\t\t\t\t\t\t LEFT JOIN users u ON u.user_name = m.user AND u.deleted = 0\n\t\t\t\t\t\t LEFT JOIN users foru ON foru.user_name = m.foruser AND foru.deleted = 0\n\t\t\t\t\t\t WHERE m.id>" . $_REQUEST['time'] . " AND m.foruser = '******' AND m.time>=" . $myTmp . "\n\t\t\t\t\t\t ORDER BY sortid ASC";