phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] messenger/inc class.bomessenger.inc.php class.s...


From: Dave Hall
Subject: [Phpgroupware-cvs] messenger/inc class.bomessenger.inc.php class.s...
Date: Thu, 28 Dec 2006 15:01:05 +0000

CVSROOT:        /sources/phpgroupware
Module name:    messenger
Changes by:     Dave Hall <skwashd>     06/12/28 15:01:05

Modified files:
        inc            : class.bomessenger.inc.php 
                         class.somessenger.inc.php 
                         class.somessenger_sql.inc.php 
                         class.uimessenger.inc.php 

Log message:
        notices, links and some other small cleanups

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/messenger/inc/class.bomessenger.inc.php?cvsroot=phpgroupware&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/messenger/inc/class.somessenger.inc.php?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/messenger/inc/class.somessenger_sql.inc.php?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/messenger/inc/class.uimessenger.inc.php?cvsroot=phpgroupware&r1=1.8&r2=1.9

Patches:
Index: class.bomessenger.inc.php
===================================================================
RCS file: /sources/phpgroupware/messenger/inc/class.bomessenger.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- class.bomessenger.inc.php   11 Apr 2006 22:44:30 -0000      1.5
+++ class.bomessenger.inc.php   28 Dec 2006 15:01:05 -0000      1.6
@@ -12,7 +12,7 @@
        *  option) any later version.                                           
   *
        
\**************************************************************************/
 
