phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/inc class.blocks_bo.inc.php


From: Michael Totschnig <address@hidden>
Subject: [Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/inc class.blocks_bo.inc.php,1.1,1.2 class.Template2.inc.php,1.1,1.2 class.bo.inc.php,1.7,1.8 class.so.inc.php,1.1.1.1,1.2 class.ui.inc.php,1.8,1.9 phpnuke.compat.inc.php,1.5,1.6
Date: Thu, 05 Dec 2002 17:15:33 -0500

Update of /cvsroot/phpgroupware/sitemgr/sitemgr-site/inc
In directory subversions:/tmp/cvs-serv27375/sitemgr-site/inc

Modified Files:
        class.Template2.inc.php class.bo.inc.php class.so.inc.php 
        class.ui.inc.php phpnuke.compat.inc.php 
Added Files:
        class.blocks_bo.inc.php 
Log Message:
bringing head up to sync with 0.9.14 branch



Index: class.Template2.inc.php
===================================================================
RCS file: 
/cvsroot/phpgroupware/sitemgr/sitemgr-site/inc/class.Template2.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.Template2.inc.php     2 Sep 2002 23:08:13 -0000       1.1
--- class.Template2.inc.php     5 Dec 2002 22:15:00 -0000       1.2
***************
*** 459,468 ****
                }
  
!               function replace_var($vars)
                {
!                       $var = $vars[1];
!                       if (substr($var,0,9)=='?sitemgr:')
                        {
!                               $params=explode(',',substr($var,9));
                                switch(count($params))
                                {
--- 459,467 ----
                }
  
!               function make_link($linkcode)
                {
!                       if (substr($linkcode,0,9)=='?sitemgr:')
                        {
!                               $params=explode(',',substr($linkcode,9));
                                switch(count($params))
                                {
***************
*** 477,486 ****
                                                break;
                                        default:
!                                               $val = $var;
                                }
                        }
!                       elseif (substr($var,0,7)=='?phpgw:')
                        {
!                               $params=explode(',',substr($var,7));
                                switch(count($params))
                                {
--- 476,485 ----
                                                break;
                                        default:
!                                               $val = $linkcode;
                                }
                        }
!                       elseif (substr($linkcode,0,7)=='?phpgw:')
                        {
!                               $params=explode(',',substr($linkcode,7));
                                switch(count($params))
                                {
***************
*** 495,510 ****
                                                break;
                                        default:
!                                               $val = $var;
                                }
                        }
!                       elseif (substr($var,0,1)=='?')
                        {
!                               $val = 
sitemgr_link2('/index.php',substr($var,1));
                        }
                        else
                        {
!                               $val = '{'.$var.'}';
                        }
                        return $val;
                }
        }       
--- 494,568 ----
                                                break;
                                        default:
!                                               $val = $linkcode;
                                }
                        }
!                       elseif (substr($linkcode,0,1)=='?')
!                       {
!                               $val = 
sitemgr_link2('/index.php',substr($linkcode,1));
!                       }
!                       
!                       return $val;
!               }
! 
!               function replace_var($vars)
!               {
!                       $var = $vars[1];
!                       if (substr($var,0,1)=='?')
!                       {
!                               $val = $this->make_link($var);
!                       }
!                       elseif (substr($var,0,6)=='block:')
                        {
!                               $blockname = substr($var,6);
!                               $themesel = 
$GLOBALS['sitemgr_info']['themesel'];
!                               $sitemgr_path = 
$GLOBALS['sitemgr_info']['sitemgr-site_path'];
!                               if (file_exists($sitemgr_path . 
'/blocks/block-' . 
!                                       $blockname . '.php'))
!                               {
!                                       require_once($sitemgr_path . 
!                                               '/inc/class.blocks_bo.inc.php');
!                                       $blocks_bo = new blocks_bo;
!                                       
!                                       $block = 
$blocks_bo->find_block($blockname);
!                                       if ($block && ! 
$blocks_bo->block_allowed($block))
!                                       {
!                                               // If the block is specified 
and this user can't view it
!                                               $val = '';
!                                       }
!                                       else
!                                       {
!                                               // block not specified or block 
specified and viewable
!                                       
!                                               $t = new Template2;
!                                               $t->set_file('centerblocks', 
$sitemgr_path . 
!                                                       '/templates/' . 
$themesel . '/centerblock.tpl');
!                                               
$t->set_block('centerblocks','SideBlock','SBlock');
!                                               $t->set_var('block_title',
!                                                       
$blocks_bo->get_blocktitle($block));
!                                               $t->set_var('block_content',
!                                                       
$blocks_bo->get_blockcontent($block));
!                                               $val = 
$t->parse('SBlock','SideBlock',false);
!                                               unset($t);
!                                       }
!                               }
!                               else
!                               {
!                                       $val = '<h4>CONTRIBUTOR SPECIFIED 
BLOCK, '. $blockname .
!                                               ', NOT FOUND</h4>';
!                               }
                        }
                        else
                        {
!                               switch($var)
!                               {
!                                       case 'xyz':
!                                               $val = 'test';
!                                               break;
!                                       default:
!                                               $val = '{'.$var.'}';
!                               }
                        }
                        return $val;
                }
        }       
