phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] sitemgr/inc class.ACL_BO.inc.php class.ACL_SO.i... [s


From: Dave Hall
Subject: [Phpgroupware-cvs] sitemgr/inc class.ACL_BO.inc.php class.ACL_SO.i... [skwashd-16-compat]
Date: Fri, 29 Sep 2006 10:00:53 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    sitemgr
Branch:         skwashd-16-compat
Changes by:     Dave Hall <skwashd>     06/09/29 10:00:53

Modified files:
        inc            : class.ACL_BO.inc.php class.ACL_SO.inc.php 
                         class.Common_BO.inc.php class.Common_UI.inc.php 
                         class.Content_BO.inc.php 
                         class.Content_UI.inc.php 
                         class.Modules_BO.inc.php 
                         class.Modules_UI.inc.php 
                         class.Outline_UI.inc.php class.Sites_BO.inc.php 
                         class.Sites_SO.inc.php class.Sites_UI.inc.php 
                         class.module.inc.php 

Log message:
        various fixes and cleanups

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.ACL_BO.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.2.2.2&r2=1.2.2.2.4.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.ACL_SO.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.3.2.1&r2=1.3.2.1.4.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.Common_BO.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.1.2.4.4.1&r2=1.1.2.4.4.2
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.Common_UI.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.8.2.5.4.2&r2=1.8.2.5.4.3
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.Content_BO.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.2.2.1.4.2&r2=1.2.2.1.4.3
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.Content_UI.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.3.2.4.2.4&r2=1.3.2.4.2.5
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.Modules_BO.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.2.2.1&r2=1.2.2.1.4.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.Modules_UI.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.2.2.2&r2=1.2.2.2.4.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.Outline_UI.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.3.2.1&r2=1.3.2.1.4.1
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.Sites_BO.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.7.2.1.4.2&r2=1.7.2.1.4.3
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.Sites_SO.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.2.2.3.4.2&r2=1.2.2.3.4.3
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.Sites_UI.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.6.2.1.4.2&r2=1.6.2.1.4.3
http://cvs.savannah.gnu.org/viewcvs/sitemgr/inc/class.module.inc.php?cvsroot=phpgroupware&only_with_tag=skwashd-16-compat&r1=1.8.2.2.4.3&r2=1.8.2.2.4.4

Patches:
Index: class.ACL_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.ACL_BO.inc.php,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.2.4.1
diff -u -b -r1.2.2.2 -r1.2.2.2.4.1
--- class.ACL_BO.inc.php        23 Jun 2003 22:58:39 -0000      1.2.2.2
+++ class.ACL_BO.inc.php        29 Sep 2006 10:00:52 -0000      1.2.2.2.4.1
@@ -13,9 +13,25 @@
 
        class ACL_BO
        {
+               /**
+               * @var object $acl reference to the API ACL class
+               */
                var $acl;
+
+               /**
+               * @var object $acl_so the sitemgr ACL storage class
+               */
                var $acl_so;
-               var $logged_in_user;
+
+               /**
+               * @var bool $logged_in_user is the current user a logged in 
user, rather than anonymous
+               */
+               var $logged_in_user = false;
+
+               /**
+               * @var bool $is_admin does the current user have admin rights 
to the current site
+               */
+               var $is_admin = false;
 
                function ACL_BO()
                {

Index: class.ACL_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.ACL_SO.inc.php,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.1.4.1
diff -u -b -r1.3.2.1 -r1.3.2.1.4.1
--- class.ACL_SO.inc.php        30 Mar 2004 09:11:01 -0000      1.3.2.1
+++ class.ACL_SO.inc.php        29 Sep 2006 10:00:52 -0000      1.3.2.1.4.1
@@ -14,7 +14,7 @@
 
        function get_permission($location)
        {
-               $memberships = 
$this->acct->membership($this->acl->logged_in_user);
+               $memberships = 
$this->acct->membership($GLOBALS['phpgw_info']['user']['account_id']);
                $sql = 'SELECT acl_rights FROM phpgw_acl'
                        . " WHERE acl_location='" . 
$GLOBALS['phpgw']->db->db_addslashes($location) . "'"
                        . ' AND acl_account IN (' . 
intval($GLOBALS['phpgw_info']['user']['account_id']);

Index: class.Common_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Common_BO.inc.php,v
retrieving revision 1.1.2.4.4.1
retrieving revision 1.1.2.4.4.2
diff -u -b -r1.1.2.4.4.1 -r1.1.2.4.4.2
--- class.Common_BO.inc.php     24 Jul 2006 03:31:54 -0000      1.1.2.4.4.1
+++ class.Common_BO.inc.php     29 Sep 2006 10:00:52 -0000      1.1.2.4.4.2
@@ -52,9 +52,12 @@
                        {
                                foreach($varname as $var)
                                {
+                                       if ( isset($_POST[$var]) )
+                                       {
                                        $GLOBALS[$var] = $_POST[$var];
                                }
                        }
+                       }
                        else
                        {
                                $GLOBALS[$varname] = $_POST[$varname];

Index: class.Common_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Common_UI.inc.php,v
retrieving revision 1.8.2.5.4.2
retrieving revision 1.8.2.5.4.3
diff -u -b -r1.8.2.5.4.2 -r1.8.2.5.4.3
--- class.Common_UI.inc.php     24 Jul 2006 03:31:54 -0000      1.8.2.5.4.2
+++ class.Common_UI.inc.php     29 Sep 2006 10:00:52 -0000      1.8.2.5.4.3
@@ -7,7 +7,7 @@
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/
-       /* $Id: class.Common_UI.inc.php,v 1.8.2.5.4.2 2006/07/24 03:31:54 
skwashd Exp $ */
+       /* $Id: class.Common_UI.inc.php,v 1.8.2.5.4.3 2006/09/29 10:00:52 
skwashd Exp $ */
        
        class Common_UI
        {
@@ -36,7 +36,7 @@
                        global $Common_BO;
                        $Common_BO = CreateObject('sitemgr.Common_BO');
                        $this->do_sites_exist = 
$Common_BO->sites->set_currentsite(False,'Administration');
-                       $this->t = $GLOBALS['phpgw']->template;
+                       $this->t =& $GLOBALS['phpgw']->template;
                        $this->acl = &$Common_BO->acl;
                        $this->theme = &$Common_BO->theme;
                        $this->pages_bo = &$Common_BO->pages;
@@ -90,7 +90,8 @@
                        $this->DisplayHeader();
                        if ($this->acl->is_admin())
                        {
-                               if ($_POST['btnlangchange'])
+                               if ( isset($_POST['btnlangchange'])
+                                       && $_POST['btnlangchange'] )
                                {
                                        echo '<p>';
                                        while (list($oldlang,$newlang) = 
each($_POST['change']))
@@ -114,7 +115,8 @@
                                        echo '</p>';
                                }
 
-                               if ($_POST['btnSave'])
+                               if ( isset($_POST['btnSave']) 
+                                       && $_POST['btnSave'] )
                                {
                                        $oldsitelanguages = 
$GLOBALS['Common_BO']->sites->current_site['site_languages'];
 
@@ -229,9 +231,20 @@
                                ));
 
                                
$this->t->set_block('sitemgr_prefs','PrefBlock','PBlock');
-                               reset($preferences);
-                               while (list($name,$details) = 
each($preferences))
+                               if ( is_array($preferences) && 
count($preferences) )
                                {
+                                       foreach ( $preferences as $name => 
$details )
+                                       {
+                                               if ( !isset($details['input']) )
+                                               {
+                                                       $details['input'] = 
'inputbox';
+                                               }
+
+                                               if ( 
!isset($details['default']) )
+                                               {
+                                                       $details['default'] = 
'';
+                                               }
+
                                        $inputbox = '';
                                        switch($details['input'])
                                        {
@@ -242,19 +255,18 @@
                                                        $inputbox = 
$this->inputCheck($name);
                                                        break;
                                                case 'option':
-                                                       $inputbox = 
$this->inputOption($name,
-                                                               
$details['options'],$details['default']);
+                                                               $inputbox = 
$this->inputOption($name, $details['options'], $details['default']);
                                                        break;
                                                case 'inputbox':
                                                default:
-                                                       $inputbox = 
$this->inputText($name,
-                                                               
$details['input_size'],$details['default']);
+                                                               $inputbox = 
$this->inputText($name, $details['default']);
                                        }
                                        if ($inputbox)
                                        {
                                                
$this->PrefBlock($details['title'],$inputbox,$details['note']);
                                        }
                                }
+                               }
                                $this->t->pfp('out','sitemgr_prefs');
                        }
                        else
@@ -264,20 +276,15 @@
                        $this->DisplayFooter();
                }
 
-               function inputText($name='',$size=40,$default='')
+               function inputText($name='', $default='')
                {
-                       if (!is_int($size))
-                       {
-                               $size=40;
-                       }
                        $val = 
$GLOBALS['Common_BO']->sites->current_site[$name];
                        if (!$val)
                        {
                                $val = $default;
                        }
 
-                       return '<input type="text" size="'.$size.
-                               '" name="pref['.$name.']" value="'.$val.'">';
+                       return '<input type="text" name="pref['.$name.']" 
value="'.$val.'">';
                }
 
                function inputtextarea($name='',$cols=40,$rows=5,$default='')
@@ -295,20 +302,17 @@
                function inputCheck($name = '')
                {
                        $val = 
$GLOBALS['Common_BO']->sites->current_site[$name];
+                       $checked_yes = $checked_no = '';
                        if ($val)
                        {
-                               $checked_yes = ' CHECKED';
-                               $checked_no = '';
+                               $checked_yes = ' checked';
                        }
                        else
                        {
-                               $checked_yes = '';
-                               $checked_no = ' CHECKED';
+                               $checked_no = ' checked';
                        }
-                       return '<INPUT TYPE="radio" NAME="pref['.$name.']" 
VALUE="1"'.
-                               $checked_yes.'>Yes</INPUT>'."\n".
-                               '<INPUT TYPE="radio" NAME="'.$name.'" 
VALUE="0"'.
-                               $checked_no.'>No</INPUT>'."\n";
+                       return '<input type="radio" id="pref" ' . $name . '_y" 
name="pref['.$name.']" value="1"' . $checked_yes . '><label for="pref" ' . 
$name . '_y"> ' . lang('Yes')."<label>\n"
+                               . '<input type="radio" id="pref" ' . $name . 
'_n" name="pref['.$name.']" value="0"' . $checked_no . '><label for=pref" ' . 
$name . '_n"> ' . lang('No')."<label>\n";
                                
                }
 
@@ -323,19 +327,19 @@
                        {
                                $val = $default;
                        }
-                       $returnValue = '<SELECT NAME="pref['.$name.']">'."\n";
+                       $returnValue = '<select name="pref['.$name.']">'."\n";
                        
                        foreach($options as $option)
                        {
                                $selected='';
                                if ($val == $option['value'])
                                {
-                                       $selected = 'SELECTED ';
+                                       $selected = 'selected ';
                                }
-                               $returnValue.='<OPTION 
'.$selected.'VALUE="'.$option['value'].'">'.
-                                       $option['display'].'</OPTION>'."\n";
+                               $returnValue.='<option 
'.$selected.'value="'.$option['value'].'">'.
+                                       $option['display'].'</option>'."\n";
                        }
-                       $returnValue .= '</SELECT>';
+                       $returnValue .= '</select>';
                        return $returnValue;
                }
 
@@ -363,8 +367,7 @@
                                if ( 
$GLOBALS['phpgw_info']['server']['template_set'] == 'idots' 
                                        || 
$GLOBALS['phpgw_info']['server']['template_set'] == 'desktop' )
                                {
-                                       
$GLOBALS['phpgw']->common->phpgw_header();
-                                       echo parse_navbar();
+                                       
$GLOBALS['phpgw']->common->phpgw_header(true);
                                        return true;
                                }
                                
$this->t->set_file('sitemgr_header','sitemgr_header.tpl');
@@ -380,13 +383,11 @@
                                        $this->t->set_var('switchhandle','');
                                }
                                $GLOBALS['phpgw_info']['flags']['app_header'] 
.= $this->t->parse('out','sitemgr_header');
-                               $GLOBALS['phpgw']->common->phpgw_header();
-                               echo parse_navbar();
+                               $GLOBALS['phpgw']->common->phpgw_header(true);
                        }
                        else
                        {
-                               $GLOBALS['phpgw']->common->phpgw_header();
-                               echo parse_navbar();
+                               $GLOBALS['phpgw']->common->phpgw_header(true);
                                echo lang('No websites defined');
                                $GLOBALS['phpgw']->common->phpgw_exit(True);
                        }

Index: class.Content_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Content_BO.inc.php,v
retrieving revision 1.2.2.1.4.2
retrieving revision 1.2.2.1.4.3
diff -u -b -r1.2.2.1.4.2 -r1.2.2.1.4.3
--- class.Content_BO.inc.php    14 Aug 2006 01:51:13 -0000      1.2.2.1.4.2
+++ class.Content_BO.inc.php    29 Sep 2006 10:00:52 -0000      1.2.2.1.4.3
@@ -280,6 +280,7 @@
                function saveversionstate($block_id,$state)
                {
                        $count_array = array_count_values($state);
+                       //TODO deal with E_NOTICES about undefined offsets here 
:(
                        $active_versions = 
$count_array[SITEMGR_STATE_PREPUBLISH] + 
                                $count_array[SITEMGR_STATE_PUBLISH] + 
                                $count_array[SITEMGR_STATE_PREUNPUBLISH];

Index: class.Content_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Content_UI.inc.php,v
retrieving revision 1.3.2.4.2.4
retrieving revision 1.3.2.4.2.5
diff -u -b -r1.3.2.4.2.4 -r1.3.2.4.2.5
--- class.Content_UI.inc.php    14 Aug 2006 01:51:13 -0000      1.3.2.4.2.4
+++ class.Content_UI.inc.php    29 Sep 2006 10:00:52 -0000      1.3.2.4.2.5
@@ -35,12 +35,12 @@
                        );
 
                        $this->sitelanguages = 
$GLOBALS['Common_BO']->sites->current_site['sitelanguages'];
-                       $savelanguage = $_POST['savelanguage'];
-                       if ($savelanguage)
+
+                       if ( isset($_POST['savelanguage']) && 
$_POST['savelanguage'] )
                        {
                                //we save the language the user chooses as 
session variable
-                               $this->worklanguage = $savelanguage;
-                               
$GLOBALS['phpgw']->session->appsession('worklanguage','sitemgr',$savelanguage);
+                               $this->worklanguage = $_POST['savelanguage'];
+                               
$GLOBALS['phpgw']->session->appsession('worklanguage', 'sitemgr', 
$_POST['savelanguage']);
                        }
                        else
                        {
@@ -75,7 +75,7 @@
 
                        if ( !isset($GLOBALS['phpgw']->richtext) || 
!is_object($GLOBALS['phpgw']->richtext) )
                        {
-                               $GLOBALS['phpgw']->richtext =& 
createObject('phpgwapi.richtext');
+                               $GLOBALS['phpgw']->richtext = 
createObject('phpgwapi.richtext');
                        }
                        
$GLOBALS['phpgw']->richtext->set_base_url($GLOBALS['Common_BO']->sites->current_site['site_url']);
                        
@@ -89,9 +89,9 @@
                        global $inputmoduleid, $inputarea, $btnAddBlock, 
$btnDeleteVersion, $element;
 
                        global $page_id, $cat_id;
-                       $page_id = $_GET['page_id'];
-                       $cat_id = $_GET['cat_id'];
-                       $block_id = $_GET['block_id'];
+                       $page_id = isset($_GET['page_id']) ? $_GET['page_id'] : 
0;
+                       $cat_id = isset($_GET['cat_id']) ? $_GET['cat_id'] : 0;
+                       $block_id = isset($_GET['block_id']) ? 
$_GET['block_id'] : 0;
 
                        if ($block_id)
                        {}
@@ -154,7 +154,7 @@
                        }
                        elseif ($btnSaveBlock)
                        {
-                               if ( !isset($GLOBALS['data_cleaner']) || 
!is_object($GLOVALS['data_cleaner']) )
+                               if ( !isset($GLOBALS['data_cleaner']) || 
!is_object($GLOBALS['data_cleaner']) )
                                {
                                        $GLOBALS['data_cleaner'] = 
createObject('phpgwapi.data_cleaner', '');
                                }

Index: class.Modules_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Modules_BO.inc.php,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.1.4.1
diff -u -b -r1.2.2.1 -r1.2.2.1.4.1
--- class.Modules_BO.inc.php    23 Jun 2003 20:31:21 -0000      1.2.2.1
+++ class.Modules_BO.inc.php    29 Sep 2006 10:00:52 -0000      1.2.2.1.4.1
@@ -41,61 +41,17 @@
                //this is identical to CreateObect in 
phpgwapi/functions.inc.php, but looks into sitemgr/modules instead of 
appname/inc
                function createmodule($modulename)
                {
-
-               global $phpgw_info, $phpgw;
-
-               //if (is_object(@$GLOBALS['phpgw']->log) && $class != 
'phpgwapi.error' && $class != 'phpgwapi.errorlog')
-               //{
-                       //$GLOBALS['phpgw']->log->write(array('text'=>'D-Debug, 
dbg: %1','p1'=>'This class was run: 
'.$class,'file'=>__FILE__,'line'=>__LINE__));
-               //}
-
-               /* error_reporting(0); */
-               //list($appname,$classname) = explode(".", $class);
-               
                $classname = 'module_' . $modulename;
 
-               if 
(!isset($GLOBALS['phpgw_info']['flags']['included_classes'][$classname]) ||
-                       
!$GLOBALS['phpgw_info']['flags']['included_classes'][$classname])
-               {
-                       
if(@file_exists(PHPGW_INCLUDE_ROOT.'/sitemgr/modules/class.'.$classname.'.inc.php'))
-                       {
-                               
include(PHPGW_INCLUDE_ROOT.'/sitemgr/modules/class.'.$classname.'.inc.php');
-                               
$GLOBALS['phpgw_info']['flags']['included_classes'][$classname] = True;
-                       }
-                       else
-                       {
-                               
$GLOBALS['phpgw_info']['flags']['included_classes'][$classname] = False;
-                       }
-               }
-               
if($GLOBALS['phpgw_info']['flags']['included_classes'][$classname])
-               {
-                       if ($p1 == '_UNDEF_' && $p1 != 1)
-                       {
-                               eval('$obj = new ' . $classname . ';');
-                       }
-                       else
+                       if ( file_exists(PHPGW_INCLUDE_ROOT . 
"/sitemgr/modules/class.{$classname}.inc.php") )
                        {
-                               $input = 
array($p1,$p2,$p3,$p4,$p5,$p6,$p7,$p8,$p9,$p10,$p11,$p12,$p13,$p14,$p15,$p16);
-                               $i = 1;
-                               $code = '$obj = new ' . $classname . '(';
-                               while (list($x,$test) = each($input))
-                               {
-                                       if (($test == '_UNDEF_' && $test != 1 ) 
|| $i == 17)
-                                       {
-                                               break;
+                               include_once(PHPGW_INCLUDE_ROOT . 
"/sitemgr/modules/class.{$classname}.inc.php");
                                        }
                                        else
                                        {
-                                               $code .= '$p' . $i . ',';
-                                       }
-                                       $i++;
-                               }
-                               $code = substr($code,0,-1) . ');';
-                               eval($code);
-                       }
-                       /* error_reporting(E_ERROR | E_WARNING | E_PARSE); */
-                       return $obj;
+                               return null;
                }
+                               return new $classname();
        }
 
 

Index: class.Modules_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Modules_UI.inc.php,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.2.4.1
diff -u -b -r1.2.2.2 -r1.2.2.2.4.1
--- class.Modules_UI.inc.php    23 Jun 2003 20:31:21 -0000      1.2.2.2
+++ class.Modules_UI.inc.php    29 Sep 2006 10:00:52 -0000      1.2.2.2.4.1
@@ -58,8 +58,8 @@
                                        'lang_findmodules' => lang('Register 
new modules'),
                                        'lang_select_allowed_modules' => 
lang('Select allowed modules'),
                                        'lang_configure_module_properties' => 
lang('Configure module properties'),
-                                       'cat_name' => ($cat_name ? (' - ' . 
$cat_name) : ''),
-                                       'managelink' => ($managelink ? ('<a 
href="' . $managelink . '">&lt; ' . lang('Go to') . ' ' . $goto . ' &gt;</a>') 
: '')
+                                       'cat_name' => isset($cat_name) ? " - 
$cat_name" : '',
+                                       'managelink' => isset($managelink) ? 
"<a href=\"$managelink\">&lt; " . lang('Go to') . " $goto &gt;</a>" : ''
                                ));
                                $link_data['cat_id'] = $cat_id;
                                $link_data['menuaction'] = 
"sitemgr.Modules_UI.findmodules";

Index: class.Outline_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Outline_UI.inc.php,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.1.4.1
diff -u -b -r1.3.2.1 -r1.3.2.1.4.1
--- class.Outline_UI.inc.php    23 Jun 2003 20:31:21 -0000      1.3.2.1
+++ class.Outline_UI.inc.php    29 Sep 2006 10:00:52 -0000      1.3.2.1.4.1
@@ -7,7 +7,7 @@
        * Free Software Foundation; either version 2 of the License, or (at 
your  *
        * option) any later version.                                            
  *
        
\*************************************************************************/
-       /* $Id: class.Outline_UI.inc.php,v 1.3.2.1 2003/06/23 20:31:21 
totschnig Exp $ */
+       /* $Id: class.Outline_UI.inc.php,v 1.3.2.1.4.1 2006/09/29 10:00:52 
skwashd Exp $ */
        
        class Outline_UI
        {
@@ -17,11 +17,11 @@
                var $pagebo;
                var $cat_bo;
                var $isadmin;
-               
+               var     $sitelanguages;
                
                var $public_functions=array
                (
-                       'manage' => True,
+                       'manage' => true,
                );
                
                function Outline_UI()                   
@@ -53,20 +53,21 @@
 
                        $cat_list = $this->cat_bo->getpermittedcatsWrite();
 
-                       if (!$cat_list)
+                       if ( ! is_array($cat_list) )
                        {
                                 echo lang("You do not have write permissions 
for any site categories.") . '<br><br>';
+                                $cat_list = array();
                        }
 
-                       while (list(,$cat_id) = @each($cat_list))
+                       foreach ( $cat_list as $cat_id )
                        {
                                $category = $this->cat_bo->getCategory($cat_id);
                                $this->t->set_var('PBlock', '');
                                $page_list = 
$this->pagebo->getPageIDList($cat_id);
 
-                               while (list(,$page_id) = @each($page_list))
+                               foreach ( $page_list as $page_id )
                                {
-                                       $page = 
$this->pagebo->getPage($page_id,$this->sitelanguages[0]);
+                                       $page = 
$this->pagebo->getPage($page_id, $this->sitelanguages[0]);
                                        $page_description = sprintf(
                                                '<b>%s</b>: %s 
&nbsp;&nbsp;<b>ID</b>: %s<br><b>%s</b>: %s',
                                                lang('Name'),
@@ -97,6 +98,7 @@
                                ));
                                $link_data['page_id'] = 0;
                                $link_data['cat_id'] = $cat_id;
+
                                if ($this->isadmin)
                                {
                                        $link_data['menuaction'] = 
"sitemgr.Categories_UI.edit";

Index: class.Sites_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Sites_BO.inc.php,v
retrieving revision 1.7.2.1.4.2
retrieving revision 1.7.2.1.4.3
diff -u -b -r1.7.2.1.4.2 -r1.7.2.1.4.3
--- class.Sites_BO.inc.php      24 Jul 2006 03:31:54 -0000      1.7.2.1.4.2
+++ class.Sites_BO.inc.php      29 Sep 2006 10:00:52 -0000      1.7.2.1.4.3
@@ -9,7 +9,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-  /* $Id: class.Sites_BO.inc.php,v 1.7.2.1.4.2 2006/07/24 03:31:54 skwashd Exp 
$ */
+  /* $Id: class.Sites_BO.inc.php,v 1.7.2.1.4.3 2006/09/29 10:00:52 skwashd Exp 
$ */
 
        class Sites_BO
        {
@@ -65,11 +65,14 @@
                        $data = 
$GLOBALS['phpgw']->session->appsession('session_data','sitemgr_sites');
                        if($this->debug) { echo '<br>Read:'; 
_debug_array($data); }
 
+                       if ( is_array($data) && count($data) )
+                       {
                        $this->start  = $data['start'];
                        $this->query  = $data['query'];
                        $this->sort   = $data['sort'];
                        $this->order  = $data['order'];
                }
+               }
 
                function list_sites($limit=True)
                {

Index: class.Sites_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Sites_SO.inc.php,v
retrieving revision 1.2.2.3.4.2
retrieving revision 1.2.2.3.4.3
diff -u -b -r1.2.2.3.4.2 -r1.2.2.3.4.3
--- class.Sites_SO.inc.php      24 Jul 2006 03:31:54 -0000      1.2.2.3.4.2
+++ class.Sites_SO.inc.php      29 Sep 2006 10:00:52 -0000      1.2.2.3.4.3
@@ -29,6 +29,8 @@
                                {
                                        $sort = 'DESC';
                                }
+
+                               $whereclause = '';
                                if ($query)
                                {
                                        $query = 
$this->db->db_addslashes($query);
@@ -36,15 +38,14 @@
                                                . "OR site_url LIKE '%$query%'"
                                                . "OR site_dir LIKE '%$query%'";
                                }
+
+                               $orderclause = 'ORDER BY site_name ASC';
                                if ($order)
                                {
                                        $orderclause = 'ORDER BY ' . 
$this->db->db_addslashes($order) 
                                                        . ' ' . 
$this->db->db_addslashes($sort);
                                }
-                               else
-                               {
-                                       $orderclause = 'ORDER BY site_name ASC';
-                               }
+
                                $sql = "SELECT site_id,site_name,site_url from 
phpgw_sitemgr_sites $whereclause $orderclause";  
                                $this->db->query($sql,__LINE__,__FILE__);
                                $total = $this->db->num_rows();

Index: class.Sites_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Sites_UI.inc.php,v
retrieving revision 1.6.2.1.4.2
retrieving revision 1.6.2.1.4.3
diff -u -b -r1.6.2.1.4.2 -r1.6.2.1.4.3
--- class.Sites_UI.inc.php      24 Jul 2006 03:31:54 -0000      1.6.2.1.4.2
+++ class.Sites_UI.inc.php      29 Sep 2006 10:00:52 -0000      1.6.2.1.4.3
@@ -9,7 +9,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-  /* $Id: class.Sites_UI.inc.php,v 1.6.2.1.4.2 2006/07/24 03:31:54 skwashd Exp 
$ */
+  /* $Id: class.Sites_UI.inc.php,v 1.6.2.1.4.3 2006/09/29 10:00:52 skwashd Exp 
$ */
 
        //copied from class admin.uiservers
        class Sites_UI
@@ -77,7 +77,7 @@
                                $this->deny();
                        }
 
-                       
$GLOBALS['phpgw']->template->set_file(array('site_list_t' => 'listsites.tpl'));
+                       $GLOBALS['phpgw']->template->set_file('site_list_t', 
'listsites.tpl');
                        
$GLOBALS['phpgw']->template->set_block('site_list_t','site_list','list');
 
                        
$GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Sites_UI.edit'));
@@ -113,13 +113,15 @@
                                )
                        ));
 
+                       $row_class = '';
                        $sites = $this->bo->list_sites();
                        foreach ( $sites as $site_id => $site )
                        {
-                               $tr_color = 
$this->nextmatchs->alternate_row_color($tr_color);
+                               $row_class = 
$this->nextmatchs->alternate_row_class($row_class);
 
-                               $GLOBALS['phpgw']->template->set_var(array(
-                                       'tr_color' => $tr_color,
+                               $GLOBALS['phpgw']->template->set_var(array
+                               (
+                                       'row_class'                     => 
$row_class,
                                        'site_name' => 
$GLOBALS['phpgw']->strip_html($site['site_name']),
                                        'site_url' => $site['site_url'],
                                        'edit' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Sites_UI.edit&site_id='
 . $site_id),

Index: class.module.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.module.inc.php,v
retrieving revision 1.8.2.2.4.3
retrieving revision 1.8.2.2.4.4
diff -u -b -r1.8.2.2.4.3 -r1.8.2.2.4.4
--- class.module.inc.php        25 Aug 2006 10:04:34 -0000      1.8.2.2.4.3
+++ class.module.inc.php        29 Sep 2006 10:00:52 -0000      1.8.2.2.4.4
@@ -50,7 +50,7 @@
        {
                if ($produce)
                {
-                       if ($this->session)
+                       if ( isset($this->session) && $this->session )
                        {
                                $sessionarguments = 
$GLOBALS['phpgw']->session->appsession('block[' . $block->id . ']', 
'sitemgr-site');
                                while (list(,$argument) = @each($this->session))
@@ -166,7 +166,7 @@
                while (list($key,$input) = @each($this->arguments))
                {
                        $elementname = 'element[' . $this->block->version . ']';
-                       $elementname .= ($input['i18n'] ? ('[i18n][' .$key . 
']') : ('[' .$key . ']'));
+                       $elementname .= isset($input['i18n']) ? 
"[i18n][{$key}]" : "[{$key}]";
                        //arrays of input elements are only implemented for the 
user interface
                        if ($input['type'] == 'array')
                        {
@@ -197,10 +197,14 @@
                //if you override this function you can fetch properties and 
adapt the interface accordingly
                //$properties = $this->get_properties();
                $interface = array();
-               reset($this->arguments);
-               while (list($key,$input) = @each($this->arguments))
+               if ( !is_array($this->arguments) )
+               {
+                       $this->arguments = array();
+               }
+
+               foreach ( $this->arguments as $key => $input )
                {
-                       if ($input['i18n'])
+                       if ( isset($input['i18n']) && $input['i18n'] )
                        {
                                $elementname = 'element[' . 
$this->block->version . '][i18n][' .$key . ']';
                                //arrays of input elements are only implemented 
for the user interface
@@ -283,7 +287,7 @@
                {
                        $paramstring .= $param . '="' . $value . '" ';
                }
-               $inputdef = $paramstring . ' name="' . $elementname . 
($input['multiple'] ? '[]' : '') . '"';
+               $inputdef = $paramstring . ' name="' . $elementname . 
(isset($input['multiple']) ? '[]' : '') . '"';
                switch($input['type'])
                {
                        case 'textarea':
@@ -293,15 +297,12 @@
                        case 'checkbox':
                                return '<input id="'.$element_id.'" 
type="checkbox" ' . $inputdef . ($default ? 'checked="checked"' :'') . '" />';
                        case 'select':
-                               $select = '<select id="'.$element_id.'" ' 
.($input['multiple'] ? 'multiple="multiple"' : '') . $inputdef . '>';
+                               $select = '<select id="'.$element_id.'" ' . 
(isset($input['multiple']) ? 'multiple="multiple"' : '') . $inputdef . '>';
                                foreach ($input['options'] as $value => 
$display)
                                {
                                        $selected='';
-                                       if 
-                                       (
-                                               ($input['multiple'] && 
is_array($default) && in_array($value,$default)) || 
-                                               (!$input['multiple'] && 
($default == $value))
-                                       )
+                                       if ( ( isset($input['multiple']) && 
is_array($default) && in_array($value,$default)) 
+                                               || (!isset($input['multiple']) 
&& ($default == $value)) )
                                        {
                                                $selected = 
'selected="selected"';
                                        }
@@ -356,11 +357,11 @@
                        {
                                $content = 
$this->transformer_chain[$i]->apply_transform($this->block->title,$content);
                        }
+                       $sessionarguments = array();
                        //store session variables
-                       if ($this->session)
+                       if ( isset($this->session) && is_array($this->session) )
                        {
-                               reset($this->session);
-                               while (list(,$argument) = each($this->session))
+                               foreach ( $this->session as $argument )
                                {
                                        if 
(isset($this->block->arguments[$argument]))
                                        {




reply via email to

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