-       /* $Id: class.bomessenger.inc.php,v 1.5 2006/04/11 22:44:30 skwashd Exp 
$ */
+       /* $Id: class.bomessenger.inc.php,v 1.6 2006/12/28 15:01:05 skwashd Exp 
$ */
 
        class bomessenger
        {
@@ -114,10 +114,11 @@
 
                function check_for_missing_fields($message)
                {
+                       $errors = array();
                        if ($message['to'] > 0)
                        {
                                $user = $this->get_available_users();
-                               if ( isset($user[$messenge['to']]) )
+                               if ( isset($user[$message['to']]) )
                                {
                                        $errors[] = lang('You are not allow to 
send messages to the user you have selected');
                                }
@@ -162,21 +163,21 @@
                        else
                        {
                                $message = $_POST['message'];
-                               $send    = $_POST['send'];
-                               $cancel  = $_POST['cancel'];
+                               $send           = isset($_POST['send']) ? 
!!$_POST['send'] : false;
+                               $cancel         = isset($_POST['cancel']) ? 
!!$_POST['cancel'] : false;
                        }
 
                        if ($cancel)
                        {
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'messenger.uimessenger.inbox'));
+                               exit;
                        }
 
                        $errors = $this->check_for_missing_fields($message);
 
-                       if (is_array($errors))
+                       if ( count($errors))
                        {
                                
ExecMethod('messenger.uimessenger.compose',$errors);
-                               //$this->ui->compose($errors);
                        }
                        else
                        {
@@ -187,9 +188,10 @@
 
                function read_inbox($params)
                {
-                       $messages = $this->so->read_inbox($params);
+                       $_messages = array();
 
-                       while (is_array($messages) && list(,$message) = 
each($messages))
+                       $messages = $this->so->read_inbox($params);
+                       foreach ( $messages as $message )
                        {
                                if ($message['from'] == -1)
                                {

Index: class.somessenger.inc.php
===================================================================
RCS file: /sources/phpgroupware/messenger/inc/class.somessenger.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- class.somessenger.inc.php   9 Apr 2006 13:53:18 -0000       1.2
+++ class.somessenger.inc.php   28 Dec 2006 15:01:05 -0000      1.3
@@ -11,7 +11,7 @@
        
\**************************************************************************/
 
        // Now we can use this again later if we need it
-       $GLOBALS['phpgw']->config  =& CreateObject('phpgwapi.config', 
'messenger');
+       $GLOBALS['phpgw']->config  = CreateObject('phpgwapi.config', 
'messenger');
        $GLOBALS['phpgw']->config->read_repository();
 
        if ( !is_array($GLOBALS['phpgw']->config->config_data) 

Index: class.somessenger_sql.inc.php
===================================================================
RCS file: /sources/phpgroupware/messenger/inc/class.somessenger_sql.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- class.somessenger_sql.inc.php       9 Apr 2006 13:53:18 -0000       1.1
+++ class.somessenger_sql.inc.php       28 Dec 2006 15:01:05 -0000      1.2
@@ -33,6 +33,7 @@
 
                function read_inbox($params)
                {
+                       $sortmethod = '';
                        if ($params['sort'] && $params['order'])
                        {
                                $sortmethod = " order by {$params['order']} 
{$params['sort']}";
@@ -40,9 +41,12 @@
 
                        $this->db->limit_query("select * from 
phpgw_messenger_messages where message_owner='" . $this->owner
                                . "' 
$sortmethod",$params['start'],__LINE__,__FILE__);
+                       
+                       $messages = array();
                        while ($this->db->next_record())
                        {
-                               $messages[] = array(
+                               $messages[] = array
+                               (
                                        'id'      => $this->db->f('message_id'),
                                        'from'    => 
$this->db->f('message_from'),
                                        'status'  => 
$this->db->f('message_status'),

Index: class.uimessenger.inc.php
===================================================================
RCS file: /sources/phpgroupware/messenger/inc/class.uimessenger.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- class.uimessenger.inc.php   11 Apr 2006 22:44:30 -0000      1.8
+++ class.uimessenger.inc.php   28 Dec 2006 15:01:05 -0000      1.9
@@ -41,7 +41,7 @@
 
                function compose($errors = '')
                {
-                       $message = $_POST['message'];
+                       $message = isset($_POST['message']) ? $_POST['message'] 
: array('subject' => '', 'content' => '');
 
                        $this->_display_headers();
                        $this->_set_compose_read_blocks();
@@ -65,7 +65,7 @@
                                $this->template->parse('select_tos', 
'select_to', true);
                        }
 
-                       
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=messenger.bomessenger.send_message'));
+                       
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'messenger.bomessenger.send_message') ) );
                        //$this->template->set_var('value_to','<input 
name="message[to]" value="' . $message['to'] . '" size="30">');
                        $this->template->set_var('value_subject','<input 
name="message[subject]" value="' . $message['subject'] . '" size="30">');
                        $this->template->set_var('value_content','<textarea 
name="message[content]" rows="20" wrap="hard" cols="76">' . $message['content'] 
. '</textarea>');
@@ -99,7 +99,7 @@
                        $this->_set_common_langs();
                        $this->template->set_var('header_message',lang('Compose 
global message'));
 
-                       
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=messenger.bomessenger.send_global_message'));
+                       
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'messenger.bomessenger.send_global_message') ) );
                        $this->template->set_var('value_subject','<input 
name="message[subject]" value="' . $message['subject'] . '">');
                        $this->template->set_var('value_content','<textarea 
name="message[content]" rows="20" wrap="hard" cols="76">' . $message['content'] 
. '</textarea>');
 
@@ -120,9 +120,9 @@
 
                function inbox()
                {
-                       $start = $_REQUEST['start'];
-                       $order = $_REQUEST['order'];
-                       $sort  = $_REQUEST['sort'];
+                       $start = isset($_REQUEST['start']) ? $_REQUEST['start'] 
: 0;
+                       $order = isset($_REQUEST['order']) ? $_REQUEST['order'] 
: '';
+                       $sort  = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 
'';
                        $total = $this->bo->total_messages();
 
                        $extra_menuaction = 
'&menuaction=messenger.uimessenger.inbox';
@@ -155,7 +155,7 @@
                        }
                        else
                        {
-                               
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=messenger.uimessenger.delete'));
+                               
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'messenger.uimessenger.delete') ) );
                                
$this->template->set_var('button_delete','<input type="image" src="' . 
PHPGW_IMAGES . '/delete.gif" name="delete" title="' . lang('Delete selected') . 
'" border="0">');
                                $i = 0;
                                foreach ( $messages as $message)
@@ -203,15 +203,15 @@
                        $this->template->set_var('value_content', 
nl2br(wordwrap($GLOBALS['phpgw']->strip_html($message['content']), 80)));
 
                        $this->template->set_var('link_delete','<a href="'
-                                       . 
$GLOBALS['phpgw']->link('/index.php','menuaction=messenger.uimessenger.delete&messages%5B%5D='
 . $message['id'])
+                                       . $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'messenger.uimessenger.delete', 'messages[]' => 
$message['id']) )
                                        . '">' . lang('Delete') . '</a>');
 
                        $this->template->set_var('link_reply','<a href="'
-                                       . 
$GLOBALS['phpgw']->link('/index.php','menuaction=messenger.uimessenger.reply&message_id='
 . $message['id'])
+                                       . $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'messenger.uimessenger.reply', 'message_id' => 
$message['id']) )
                                        . '">' . lang('Reply') . '</a>');
 
                        $this->template->set_var('link_forward','<a href="'
-                                       . 
$GLOBALS['phpgw']->link('/index.php','menuaction=messenger.uimessenger.forward&message_id='
 . $message['id'])
+                                       . $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'messenger.uimessenger.forward', 'message_id' => 
$message['id']) )
                                        . '">' . lang('Forward') . '</a>');
 
                        switch($message['status'])
@@ -261,7 +261,7 @@
 
                        $this->template->set_var('header_message',lang('Reply 
to a message'));
 
-                       
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=messenger.bomessenger.reply&message_id='
 . $message['id']));
+                       
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'messenger.bomessenger.reply', 'message_id=' . 
$message['id']) ) );
                        $this->template->set_var('value_to','<input 
name="n_message[to]" value="' . $message['from'] . '" size="30">');
                        $this->template->set_var('value_subject','<input 
name="n_message[subject]" value="' .  
$GLOBALS['phpgw']->strip_html(stripslashes($message['subject'])) . '" 
size="30">');
                        $this->template->set_var('value_content','<textarea 
name="n_message[content]" rows="20" wrap="hard" cols="76">' .  
$GLOBALS['phpgw']->strip_html(stripslashes($message['content'])) . 
'</textarea>');
@@ -300,7 +300,7 @@
 
                        $this->template->set_var('header_message',lang('Forward 
a message'));
 
-                       
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=messenger.bomessenger.forward&message_id='
 . $message['id']));
+                       
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'messenger.bomessenger.forward', 'message_id' => 
$message['id']) ) );
                        $this->template->set_var('value_to','<input 
name="n_message[to]" value="' . $message['from'] . '" size="30">');
                        $this->template->set_var('value_subject','<input 
name="n_message[subject]" value="' .  
$GLOBALS['phpgw']->strip_html(stripslashes($message['subject'])) . '" 
size="30">');
                        $this->template->set_var('value_content','<textarea 
name="n_message[content]" rows="20" wrap="hard" cols="76">' .  
$GLOBALS['phpgw']->strip_html(stripslashes($message['content'])) . 
'</textarea>');
@@ -317,23 +317,22 @@
                {
                        $this->template->set_file('_header','header.tpl');
                        $this->template->set_block('_header','global_header');
-                       $this->template->set_var('lang_inbox','<a href="' . 
$GLOBALS['phpgw']->link('/index.php','menuaction=messenger.uimessenger.inbox') 
. '">' . lang('Inbox') . '</a>');
-                       $this->template->set_var('lang_compose','<a href="' . 
$GLOBALS['phpgw']->link('/index.php','menuaction=messenger.uimessenger.compose')
 . '">' . lang('Compose') . '</a>');
+                       $this->template->set_var('lang_inbox','<a href="' . 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'messenger.uimessenger.inbox') ) . '">' . lang('Inbox') . '</a>');
+                       $this->template->set_var('lang_compose','<a href="' . 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'messenger.uimessenger.compose') ) . '">' . lang('Compose') . '</a>');
 
-                       if ($extras['nextmatchs_left'])
+                       if ( isset($extras['nextmatchs_left']) && 
$extras['nextmatchs_left'] )
                        {
                                
$this->template->set_var('nextmatchs_left',$extras['nextmatchs_left']);
                        }
 
-                       if ($extras['nextmatchs_right'])
+                       if ( isset($extras['nextmatchs_right']) && 
$extras['nextmatchs_right'] )
                        {
                                
$this->template->set_var('nextmatchs_right',$extras['nextmatchs_right']);
                        }
 
                        $this->template->fp('app_header','global_header');
 
-                       $GLOBALS['phpgw']->common->phpgw_header();
-                       echo parse_navbar();
+                       $GLOBALS['phpgw']->common->phpgw_header(true);
                }
                
                function _error_not_connected()




reply via email to

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