phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: chat body.php,1.6.2.1,1.6.2.2 index.php,1.18.2.1


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: chat body.php,1.6.2.1,1.6.2.2 index.php,1.18.2.1,1.18.2.2 load.php,1.9.2.1,1.9.2.2 messages.php,1.6.2.1,1.6.2.2 sendmsg.php,1.7.2.1,1.7.2.2
Date: Sun, 24 Nov 2002 10:02:05 -0500

Update of /cvsroot/phpgroupware/chat
In directory subversions:/tmp/cvs-serv18434

Modified Files:
      Tag: Version-0_9_14-branch
        body.php index.php load.php messages.php sendmsg.php 
Log Message:
fixed for bugs #1674, #1223 and a lot more ...
Tested in Mozilla 1.0 and IE 5.5


Index: body.php
===================================================================
RCS file: /cvsroot/phpgroupware/chat/body.php,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C2 -r1.6.2.1 -r1.6.2.2
*** body.php    21 Apr 2002 18:29:50 -0000      1.6.2.1
--- body.php    24 Nov 2002 15:02:03 -0000      1.6.2.2
***************
*** 19,28 ****
        );
        include('../header.inc.php');
  ?>
  <html>
        <head></head>
        <FRAMESET ROWS="*,130" BORDER="0" SCROLLING="NO">
!               <?php echo '<FRAME SRC="' . 
$GLOBALS['phpgw']->link('/chat/messages.php','channel='.$channel.'&action='.$action.'&location='.$location)
 . '" NAME="messages">';
!               echo '<FRAME SRC="' . 
$GLOBALS['phpgw']->link('/chat/sendmsg.php','channel='.$channel.'&location='.$location.'&user2='.$user2)
 . '" NAME="sendmsg" SCROLLING="NO">';?>
        </FRAMESET>
  </html>
--- 19,52 ----
        );
        include('../header.inc.php');
+ 
+       function get_var($name,$from)   // a simple version
+       {
+               if (!is_array($from)) $from = explode(',',$from);
+               while ((list(,$f) = each($from)) && 
!isset($GLOBALS['HTTP_'.$f.'_VARS'][$name])) ;
+               $ret = $GLOBALS['HTTP_'.$f.'_VARS'][$name];
+               //echo "HTTP_$f"."_VARS[$name]=$ret<br>\n";
+               return $ret;
+       }
+ 
+       $cannel   = get_var('channel',array('POST','GET'));
+       $action   = get_var('action',array('POST','GET'));
+       $location = get_var('location',array('GET','POST'));
+       $user2    = get_var('user2',array('POST','GET'));
  ?>
  <html>
        <head></head>
        <FRAMESET ROWS="*,130" BORDER="0" SCROLLING="NO">
! <?php
!       echo '<FRAME SRC="' . 
$GLOBALS['phpgw']->link('/chat/messages.php',array(
!               'channel' => $channel,
!               'action'  => $action,
!               'location'=> $location
!       )) . '#bottom" NAME="messages">';
!       echo '<FRAME SRC="' . $GLOBALS['phpgw']->link('/chat/sendmsg.php',array(
!               'channel' => $channel,
!               'location'=> $location,
!               'user2'   => $user2
!       )) . '" NAME="sendmsg" SCROLLING="NO">';
! ?>
        </FRAMESET>
  </html>

Index: index.php
===================================================================
RCS file: /cvsroot/phpgroupware/chat/index.php,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -C2 -r1.18.2.1 -r1.18.2.2
*** index.php   21 Apr 2002 18:29:50 -0000      1.18.2.1
--- index.php   24 Nov 2002 15:02:03 -0000      1.18.2.2
***************
*** 22,25 ****
--- 22,37 ----
        include('../header.inc.php');
  
