Main Page | Directories | File List | File Members

mail/index.php

Go to the documentation of this file.
00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: index.php 5490 2006-02-24 17:01:29Z yeupou $
00006 #
00007 #  Copyright 1999-2000 (c) The SourceForge Crew
00008 #  Copyright 2000-2003 (c) Free Software Foundation
00009 #                          Mathieu Roy <yeupou--gnu.org>
00010 #
00011 #  Copyright 2004-2006 (c) Mathieu Roy <yeupou--gnu.org>
00012 # 
00013 # The Savane project is free software; you can redistribute it and/or
00014 # modify it under the terms of the GNU General Public License
00015 # as published by the Free Software Foundation; either version 2
00016 # of the License, or (at your option) any later version.
00017 #
00018 # The Savane project is distributed in the hope that it will be useful,
00019 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021 # GNU General Public License for more details.
00022 #
00023 # You should have received a copy of the GNU General Public License
00024 # along with the Savane project; if not, write to the Free Software
00025 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00026 
00027 
00028 require '../include/pre.php';
00029 
00030 if ($group_id) 
00031 {  
00032 
00033   exit_test_usesmail($group_id);
00034 
00035   site_project_header(array('group'=>$group_id, 'context'=>'mail'));
00036 
00037 
00038   
00039   if (user_isloggedin() && user_ismember($group_id)) 
00040     { $public_flag='0,1'; } 
00041   else 
00042     { $public_flag='1'; }
00043   
00044   $sql="SELECT * FROM mail_group_list WHERE group_id='$group_id' AND is_public IN ($public_flag) ORDER BY list_name ASC";
00045   $result = db_query ($sql);
00046   $rows = db_numrows($result); 
00047   
00048   if (!$result || $rows < 1) 
00049     {
00050       printf ('<h2>'._("No Lists found for %s").'</h2>',$project->getName());
00051       print '<p>'._("Project administrators can add mailing lists using the admin interface.").'</p>';
00052       $HTML->footer(array());
00053       exit;
00054     }
00055   
00056   for ($j = 0; $j < $rows; $j++) 
00057     {
00058       $is_public = db_result($result,$j,'is_public');
00059       $pass = db_result($result,$j,'password');
00060 
00061       $list = db_result($result, $j, 'list_name');
00062 
00063       # Pointer to listinfo or to the mailing list address, if no listinfo is found
00064       if ($project->getTypeMailingListListinfoUrl($list) && $project->getTypeMailingListListinfoUrl($list) != "http://")
00065         { 
00066           $default_pointer = $project->getTypeMailingListListinfoUrl($list); }
00067       else
00068         { unset($default_pointer); }
00069 
00070       print '<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/mail.png" border="0" alt="" /> <a href="'.$default_pointer.'">'.$list.'</a> ';
00071       
00072       # Description
00073       print '&nbsp;&nbsp;<em>'.db_result($result, $j, 'description').'</em>';
00074       print '<p class="smaller">';
00075 
00076       unset($previoustextexists);
00077       if ($is_public && $project->getTypeMailingListArchivesUrl($list) && $project->getTypeMailingListArchivesUrl($list) != "http://")
00078         {
00079           if ($previoustextexists)
00080             { print '<br />'; }
00081           $previoustextexists = 1;
00082 
00083           # Pointer to archives
00084           print sprintf(_("To see the collection of prior posting to the list, visit the %s%s archives%s"),'<a href="'.$project->getTypeMailingListArchivesUrl($list).'">', $list, '</a>.');
00085         }
00086 
00087       if (!$is_public && $project->getTypeMailingListArchivesPrivateUrl($list) && $project->getTypeMailingListArchivesPrivateUrl($list) != "http://")
00088         {
00089           if ($previoustextexists)
00090             { print '<br />'; }
00091           $previoustextexists = 1;
00092 
00093           # Pointer to archives
00094           print sprintf(_("To see the collection of prior posting to the list, visit the %s%s archives%s"),'<a href="'.$project->getTypeMailingListArchivesPrivateUrl($list).'">', $list, '</a> (authorization required).');
00095         }
00096 
00097       if ($project->getTypeMailingListAddress($list))
00098         {
00099           if ($previoustextexists)
00100             { print '<br />'; }
00101           $previoustextexists = 1;
00102 
00103           # Address
00104           print sprintf(_("To post a message to all the list members, write to %s"), utils_email($project->getTypeMailingListAddress($list)));
00105         }
00106       else 
00107         {
00108           print '<br /><span class="error">'._("No mailing-list address was found, the configuration of the server is probably broken, contact the admins!").'</span>';
00109         }
00110 
00111       # Subscribe, unsubscribe:
00112       # if these fields are empty, go back on the listinfo page
00113       if ($project->getTypeMailingListSubscribeUrl($list) && 
00114           $project->getTypeMailingListSubscribeUrl($list) != "http://" && 
00115           $project->getTypeMailingListUnsubscribeUrl($list) && 
00116           $project->getTypeMailingListUnsubscribeUrl($list) != "http://")
00117         {
00118           if ($project->getTypeMailingListSubscribeUrl($list) && $project->getTypeMailingListSubscribeUrl($list) != "http://") {
00119 
00120           if ($previoustextexists)
00121             { print '<br />'; }
00122           $previoustextexists = 1;
00123 
00124             print sprintf(_("You can subscribe to the list by submitting %sthis message%s"),'<a href="'.$project->getTypeMailingListSubscribeUrl($list).'">','</a>.');
00125           }
00126           if ($project->getTypeMailingListUnsubscribeUrl($list) && $project->getTypeMailingListUnsubscribeUrl($list) != "http://") {
00127 
00128           if ($previoustextexists)
00129             { print '<br />'; }
00130           $previoustextexists = 1;
00131 
00132             print sprintf(_("You can unsubscribe to the list by submitting %sthis message%s"),'<a href="'.$project->getTypeMailingListUnsubscribeUrl($list).'">','</a>.');
00133           }
00134         }
00135       else if ($project->getTypeMailingListListinfoUrl($list) && $project->getTypeMailingListListinfoUrl($list) != "http://")
00136         {
00137           if ($previoustextexists)
00138             { print '<br />'; }
00139           $previoustextexists = 1;
00140 
00141           print sprintf(_("You can (un)subscribe to the list by following instructions on the %slist information page%s"),'<a href="'.$project->getTypeMailingListListinfoUrl($list).'">','</a>.');
00142         }
00143       
00144       if ($project->getTypeMailingListAdminUrl($list) && $project->getTypeMailingListAdminUrl($list) != "http://")
00145         {
00146           if ($previoustextexists)
00147             { print '<br />'; }
00148           $previoustextexists = 1;
00149 
00150           # Admin interface
00151           print sprintf(_("Project administrators could use the %sadministrative interface%s to manage the list."),'<a href="'.$project->getTypeMailingListAdminUrl($list).'">','</a>').'</dd>';
00152           
00153         }
00154       print '</p><br />';
00155     }
00156   
00157   site_project_footer(array()); 
00158   
00159 } 
00160 else 
00161 {
00162   exit_no_group();
00163 }
00164 
00165 ?>

Generated on Sun Feb 26 13:23:04 2006 for Savane PHP Frontend Developer Reference by  doxygen 1.4.4