phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: news_admin/inc class.boadmin.inc.php,1.8.2.2,1.


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: news_admin/inc class.boadmin.inc.php,1.8.2.2,1.8.2.2.2.1 class.soadmin.inc.php,1.6.2.3,1.6.2.3.2.1 class.sonews.inc.php,1.1.2.1,1.1.2.1.2.1 class.uiadmin.inc.php,1.12.2.4,1.12.2.4.2.1 class.uinews.inc.php,1.10.2.6,1.10.2.6.2.1
Date: Sun, 04 May 2003 02:12:15 -0400

Update of /cvsroot/phpgroupware/news_admin/inc
In directory subversions:/tmp/cvs-serv9749/inc

Modified Files:
      Tag: Version-0_9_16-branch
        class.boadmin.inc.php class.soadmin.inc.php 
        class.sonews.inc.php class.uiadmin.inc.php 
        class.uinews.inc.php 
Log Message:
fixes bugs #3349, #3380 security and other issues

Index: class.boadmin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.boadmin.inc.php,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.2.2.1
diff -C2 -r1.8.2.2 -r1.8.2.2.2.1
*** class.boadmin.inc.php       19 Mar 2003 21:03:09 -0000      1.8.2.2
--- class.boadmin.inc.php       4 May 2003 06:12:12 -0000       1.8.2.2.2.1
***************
*** 24,33 ****
                }
  