+ ?>
\ No newline at end of file

Index: class.bo.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/inc/class.bo.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.bo.inc.php    17 Sep 2002 23:51:58 -0000      1.7
--- class.bo.inc.php    5 Dec 2002 22:15:00 -0000       1.8
***************
*** 24,28 ****
                        $this->catbo = CreateObject('sitemgr.Categories_BO');
                        $this->pages_bo = CreateObject('sitemgr.Pages_BO');
!                       $this->pages_so = CreateObject('sitemgr.Pages_SO');
                        $this->headerfooter_bo = 
CreateObject('sitemgr.headerFooter_BO');
                        $this->page = CreateObject('sitemgr.Page_SO');
--- 24,28 ----
                        $this->catbo = CreateObject('sitemgr.Categories_BO');
                        $this->pages_bo = CreateObject('sitemgr.Pages_BO');
!                       //$this->pages_so = CreateObject('sitemgr.Pages_SO');
                        $this->headerfooter_bo = 
CreateObject('sitemgr.headerFooter_BO');
                        $this->page = CreateObject('sitemgr.Page_SO');
***************
*** 30,44 ****
                }
  
                function loadPage($page_id)
                {
!                       $this->page = $this->pages_bo->GetPage($page_id);
                }
  
                function loadIndex()
                {
!                       $this->page->title = 'Site Index';
                        $this->page->subtitle = '';
                        $indexarray = $this->getIndex();
!                       $content = "\n".'<table border="0" width="100%" 
align="left" cellspacing="1" cellpadding="0"><tr>';
                        $catname = '';
                        foreach($indexarray as $page)
--- 30,83 ----
                }
  
+               function getcatwrapper($cat_id)
+               {
+                       $availablelangsforcat = 
$this->catbo->getlangarrayforcategory($cat_id);
+                       if 
(in_array($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],$availablelangsforcat))
+                       {
+                               return 
$this->catbo->getCategory($cat_id,$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
+                       }
+                       else
+                       {
+                               foreach 
($GLOBALS['sitemgr_info']['sitelanguages'] as $lang)
+                               {
+                                       if 
(in_array($lang,$availablelangsforcat))
+                                       {
+                                               return 
$this->catbo->getCategory($cat_id,$lang);
+                                       }
+                               }
+                       }
+               }
+ 
+               function getpagewrapper($page_id)
+               {
+                       $availablelangsforpage = 
$this->pages_bo->getlangarrayforpage($page_id);
+                         if 
(in_array($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],$availablelangsforpage))
+                         {
+                                 return 
$this->pages_bo->GetPage($page_id,$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
+                         }
+                         else
+                         {
+                                 foreach 
($GLOBALS['sitemgr_info']['sitelanguages'] as $lang)
+                                 {
+                                         if 
(in_array($lang,$availablelangsforpage))
+                                         return 
$this->pages_bo->GetPage($page_id,$lang);
+                                 }
+                         }
+                 }
+       
+ 
                function loadPage($page_id)
                {
!                       $this->page = $this->getpagewrapper($page_id);
                }
  
                function loadIndex()
                {
!                       $this->page->title = lang('Site Index');
                        $this->page->subtitle = '';
                        $indexarray = $this->getIndex();
!                       $content = "\n".
!                               '<table border="0" width="100%" align="left" 
cellspacing="1" cellpadding="0">
!                               <tr>';
                        $catname = '';
                        foreach($indexarray as $page)
***************
*** 68,72 ****
                        if (count($indexarray)==0)
                        {
!                               $content='You do not have access to any content 
on this site.';
                        }
                        $this->page->content = $content;
--- 107,111 ----
                        if (count($indexarray)==0)
                        {
!                               $content=lang('You do not have access to any 
content on this site.');
                        }
                        $this->page->content = $content;
***************
*** 108,112 ****
                                                        
'catdescrip'=>$cat['description'],
                                                        'catlink'=>$cat['link'],
!                                                       'pagelink'=>'No pages 
available'
                                                );
                                        }
