Source for file functions.php

Documentation is available at functions.php

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

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