phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] bookmarks inc/class.bo.inc.php inc/class.so.inc...


From: Dave Hall
Subject: [Phpgroupware-cvs] bookmarks inc/class.bo.inc.php inc/class.so.inc...
Date: Thu, 28 Dec 2006 13:35:12 +0000

CVSROOT:        /sources/phpgroupware
Module name:    bookmarks
Changes by:     Dave Hall <skwashd>     06/12/28 13:35:12

Modified files:
        inc            : class.bo.inc.php class.so.inc.php 
                         class.ui.inc.php 
        templates/base : list.body.tpl list.tpl 

Log message:
        lots of fixes to make this work properly

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/bookmarks/inc/class.bo.inc.php?cvsroot=phpgroupware&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/bookmarks/inc/class.so.inc.php?cvsroot=phpgroupware&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/bookmarks/inc/class.ui.inc.php?cvsroot=phpgroupware&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/bookmarks/templates/base/list.body.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/bookmarks/templates/base/list.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2

Patches:
Index: inc/class.bo.inc.php
===================================================================
RCS file: /sources/phpgroupware/bookmarks/inc/class.bo.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- inc/class.bo.inc.php        21 Jun 2005 15:25:16 -0000      1.8
+++ inc/class.bo.inc.php        28 Dec 2006 13:35:12 -0000      1.9
@@ -7,11 +7,10 @@
        * @copyright Copyright (C) 2005 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package bookmarks
-       * @version $Id: class.bo.inc.php,v 1.8 2005/06/21 15:25:16 ceb Exp $
+       * @version $Id: class.bo.inc.php,v 1.9 2006/12/28 13:35:12 skwashd Exp $
        * @internal Based on Bookmarker, Copyright (C) 1998 Padraic Renaghan, 
http://www.renaghan.com/bookmarker
        * @internal Ported to phpGroupWare by Joseph Engo
        * @internal Ported to three-layered design by Michael Totschnig
-       * @todo Class must be renamed to avoid conflicts
        */
 
        /**
@@ -19,7 +18,7 @@
         * 
         * @package bookmarks
         */
