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 expor


From: Michael Totschnig <address@hidden>
Subject: [Phpgroupware-cvs] CVS: news_admin/website setup.inc.php,NONE,1.1 export.php,1.2,1.3 news.inc.php,1.6,1.7 setup.inc.php.sample,1.4,1.5
Date: Mon, 02 Jun 2003 23:15:14 -0400

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

Modified Files:
        export.php news.inc.php setup.inc.php.sample 
Added Files:
        setup.inc.php 
Log Message:
ACL
configurable RSS exports
clean up


--- 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.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** export.php  20 Jan 2002 22:42:15 -0000      1.2
--- export.php  3 Jun 2003 03:15:12 -0000       1.3
***************
*** 15,45 ****
    /* $Id$ */
  
!   // Note: Some of this is hard coded for right now ....
  
!   include("setup.inc.php");
! 
!   if (! $format) {
!      $format = "rdf";
!   }
! 
!   $tpl->set_file(array("news" => $format . ".tpl",
!                        "row"  => $format . "_row.tpl"));
! 
!   $db->query("select * from phpgw_news,accounts where news_status='Active' 
order by news_date "
!            . "desc limit 5");
! 
!   $tpl->set_var("site_title",$site_title);
!   $tpl->set_var("site_link",$site_link);
!   $tpl->set_var("site_description",$site_site_description);
!   $tpl->set_var("img_title",$img_title);
!   $tpl->set_var("img_url",$img_url);
!   $tpl->set_var("img_link",$img_link);
! 
!   while ($db->next_record()) {
!     $tpl->set_var("title",$db->f("news_subject"));
!     $tpl->set_var("link",$site_link);
      
!     $tpl->parse("rows","row",True);
!   }
!   $tpl->pparse("out","news");
! 
--- 15,93 ----
    /* $Id$ */
  
!       include('setup.inc.php');
  
!       $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');
!       }
! 
!       $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))
!       {
!               foreach($news as $news_id => $news_data) 
!               {
!                       $tpl->set_var($news_data);
! 
!                       $tpl->set_var('item_link', $site['link'] . $itemsyntax 
. $news_id);
!                       if($format == 'rss1')
!                       {
!                               $tpl->parse('seqs','seq',True);
!                       }
      
!                       $tpl->parse('items','item',True);
!               }
!       }
!       else
!       {
!               $tpl->set_var('items', '');
!       }
!       $tpl->pparse('out','news');
! ?>

Index: news.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/website/news.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** news.inc.php        6 Mar 2002 21:32:39 -0000       1.6
--- news.inc.php        3 Jun 2003 03:15:12 -0000       1.7
***************
*** 17,23 ****
  
        $tpl->set_file(array('news' => 'news.tpl',
!                                                       'row' => 
'news_row.tpl'));
  
!       $db->query("select count(*) from phpgw_news where 
news_status='Active'");
        $db->next_record();
        $total = $db->f(0);
--- 17,24 ----
  
        $tpl->set_file(array('news' => 'news.tpl',
!                       'row' => 'news_row.tpl')
!       );
  
!       $db->query("SELECT COUNT(*) FROM phpgw_news WHERE 
news_status='Active'");
        $db->next_record();
        $total = $db->f(0);
***************
*** 25,35 ****
        if (! $oldnews)
        {
!               $db->query("select *,account_lid as submittedby from 
phpgw_news,phpgw_accounts where news_status='Active' "
!                                       . "and 
news_submittedby=phpgw_accounts.account_id order by news_date desc limit 5");
        }
        else
        {
!               $db->query("select *,account_lid as submittedby from 
phpgw_news,phpgw_accounts where news_status='Active' and "
!                                       . 
"news_submittedby=phpgw_accounts.account_id order by news_date desc limit 
5,$total");
        }
  
--- 26,36 ----
        if (! $oldnews)
        {
!               $db->query("SELECT *,account_lid AS submittedby FROM 
phpgw_news,phpgw_accounts WHERE news_status='Active' "
!                                       . "AND 
news_submittedby=phpgw_accounts.account_id ORDER BY news_date DESC LIMIT 5");
        }
        else
        {
!               $db->query("SELECT *,account_lid AS submittedby FROM 
phpgw_news,phpgw_accounts WHERE news_status='Active' AND "
!                                       . 
"news_submittedby=phpgw_accounts.account_id ORDER BY news_date DESC LIMIT 
5,$total");
        }
  

Index: setup.inc.php.sample
===================================================================
RCS file: /cvsroot/phpgroupware/news_admin/website/setup.inc.php.sample,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** setup.inc.php.sample        6 Mar 2002 21:32:39 -0000       1.4
--- setup.inc.php.sample        3 Jun 2003 03:15:12 -0000       1.5
***************
*** 1,29 ****
  <?php
  
!       $path_to_header   = '/path/to/phpgroupware/';
!       $template_path    = 
'/path/to/phpgroupware/news_admin/website/templates/';
        $domain           = 'default';
  
!       // This is used for exporting news
!       $site_title       = 'mysite title';
!       $site_link        = 'http://www.mysite.com';
!       $site_description = 'Just a sample';
!       $img_title        = 'my logo';
!       $img_url          = 'http://www.mysite.com/logo.jpg';
!       $img_link         = 'http://www.mysite.com';
  
-       // Don't change the follow lines
        $GLOBALS['phpgw_info']['flags']['noapi'] = True;
        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');
  
!       $db           = new db;
!       $db->Host     = $GLOBALS['phpgw_domain'][$domain]['server']['db_host'];
!       $db->Type     = $GLOBALS['phpgw_domain'][$domain]['db_type'];
!       $db->Database = $GLOBALS['phpgw_domain'][$domain]['db_name'];
!       $db->User     = $GLOBALS['phpgw_domain'][$domain]['db_user'];
!       $db->Password = $GLOBALS['phpgw_domain'][$domain]['db_pass'];
  
!       $tpl = new Template($template_path);
  
--- 1,29 ----
  <?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();
  





reply via email to

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