phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: news_admin/website setup.inc.php,NONE,1.1.2.1 ex


From: Michael Totschnig <address@hidden>
Subject: [Phpgroupware-cvs] CVS: news_admin/website setup.inc.php,NONE,1.1.2.1 export.php,1.1.4.1.2.4,1.1.4.1.2.5 setup.inc.php.sample,1.3.4.1.2.2,1.3.4.1.2.3
Date: Mon, 23 Jun 2003 15:20:55 -0400

Update of /cvsroot/phpgroupware/news_admin/website
In directory subversions:/tmp/cvs-serv24161/website

Modified Files:
      Tag: Version-0_9_16-branch
        export.php setup.inc.php.sample 
Added Files:
      Tag: Version-0_9_16-branch
        setup.inc.php 
Log Message:
sync up with HEAD


--- NEW FILE ---
<?php

        $path_to_header   = '../../';
        $template_path    = $path_to_header . 'news_admin/website/templates/';
        $domain           = 'default';

        /* ********************************************************************\
        * Don't change anything after this line                                *
        \******************************************************************** */

        $GLOBALS['phpgw_info']['flags']['noapi'] = True;
        include($path_to_header . 'header.inc.php');
        include(PHPGW_SERVER_ROOT . '/phpgwapi/inc/class.Template.inc.php');
        $tpl = new Template($template_path);
        include(PHPGW_SERVER_ROOT . '/phpgwapi/inc/class.db_' . 
$phpgw_domain[$domain]['db_type'] . '.inc.php');

        $GLOBALS['phpgw']->db = new db();
        $GLOBALS['phpgw']->db->Host     = 
$GLOBALS['phpgw_domain'][$domain]['server']['db_host'];
        $GLOBALS['phpgw']->db->Type     = 
$GLOBALS['phpgw_domain'][$domain]['db_type'];
        $GLOBALS['phpgw']->db->Database = 
$GLOBALS['phpgw_domain'][$domain]['db_name'];
        $GLOBALS['phpgw']->db->User     = 
$GLOBALS['phpgw_domain'][$domain]['db_user'];
        $GLOBALS['phpgw']->db->Password = 
$GLOBALS['phpgw_domain'][$domain]['db_pass'];

        include(PHPGW_SERVER_ROOT . '/news_admin/inc/class.so.inc.php');
        $news_obj = new so();
        
        include(PHPGW_SERVER_ROOT . '/news_admin/inc/class.soexport.inc.php');
        $export_obj = new soexport();


Index: export.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/website/export.php,v
retrieving revision 1.1.4.1.2.4
retrieving revision 1.1.4.1.2.5
diff -C2 -r1.1.4.1.2.4 -r1.1.4.1.2.5
*** export.php  1 Jun 2003 08:10:25 -0000       1.1.4.1.2.4
--- export.php  23 Jun 2003 19:20:52 -0000      1.1.4.1.2.5
***************
*** 18,40 ****
  
        $cat_id = intval($_GET['cat_id']);
!       $format = (isset($_GET['format']) ? strtolower(trim($_GET['format'])) : 
'rss');
        $limit  = (isset($_GET['limit']) ? trim($_GET['limit']) : 5);
!       $all    = (isset($_GET['all']) ? True : False); 
  
        //validate format
  
!       $available_formats = array('rss'        => True, //RSS 0.91
!                               'rdf-chan'      => True, //RDF 1.0
!                               'rdf2'          => True, //RDF/RSS 2.0
!                               );
  
!       if(!$available_formats[$format])
        {
!               $format = 'rss';
        }
  
        $tpl->set_file(array('news' => $format . '.tpl'));
        $tpl->set_block('news', 'item', 'items');
!       if($format == 'rdf-chan')
        {
                $tpl->set_block('news', 'seq', 'seqs');
--- 18,59 ----
  
        $cat_id = intval($_GET['cat_id']);
! //    $format = (isset($_GET['format']) ? strtolower(trim($_GET['format'])) : 
'rss');
        $limit  = (isset($_GET['limit']) ? trim($_GET['limit']) : 5);
! //    $all    = (isset($_GET['all']) ? True : False);
  
+       $site = $export_obj->readconfig($cat_id);
+ 
+       //TODO allow override of configured value by a configurable flag
        //validate format
  
! //    $available_formats = array('rss'        => True, //RSS 0.91
! //                            'rdf-chan'      => True, //RDF 1.0
! //                            'rdf2'          => True, //RDF/RSS 2.0
! //                            );
! 
! //    if(!$available_formats[$format])
! //    {
! //            $format = 'rss';
! //    }
  
!       if (!$site['type'])
        {
!               echo "THIS CATEGORY IS NOT PUBLICLY ACCESSIBLE";
!               die();
        }
  