+       function get_var($name,$from)   // a simple version
+       {
+               if (!is_array($from)) $from = explode(',',$from);
+               while ((list(,$f) = each($from)) && 
!isset($GLOBALS['HTTP_'.$f.'_VARS'][$name])) ;
+               $ret = $GLOBALS['HTTP_'.$f.'_VARS'][$name];
+               //echo "HTTP_$f"."_VARS[$name]=$ret<br>";
+               return $ret;
+       }
+       $cannel   = get_var('channel',array('POST','GET'));
+       $action   = get_var('action',array('POST','GET'));
+       $location = get_var('location',array('POST','GET'));
+ 
        $loginid = $GLOBALS['phpgw_info']['user']['userid'];
        if ($action=='part')

Index: load.php
===================================================================
RCS file: /cvsroot/phpgroupware/chat/load.php,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -C2 -r1.9.2.1 -r1.9.2.2
*** load.php    21 Apr 2002 18:29:50 -0000      1.9.2.1
--- load.php    24 Nov 2002 15:02:03 -0000      1.9.2.2
***************
*** 20,27 ****
        include('../header.inc.php');
  
!       $channel = 
(@$GLOBALS['HTTP_GET_VARS']['channel']?$GLOBALS['HTTP_GET_VARS']['channel']:$GLOBALS['HTTP_POST_VARS']['channel']);
!       $action = 
(@$GLOBALS['HTTP_GET_VARS']['action']?$GLOBALS['HTTP_GET_VARS']['action']:$GLOBALS['HTTP_POST_VARS']['action']);
!       $location = 
(@$GLOBALS['HTTP_GET_VARS']['location']?$GLOBALS['HTTP_GET_VARS']['location']:$GLOBALS['HTTP_POST_VARS']['location']);
! 
        if ($channel == '')
        {
--- 20,34 ----
        include('../header.inc.php');
  
!       function get_var($name,$from)   // a simple version
!       {
!               if (!is_array($from)) $from = explode(',',$from);
!               while ((list(,$f) = each($from)) && 
!isset($GLOBALS['HTTP_'.$f.'_VARS'][$name])) ;
!               $ret = $GLOBALS['HTTP_'.$f.'_VARS'][$name];
!               //echo "HTTP_$f"."_VARS[$name]=$ret<br>\n";
!               return $ret;
!       }
!       $channel  = get_var('channel',array('POST','GET'));
!       $action   = get_var('action',array('POST','GET'));
!       
        if ($channel == '')
        {
***************
*** 42,45 ****
--- 49,56 ----
        }
  
+       //echo "<p>load.php: channel='$channel', action='$action' => 
location='$location'</p>\n";
+ 
+       $now = $GLOBALS['phpgw']->datetime->gmtnow;
+ 
        if ($action == 'newprivate')
        {
***************
*** 49,53 ****
                if(!$notnew)
                {
!                       $GLOBALS['phpgw']->db->query("INSERT INTO 
phpgw_chat_privatechat (user1,user2,sentby,message,messagetype,timesent,closed) 
VALUES ('$loginid','$user2','System','New chat with $loginid and $user2','0','" 
. time() . "','0')");
                }
        }
--- 60,64 ----
                if(!$notnew)
                {
!                       $GLOBALS['phpgw']->db->query("INSERT INTO 
phpgw_chat_privatechat (user1,user2,sentby,message,messagetype,timesent,closed) 
VALUES ('$loginid','$user2','System','New chat with $loginid and $user2','0','" 
. $now . "','0')");
                }
        }
***************
*** 58,66 ****
                if ($GLOBALS['phpgw']->db->nf() == 0 && $newchannel)
                {
!                       $GLOBALS['phpgw']->db->query("INSERT INTO 
phpgw_chat_currentin (loginid, channel, lastmessage) VALUES 
('$loginid','$newchannel','" . time() . "')");
                }
                else
                {
!                       $GLOBALS['phpgw']->db->query("UPDATE 
phpgw_chat_currentin SET lastmessage='" . time() . "' WHERE loginid='$loginid' 
AND channel='$newchannel'");
                }
        }
--- 69,77 ----
                if ($GLOBALS['phpgw']->db->nf() == 0 && $newchannel)
                {
!                       $GLOBALS['phpgw']->db->query("INSERT INTO 
phpgw_chat_currentin (loginid, channel, lastmessage) VALUES 
('$loginid','$newchannel','" . $now . "')");
                }
                else
                {
!                       $GLOBALS['phpgw']->db->query("UPDATE 
phpgw_chat_currentin SET lastmessage='" . $now . "' WHERE loginid='$loginid' 
AND channel='$newchannel'");
                }
        }
***************
*** 71,78 ****
  </head>';
  
!       echo '  <FRAMESET COLS="130,*,126" FRAMEBORDER="0">' . "\n";
!       echo '    <FRAME SRC="' . 
$GLOBALS['phpgw']->link('/chat/channels.php','channel='.$newchannel.'&location='.$location)
 . '" NAME="static" SCROLLING="AUTO">' . "\n";
        echo '    <FRAME SRC="' . 
$GLOBALS['phpgw']->link('/chat/body.php','channel='.$newchannel.'&action='.$action.'&location='.$location.'&user2='.$user2)
 . '" NAME="body">' . "\n";
!       echo '    <FRAME SRC="' . 
$GLOBALS['phpgw']->link('/chat/users.php','channel='.$newchannel.'&location='.$location)
 . '" NAME="users" SCROLLING="AUTO">' . "\n";
        echo "  </FRAMESET>\n";
        echo "</html>\n";
--- 82,89 ----
  </head>';
  
!       echo '  <FRAMESET COLS="140,*,126" FRAMEBORDER="0">' . "\n";
!       echo '    <FRAME SRC="' . 
$GLOBALS['phpgw']->link('/chat/channels.php','channel='.$newchannel.'&location='.$location)
 . '" NAME="static" SCROLLING="no">' . "\n";
        echo '    <FRAME SRC="' . 
$GLOBALS['phpgw']->link('/chat/body.php','channel='.$newchannel.'&action='.$action.'&location='.$location.'&user2='.$user2)
 . '" NAME="body">' . "\n";
!       echo '    <FRAME SRC="' . 
$GLOBALS['phpgw']->link('/chat/users.php','channel='.$newchannel.'&location='.$location)
 . '" NAME="users" SCROLLING="no">' . "\n";
        echo "  </FRAMESET>\n";
        echo "</html>\n";

Index: messages.php
===================================================================
RCS file: /cvsroot/phpgroupware/chat/messages.php,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C2 -r1.6.2.1 -r1.6.2.2
*** messages.php        21 Apr 2002 18:29:50 -0000      1.6.2.1
--- messages.php        24 Nov 2002 15:02:03 -0000      1.6.2.2
***************
*** 23,26 ****
--- 23,39 ----
        $refresh = 3;
  
+       function get_var($name,$from)   // a simple version
+       {
+               if (!is_array($from)) $from = explode(',',$from);
+               while ((list(,$f) = each($from)) && 
!isset($GLOBALS['HTTP_'.$f.'_VARS'][$name])) ;
+               $ret = $GLOBALS['HTTP_'.$f.'_VARS'][$name];
+               //echo "HTTP_$f"."_VARS[$name]=$ret<br>";
+               return $ret;
+       }
+       $cannel   = get_var('channel',array('POST','GET'));
+       $action   = get_var('action',array('POST','GET'));
+       $location = get_var('location',array('POST','GET'));
+       $user2    = get_var('user2',array('POST','GET'));
+       
        $GLOBALS['phpgw']->db->query("SELECT * FROM phpgw_chat_messages WHERE 
channel='$channel'");
        $GLOBALS['phpgw']->db->next_record();
***************
*** 30,54 ****
  
        // below line is abusively bad HTML form, but works in NS so far.
!       echo '<head><META HTTP-EQUIV="Refresh" Content="10"' . 
$GLOBALS['phpgw_info']['user']['preferences']['chat']['phpgw_chat_refresh'] . 
';URL=#bottom"></head><body>';
  
!       echo '<center><strong>' . $loginid . ' in ' . $channel . 
'</strong></center>';
!       if ($location == 'public')
        {
!               $GLOBALS['phpgw']->db->query("SELECT * FROM phpgw_chat_messages 
WHERE channel='$channel' AND timesent>'" . 
$GLOBALS['phpgw_info']["user"]["logintime"]. "' ORDER BY timesent");
!               while($GLOBALS['phpgw']->db->next_record())
!               {
!                       echo '<font color="blue">' . 
$GLOBALS['phpgw']->db->f('loginid') . ' (' . 
$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('timesent'),'H:i.s')
 . '):  </font><font color="red">' . $GLOBALS['phpgw']->db->f('message') . 
'</font><br>';
!               }
        }
!       if ($location == 'private')
        {
!               $GLOBALS['phpgw']->db->query("SELECT * FROM 
phpgw_chat_privatechat WHERE (user1='$loginid' AND user2='$user2') OR 
(user1='$user2' AND user2='$loginid') ORDER BY timesent");
!               while($GLOBALS['phpgw']->db->next_record())
!               {
!                       echo '<font color="blue">' . 
$GLOBALS['phpgw']->db->f('sentby') . ' (' . 
$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('timesent'),'H:i.s')
 . '):  </font><font color="red">' . $GLOBALS['phpgw']->db->f('message') . 
'</font><br>';
!               }               
        }
  
        echo '<a name="bottom"></a>';
!       echo '</body></html>';
  ?>
--- 43,76 ----
  
        // below line is abusively bad HTML form, but works in NS so far.
!       echo "<html>\n<head>\n\t".
!            '<META HTTP-EQUIV="Refresh" Content="10; 
URL='.$GLOBALS['phpgw']->link('/chat/messages.php',array(
!               'channel'  => $channel,
!               'action'   => $action,
!               'location' => $location,
!               'unique'    => time()
!       )).'#bottom">'."\n</head>\n<body>\n";
  
!       echo "<center><strong>$loginid in $channel</strong></center>\n";
! 
!       if ($location == 'private')
        {
!               $sql = "SELECT * FROM phpgw_chat_privatechat WHERE 
(user1='$loginid' AND user2='$user2') OR (user1='$user2' AND user2='$loginid')";
        }
!       else
!       {
!               $sql = "SELECT * FROM phpgw_chat_messages WHERE 
channel='$channel' AND timesent>'" . 
$GLOBALS['phpgw_info']['user']['logintime']. "'";
!       }
!       $GLOBALS['phpgw']->db->query($sql.' ORDER BY 
timesent',__FILE__,__LINE__);
! 
!       while($GLOBALS['phpgw']->db->next_record())
        {
!               echo '<font color="blue">' . 
!                    $GLOBALS['phpgw']->db->f($location == 'privat' ? 'sentby' 
: 'loginid') . ' (' . 
!                    
$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('timesent'),'H:i.s')
 . 
!                    '):  </font><font color="red">' . 
stripslashes($GLOBALS['phpgw']->db->f('message')) . 
!                    "</font><br>\n";
        }
  
        echo '<a name="bottom"></a>';
!       echo "\n</body>\n</html>\n";
  ?>

Index: sendmsg.php
===================================================================
RCS file: /cvsroot/phpgroupware/chat/sendmsg.php,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -C2 -r1.7.2.1 -r1.7.2.2
*** sendmsg.php 21 Apr 2002 18:29:50 -0000      1.7.2.1
--- sendmsg.php 24 Nov 2002 15:02:03 -0000      1.7.2.2
***************
*** 20,33 ****
        include('../header.inc.php');
  
        $loginid = $GLOBALS['phpgw_info']['user']['userid'];
-       $channel = 
(@$GLOBALS['HTTP_GET_VARS']['channel']?$GLOBALS['HTTP_GET_VARS']['channel']:$GLOBALS['HTTP_POST_VARS']['channel']);
-       $action = 
(@$GLOBALS['HTTP_GET_VARS']['action']?$GLOBALS['HTTP_GET_VARS']['action']:$GLOBALS['HTTP_POST_VARS']['action']);
-       $location = 
(@$GLOBALS['HTTP_GET_VARS']['location']?$GLOBALS['HTTP_GET_VARS']['location']:$GLOBALS['HTTP_POST_VARS']['location']);
  
! //    $date=date("YmdHis");
  
!       if ($action=='post')
        {
!               $datetime = createobject('phpgwapi.datetime');
                if ($location=='public')
                {
--- 20,43 ----
        include('../header.inc.php');
  
+       function get_var($name,$from)   // a simple version
+       {
+               if (!is_array($from)) $from = explode(',',$from);
+               while ((list(,$f) = each($from)) && 
!isset($GLOBALS['HTTP_'.$f.'_VARS'][$name])) ;
+               $ret = $GLOBALS['HTTP_'.$f.'_VARS'][$name];
+               //echo "HTTP_$f"."_VARS[$name]=$ret<br>\n";
+               return $ret;
+       }
+ 
        $loginid = $GLOBALS['phpgw_info']['user']['userid'];
  
!       $cannel   = get_var('channel',array('GET','POST'));
!       $action   = get_var('action',array('GET','POST'));
!       $location = get_var('location',array('GET','POST'));
!       $message    = get_var('message',array('POST','GET'));
  
!       if ($action=='post' && !empty($message))
        {
!               $now = $GLOBALS['phpgw']->datetime->gmtnow;
! 
                if ($location=='public')
                {
***************
*** 36,40 ****
                                ."timesent) values ('$channel',"
                                ."'$loginid','" . addslashes($message)."','1','"
!                       . $datetime->gmtnow . "')");
                }
                else
--- 46,50 ----
                                ."timesent) values ('$channel',"
                                ."'$loginid','" . addslashes($message)."','1','"
!                       . $now . "')");
                }
                else
***************
*** 45,61 ****
                                . "timesent) values ('$loginid',"
                                . "'$channel','$loginid','" . 
addslashes($message)."','1','"
!                               . $datetime->gmtnow . "')");
!                       $GLOBALS['phpgw']->db->query("INSERT INTO 
phpgw_chat_privatechat (user1, user2, sentby, message, messagetype, timesent) 
VALUES ('$loginid','$channel','$loginid','$message','1','" . $datetime->gmtnow 
. "')");                 
                }
        }
  
