Source for file setup.php

Documentation is available at setup.php

  1. <?php
  2.  
  3. /**
  4.  * setup.php
  5.  *
  6.  * Copyright (c) 1999-2006 The SquirrelMail Project Team
  7.  * Licensed under the GNU GPL. For full terms see the file COPYING.
  8.  *
  9.  * Implementation of RFC 2369 for SquirrelMail.
  10.  * When viewing a message from a mailinglist complying with this RFC,
  11.  * this plugin displays a menu which gives the user a choice of mailinglist
  12.  * commands such as (un)subscribe, help and list archives.
  13.  *
  14.  * $Id: setup.php,v 1.24.2.10 2006/03/12 13:53:14 kink Exp $
  15.  * @package plugins
  16.  * @subpackage listcommands
  17.  */
  18.  
  19.     global $squirrelmail_plugin_hooks;
  20.  
  21.     $squirrelmail_plugin_hooks['read_body_header']['listcommands''plugin_listcommands_menu';
  22. }
  23.  
  24.     global $passed_id$passed_ent_id$color$mailbox,
  25.            $message$compose_new_win$startMessage;
  26.  
  27.     /**
  28.      * Array of commands we can deal with from the header. The Reply option
  29.      * is added later because we generate it using the Post information.
  30.      */
  31.     $fieldsdescr array('post'        => _("Post to List"),
  32.                          'reply'       => _("Reply to List"),
  33.                          'subscribe'   => _("Subscribe"),
  34.                          'unsubscribe' => _("Unsubscribe"),
  35.                          'archive'     => _("List Archives"),
  36.                          'owner'       => _("Contact Listowner"),
  37.                          'help'        => _("Help"));
  38.     $output array();
  39.  
  40.     foreach ($message->rfc822_header->mlist as $cmd => $actions{
  41.  
  42.         /* I don't know this action... skip it */
  43.         if ( ( function_exists('array_key_exists'&&       /* PHP >= 4.1 */
  44.                !array_key_exists($cmd$fieldsdescr) ) ||
  45.              function_exists('key_exists'&& 
  46.                !key_exists($cmd$fieldsdescr) )            /* PHP == 4.0.6 */
  47.         {
  48.             continue;
  49.         }
  50.  
  51.         /* proto = {mailto,href} */
  52.         $aActionKeys array_keys($actions);
  53.         $proto array_shift($aActionKeys);
  54.         $act   array_shift($actions);
  55.  
  56.         if ($proto == 'mailto'{
  57.  
  58.             if (($cmd == 'post'|| ($cmd == 'owner')) {
  59.                 $url 'src/compose.php?' .
  60.                 (isset($startMessage)?'startMessage='.$startMessage.'&amp;':'');
  61.             else {
  62.                 $url "plugins/listcommands/mailout.php?action=$cmd&amp;";
  63.             }
  64.             $url .= 'send_to=' str_replace('?','&amp;'$act);
  65.  
  66.             $output[makeComposeLink($url$fieldsdescr[$cmd]);
  67.  
  68.             if ($cmd == 'post'{
  69.                 $url .= '&amp;passed_id='.$passed_id.
  70.                     '&amp;mailbox='.urlencode($mailbox).
  71.                     (isset($passed_ent_id)?'&amp;passed_ent_id='.$passed_ent_id:'');
  72.                 $url .= '&amp;smaction=reply';
  73.                 
  74.                 $output[makeComposeLink($url$fieldsdescr['reply']);
  75.             }
  76.         else if ($proto == 'href'{
  77.             $output['<a href="' $act '" target="_blank">'
  78.                       . $fieldsdescr[$cmd'</a>';
  79.         }
  80.     }
  81.  
  82.     if (count($output0{
  83.         echo '<tr>';
  84.         echo html_tag('td''<b>' _("Mailing List"':&nbsp;&nbsp;</b>',
  85.                       'right''''valign="middle" width="20%"'"\n";
  86.         echo html_tag('td''<small>' implode('&nbsp;|&nbsp;'$output'</small>',
  87.                       'left'$color[0]'valign="middle" width="80%"'"\n";
  88.         echo '</tr>';
  89.     }
  90. }
  91.  
  92. ?>

Documentation generated on Sat, 07 Oct 2006 16:33:24 +0300 by phpDocumentor 1.3.0RC6