!               function delete()
                {
-                       $news_id = $GLOBALS['HTTP_POST_VARS']['news_id'] ? 
$GLOBALS['HTTP_POST_VARS']['news_id'] : $GLOBALS['HTTP_GET_VARS']['news_id'];
- 
                        $this->so->delete($news_id);
-                       
ExecMethod('news_admin.uiadmin.news_list',array('message' => lang('Item has 
been deleted')));
                }
  
--- 24,30 ----
                }
  
!               function delete($news_id)
                {
                        $this->so->delete($news_id);
                }
  

Index: class.soadmin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.soadmin.inc.php,v
retrieving revision 1.6.2.3
retrieving revision 1.6.2.3.2.1
diff -C2 -r1.6.2.3 -r1.6.2.3.2.1
*** class.soadmin.inc.php       19 Mar 2003 21:03:09 -0000      1.6.2.3
--- class.soadmin.inc.php       4 May 2003 06:12:12 -0000       1.6.2.3.2.1
***************
*** 26,33 ****
                function add($news)
                {
!                       $this->db->query("INSERT INTO phpgw_news 
(news_date,news_submittedby,news_content,news_subject,"
!                               . "news_status,news_cat) VALUES ('" . time() . 
"','" . $GLOBALS['phpgw_info']['user']['account_id'] . "','"
!                               . addslashes($news['content']) . "','" . 
addslashes($news['subject']) . "','"
!                               . $news['status'] . "','" . $news['category'] . 
"')",__LINE__,__FILE__);
                }
  
--- 26,36 ----
                function add($news)
                {
!                       $sql  = 'INSERT INTO phpgw_news 
(news_date,news_submittedby,news_content,news_subject,news_status,news_cat) ';
!                       $sql .= 'VALUES (' . time() . ',' . 
$GLOBALS['phpgw_info']['user']['account_id'] . ",'";
!                       $sql .=  $this->db->db_addslashes($news['content']) 
."','" . $this->db->db_addslashes($news['subject']) . "','";
!                       $sql .=  $this->db->db_addslashes($news['status']) . 
"'," . intval($news['category']) . ')';
!                       $this->db->query($sql);
! 
!                       return $this->db->get_last_insert_id('phpgw_news', 
'news_id');
                }
  
***************
*** 36,41 ****
                        $this->db->query("UPDATE phpgw_news SET "
                                . "news_date='" . time() . "',"
!                               . "news_content='" . 
addslashes($news['content']) . "',"
!                               . "news_subject='" . 
addslashes($news['subject']) . "' "
                                . "WHERE news_id=" . 
intval($news['id']),__LINE__,__FILE__);
                }
--- 39,44 ----
                        $this->db->query("UPDATE phpgw_news SET "
                                . "news_date='" . time() . "',"
!                               . "news_content='" . 
$this->db->db_addslashes($news['content']) . "',"
!                               . "news_subject='" . 
$this->db->db_addslashes($news['subject']) . "' "
                                . "WHERE news_id=" . 
intval($news['id']),__LINE__,__FILE__);
                }
***************
*** 43,52 ****
                function delete($news_id)
                {
!                       $this->db->query("DELETE FROM phpgw_news WHERE 
news_id='$news_id'",__LINE__,__FILE__);
                }
  
                function total($cat_id)
                {
!                       $this->db->query("SELECT COUNT(*) FROM phpgw_news WHERE 
news_cat='$cat_id'",__LINE__,__FILE__);
                        $this->db->next_record();
  
--- 46,55 ----
                function delete($news_id)
                {
!                       $this->db->query('DELETE FROM phpgw_news WHERE 
news_id=' . intval($news_id) ,__LINE__,__FILE__);
                }
  
                function total($cat_id)
                {
!                       $this->db->query('SELECT COUNT(*) FROM phpgw_news WHERE 
news_cat=' . intval($cat_id),__LINE__,__FILE__);
                        $this->db->next_record();
  
***************
*** 56,60 ****
                function view($news_id)
                {
!                       $this->db->query("SELECT * FROM phpgw_news WHERE 
news_id='$news_id'",__LINE__,__FILE__);
                        $this->db->next_record();
  
--- 59,63 ----
                function view($news_id)
                {
!                       $this->db->query('SELECT * FROM phpgw_news WHERE 
news_id=' . intval($news_id),__LINE__,__FILE__);
                        $this->db->next_record();
  
***************
*** 75,91 ****
                        if ($order)
                        {
!                               $ordermethod = "ORDER BY $order $sort";
                        }
                        else
                        {
!                               $ordermethod = 'ORDER BY news_date DESC';
!                       }
! 
!                       if (! $cat_id)
!                       {
!                               $cat_id = 0;
                        }
  
!                       $this->db->query("SELECT * FROM phpgw_news WHERE 
news_cat='$cat_id' $ordermethod",__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
--- 78,89 ----
                        if ($order)
                        {
!                               $ordermethod = ' ORDER BY ' . 
$this->db->db_addslashes($order) . $this->db->db_addslashes($sort);
                        }
                        else
                        {
!                               $ordermethod = ' ORDER BY news_date DESC';
                        }
  
!                       $this->db->query('SELECT * FROM phpgw_news WHERE 
news_cat=' . intval($cat_id) . $ordermethod,__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {

Index: class.sonews.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.sonews.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.1.2.1
diff -C2 -r1.1.2.1 -r1.1.2.1.2.1
*** class.sonews.inc.php        30 Aug 2002 08:00:19 -0000      1.1.2.1
--- class.sonews.inc.php        4 May 2003 06:12:12 -0000       1.1.2.1.2.1
***************
*** 30,34 ****
                        if ($news_id)
                        {
!                               $sql = 'SELECT * FROM phpgw_news WHERE 
news_id="'.$news_id.'"';
                                $this->db->query($sql,__LINE__,__FILE__);
                                if ($this->db->next_record())
--- 30,34 ----
                        if ($news_id)
                        {
!                               $sql = 'SELECT * FROM phpgw_news WHERE 
news_id=' . intval($news_id);
                                $this->db->query($sql,__LINE__,__FILE__);
                                if ($this->db->next_record())
***************
*** 48,52 ****
                function get_numNewsInCat($cat_id = 0)
                {
!                       $this->db->query("SELECT COUNT(*) FROM phpgw_news WHERE 
news_status='Active' AND news_cat='$cat_id'",__LINE__,__FILE__);
                        if ($this->db->next_record())
                        {
--- 48,52 ----
                function get_numNewsInCat($cat_id = 0)
                {
!                       $this->db->query("SELECT COUNT(*) FROM phpgw_news WHERE 
news_status='Active' AND news_cat=" .intval($cat_id),__LINE__,__FILE__);
                        if ($this->db->next_record())
                        {
***************
*** 63,71 ****
                        if (! $oldnews)
                        {
!                               $this->db->limit_query("SELECT * FROM 
phpgw_news WHERE news_status='Active' AND news_cat='$cat_id' ORDER BY news_date 
DESC",0,__LINE__,__FILE__,5);
                        }
                        else
                        {
!                               $this->db->limit_query("SELECT * FROM 
phpgw_news WHERE news_status='Active' AND news_cat='$cat_id' ORDER BY news_date 
DESC ",$start,__LINE__,__FILE__,$total);
                        }
  
--- 63,71 ----
                        if (! $oldnews)
                        {
!                               $this->db->limit_query("SELECT * FROM 
phpgw_news WHERE news_status='Active' AND news_cat=" . intval($cat_id) . "ORDER 
BY news_date DESC",0,__LINE__,__FILE__,5);
                        }
                        else
                        {
!                               $this->db->limit_query("SELECT * FROM 
phpgw_news WHERE news_status='Active' AND news_cat=" . intval($cat_id) . "ORDER 
BY news_date DESC ",$start,__LINE__,__FILE__,$total);
                        }
  

Index: class.uiadmin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.uiadmin.inc.php,v
retrieving revision 1.12.2.4
retrieving revision 1.12.2.4.2.1
diff -C2 -r1.12.2.4 -r1.12.2.4.2.1
*** class.uiadmin.inc.php       19 Mar 2003 21:03:09 -0000      1.12.2.4
--- class.uiadmin.inc.php       4 May 2003 06:12:12 -0000       1.12.2.4.2.1
***************
*** 21,30 ****
                var $session_data;
                var $public_functions = array(
!                       'news_list' => True,
!                       'add'       => True,
!                       'view'      => True,
!                       'edit'      => True,
!                       'delete'    => True
!               );
  
                function uiadmin()
--- 21,31 ----
                var $session_data;
                var $public_functions = array(
!                       'news_list'     => True,
!                       'add'           => True,
!                       'view'          => True,
!                       'edit'          => True,
!                       'delete'        => True,
!                       'delete_item'   => True
!                       );
  
                function uiadmin()
***************
*** 85,89 ****
                        
$GLOBALS['phpgw']->template->set_var('lang_no',lang('No'));
  
!                       
$GLOBALS['phpgw']->template->set_var('link_yes',$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.boadmin.delete&news_id='
 . $news_id));
                        
$GLOBALS['phpgw']->template->set_var('link_no',$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uiadmin.news_list'));
  
--- 86,90 ----
                        
$GLOBALS['phpgw']->template->set_var('lang_no',lang('No'));
  
!                       
$GLOBALS['phpgw']->template->set_var('link_yes',$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uiadmin.delete_item&news_id='
 . $news_id));
                        
$GLOBALS['phpgw']->template->set_var('link_no',$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uiadmin.news_list'));
  
***************
*** 113,118 ****
                                if (!is_array($errors))
                                {
!                                       $this->bo->add($news);
                                        $message = lang('News item has been 
added');
                                }
                        }
--- 114,121 ----
                                if (!is_array($errors))
                                {
!                                       $id = $this->bo->add($news);
                                        $message = lang('News item has been 
added');
+                                       $this->edit($message, $id);
+                                       exit;
                                }
                        }
***************
*** 160,167 ****
                }
  
!               function edit($errors = '')
                {
!                       $news    = $GLOBALS['HTTP_POST_VARS']['news'];
!                       $news_id = $GLOBALS['HTTP_GET_VARS']['news_id'];
  
                        if($GLOBALS['HTTP_POST_VARS']['cancel'])
--- 163,185 ----
                }
  
!               function delete_item()
                {
!                       $item = intval(get_var('news_id'));
!                       if($item)
!                       {
!                               $this->bo->delete($item);
!                               $msg = lang('Item has been deleted');
!                       }
!                       else
!                       {
!                               $msg = lang('Item not found');
!                       }
!                       $this->news_list($msg);
!               }
! 
!               function edit($errors = '', $id=0)
!               {
!                       $news    = $_POST['news'];
!                       $news_id = (isset($_GET['news_id']) ? 
trim($_GET['news_id']) : $id);
  
                        if($GLOBALS['HTTP_POST_VARS']['cancel'])

Index: class.uinews.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/inc/class.uinews.inc.php,v
retrieving revision 1.10.2.6
retrieving revision 1.10.2.6.2.1
diff -C2 -r1.10.2.6 -r1.10.2.6.2.1
*** class.uinews.inc.php        19 Mar 2003 07:57:21 -0000      1.10.2.6
--- class.uinews.inc.php        4 May 2003 06:12:12 -0000       1.10.2.6.2.1
***************
*** 1,255 ****
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - News                                                   
   *
!       * http://www.phpgroupware.org                                           
   *
!       * --------------------------------------------                          
   *
!       *  This program is free software; you can redistribute it and/or modify 
it *
!       *  under the terms of the GNU General Public License as published by 
the   *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
!       *  option) any later version.                                           
   *
!       * --------------------------------------------                          
   *
!       * This program was sponsered by Golden Glair productions                
   *
!       * http://www.goldenglair.com                                            
   *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       class uinews
!       {
!               var $template;
!               var $bonews;
!               var $public_functions = array(
!                       'show_news'      => True,
!                       'show_news_home' => True
!               );
! 
!               function uinews()
!               {
!                       $this->template = $GLOBALS['phpgw']->template;
!                       $this->bonews   = CreateObject('news_admin.bonews');
!                       
$this->template->set_root($GLOBALS['phpgw']->common->get_tpl_dir('news_admin'));
!               }
! 
!               function show_news($show_category_select = False)
!               {
!                       global $cat_id, $start, $category_list, $oldnews;
! 
!                       if (! function_exists('parse_navbar'))
!                       {
!                               $GLOBALS['phpgw']->common->phpgw_header();
!                               echo parse_navbar();
!                       }
! 
!                       if (! $cat_id)
!                       {
!                               $cat_id = 0;
!                       }
! 
!                       if (function_exists('get_var'))
!                       {
!                               $news_id = get_var('news_id',Array('GET'));
!                       }
!                       else
!                       {       
!                               $news_id = $GLOBALS['HTTP_GET_VARS']['news_id'];
!                       }
! 
!                       if($news_id)
!                       {
!                               $news = $this->bonews->get_news($news_id);
!                       }
!                       else
!                       {
!                               $news = $this->bonews->get_NewsList($cat_id, 
$oldnews, $start, $total);
!                       }
! 
!                       $total = $this->bonews->get_NumNewsInCat($cat_id);
! 
!                       if($total)
!                       {
!                       $this->template->set_file(array(
!                               '_news' => 'news.tpl'
!                       ));
!                       $this->template->set_block('_news','news_form');
!                       $this->template->set_block('_news','row');
!                       $this->template->set_block('_news','category');
!   
!                       $var = Array();
!   
!                       
$this->template->set_var('icon',$GLOBALS['phpgw']->common->image('news_admin','news-corner.gif'));
!   
!                       if ($show_category_select || $category_list)
!                       {
!                               $var['form_action'] = 
$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uinews.show_news&category_list=True');
!                               $var['lang_category'] = lang('Category');
!   
!                               $var['lang_main'] = lang('Main');
!   //                          $cats = createobject('phpgwapi.categories');
!                               $var['input_category'] = 
ExecMethod('phpgwapi.categories.formated_list',
!                                       Array(
!                                               'format'        =>'select',
!                                               'type'  => 'mains',
!                                               'selected'      => $cat_id
!                                       )
!                               );
!                               $this->template->set_var($var);
!                               $this->template->parse('_category','category');
!                       }
!   
!                       foreach($news as $newsitem)
!                       {
!                               $var = Array(
!                                       'subject'       => $newsitem['subject'],
!                                       'submitedby'    => 'Submitted by ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' on ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'content'       => 
nl2br($newsitem['content'])
!                               );
!   
!                               $this->template->set_var($var);
!                               $this->template->parse('rows','row',True);
!                       }
!   
!                       $this->template->pfp('_out','news_form');
!                       if ($total > 5 && ! $oldnews)
!                       {
!                               $link_values = array(
!                                       'menuaction'    => 
'news_admin.uinews.show_news',
!                                       'oldnews'       => 'True',
!                                       'cat_id'        => $cat_id,
!                                       'category_list' => 'True'
!                               );
!   
!                               echo '<center><a href="' . 
$GLOBALS['phpgw']->link('/index.php',$link_values) . '">View news 
archives</a></center>';
!                       }
!                       }
!                       else
!                       {
!                               echo '<p align="center">' . lang('no news') . 
'</p>';
!                       }
!               }
! 
!               function show_news_home()
!               {
!                       $title = '<font color="#FFFFFF">'.lang('News 
Admin').'</font>';
!                       $portalbox = CreateObject('phpgwapi.listbox',array(
!                               'title'     => $title,
!                               'primary'   => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'secondary' => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'tertiary'  => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'width'     => '100%',
!                               'outerborderwidth' => '0',
!                               'header_background_image' => 
$GLOBALS['phpgw']->common->image('phpgwapi/templates/default','bg_filler')
!                       ));
! 
!                       $app_id = 
$GLOBALS['phpgw']->applications->name2id('news_admin');
!                       $GLOBALS['portal_order'][] = $app_id;
! 
!                       $var = Array(
!                               'up'       => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'down'     => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'close'    => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'question' => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'edit'     => Array('url' => '/set_box.php', 
'app' => $app_id)
!                       );
! 
!                       while(list($key,$value) = each($var))
!                       {
!                               $portalbox->set_controls($key,$value);
!                       }
! 
!                       $total = $this->bonews->get_NumNewsInCat(0);
! 
!                       $newslist = $this->bonews->get_newslist($cat_id);
! 
!                       $image_path = 
$GLOBALS['phpgw']->common->get_image_path('news_admin');
! 
!                       if(is_array($newslist))
!                       {
!                       foreach($newslist as $newsitem)
!                       {
!                               $portalbox->data[] = array(
!                                       'text' => $newsitem['subject'] . ' - ' 
. lang('Submitted by') . ' ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' ' . 
lang('on') . ' ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'link' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uinews.show_news&news_id='
 . $newsitem['id'])
!                               );
!                       }
!                       }
!                       else
!                       {
!                               $portalbox->data[] = array('text' => lang('no 
news'));
!                       }
! 
!                       $tmp = "\r\n"
!                               . '<!-- start News Admin -->' . "\r\n"
!                               . $portalbox->draw()
!                               . '<!-- end News Admin -->'  . "\r\n";
!                       
$GLOBALS['phpgw']->template->set_var('phpgw_body',$tmp,True);
!               }
! 
!               function show_news_website($section='mid')
!               {
!                       global $cat_id, $start, $oldnews;
! 
!                       if (! $cat_id)
!                       {
!                               $cat_id = 0;
!                       }
! 
!                       $this->template->set_file(array(
!                               '_news' => 'news_' . $section . '.tpl'
!                       ));
!                       $this->template->set_block('_news','news_form');
!                       $this->template->set_block('_news','row');
!                       $this->template->set_block('_news','category');
! 
!                       if (function_exists('get_var'))
!                       {
!                               $news_id = get_var('news_id',Array('GET'));
!                       }
!                       else
!                       {   
!                               $news_id = $GLOBALS['HTTP_GET_VARS']['news_id'];
!                       }
! 
!                       if($news_id)
!                       {
!                               $news = $this->bonews->get_news($news_id);
!                       }
!                       else
!                       {
!                               $news = 
$this->bonews->get_NewsList($cat_id,$oldnews,$start,$total);
!                       }
! 
! 
!                       $total = $this->bonews->get_NumNewsInCat($cat_id);
! 
!                       $var = Array();
! 
!                       
$this->template->set_var('icon',$GLOBALS['phpgw']->common->image('news_admin','news-corner.gif'));
! 
!                       foreach($news as $newsitem)
!                       {
!                               $var = Array(
!                                       'subject'    => $newsitem['subject'],
!                                       'submitedby' => 'Submitted by ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' on ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'content'    => 
nl2br($newsitem['content'])
!                               );
! 
!                               $this->template->set_var($var);
!                               $this->template->parse('rows','row',True);
!                       }
! 
!                       $out = $this->template->fp('out','news_form');
! 
!                       if ($total > 5 && ! $oldnews)
!                       {
!                               $link_values = array(
!                                       'menuaction'    => 
'news_admin.uinews.show_news',
!                                       'oldnews'       => 'True',
!                                       'cat_id'        => $cat_id,
!                                       'category_list' => 'True'
!                               );
! 
!                               $out .= '<center><a href="' . 
$GLOBALS['phpgw']->link('/index.php',$link_values) . '">View news 
archives</a></center>';
!                       }
!                       return $out;
!               }
!       }
--- 1,255 ----
! <?php
!       
/**************************************************************************\
!       * phpGroupWare - News                                                   
   *
!       * http://www.phpgroupware.org                                           
   *
!       * --------------------------------------------                          
   *
!       *  This program is free software; you can redistribute it and/or modify 
it *
!       *  under the terms of the GNU General Public License as published by 
the   *
!       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
!       *  option) any later version.                                           
   *
!       * --------------------------------------------                          
   *
!       * This program was sponsered by Golden Glair productions                
   *
!       * http://www.goldenglair.com                                            
   *
!       
\**************************************************************************/
! 
!       /* $Id$ */
! 
!       class uinews
!       {
!               var $template;
!               var $bonews;
!               var $public_functions = array(
!                       'show_news'      => True,
!                       'show_news_home' => True
!               );
! 
!               function uinews()
!               {
!                       $this->template = $GLOBALS['phpgw']->template;
!                       $this->bonews   = CreateObject('news_admin.bonews');
!                       
$this->template->set_root($GLOBALS['phpgw']->common->get_tpl_dir('news_admin'));
!               }
! 
!               function show_news($show_category_select = False)
!               {
!                       global $cat_id, $start, $category_list, $oldnews;
! 
!                       if (! function_exists('parse_navbar'))
!                       {
!                               $GLOBALS['phpgw']->common->phpgw_header();
!                               echo parse_navbar();
!                       }
! 
!                       if (! $cat_id)
!                       {
!                               $cat_id = 0;
!                       }
! 
!                       if (function_exists('get_var'))
!                       {
!                               $news_id = get_var('news_id',Array('GET'));
!                       }
!                       else
!                       {       
!                               $news_id = $GLOBALS['HTTP_GET_VARS']['news_id'];
!                       }
! 
!                       if($news_id)
!                       {
!                               $news = $this->bonews->get_news($news_id);
!                       }
!                       else
!                       {
!                               $news = $this->bonews->get_NewsList($cat_id, 
$oldnews, $start, $total);
!                       }
! 
!                       $total = $this->bonews->get_NumNewsInCat($cat_id);
! 
!                       if($total)
!                       {
!                       $this->template->set_file(array(
!                               '_news' => 'news.tpl'
!                       ));
!                       $this->template->set_block('_news','news_form');
!                       $this->template->set_block('_news','row');
!                       $this->template->set_block('_news','category');
!   
!                       $var = Array();
!   
!                       
$this->template->set_var('icon',$GLOBALS['phpgw']->common->image('news_admin','news-corner.gif'));
!   
!                       if ($show_category_select || $category_list)
!                       {
!                               $var['form_action'] = 
$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uinews.show_news&category_list=True');
!                               $var['lang_category'] = lang('Category');
!   
!                               $var['lang_main'] = lang('Main');
!   //                          $cats = createobject('phpgwapi.categories');
!                               $var['input_category'] = 
ExecMethod('phpgwapi.categories.formated_list',
!                                       Array(
!                                               'format'        =>'select',
!                                               'type'  => 'mains',
!                                               'selected'      => $cat_id
!                                       )
!                               );
!                               $this->template->set_var($var);
!                               $this->template->parse('_category','category');
!                       }
!   
!                       foreach($news as $newsitem)
!                       {
!                               $var = Array(
!                                       'subject'       => $newsitem['subject'],
!                                       'submitedby'    => 'Submitted by ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' on ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'content'       => 
nl2br($newsitem['content'])
!                               );
!   
!                               $this->template->set_var($var);
!                               $this->template->parse('rows','row',True);
!                       }
!   
!                       $this->template->pfp('_out','news_form');
!                       if ($total > 5 && ! $oldnews)
!                       {
!                               $link_values = array(
!                                       'menuaction'    => 
'news_admin.uinews.show_news',
!                                       'oldnews'       => 'True',
!                                       'cat_id'        => $cat_id,
!                                       'category_list' => 'True'
!                               );
!   
!                               echo '<center><a href="' . 
$GLOBALS['phpgw']->link('/index.php',$link_values) . '">View news 
archives</a></center>';
!                       }
!                       }
!                       else
!                       {
!                               echo '<p align="center">' . lang('no news') . 
'</p>';
!                       }
!               }
! 
!               function show_news_home()
!               {
!                       $title = '<font color="#FFFFFF">'.lang('News 
Admin').'</font>';
!                       $portalbox = CreateObject('phpgwapi.listbox',array(
!                               'title'     => $title,
!                               'primary'   => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'secondary' => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'tertiary'  => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
!                               'width'     => '100%',
!                               'outerborderwidth' => '0',
!                               'header_background_image' => 
$GLOBALS['phpgw']->common->image('phpgwapi/templates/default','bg_filler')
!                       ));
! 
!                       $app_id = 
$GLOBALS['phpgw']->applications->name2id('news_admin');
!                       $GLOBALS['portal_order'][] = $app_id;
! 
!                       $var = Array(
!                               'up'       => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'down'     => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'close'    => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'question' => Array('url' => '/set_box.php', 
'app' => $app_id),
!                               'edit'     => Array('url' => '/set_box.php', 
'app' => $app_id)
!                       );
! 
!                       while(list($key,$value) = each($var))
!                       {
!                               $portalbox->set_controls($key,$value);
!                       }
! 
!                       $total = $this->bonews->get_NumNewsInCat(0);
! 
!                       $newslist = $this->bonews->get_newslist($cat_id);
! 
!                       $image_path = 
$GLOBALS['phpgw']->common->get_image_path('news_admin');
! 
!                       if(is_array($newslist))
!                       {
!                       foreach($newslist as $newsitem)
!                       {
!                               $portalbox->data[] = array(
!                                       'text' => $newsitem['subject'] . ' - ' 
. lang('Submitted by') . ' ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' ' . 
lang('on') . ' ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'link' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=news_admin.uinews.show_news&news_id='
 . $newsitem['id'])
!                               );
!                       }
!                       }
!                       else
!                       {
!                               $portalbox->data[] = array('text' => lang('no 
news'));
!                       }
! 
!                       $tmp = "\r\n"
!                               . '<!-- start News Admin -->' . "\r\n"
!                               . $portalbox->draw()
!                               . '<!-- end News Admin -->'  . "\r\n";
!                       
$GLOBALS['phpgw']->template->set_var('phpgw_body',$tmp,True);
!               }
! 
!               function show_news_website($section='mid')
!               {
!                       global $cat_id, $start, $oldnews;
! 
!                       if (! $cat_id)
!                       {
!                               $cat_id = 0;
!                       }
! 
!                       $this->template->set_file(array(
!                               '_news' => 'news_' . $section . '.tpl'
!                       ));
!                       $this->template->set_block('_news','news_form');
!                       $this->template->set_block('_news','row');
!                       $this->template->set_block('_news','category');
! 
!                       if (function_exists('get_var'))
!                       {
!                               $news_id = get_var('news_id',Array('GET'));
!                       }
!                       else
!                       {   
!                               $news_id = $GLOBALS['HTTP_GET_VARS']['news_id'];
!                       }
! 
!                       if($news_id)
!                       {
!                               $news = $this->bonews->get_news($news_id);
!                       }
!                       else
!                       {
!                               $news = 
$this->bonews->get_NewsList($cat_id,$oldnews,$start,$total);
!                       }
! 
! 
!                       $total = $this->bonews->get_NumNewsInCat($cat_id);
! 
!                       $var = Array();
! 
!                       
$this->template->set_var('icon',$GLOBALS['phpgw']->common->image('news_admin','news-corner.gif'));
! 
!                       foreach($news as $newsitem)
!                       {
!                               $var = Array(
!                                       'subject'    => $newsitem['subject'],
!                                       'submitedby' => 'Submitted by ' . 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']) . ' on ' . 
$GLOBALS['phpgw']->common->show_date($newsitem['submissiondate']),
!                                       'content'    => 
nl2br($newsitem['content'])
!                               );
! 
!                               $this->template->set_var($var);
!                               $this->template->parse('rows','row',True);
!                       }
! 
!                       $out = $this->template->fp('out','news_form');
! 
!                       if ($total > 5 && ! $oldnews)
!                       {
!                               $link_values = array(
!                                       'menuaction'    => 
'news_admin.uinews.show_news',
!                                       'oldnews'       => 'True',
!                                       'cat_id'        => $cat_id,
!                                       'category_list' => 'True'
!                               );
! 
!                               $out .= '<center><a href="' . 
$GLOBALS['phpgw']->link('/index.php',$link_values) . '">View news 
archives</a></center>';
!                       }
!                       return $out;
!               }
!       }





reply via email to

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