!       echo "<html><body><center>";
!       echo '<form  name="sendmsg" method="post" action="' . 
$GLOBALS['phpgw']->link('/chat/sendmsg.php') . '">';
!       echo '<input type="hidden" name="channel" value="' . $channel . '">';
!       echo '<input type="hidden" name="message" value="' . $message . '">';
!       echo '<input type="hidden" name="action" value="post">';
!       echo '<input type="hidden" name="location" value="' . $location . '">';
!       echo '<input type="text"   size="50" name="message"><br>';
!       echo '<input type="submit" value="' . lang('Send Message') . 
'"></center></form>';
!       echo '<script> form.sendmsg.message.focus(); </script></body></html>';
  ?>
--- 55,70 ----
                                . "timesent) values ('$loginid',"
                                . "'$channel','$loginid','" . 
addslashes($message)."','1','"
!                               . $now . "')");
                }
        }
  
!       echo '<html><body 
onLoad="document.forms[0].message.focus();"><center>'."\n";
!       echo '<form  name="sendmsg" method="post" action="' . 
$GLOBALS['phpgw']->link('/chat/sendmsg.php') . '">'."\n";
!       echo '<input type="hidden" name="channel" value="' . $channel . 
'">'."\n";
!       echo '<input type="hidden" name="action" value="post">'."\n";
!       echo '<input type="hidden" name="location" value="' . $location . 
'">'."\n";
!       echo '<input type="text"   size="50" name="message"><br>'."\n";
!       echo '<input type="submit" value="' . lang('Send Message') . '">';
!       echo "</form>\n</center>\n";
!       echo "</body>\n</html>\n";
  ?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]