Source for file setup.php

Documentation is available at setup.php

  1. <?php
  2.  
  3. /**
  4.  * setup.php
  5.  *
  6.  * Copyright (c) 1999-2018 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 14749 2018-01-16 23:36:07Z pdontthink $
  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 !array_key_exists($cmd$fieldsdescr) ) {
  44.             continue;
  45.         }
  46.  
  47.         /* proto = {mailto,href} */
  48.         $aActionKeys array_keys($actions);
  49.         // note that we only use the first cmd/action, ignore the rest
  50.         $proto array_shift($aActionKeys);
  51.         $act   array_shift($actions);
  52.  
  53.         if ($proto == 'mailto'{
  54.  
  55.             $identity '';
  56.  
  57.             if (($cmd == 'post'|| ($cmd == 'owner')) {
  58.                 $url 'src/compose.php?' .
  59.                 (isset($startMessage)?'startMessage='.$startMessage.'&amp;':'');
  60.             else {
  61.                 $url "plugins/listcommands/mailout.php?action=$cmd&amp;";
  62.  
  63.                 // try to find which identity the mail should come from
  64.                 include_once(SM_PATH 'functions/identity.php');
  65.                 $idents get_identities();
  66.                 // ripped from src/compose.php
  67.                 $identities array();
  68.                 if (count($idents1{
  69.                     foreach($idents as $nr=>$data{
  70.                         $enc_from_name '"'.$data['full_name'].'" <'$data['email_address'].'>';
  71.                         $identities[$enc_from_name;
  72.                     }
  73.  
  74.                     $identity_match $message->rfc822_header->findAddress($identities);
  75.                     if ($identity_match !== FALSE{
  76.                         $identity $identity_match;
  77.                     }
  78.                 }
  79.             }
  80.  
  81.             // if things like subject are given, peel them off and give
  82.             // them to src/compose.php as is (not encoded)
  83.             if (strpos($act'?'0{
  84.                list($act$parametersexplode('?'$act2);
  85.                $parameters '&amp;identity=' $identity '&amp;' $parameters;
  86.             else {
  87.                $parameters '&amp;identity=' $identity;
  88.             }
  89.  
  90.             $url .= 'send_to=' urlencode($act$parameters;
  91.  
  92.             $output[makeComposeLink($url$fieldsdescr[$cmd]);
  93.  
  94.             if ($cmd == 'post'{
  95.                 $url .= '&amp;passed_id='.$passed_id.
  96.                     '&amp;mailbox='.urlencode($mailbox).
  97.                     (isset($passed_ent_id)?'&amp;passed_ent_id='.$passed_ent_id:'');
  98.                 $url .= '&amp;smaction=reply';
  99.                 
  100.                 $output[makeComposeLink($url$fieldsdescr['reply']);
  101.             }
  102.         else if ($proto == 'href'{
  103.             $output['<a href="' $act '" target="_blank">'
  104.                       . $fieldsdescr[$cmd'</a>';
  105.         }
  106.     }
  107.  
  108.     if (count($output0{
  109.         echo '<tr>';
  110.         echo html_tag('td''<b>' _("Mailing List"':&nbsp;&nbsp;</b>',
  111.                       'right''''valign="middle" width="20%"'"\n";
  112.         echo html_tag('td''<small>' implode('&nbsp;|&nbsp;'$output'</small>',
  113.                       'left'$color[0]'valign="middle" width="80%"'"\n";
  114.         echo '</tr>';
  115.     }
  116. }

Documentation generated on Wed, 19 Dec 2018 04:25:11 +0100 by phpDocumentor 1.4.3