1<?php 2 /**************************************************************************\ 3 * phpGroupWare application (NNTP) * 4 * http://www.phpgroupware.org * 5 * Written by Mark Peters <mpeters@satx.rr.com> * 6 * -------------------------------------------- * 7 * This program is free software; you can redistribute it and/or modify it * 8 * under the terms of the GNU General Public License as published by the * 9 * Free Software Foundation; either version 2 of the License, or (at your * 10 * option) any later version. * 11 \**************************************************************************/ 12 13 /* $Id: viewgroup.php 21070 2010-03-25 22:50:36Z Caeies $ */ 14 15 $GLOBALS['phpgw_info']['flags'] = array 16 ( 17 'currentapp' => 'nntp', 18 'enable_nextmatchs_class' => True, 19 'enable_vfs_class' => True 20 ); 21 include('../header.inc.php'); 22 23 function close_routine() 24 { 25 $GLOBALS['nntp']->close_port(); 26 } 27 28 $folder = (int) isset($_GET['folder']) ? $_GET['folder'] : 0; 29 $msgnum = (int) isset($_GET['msgnum']) ? $_GET['msgnum'] : 0; 30 31 @set_time_limit(0); 32 33 $GLOBALS['phpgw']->translation->add_app('email'); 34 35 $GLOBALS['phpgw']->db->query("SELECT active FROM newsgroups WHERE con = {$folder} AND active = 'Y'", __LINE__, __FILE__); 36 if (($GLOBALS['phpgw']->db->num_rows() == 0) || !isset($GLOBALS['phpgw_info']['user']['preferences']['nntp'][$folder]) ) 37 { 38 echo 'You do not have access to this newsgroup!'."<br>\n"; 39 $GLOBALS['phpgw']->common->phpgw_exit(); 40 } 41 42 if(!$GLOBALS['folder']) 43 { 44 echo lang('Cannot display the requested newsgroup')."<br>\n"; 45 $GLOBALS['phpgw']->common->phpgw_exit(); 46 } 47 48 $GLOBALS['nntp']->display = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; 49 if ($GLOBALS['nntp']->errorset) 50 { 51 echo $GLOBALS['nntp']->error['msg'].':'.$GLOBALS['nntp']->error['desc']."<br>\n"; 52 $GLOBALS['phpgw']->common->phpgw_exit(); 53 } 54 55 register_shutdown_function("close_routine"); 56 57 $p =& $GLOBALS['phpgw']->template; 58 $p->set_root( $GLOBALS['phpgw']->common->get_tpl_dir('nntp') ); 59 60 $p->set_file('view_group', 'view_group.tpl'); 61 $p->set_block('view_group','vg','vg'); 62 $p->set_block('view_group','vg_row','vg_row'); 63 64 $nntp->read_table($folder); 65 66 $start = intval($_REQUEST['start']); 67 68 if( !isset($_REQUEST['tm']) ) 69 { 70 $tm = ($GLOBALS['nntp']->highmsg - $GLOBALS['nntp']->lowmsg); 71 } 72 else 73 { 74 $tm = $_REQUEST['tm']; 75 } 76 77 if( !isset($_REQUEST['fm']) ) 78 { 79 $fm = $GLOBALS['nntp']->lowmsg; 80 } 81 else 82 { 83 $fm = $_REQUEST['fm']; 84 } 85 86 $p->set_var(array 87 ( 88 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], 89 'th_font' => $GLOBALS['phpgw_info']['theme']['font'], 90 'th_text' => $GLOBALS['phpgw_info']['theme']['th_text'], 91 'th_em_folder' => $GLOBALS['phpgw_info']['theme']['em_folder'], 92 'th_em_text' => $GLOBALS['phpgw_info']['theme']['em_folder_text'], 93 'folder' => $GLOBALS['nntp']->folder, 94 'nml' => $GLOBALS['phpgw']->nextmatchs->left('/nntp/viewgroup.php',$start,$tm,'&folder='.$GLOBALS['folder'].'&tm='.$tm.'&fm='.$fm), 95 'nmr' => $GLOBALS['phpgw']->nextmatchs->right('/nntp/viewgroup.php',$start,$tm,'&folder='.$GLOBALS['folder'].'&tm='.$tm.'&fm='.$fm), 96 'row_color' => $GLOBALS['phpgw_info']['theme']['th_bg'], 97 'from' => '<font size="2"><b>'.lang('from').'</b></font>', 98 'subject' => '<font size="2"><b>'.lang('subject').'</b></font>', 99 'date' => '<font size="2"><b>'.lang('date').'</b></font>' 100 //'size' => '<font size="2"><b>'.lang('size').'</b></font>' 101 )); 102 103 $p->set_var($var); 104 $p->parse('rows','vg_row',True); 105 106 if ( $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] <= ($tm - $start) ) 107 { 108 $totaltodisplay = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; 109 } 110 else 111 { 112 $totaltodisplay = ($tm - $start) - 1; 113 } 114 115 $firstmessage = ($fm + $start); 116 $list = $GLOBALS['nntp']->get_list('from', $firstmessage, $totaltodisplay); 117// $subject = $GLOBALS['nntp']->get_list('subject',$firstmessage,$firstmessage+$totaltodisplay); 118// $date = $GLOBALS['nntp']->get_list('date',$firstmessage,$firstmessage+$totaltodisplay); 119 120 for ( $i = 0; $i < $totaltodisplay; ++$i) 121 { 122 $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); 123 124 $subject_url = $GLOBALS['phpgw']->link('/nntp/read_article.php', array('folder' => $GLOBALS['nntp']->con, 'msgnum' => $list[$i]['Msgnum']) ); 125 126 $p->set_var(array 127 ( 128 'row_color' => $tr_color, 129 'from' => '<font size="-1">'.$list[$i]['From'].'</font>', 130 'subject' => '<font size="-1"><a href="'.$subject_url.'">'.$list[$i]['Subject'].'</a></font>', 131 'date' => '<font size="-2">'.$GLOBALS['phpgw']->common->show_date($list[$i]['Date']).'</font>' 132 //'size' => '' 133 )); 134 $p->parse('rows','vg_row',True); 135 } 136 137 $p->pparse('out','vg'); 138 $GLOBALS['phpgw']->common->phpgw_footer(); 139?> 140