+       $formats = array(1 => 'rss091', 2 => 'rss1', 3 => 'rss2');
+       $itemsyntaxs = array(
+               0 => '?item=',
+               1 => '&item=',
+               2 => '?news%5Bitem%5D=',
+               3 => '&news%5Bitem%5D='
+       );
+       $format = $formats[$site['type']];
+       $itemsyntax = $itemsyntaxs[$site['itemsyntax']];
+ 
        $tpl->set_file(array('news' => $format . '.tpl'));
        $tpl->set_block('news', 'item', 'items');
!       if($format == 'rss1')
        {
                $tpl->set_block('news', 'seq', 'seqs');
***************
*** 43,54 ****
        $tpl->set_var($site);
  
!       if($all)
!       {
!               $news = $news_obj->get_all_public_news($limit);
!       }
!       else
!       {
!               $news = $news_obj->get_newslist($cat_id, False, 0, $limit);
!       }
  
        if(is_array($news))
--- 62,73 ----
        $tpl->set_var($site);
  
! //    if($all)
! //    {
! //            $news = $news_obj->get_all_public_news($limit);
! //    }
! //    else
! //    {
!               $news = $news_obj->get_newslist($cat_id, 0,'','',$limit,True);
! //    }
  
        if(is_array($news))
***************
*** 57,62 ****
                {
                        $tpl->set_var($news_data);
!                       $tpl->set_var('item_link', $site['link'] . '?item=' . 
$news_id);
!                       if($format == 'rdf-chan')
                        {
                                $tpl->parse('seqs','seq',True);
--- 76,82 ----
                {
                        $tpl->set_var($news_data);
! 
!                       $tpl->set_var('item_link', $site['link'] . $itemsyntax 
. $news_id);
!                       if($format == 'rss1')
                        {
                                $tpl->parse('seqs','seq',True);

Index: setup.inc.php.sample
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/website/setup.inc.php.sample,v
retrieving revision 1.3.4.1.2.2
retrieving revision 1.3.4.1.2.3
diff -C2 -r1.3.4.1.2.2 -r1.3.4.1.2.3
*** setup.inc.php.sample        1 Jun 2003 03:54:38 -0000       1.3.4.1.2.2
--- setup.inc.php.sample        23 Jun 2003 19:20:52 -0000      1.3.4.1.2.3
***************
*** 1,18 ****
  <?php
  
!       $path_to_header   = '/var/www/phpgroupware/';
!       $template_path    = 
'/var/www/phpgroupware/news_admin/website/templates/';
        $domain           = 'default';
  
-       // This is used for exporting news
-       $site['title']          = 'MySite';
-       $site['link']           = 'http://www.mysite.com/news/view.php';
-       $site['description']    = 'MySite is great';
-       $site['img_title']      = 'MySite logo';
-       $site['img_url']        = 'http://www.mysite.com/images/logo.gif';
-       $site['img_link']       = 'http://www.mysite.com/';
- 
        /* ********************************************************************\
!       * Don't change anything after this line lines                          *
        \******************************************************************** */
  
--- 1,10 ----
  <?php
  
!       $path_to_header   = '../../';
!       $template_path    = $path_to_header . 'news_admin/website/templates/';
        $domain           = 'default';
  
        /* ********************************************************************\
!       * Don't change anything after this line                                *
        \******************************************************************** */
  
***************
*** 20,25 ****
        include($path_to_header . 'header.inc.php');
        include(PHPGW_SERVER_ROOT . '/phpgwapi/inc/class.Template.inc.php');
        include(PHPGW_SERVER_ROOT . '/phpgwapi/inc/class.db_' . 
$phpgw_domain[$domain]['db_type'] . '.inc.php');
-       include(PHPGW_SERVER_ROOT . '/news_admin/inc/class.sonews.inc.php');
  
        $GLOBALS['phpgw']->db = new db();
--- 12,17 ----
        include($path_to_header . 'header.inc.php');
        include(PHPGW_SERVER_ROOT . '/phpgwapi/inc/class.Template.inc.php');
+       $tpl = new Template($template_path);
        include(PHPGW_SERVER_ROOT . '/phpgwapi/inc/class.db_' . 
$phpgw_domain[$domain]['db_type'] . '.inc.php');
  
        $GLOBALS['phpgw']->db = new db();
***************
*** 30,34 ****
        $GLOBALS['phpgw']->db->Password = 
$GLOBALS['phpgw_domain'][$domain]['db_pass'];
  
!       $news_obj = new sonews();
!       $tpl = new Template($template_path);
  
--- 22,29 ----
        $GLOBALS['phpgw']->db->Password = 
$GLOBALS['phpgw_domain'][$domain]['db_pass'];
  
!       include(PHPGW_SERVER_ROOT . '/news_admin/inc/class.so.inc.php');
!       $news_obj = new so();
!       
!       include(PHPGW_SERVER_ROOT . '/news_admin/inc/class.soexport.inc.php');
!       $export_obj = new soexport();
  





reply via email to

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