-       class bo
+       class bookmarks_bo
        {
                var $so;
                var $db;
@@ -33,10 +32,10 @@
                var $error_msg;
                var $msg;
 
-               function bo()
+               function bookmarks_bo()
                {
                        $this->so = createobject('bookmarks.so');
-                       $this->db          = $GLOBALS['phpgw']->db;
+                       $this->db          =& $GLOBALS['phpgw']->db;
                        $this->grants      = 
$GLOBALS['phpgw']->acl->get_grants('bookmarks');
                        $this->categories = 
createobject('phpgwapi.categories','','bookmarks');
                        $GLOBALS['phpgw']->config     = 
createobject('phpgwapi.config');
@@ -48,17 +47,19 @@
 
                function grab_form_values($returnto,$returnto2,$bookmark)
                {
-                       $location_info = array(
+                       $location_info = array
+                       (
                                'returnto'  => $returnto,
                                'returnto2' => $returnto2,
-                               'bookmark'  => array(
+                               'bookmark'      => array
+                               (
                                'url'       => $bookmark['url'],
                                'name'      => $bookmark['name'],
                                'desc'      => $bookmark['desc'],
                                'keywords'  => $bookmark['keywords'],
-                               'category'  => $bookmark['category'],
+                                       'category'      => 
isset($bookmark['category']) ? $bookmark['category'] : 0,
                                'rating'    => $bookmark['rating'],
-                               'access' => $bookmark['access'],
+                                       'access'        => 
isset($bookmark['access']) ? $bookmark['access'] : ''
                                )
                        );
                        $this->save_session_data($location_info);

Index: inc/class.so.inc.php
===================================================================
RCS file: /sources/phpgroupware/bookmarks/inc/class.so.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- inc/class.so.inc.php        21 Jun 2005 15:25:16 -0000      1.6
+++ inc/class.so.inc.php        28 Dec 2006 13:35:12 -0000      1.7
@@ -7,11 +7,10 @@
        * @copyright Copyright (C) 2005 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package bookmarks
-       * @version $Id: class.so.inc.php,v 1.6 2005/06/21 15:25:16 ceb Exp $
+       * @version $Id: class.so.inc.php,v 1.7 2006/12/28 13:35:12 skwashd Exp $
        * @internal Based on Bookmarker, Copyright (C) 1998 Padraic Renaghan, 
http://www.renaghan.com/bookmarker
        * @internal Ported to phpGroupWare by Joseph Engo
        * @internal Ported to three-layered design by Michael Totschnig
-       * @todo Class must be renamed to avoid conflicts
        */
 
        /**
@@ -19,14 +18,14 @@
         * 
         * @package bookmarks
         */
-       class so
+       class bookmarks_so
        {
                var $db;
                var $total_records;
 
-               function so()
+               function bookmarks_so()
                {
-                       $this->db = $GLOBALS['phpgw']->db;
+                       $this->db =& $GLOBALS['phpgw']->db;
                }
 
                function _list($cat_list,$public_user_list,$start,$where_clause)
@@ -63,6 +62,7 @@
                                
$this->db->limit_query($query,$start,__LINE__,__FILE__);
                        }
 
+                       $result = array();
                        while ($this->db->next_record())
                        {
                                $bookmark['name'] = 
$GLOBALS['phpgw']->strip_html($this->db->f('bm_name'));
@@ -115,12 +115,12 @@
 
                function add($values)
                {
-                       if (! $values['access'])
+                       if ( !isset($values['access']) || !$values['access'] )
                        {
                                $values['access'] = 'public';
                        }
 
-                       if (! $values['timestamps'])
+                       if ( !isset($values['timestamps']) || 
!$value['timestamps'] )
                        {
                                $values['timestamps'] = time() . ',0,0';
                        }
@@ -128,9 +128,10 @@
                        $query = sprintf("insert into phpgw_bookmarks (bm_url, 
bm_name, bm_desc, bm_keywords, bm_category,"
                                . "bm_rating, bm_owner, bm_access, bm_info, 
bm_visits) "
                                . "values 
('%s','%s','%s','%s',%s,%s,'%s','%s','%s',0)", 
-                               $values['url'], addslashes($values['name']), 
addslashes($values['desc']), addslashes($values['keywords']),
-                               $values['category'], $values['rating'], 
$GLOBALS['phpgw_info']['user']['account_id'], $values['access'],
-                               $values['timestamps']);
+                               $this->db->db_addslashes($values['url']), 
$this->db->db_addslashes($values['name']), 
+                               $this->db->db_addslashes($values['desc']), 
$this->db->db_addslashes($values['keywords']),
+                               (int)$values['category'], 
(int)$values['rating'], (int)$GLOBALS['phpgw_info']['user']['account_id'], 
+                               $this->db->db_addslashes($values['access']), 
$values['timestamps']);
 
                        if ($this->db->query($query,__LINE__,__FILE__))
                        {

Index: inc/class.ui.inc.php
===================================================================
RCS file: /sources/phpgroupware/bookmarks/inc/class.ui.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- inc/class.ui.inc.php        21 Jun 2005 15:25:16 -0000      1.12
+++ inc/class.ui.inc.php        28 Dec 2006 13:35:12 -0000      1.13
@@ -7,11 +7,10 @@
        * @copyright Copyright (C) 2005 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package bookmarks
-       * @version $Id: class.ui.inc.php,v 1.12 2005/06/21 15:25:16 ceb Exp $
+       * @version $Id: class.ui.inc.php,v 1.13 2006/12/28 13:35:12 skwashd Exp 
$
        * @internal Based on Bookmarker, Copyright (C) 1998 Padraic Renaghan, 
http://www.renaghan.com/bookmarker
        * @internal Ported to phpGroupWare by Joseph Engo
        * @internal Ported to three-layered design by Michael Totschnig
-       * @todo Class must be renamed to avoid conflicts
        */
 
 /**
@@ -39,13 +38,15 @@
         * 
         * @package bookmarks
         */
-       class ui
+       class bookmarks_ui
        {
                var $t;
                var $bo;
                var $img;
                var $expandedcats;
                var $nextmatchs;
+               var $page_header_shown = false;
+               var $massupdate_shown = false;
 
                var $public_functions = array
                (
@@ -62,9 +63,9 @@
                        'import' => True
                );
 
-               function ui()
+               function bookmarks_ui()
                {
-                       $this->t = $GLOBALS["phpgw"]->template;
+                       $this->t =& $GLOBALS['phpgw']->template;
                        $this->bo = createobject('bookmarks.bo');
                        $this->img = array(
                                'collapse' => 
$GLOBALS['phpgw']->common->image('bookmarks','tree_collapse'),
@@ -85,14 +86,14 @@
                        // we maintain two levels of state:
                        // returnto the main interface (tree, list, or search)
                        // returnto2 temporaray interface (create, edit, view, 
mail)
-                       $returnto2 = $this->location_info['returnto2'];
-                       $returnto = $this->location_info['returnto'];
-                       if ($returnto2)
+                       if ( isset($this->location_info['returnto2']) )
                        {
+                               $returnto2 = $this->location_info['returnto2'];
                                $this->$returnto2();
                        }
-                       elseif ($returnto)
+                       else if ( isset($this->location_info['returnto']) )
                        {
+                               $returnto = $this->location_info['returnto'];
                                $this->$returnto();
                        }
                        elseif 
($GLOBALS['phpgw_info']['user']['preferences']['bookmarks']['defaultview'] == 
'tree')
@@ -108,25 +109,26 @@
                function app_header($where=0)
                { 
                        $tabs[1]['label'] = lang('Tree view');
-                       $tabs[1]['link']  = 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.tree');
+                       $tabs[1]['link']  = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.tree') );
 
                        $tabs[2]['label'] = lang('List');
-                       $tabs[2]['link']  = 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui._list');
+                       $tabs[2]['link']  = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui._list') );
 
                        if (! 
$GLOBALS['phpgw']->acl->check('anonymous',1,'bookmarks'))
                        {
                                $tabs[3]['label'] = lang('New');
-                               $tabs[3]['link']  = 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.create');
+                               $tabs[3]['link']  = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.create') );
                        }
 
                        $tabs[4]['label'] = lang('Search');
-                       $tabs[4]['link']  = 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.search');
+                       $tabs[4]['link']  = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.search') );
 
                        
$this->t->set_var('app_navbar',$GLOBALS['phpgw']->common->create_tabs($tabs,$where));
                }
 
                function app_messages()
                {
+                       $bk_output_html = '';
                        if ($this->bo->error_msg)
                        {
                                $bk_output_html = '<center style="color:red">' 
. lang('Error') . ': ' . $this->bo->error_msg . '</center>';
@@ -163,7 +165,6 @@
                                'save_button' => ('<input type="image" 
name="save" title="' . lang('Save') . '" src="'
                                        . 
$GLOBALS['phpgw']->common->image('bookmarks','save') . '" border="0">'
                                ),
-                               'th_bg' => 
$GLOBALS['phpgw_info']['theme']['th_bg'],
                                'category_image' => ('<input type="image" 
name="edit_category" title="' . lang('Edit category') . '" src="'
                                        . 
$GLOBALS['phpgw']->common->image('bookmarks','edit') . '" border="0">'
                                ),
@@ -173,15 +174,18 @@
                function create()
                {
                        //if we redirect to edit categories, we remember form 
values and try to come back to create
-                       if ($GLOBALS['HTTP_POST_VARS']['edit_category_x'] || 
$GLOBALS['HTTP_POST_VARS']['edit_category_y'])
+                       if ( (isset($_POST['edit_category_x']) && 
$_POST['edit_category_x'])
+                               || ( isset($_POST['edit_category_y']) && 
$_POST['edit_category_y']) )
                        {
-                               
$this->bo->grab_form_values($this->location_info['returnto'],'create',$GLOBALS['HTTP_POST_VARS']['bookmark']);
-                               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=bookmarks&global_cats=True'));
+                               
$this->bo->grab_form_values($this->location_info['returnto'],'create',$_POST['bookmark']);
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'preferences.uicategories.index', 'cats_app' => 
'bookmarks', 'global_cats' => True) );
+                               exit;
                        }
                        //save bookmark
-                       if ($GLOBALS['HTTP_POST_VARS']['save_x'] || 
$GLOBALS['HTTP_POST_VARS']['save_y'])
+                       if ( (isset($_POST['save_x']) && $_POST['save_x'])
+                               || (isset($_POST['save_y']) && 
$_POST['save_y']) )
                        {
-                               $bookmark = 
$GLOBALS['HTTP_POST_VARS']['bookmark'];
+                               $bookmark = $_POST['bookmark'];
                                $bm_id = $this->bo->add($bookmark);
                                if ($bm_id)
                                {
@@ -191,7 +195,8 @@
                                }
                        }
                        //if we come back from editing categories we restore 
form values
-                       elseif ($this->location_info['returnto2'] == 'create')
+                       else if ( isset($this->location_info['returnto2']) 
+                               && $this->location_info['returnto2'] == 
'create')
                        {
                                $bookmark['name']        = 
$this->location_info['bookmark']['name'];
                                $bookmark['url']         = 
$this->location_info['bookmark']['url'];
@@ -201,8 +206,22 @@
                                $bookmark['rating']      = 
$this->location_info['bookmark']['rating'];
                                $bookmark['access']      = 
$this->location_info['bookmark']['access'];
                        }
+                       else
+                       {
+                               $bookmark = array
+                               (
+                                       'name'          => '',
+                                       'url'           => 'http://',
+                                       'desc'          => '',
+                                       'keywords'      => '',
+                                       'category'      => 0,
+                                       'rating'        => 0,
+                                       'access'        => ''
+                               );
+                       }
                        //if the user cancelled we go back to the view we came 
from
-                       if ($GLOBALS['HTTP_POST_VARS']['cancel_x'] || 
$GLOBALS['HTTP_POST_VARS']['cancel_y'])
+                       if ( (isset($_POST['cancel_x']) && $_POST['cancel_x'])
+                               || ( isset($_POST['cancel_y']) && 
$_POST['cancel_y']) )
                        {
                                unset($this->location_info['returnto2']);
                                $this->init();
@@ -224,6 +243,7 @@
                        $this->t->set_block('form','body');
                        $this->t->set_block('form','form_info');
 
+                       $selected = array('', '', '', '', '', '', '', '', '', 
'', '');
                        $selected[$bookmark['rating']] = ' selected';
                        $this->app_template();
                        $this->t->set_var(array(
@@ -257,7 +277,7 @@
                                        $bookmark['keywords'] . '">'
                                ),
                                'input_access' => ('<input type="checkbox" 
name="bookmark[access]" value="private"' . 
-                                       ($bookmark['access'] ?' checked' : '') 
. '>'
+                                       (isset($bookmark['access']) &&  
$bookmark['access'] ?' checked' : '') . '>'
                                ),
                        ));
 
@@ -268,23 +288,23 @@
 
                function edit()
                {
-                       if (isset($GLOBALS['HTTP_GET_VARS']['bm_id']))
+                       if (isset($_GET['bm_id']))
                        {
-                               $bm_id = $GLOBALS['HTTP_GET_VARS']['bm_id'];
+                               $bm_id = $_GET['bm_id'];
                        }
                        elseif (is_array($this->location_info))
                        {
                                $bm_id = $this->location_info['bm_id'];
                        }
                        //if the user cancelled we go back to the view we came 
from
-                       if ($GLOBALS['HTTP_POST_VARS']['cancel_x'] || 
$GLOBALS['HTTP_POST_VARS']['cancel_y'])
+                       if ($_POST['cancel_x'] || $_POST['cancel_y'])
                        {
                                unset($this->location_info['returnto2']);
                                $this->init();
                                return;
                        }
                        //delete bookmark and go back to view we came from
-                       if ($GLOBALS['HTTP_POST_VARS']['delete_x'] || 
$GLOBALS['HTTP_POST_VARS']['delete_y'])
+                       if ($_POST['delete_x'] || $_POST['delete_y'])
                        {
                                $this->bo->delete($bm_id);
                                unset($this->location_info['returnto2']);
@@ -292,15 +312,16 @@
                                return;
                        }
                        //if we redirect to edit categories, we remember form 
values and try to come back to edit
-                       if ($GLOBALS['HTTP_POST_VARS']['edit_category_x'] || 
$GLOBALS['HTTP_POST_VARS']['edit_category_y'])
+                       if ($_POST['edit_category_x'] || 
$_POST['edit_category_y'])
                        {
-                               
$this->bo->grab_form_values($this->location_info['returnto'],'edit',$GLOBALS['HTTP_POST_VARS']['bookmark']);
-                               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=bookmarks&global_cats=True'));
+                               
$this->bo->grab_form_values($this->location_info['returnto'],'edit',$_POST['bookmark']);
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'preferences.uicategories.index', 'cats_app' => 
'bookmarks', 'global_cats' => 'True'));
+                               exit;
                        }
                        //save bookmark and go to view interface
-                       if ($GLOBALS['HTTP_POST_VARS']['save_x'] || 
$GLOBALS['HTTP_POST_VARS']['save_y'])
+                       if ($_POST['save_x'] || $_POST['save_y'])
                        {
-                               $bookmark = 
$GLOBALS['HTTP_POST_VARS']['bookmark'];
+                               $bookmark = $_POST['bookmark'];
                                if ($this->bo->update($bm_id,$bookmark))
                                {
                                        $this->location_info['bm_id'] = $bm_id;
@@ -375,7 +396,7 @@
                        $this->t->parse('info','form_info');
                        $this->t->set_var(array(
                                'form_info' => '',
-                               'form_action' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.edit&bm_id=' . 
$bm_id),
+                               'form_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.edit', 'bm_id' => (int)$bm_id) ),
                                'lang_access' => lang('Private'),
                                'input_access' => ('<input type="checkbox" 
name="bookmark[access]" value="private"' . 
                                        ($bookmark['access']=='private'?' 
checked':'') . '>'
@@ -411,20 +432,20 @@
                {
                        if (is_array($this->location_info))
                        {
-                               $start = $this->location_info['start'];
-                               $bm_cat = $this->location_info['bm_cat'];
+                               $start = isset($this->location_info['start']) ? 
$this->location_info['start'] : 0;
+                               $bm_cat = isset($this->location_info['bm_cat']) 
? $this->location_info['bm_cat'] : 0;
                        }
-                       if (isset($GLOBALS['HTTP_GET_VARS']['bm_cat']))
+                       if (isset($_GET['bm_cat']))
                        {
-                               $bm_cat = $GLOBALS['HTTP_GET_VARS']['bm_cat'];
+                               $bm_cat = $_GET['bm_cat'];
                        }
-                       if (isset($GLOBALS['HTTP_GET_VARS']['start']))
+                       if (isset($_GET['start']))
                        {
-                               $start = $GLOBALS['HTTP_GET_VARS']['start'];
+                               $start = $_GET['start'];
                        }
-                       if (isset($GLOBALS['HTTP_POST_VARS']['start']))
+                       if (isset($_POST['start']))
                        {
-                               $start = $GLOBALS['HTTP_POST_VARS']['start'];
+                               $start = $_POST['start'];
                        }
                        $this->location_info['start'] = $start;
                        $this->location_info['bm_cat'] = $bm_cat;
@@ -432,8 +453,7 @@
                        unset($this->location_info['returnto2']);
                        $this->bo->save_session_data($this->location_info);
 
-                       $GLOBALS['phpgw']->common->phpgw_header();
-                       echo parse_navbar();
+                       $GLOBALS['phpgw']->common->phpgw_header(true);
                        $this->app_header(_LIST);
 
                        $this->t->set_file(array(
@@ -442,13 +462,13 @@
                        ));
 
                        $this->t->set_var(array(
-                               'th_bg' => 
$GLOBALS['phpgw_info']['theme']['th_bg'],
                                'lang_url' => lang('URL'),
                                'lang_name' => lang('Name')
                        ));
 
                        // We need to send the $start var instead of the page 
number
                        // Use appsession() to remeber the return page,instead 
of always passing it 
+                       $where_clause = '';
                        
$this->print_list($where_clause,$start,$bm_cat,$bookmark_list);
 
                        $this->t->set_var('BOOKMARK_LIST', $bookmark_list);
@@ -469,7 +489,7 @@
                                $total_matchs .= ' ' . 
                                        lang('from category 
%1',$GLOBALS['phpgw']->strip_html($this->bo->categories->id2name($bm_cat))) .
                                        ' - <a href="' . 
-                                       
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui._list&bm_cat=0&start=0')
 .
+                                       $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'bookmarks.ui._list', 'bm_cat' => 0, 'start' => 0) ) .
                                        '">' .
                                        lang('All bookmarks') .
                                        '</a>';
@@ -499,14 +519,14 @@
                                $start = $this->location_info['searchstart'];
                                $x = $this->location_info['x'];
                        }
-                       if (isset($GLOBALS['HTTP_POST_VARS']['x']))
+                       if (isset($_POST['x']))
                        {
-                               $x = $GLOBALS['HTTP_POST_VARS']['x'];
+                               $x = $_POST['x'];
                                $this->location_info['x'] = $x;
                        }
-                       if (isset($GLOBALS['HTTP_POST_VARS']['start']))
+                       if (isset($_POST['start']))
                        {
-                               $start = $GLOBALS['HTTP_POST_VARS']['start'];
+                               $start = $_POST['start'];
                                $this->location_info['searchstart'] = $start;
                        }
                        $this->location_info['returnto'] = 'search';
@@ -557,11 +577,11 @@
 
                        $this->t->set_var(array(
                                'SEARCH_SELECT' => $search_select,
-                               'FORM_ACTION'   => 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.search')
+                               'FORM_ACTION'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.search') )
                        ));
 
                        # build the search form
-                       $this->t->set_var(QUERY_FORM, $q->form("x", $field, 
"qry", $GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.search')));
+                       $this->t->set_var(QUERY_FORM, $q->form("x", $field, 
"qry", $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.search') ) ) );
 
                        if ($q->query == $noquery)
                        {
@@ -609,17 +629,15 @@
                {
                        $category = 
$GLOBALS['phpgw']->strip_html($this->bo->categories->id2name($category_id));
 
-                       $massupdate_shown = $GLOBALS['massupdate_shown'];
-
                        // We only want to display the massupdate section once
-                       if (! $massupdate_shown)
+                       if (! $this->massupdate_shown)
                        {
                                $this->t->set_var(array(
                                        'lang_massupdate' => lang('Mass 
update:'),
                                        'massupdate_delete_icon' => 
sprintf('<input type="image" name="delete" border="0" 
src="%s">',$this->img['delete']),
                                        'massupdate_mail_icon' => 
sprintf('<input type="image" name="mail" border="0" 
src="%s">',$this->img['mail'])
                                ));
-                               $massupdate_shown = True;
+                               $this->massupdate_shown = true;
                        }
                        else
                        {
@@ -640,8 +658,6 @@
 
        function print_list($where_clause, $start, $bm_cat, &$content)
        {
-               $page_header_shown = $GLOBALS['page_header_shown'];
-
                $this->t->set_file(array(
                        'list' => 'list.tpl'
                ));
@@ -653,12 +669,12 @@
                $this->t->set_block('list','page_header');
                $this->t->set_block('list','page_footer');
 
-               
$this->t->set_var('list_mass_select_form',$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.mass'));
+               
$this->t->set_var('list_mass_select_form',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'bookmarks.ui.mass') ) );
 
-               if (! $page_header_shown)
+               if (! $this->page_header_shown)
                {
                        $this->t->fp('header','page_header');
-                       $page_header_shown = True;
+                       $this->page_header_shown = True;
                }
                else
                {
@@ -685,7 +701,7 @@
 
                        if ($bookmark['keywords'])
                        {
-                               $this->t->set_var(BOOKMARK_KEYW, 
$bookmark['keywords']);
+                               $this->t->set_var('BOOKMARK_KEYW', 
$bookmark['keywords']);
                                
$this->t->parse('bookmark_keywords','list_keyw');
                        }
                        else
@@ -696,7 +712,7 @@
                        // Check owner
                        if 
($this->bo->check_perms2($bookmark['owner'],$bookmark['access'],PHPGW_ACL_EDIT))
                        {
-                               $maintain_url  = 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.edit&bm_id=' . 
$bm_id);
+                               $maintain_url  = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.edit', 'bm_id' => $bm_id) );
                                $maintain_link = sprintf(
                                        '<a href="%s"><img src="%s" align="top" 
border="0" alt="%s"></a>', 
                                        $maintain_url,
@@ -709,7 +725,7 @@
                                $maintain_link = '';
                        }
 
-                       $view_url      = 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.view&bm_id=' . 
$bm_id);
+                       $view_url      = $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'bookmarks.ui.view', 'bm_id' => (int)$bm_id) );
                        $view_link     = sprintf(
                                '<a href="%s"><img src="%s" align="top" 
border="0" alt="%s"></a>', 
                                $view_url,
@@ -719,14 +735,14 @@
 
                        $mail_link = sprintf(
                                '<a href="%s"><img align="top" border="0" 
src="%s" alt="%s"></a>',
-                               
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.mail&bm_id='.$bm_id),
+                               $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'bookmarks.ui.mail', 'bm_id' => (int)$bm_id) ),
                                $this->img['mail'],
                                lang('Mail this bookmark')
                                );
 
                        $this->t->set_var(array(
                                'maintain_link' => $maintain_link,
-                               'bookmark_url' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.redirect&bm_id='.$bm_id),
+                               'bookmark_url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.redirect', 'bm_id' => (int)$bm_id) ),
                                'view_link' => $view_link,
                                'mail_link' => $mail_link,
                                'checkbox' => '<input type="checkbox" 
name="item_cb[]" value="' . $bm_id . '">',
@@ -734,7 +750,7 @@
                                'bookmark_desc' => nl2br($bookmark['desc']),
                                'bookmark_rating' => sprintf('<img 
src="%s/bar-%s.jpg">',PHPGW_IMAGES,$bookmark['rating'])
                        ));
-                       $this->t->parse(LIST_ITEMS,'list_item',True);
+                       $this->t->parse('LIST_ITEMS', 'list_item', true);
                }
 
                if ($rows_printed > 0)
@@ -751,7 +767,7 @@
                        unset($this->location_info['returnto2']);
                        $this->bo->save_session_data($this->location_info);
 
-                       if ($_COOKIE['menutree'])
+                       if ( isset($_COOKIE['menutree']) && 
$_COOKIE['menutree'] )
                        {
                                $this->expandedcats = 
array_keys($_COOKIE['menutree']);
                        }
@@ -760,16 +776,12 @@
                                $this->expandedcats = Array();
                        }
 
-                       $GLOBALS['phpgw']->common->phpgw_header();
-                       echo parse_navbar();
+                       $GLOBALS['phpgw']->common->phpgw_header(true);
                        $this->app_header(TREE);
 
                        $this->t->set_file(array(
                                'common_' => 'common.tpl',
                        ));
-                       $this->t->set_var(Array(
-                               'th_bg' => 
$GLOBALS['phpgw_info']['theme']['th_bg']
-                       ));
 
                        $categories = 
$this->bo->categories->return_array('mains',0,False,'','cat_name','',True);
 
@@ -824,6 +836,7 @@
 
                function showcat($cats)
                {
+                       $tree = '';
                        while(list(,$cat) = @each($cats))
                        {
                                $cat_id = $cat['id'];
@@ -837,7 +850,7 @@
                                        '\')"></td><td><a 
style="font-weight:bold" title="' .
                                        
$GLOBALS['phpgw']->strip_html($cat['description']) .
                                        '" href="' .
-                                       
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui._list&start=0&bm_cat='
 . $cat_id) .
+                                       $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'bookmarks.ui._list', 'start' => 0, 'bm_cat' => 
(int)$cat_id) ) .
                                        '">' .
                                        
$GLOBALS['phpgw']->strip_html($cat['name']) . 
                                        '</a></td></tr>' . 
@@ -857,7 +870,7 @@
                                                $tree .= '<tr><td colspan="2">';
                                                if 
($this->bo->check_perms2($bookmark['owner'],$bookmark['access'],PHPGW_ACL_EDIT))
                                                {
-                                                       $maintain_url  = 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.edit&bm_id=' . 
$bm_id);
+                                                       $maintain_url  = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.edit', 'bm_id' => (int)$bm_id) );
                                                        $maintain_link = 
sprintf(
                                                                '<a 
href="%s"><img src="%s" align="top" border="0" alt="%s"></a>', 
                                                                $maintain_url,
@@ -870,7 +883,7 @@
                                                        $maintain_link = '';
                                                }
 
-                                               $view_url      = 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.view&bm_id=' . 
$bm_id);
+                                               $view_url      = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.view', 'bm_id' => (int)$bm_id) );
                                                $view_link     = sprintf(
                                                        '<a href="%s"><img 
src="%s" align="top" border="0" alt="%s"></a>', 
                                                        $view_url,
@@ -879,7 +892,7 @@
                                                );
 
                                                $redirect_link = '<a href="' . 
-                                                       
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.redirect&bm_id='.$bm_id)
 .
+                                                       
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.redirect', 'bm_id' => (int)$bm_id) ) .
                                                        '" target="_new">' . 
$bookmark['name'] . '</a>';
 
                                                $tree .= $maintain_link . 
$view_link . $redirect_link . 
@@ -899,30 +912,33 @@
 
                function view()
                {
-                       if (isset($GLOBALS['HTTP_GET_VARS']['bm_id']))
+                       if (isset($_GET['bm_id']))
                        {
-                               $bm_id = $GLOBALS['HTTP_GET_VARS']['bm_id'];
+                               $bm_id = $_GET['bm_id'];
                        }
                        elseif (is_array($this->location_info))
                        {
                                $bm_id = $this->location_info['bm_id'];
                        }
                        //if the user cancelled we go back to the view we came 
from
-                       if ($GLOBALS['HTTP_POST_VARS']['cancel_x'] || 
$GLOBALS['HTTP_POST_VARS']['cancel_y'])
+                       if ( (isset($_POST['cancel_x']) && $_POST['cancel_x'])
+                               || ( isset($_POST['cancel_y']) && 
$_POST['cancel_y']) )
                        {
                                unset($this->location_info['returnto2']);
                                $this->init();
                                return;
                        }
                        //delete bookmark and go back to view we came from
-                       if ($GLOBALS['HTTP_POST_VARS']['delete_x'] || 
$GLOBALS['HTTP_POST_VARS']['delete_y'])
+                       if ( (isset($_POST['delete_x']) && $_POST['delete_x'])
+                               || (isset($_POST['delete_y']) && 
$_POST['delete_y']) )
                        {
                                $this->bo->delete($bm_id);
                                unset($this->location_info['returnto2']);
                                $this->init();
                                return;
                        }
-                       if ($GLOBALS['HTTP_POST_VARS']['edit_x'] || 
$GLOBALS['HTTP_POST_VARS']['edit_y'])
+                       if ( (isset($_POST['edit_x']) && $_POST['edit_x'])
+                               || ( isset($_POST['edit_y']) && 
$_POST['edit_y']) )
                        {
                                $this->edit();
                                return;
@@ -969,11 +985,11 @@
                        $this->t->parse('info','form_info');
                        $this->t->set_var(array(
                                'form_info' => '',
-                               'form_action' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.view&bm_id=' . 
$bm_id),
+                               'form_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.view', 'bm_id' => $bm_id) ),
                                'lang_access' => lang('Access'),
                                'input_access' => lang($bookmark['access']),
                                'lang_header' => lang('View bookmark'),
-                               'input_url' => ('<a href="' . 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.redirect&bm_id='.$bm_id)
 .
+                               'input_url' => ('<a href="' . 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.redirect', 'bm_id' => $bm_id) ) .
                                        '" target="_new">' . $bookmark['url'] . 
'</a>'
                                ),
                                'input_name' => $bookmark['name'],
@@ -1012,16 +1028,16 @@
                                'mail'    => 'maillink.body.tpl'
                        ));
 
-                       if ($GLOBALS['HTTP_POST_VARS']['send']) // Send button 
clicked
+                       if ($_POST['send'])     // Send button clicked
                        {
                                $validate = createobject('phpgwapi.validator');
                                // Strip space and tab from anywhere in the To 
field
-                               $to = 
$validate->strip_space($GLOBALS['HTTP_POST_VARS']['to']);
+                               $to = $validate->strip_space($_POST['to']);
 
                                // Trim the subject
-                               $subject = 
$GLOBALS['phpgw']->strip_html(trim($GLOBALS['HTTP_POST_VARS']['subject']));
+                               $subject = 
$GLOBALS['phpgw']->strip_html(trim($_POST['subject']));
 
-                               $message = 
$GLOBALS['phpgw']->strip_html($GLOBALS['HTTP_POST_VARS']['message']);
+                               $message = 
$GLOBALS['phpgw']->strip_html($_POST['message']);
 
                                // Do we have all necessary data?
                                if (empty($to) || empty($subject) || 
empty($message))
@@ -1073,9 +1089,9 @@
 
                        if (empty($message))
                        {
-                               if 
(is_array($GLOBALS['HTTP_POST_VARS']['item_cb']))
+                               if (is_array($_POST['item_cb']))
                                {
-                                       while (list(,$id) = 
each($GLOBALS['HTTP_POST_VARS']['item_cb']))
+                                       while (list(,$id) = 
each($_POST['item_cb']))
                                        {
                                                $bookmark = 
$this->bo->read($id);
                                                $links[] = array(
@@ -1086,7 +1102,7 @@
                                }
                                else
                                {
-                                       $bookmark = 
$this->bo->read($GLOBALS['HTTP_GET_VARS']['bm_id']);
+                                       $bookmark = 
$this->bo->read($_GET['bm_id']);
                                        $links[] = array(
                                                'name' => $bookmark['name'],
                                                'url'  => $bookmark['url']
@@ -1121,8 +1137,8 @@
 
                function mass()
                {
-                       $item_cb = $GLOBALS['HTTP_POST_VARS']['item_cb'];
-                       if ($GLOBALS['HTTP_POST_VARS']['delete_x'] || 
$GLOBALS['HTTP_POST_VARS']['delete_y'])
+                       $item_cb = $_POST['item_cb'];
+                       if ($_POST['delete_x'] || $_POST['delete_y'])
                        {
                                if (is_array($item_cb))
                                {
@@ -1139,7 +1155,7 @@
 
                                $this->_list();
                        }
-                       elseif ($GLOBALS['HTTP_POST_VARS']['mail_x'] || 
$GLOBALS['HTTP_POST_VARS']['mail_y'])
+                       elseif ($_POST['mail_x'] || $_POST['mail_y'])
                        {
                                $this->mail();
                        }
@@ -1147,7 +1163,7 @@
 
                function redirect()
                {
-                       $bm_id = $GLOBALS['HTTP_GET_VARS']['bm_id'];
+                       $bm_id = $_GET['bm_id'];
                        $bookmark = $this->bo->read($bm_id);
                        $ts = explode(",",$bookmark['info']);
                        $newtimestamp = 
sprintf("%s,%s,%s",$ts[0],time(),$ts[2]);
@@ -1179,7 +1195,7 @@
                                echo parse_navbar();
                                $this->t->set_file('body','export.body.tpl');
                                $this->t->set_var(Array(
-                                       'FORM_ACTION' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.export'),
+                                       'FORM_ACTION' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.export') ),
                                        'input_categories' => 
$this->bo->categories_list(0,True)
                                ));
                                $this->t->pfp('out','body');
@@ -1198,7 +1214,7 @@
                        echo parse_navbar();
                        $this->t->set_file('body','import.body.tpl');
                        $this->t->set_var(Array(
-                               'FORM_ACTION' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=bookmarks.ui.import'),
+                               'FORM_ACTION' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'bookmarks.ui.import') ),
                                'lang_name' => lang('Enter the name of the 
Netscape bookmark file<br>that you want imported into bookmarker below.'),
                                'lang_file' => lang('Netscape Bookmark File'),
                                'lang_import_button' => lang('Import 
Bookmarks'),

Index: templates/base/list.body.tpl
===================================================================
RCS file: /sources/phpgroupware/bookmarks/templates/base/list.body.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/list.body.tpl        23 Jul 2006 06:31:16 -0000      1.1
+++ templates/base/list.body.tpl        28 Dec 2006 13:35:12 -0000      1.2
@@ -1,15 +1,12 @@
-<!-- $Id: list.body.tpl,v 1.1 2006/07/23 06:31:16 skwashd Exp $ -->
+<!-- $Id: list.body.tpl,v 1.2 2006/12/28 13:35:12 skwashd Exp $ -->
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr bgcolor="{th_bg}">
-  <td align="left">&nbsp;{showing}</td>
-
-  <td align="right">
+       <tr>
+               <td align="center">
    {next_matchs_left}
-   &nbsp;&nbsp;
-   {next_matchs_right}&nbsp; &nbsp;
+                       {showing}
+                       {next_matchs_right}
   </td>
  </tr>
-
  <tr align="right">
   <td colspan="2">{mass_update}</td>
  </tr>

Index: templates/base/list.tpl
===================================================================
RCS file: /sources/phpgroupware/bookmarks/templates/base/list.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2




reply via email to

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