phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] news_admin/inc class.uinews.inc.php,1.33


From: skwashd
Subject: [Phpgroupware-cvs] news_admin/inc class.uinews.inc.php,1.33
Date: Sat, 8 Oct 2005 02:50:00 +0200

Update of news_admin/inc

Modified Files:
     Branch: MAIN
            class.uinews.inc.php lines: +22 -9

Log Message:
more bug fixes

====================================================
Index: news_admin/inc/class.uinews.inc.php
diff -u news_admin/inc/class.uinews.inc.php:1.32 
news_admin/inc/class.uinews.inc.php:1.33
--- news_admin/inc/class.uinews.inc.php:1.32    Mon Oct  3 12:31:53 2005
+++ news_admin/inc/class.uinews.inc.php Sat Oct  8 00:50:24 2005
@@ -332,10 +332,18 @@
                                {
                                        $errors[] = lang('The subject is 
missing');
                                }
+
                                if (! $this->news_data['content'])
                                {
                                        $errors[] = lang('The news content is 
missing');
                                }
+
+                               if ( !isset($GLOBALS['data_cleaner']) || 
!is_object($GLOBALS['data_cleaner']) )
+                               {
+                                       $GLOBALS['data_cleaner'] = 
createObject('phpgwapi.data_cleaner', '');
+                               }
+                               $this->news_data['content'] = 
$GLOBALS['data_cleaner']->clean($GLOBALS['RAW_REQUEST']['news']['content'], 
false);
+
                                if (!is_array($errors))
                                {
                                        $this->news_data['date'] = time();
@@ -343,7 +351,7 @@
                                        $this->news_id = 
$this->bo->add($this->news_data);
                                        $this->message = lang('Message has been 
added');
                                        //after having added, we must switch to 
edit mode instead of stay in add
-                                       $this->news_data = 
$this->bo->get_news($this->news_id,True);
+                                       $this->news_data = 
$this->bo->get_news($this->news_id, True);
                                        $this->_modify('edit');
                                        return;
                                }
@@ -409,12 +417,12 @@
                        $this->news_id          = (isset($_GET['news_id']) ? 
$_GET['news_id']
                                                                                
: $_POST['news']['id']);

-                       if($_POST['cancel'])
+                       if ( isset($_POST['cancel']) )
                        {
                                Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uinews.write_news'));
                                return;
                        }
-                       if(is_array($this->news_data))
+                       if ( is_array($this->news_data) )
                        {
                                if(! $this->news_data['subject'])
                                {
@@ -432,20 +440,25 @@
                                $end = 
$jscal->input2date($this->news_data['end']);
                                $this->news_data['end']   = $end['raw'];
                                unset($end);
-
+
+                               if ( !isset($GLOBALS['data_cleaner']) || 
!is_object($GLOBALS['data_cleaner']) )
+                               {
+                                       $GLOBALS['data_cleaner'] = 
createObject('phpgwapi.data_cleaner', '');
+                               }
+                               $this->news_data['content'] = 
$GLOBALS['data_cleaner']->clean($GLOBALS['RAW_REQUEST']['news']['content'], 
false);
+
                                if(!is_array($errors))
                                {
                                        $this->bo->set_dates($_POST['from'], 
$_POST['until'], $this->news_data);
                                        $this->bo->edit($this->news_data);
                                        $this->message = lang('News item has 
been updated');
+                                       $this->news_data = 
$this->bo->get_news($this->news_id, True);
                                }
                                else
                                {
                                        $this->message = $errors;
                                }
                        }
-
-                       $this->news_data = 
$this->bo->get_news($this->news_id,True);
                        $this->_modify();
                }

@@ -880,7 +893,7 @@
                function _selectlist($type, $default = 0)
                {
                        $right = ($type == 'read') ? PHPGW_ACL_READ : 
PHPGW_ACL_ADD;
-                       $selectlist = ( !$default ? ('<option>' . lang($type . 
' news') . '</option>') : '');
+                       $selectlist = ( !$default && $type == 'read' ? 
('<option>' . lang($type . ' news') . '</option>') : '');
                        $cats = is_array($this->bo->cats) ? $this->bo->cats : 
array();
                        foreach($cats as $cat)
                        {
@@ -891,7 +904,7 @@
                                        $selectlist .= '>' . $cat['name'] . 
'</option>' . "\n";
                                }
                        }
-                       if (!$default)
+                       if (!$default && $type == 'read' )
                        {
                                $selectlist .= '<option 
style="font-weight:bold" value="all">' . lang('All news') . '</option>'  . "\n";
                        }






reply via email to

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