--- 147,151 ----
                                                        
'catdescrip'=>$cat['description'],
                                                        'catlink'=>$cat['link'],
!                                                       'pagelink'=>lang('No 
pages available')
                                                );
                                        }
***************
*** 128,146 ****
                                {
                                        $links = 
$this->getPageLinks($category_id,true);
!                                       $cat = 
$this->catbo->getCategory($category_id);
                                        $content = '';
                                        if ($cat)
                                        {
!                                               $this->page->title = 'Category 
'.$cat->name;
                                                $this->page->subtitle = 
'<i>'.$cat->description.'</i>';
!                                               $content .= '<b><a 
href="'.sitemgr_link2('/index.php','toc=1').'">Up to table of contents</a></b>';
                                                if ($cat->depth)
                                                {
!                                                       $content .= ' | <b><a 
href="'.sitemgr_link2('/index.php','category_id='.$cat->parent).'">Up to 
parent</a></b>';
                                                }
                                                $children = 
$this->getCatLinks((int) $category_id,false);
                                                if (count($children))
                                                {
!                                                       $content .= 
'<br><br><b>Subcategories:</b><br>';
                                                        foreach ($children as 
$child)
                                                        {
--- 167,185 ----
                                {
                                        $links = 
$this->getPageLinks($category_id,true);
!                                       $cat = 
$this->getcatwrapper($category_id);
                                        $content = '';
                                        if ($cat)
                                        {
!                                               $this->page->title = 
lang('Category').' '.$cat->name;
                                                $this->page->subtitle = 
'<i>'.$cat->description.'</i>';
!                                               $content .= '<b><a 
href="'.sitemgr_link2('/index.php','toc=1').'">' . lang('Up to table of 
contents') . '</a></b>';
                                                if ($cat->depth)
                                                {
!                                                       $content .= ' | <b><a 
href="'.sitemgr_link2('/index.php','category_id='.$cat->parent).'">' . lang('Up 
to parent') . '</a></b>';
                                                }
                                                $children = 
$this->getCatLinks((int) $category_id,false);
                                                if (count($children))
                                                {
!                                                       $content .= 
'<br><br><b>' . lang('Subcategories') . ':</b><br>';
                                                        foreach ($children as 
$child)
                                                        {
***************
*** 149,153 ****
                                                        }
                                                }
!                                               $content .= 
'<br><br><b>Pages:</b><br>';
                                                $links = 
$this->getPageLinks($category_id,true);
                                                if (count($links)>0)
--- 188,192 ----
                                                        }
                                                }
!                                               $content .= '<br><br><b>' . 
lang('Pages') . ':</b><br>';
                                                $links = 
$this->getPageLinks($category_id,true);
                                                if (count($links)>0)
***************
*** 166,170 ****
                                                else
                                                {
!                                                       $content .= '<li>There 
are no pages in this section</li>';
                                                }
                                                $this->page->content=$content;
--- 205,209 ----
                                                else
                                                {
!                                                       $content .= '<li>' . 
lang('There are no pages in this section') . '</li>';
                                                }
                                                $this->page->content=$content;
***************
*** 187,193 ****
                        else
                        {
!                               $this->page->title = 'Table of Contents';
                                $this->page->subtitle = '';
!                               $content = '<b>Choose a category:</b><br>';
                                $links = $this->getCatLinks();
                                if (count($links)>0)
--- 226,232 ----
                        else
                        {
!                               $this->page->title = lang('Table of Contents');
                                $this->page->subtitle = '';
!                               $content = '<b>' . lang('Choose a category') . 
':</b><br>';
                                $links = $this->getCatLinks();
                                if (count($links)>0)
***************
*** 206,210 ****
                                else
                                {
!                                       $content .= 'There are no sections 
available to you.';
                                }
                                $this->page->content=$content;
--- 245,249 ----
                                else
                                {
!                                       $content .= lang('There are no sections 
available to you.');
                                }
                                $this->page->content=$content;
***************
*** 218,222 ****
                        foreach($pages as $page_id)
                        {
!                               $page=$this->pages_bo->getPage($page_id);
                                if ($showhidden || !$page->hidden)
                                {
--- 257,261 ----
                        foreach($pages as $page_id)
                        {
!                               $page=$this->getpagewrapper($page_id);
                                if ($showhidden || !$page->hidden)
                                {
***************
*** 258,262 ****
                        foreach($cat_list as $cat_id)
                        {
!                               $category = $this->catbo->getCategory($cat_id);
                                $catlinks[$cat_id] = array(
                                        'name'=>$category->name,
--- 297,301 ----
                        foreach($cat_list as $cat_id)
                        {
!                               $category = $this->getcatwrapper($cat_id);
                                $catlinks[$cat_id] = array(
                                        'name'=>$category->name,
***************
*** 272,276 ****
                function get_header()
                {
!                       return $this->headerfooter_bo->getsiteheader();
                }
  
--- 311,315 ----
                function get_header()
                {
!                       return 
$this->headerfooter_bo->getsiteheader($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
                }
  
***************
*** 278,282 ****
                {
                        $prefs = CreateObject('sitemgr.sitePreference_SO');
!                       return $prefs->getPreference('sitemgr-site-name');
                }
  
--- 317,321 ----
                {
                        $prefs = CreateObject('sitemgr.sitePreference_SO');
!                       return $prefs->getPreference('sitemgr-site-name-' . 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
                }
  
***************
*** 298,302 ****
                function get_footer()
                {
!                       return $this->headerfooter_bo->getsitefooter();
                }
  
--- 337,341 ----
                function get_footer()
                {
!                       return 
$this->headerfooter_bo->getsitefooter($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
                }
  
***************
*** 317,320 ****
--- 356,422 ----
                {
                        return $this->acl->is_admin();
+               }
+ 
+               //like $GLOBALS['phpgw']->common->getPreferredLanguage,
+               //but compares languages accepted by the user 
+               //to the languages the website is configured for
+               //instead of the languages installed in phpgroupware
+               function setsitemgrPreferredLanguage()
+               {
+                       $supportedLanguages = 
$GLOBALS['sitemgr_info']['sitelanguages'] ? 
$GLOBALS['sitemgr_info']['sitelanguages'] : array('en');
+                       $postlang = $_POST['language'];
+                       if ($postlang && 
in_array($postlang,$supportedLanguages))
+                       {
+                               
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $postlang;
+                               
$GLOBALS['phpgw']->session->appsession('language','sitemgr-site',$postlang);
+                               return;
+                       }
+                   
+                       $sessionlang = 
$GLOBALS['phpgw']->session->appsession('language','sitemgr-site');
+                       if ($sessionlang)
+                       {
+                               
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $sessionlang;
+                               return;
+                       }
+                       
+                   if ($this->is_user())
+                       {
+                               $userlang = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+                               if (in_array($userlang,$supportedLanguages))
+                               {
+                               //we do not touch 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] if
+                               //the user is registered and his lang 
preference is supported by the website,
+                               //but save it to the appsession for quicker 
retrieval
+                               
$GLOBALS['phpgw']->session->appsession('language','sitemgr-site',$userlang);
+                           return;
+                               }
+                       }
+                                    
+                       // create a array of languages the user is accepting
+                       $userLanguages = 
explode(',',$GLOBALS['HTTP_ACCEPT_LANGUAGE']);
+                   
+                       // find usersupported language
+                       while (list($key,$value) = each($userLanguages))
+                       {
+                               // remove everything behind '-' example: de-de
+                               $value = trim($value);
+                               $pieces = explode('-', $value);
+                               $value = $pieces[0];
+                               //print "current lang $value<br>";
+                               if (in_array($value,$supportedLanguages))
+                               {
+                                       $browserlang = $value;
+                                       break;
+                               }
+                       }
+ 
+                       // no usersupported language found -> return the first 
entry of sitelanguages
+                       if (empty($browserlang))
+                       {
+                               $browserlang = $supportedLanguages[0];
+                       }
+                   
+                       
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $browserlang;
+                       
$GLOBALS['phpgw']->session->appsession('language','sitemgr-site',$browserlang);
                }
  

Index: class.so.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/inc/class.so.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** class.so.inc.php    29 Aug 2002 03:03:31 -0000      1.1.1.1
--- class.so.inc.php    5 Dec 2002 22:15:01 -0000       1.2
***************
*** 1,12 ****
  <?php
!       
/***************************************************************************\
!       * phpGroupWare - Web Content Manager                                    
    *
!       * 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.                                            
    *
!       
\***************************************************************************/
        /* $Id$ */
  
--- 1,12 ----
  <?php
!       
/**************************************************************************\
!       * phpGroupWare - Web Content Manager                                    
   *
!       * 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.                                            
   *
!       
\**************************************************************************/
        /* $Id$ */
  

Index: class.ui.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/inc/class.ui.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.ui.inc.php    17 Sep 2002 23:51:58 -0000      1.8
--- class.ui.inc.php    5 Dec 2002 22:15:01 -0000       1.9
***************
*** 1,12 ****
  <?php
!       
/***************************************************************************\
!       * phpGroupWare - Web Content Manager                                    
    *
!       * 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.                                            
    *
!       
\***************************************************************************/
        /* $Id$ */
  
--- 1,12 ----
  <?php
!       
/**************************************************************************\
!       * phpGroupWare - Web Content Manager                                    
   *
!       * 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.                                            
   *
!       
\**************************************************************************/
        /* $Id$ */
  
***************
*** 15,19 ****
                var $bo;
                var $t;
!               var $tmp_title;
  
                function ui()
--- 15,20 ----
                var $bo;
                var $t;
!               var $blocks_bo;
!               
  
                function ui()
***************
*** 21,24 ****
--- 22,33 ----
                        $this->bo = new bo;
                        $this->t = new Template2;
+ 
+                       $this->bo->setsitemgrPreferredLanguage();
+                       
+                       
require_once($GLOBALS['sitemgr_info']['sitemgr-site_path'] .
+                               '/inc/class.blocks_bo.inc.php');
+                       $this->blocks_bo = new blocks_bo;
+                       
+                       
                }
  
***************
*** 26,30 ****
                {
                        $pages_so = CreateObject('sitemgr.Pages_SO');
!                       $page = $pages_so->getPageByName($page_name);
                        $this->bo->loadPage($page->id);
                        $this->generatePage();
--- 35,39 ----
                {
                        $pages_so = CreateObject('sitemgr.Pages_SO');
!                       $page = 
$pages_so->getPageByName($page_name,$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
                        $this->bo->loadPage($page->id);
                        $this->generatePage();
***************
*** 96,100 ****
                        else
                        {
!                               die("Selected theme '$themesel' does not 
exist.");
                        }
  
--- 105,109 ----
                        else
                        {
!                               die(lang("Selected theme %1 does not 
exist.",$themesel));
                        }
  
***************
*** 111,115 ****
                        echo '</head>' . "\n";
                        themeheader();
!                       blocks('c');
                        echo OpenTable();
                        echo "<h1>" . $this->bo->get_title() . "</h1>";
--- 120,124 ----
                        echo '</head>' . "\n";
                        themeheader();
!                       $this->blocks_bo->blocks('c',$this->t);
                        echo OpenTable();
                        echo "<h1>" . $this->bo->get_title() . "</h1>";
***************
*** 127,131 ****
                        if (!file_exists($templatedir.$themesel.'/main.tpl'))
                        {
!                               die("Selected template '$themesel' does not 
exist.");
                        }
                        $this->t->set_root($templatedir);
--- 136,140 ----
                        if (!file_exists($templatedir.$themesel.'/main.tpl'))
                        {
!                               die(lang("Selected template %1 does not 
exist.",$themesel));
                        }
                        $this->t->set_root($templatedir);
***************
*** 139,143 ****
                        $this->t->set_file('body',$themesel.'/main.tpl');
  
!                       $this->t->set_var('user', 
$GLOBALS['phpgw_info']['user']['account_lid']);
                        
$this->t->set_var('site_name',$this->bo->get_siteName());
                        $this->t->set_var('site_header', 
$this->bo->get_header());
--- 148,155 ----
                        $this->t->set_file('body',$themesel.'/main.tpl');
  
!                       $this->t->set_var('opencurly','{');
!                       $this->t->set_var('closecurly','}');
!                       $this->t->set_var('user', 
!                               $GLOBALS['phpgw_info']['user']['account_lid']);
                        
$this->t->set_var('site_name',$this->bo->get_siteName());
                        $this->t->set_var('site_header', 
$this->bo->get_header());
***************
*** 149,238 ****
                        
$this->t->set_file('sideblocks',$themesel.'/sideblock.tpl');
                        $this->t->set_block('sideblocks','SideBlock','SBlock');
!                       $this->blocks('l');
                        
$this->t->set_var('left_blocks',$this->t->get_var('SBlock'));
                        $this->t->set_var('SBlock','');
!                       $this->blocks('r');
                        
$this->t->set_var('right_blocks',$this->t->get_var('SBlock'));
                        $this->t->set_var('SBlock','');
  
  
                        $this->t->pfp('out','body');
-               }
- 
-               function block_allowed($block)
-               {
-                       switch($block['view'])
-                       {
-                               case 0:
-                                       return true;
-                               case 1:
-                                       return $this->bo->is_user();
-                               case 2:
-                                       return $this->bo->is_admin();
-                               case 3:
-                                       return (! $this->bo->is_user());
-                       }
-                       return false;
-               }
- 
-               function get_blocktitle($block)
-               {
-                       if (!$block['title'])
-                       {
-                               return $this->tmp_title;
-                       }
-                       else
-                       {
-                               return $block['title'];
-                       }
-               }
- 
-               function get_blockcontent($block)
-               {
-                       $content='';
-                       if (file_exists('blocks/'.$block['blockfile']) && 
trim($block['blockfile']))
-                       {
-                               $title = '';
-                               include('blocks/'.$block['blockfile']);
-                               if (!$content && !$block['skipifblank'])
-                               {
-                                       $content = 'No content found';
-                               }
-                               $this->tmp_title = $title;
-                       }
-                       elseif ($block['content'])
-                       {
-                               $content = $block['content'];
-                       }
-                       else
-                       {
-                               $content = 'Block not found';
-                       }
-                       return $content;
-               }
- 
-               function blocks($side)
-               {
-                       global $blocks;
-                       //echo "<pre>";
-                       //print_r($blocks);
-                       //echo "</pre>";
-                       foreach($blocks as $block)
-                       {
-                               if($block['position']==$side)
-                               {
-                                       if ($this->block_allowed($block))
-                                       {
-                                               $content = 
$this->get_blockcontent($block);
-                                               $title = 
$this->get_blocktitle($block);
-                                               if ($content)
-                                               {
-                                                       
$this->t->set_var('block_title',$title);
-                                                       
$this->t->set_var('block_content',$content);
-                                                       
$this->t->parse('SBlock','SideBlock',true);
-                                               }
-                                       }
-                               }
-                       }
                }
        }
--- 161,178 ----
                        
$this->t->set_file('sideblocks',$themesel.'/sideblock.tpl');
                        $this->t->set_block('sideblocks','SideBlock','SBlock');
!                       $this->blocks_bo->blocks('l',$this->t);
                        
$this->t->set_var('left_blocks',$this->t->get_var('SBlock'));
                        $this->t->set_var('SBlock','');
!                       $this->blocks_bo->blocks('r',$this->t);
                        
$this->t->set_var('right_blocks',$this->t->get_var('SBlock'));
                        $this->t->set_var('SBlock','');
  
+                       
$this->t->set_file('centerblocks',$themesel.'/centerblock.tpl');
+                       
$this->t->set_block('centerblocks','SideBlock','SBlock');
+                       $this->blocks_bo->blocks('c',$this->t);
+                       
$this->t->set_var('center_blocks',$this->t->get_var('SBlock'));
+                       $this->t->set_var('SBlock','');
  
                        $this->t->pfp('out','body');
                }
        }

Index: phpnuke.compat.inc.php
===================================================================
RCS file: 
/cvsroot/phpgroupware/sitemgr/sitemgr-site/inc/phpnuke.compat.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** phpnuke.compat.inc.php      2 Sep 2002 23:08:13 -0000       1.5
--- phpnuke.compat.inc.php      5 Dec 2002 22:15:01 -0000       1.6
***************
*** 97,102 ****
                        else
                        {
!                               $title = 'Block not found';
!                               $content = 'Contact the administrator.';
                        }
  
--- 97,102 ----
                        else
                        {
!                               $title = lang('Block not found');
!                               $content = lang('Contact the administrator.');
                        }
  
***************
*** 394,398 ****
        if (!$file) 
                {
!                       $content = 'Block not found.';
        } 
                else 
--- 394,398 ----
        if (!$file) 
                {
!                       $content = lang('Block not found.');
        } 
                else 
***************
*** 402,406 ****
        if ($content == '') 
                {
!                       $content = 'Block returned no content.';
        }
        if ($side == 1) 
--- 402,406 ----
        if ($content == '') 
                {
!                       $content = lang('Block returned no content.');
        }
        if ($side == 1) 





reply via email to

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