b2evolution PHP Cross Reference Blogging Systems

Source: /inc/tools/views/_email_settings.form.php - 185 lines - 10261 bytes - Text - Print

Description: This file implements the UI view for the general settings. This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**

   3   * This file implements the UI view for the general settings.

   4   *

   5   * This file is part of the evoCore framework - {@link http://evocore.net/}

   6   * See also {@link http://sourceforge.net/projects/evocms/}.

   7   *

   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}

   9   * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.

  10   *

  11   * {@internal License choice

  12   * - If you have received this file as part of a package, please find the license.txt file in

  13   *   the same folder or the closest folder above for complete license terms.

  14   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)

  15   *   then you must choose one of the following licenses before using the file:

  16   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php

  17   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php

  18   * }}

  19   *

  20   * {@internal Open Source relicensing agreement:

  21   * Daniel HAHLER grants Francois PLANQUE the right to license

  22   * Daniel HAHLER's contributions to this file and the b2evolution project

  23   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  24   *

  25   * Halton STEWART grants Francois PLANQUE the right to license

  26   * Halton STEWART's contributions to this file and the b2evolution project

  27   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  28   * }}

  29   *

  30   * @package admin

  31   *

  32   * @version $Id: _email_settings.form.php 396 2011-11-22 21:46:10Z fplanque $

  33   */
  34  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  35  
  36  
  37  /**

  38   * @var User

  39   */
  40  global $current_User;
  41  /**

  42   * @var GeneralSettings

  43   */
  44  global $Settings;
  45  
  46  global $baseurl, $admin_url;
  47  
  48  global $repath_test_output, $action;
  49  
  50  
  51  $Form = new Form( NULL, 'settings_checkchanges' );
  52  
  53  $Form->begin_form( 'fform' );
  54  
  55  $Form->add_crumb( 'emailsettings' );
  56  $Form->hidden( 'ctrl', 'email' );
  57  $Form->hidden( 'tab', 'settings' );
  58  $Form->hidden( 'action', 'settings' );
  59  
  60  if( $current_User->check_perm( 'emails', 'edit' ) )
  61  {
  62      $Form->begin_fieldset( T_('Test saved settings') );
  63  
  64          $url = '?ctrl=email&amp;tab=settings&amp;'.url_crumb('emailsettings').'&amp;action=';
  65          $Form->info_field( T_('Perform tests'),
  66                      '<a href="'.$url.'test_1">['.T_('server connection').']</a>&nbsp;&nbsp;'.
  67                      '<a href="'.$url.'test_2">['.T_('get one returned email').']</a>&nbsp;&nbsp;'.
  68                      '<a href="'.$url.'test_3">['.T_('Copy/Paste an error message').']</a>' );
  69  
  70          if( $action == 'test_3' )
  71          {    // Display a textarea to fill a sample error message
  72              $Form->textarea( 'test_error_message', param( 'test_error_message', 'raw', '' ), 15, T_('Test error message'),
  73                  '', 50, 'large' );
  74              $Form->buttons( array( array( 'submit', 'actionArray[test_3]', T_('Test'), 'SaveButton' ) ) );
  75          }
  76  
  77          if( !empty( $repath_test_output ) )
  78          {
  79              echo '<div style="margin-top:25px"></div>';
  80              // Display scrollable div

  81              echo '<div style="padding: 6px; margin:5px; border: 1px solid #CCC; overflow:scroll; height: 350px">'.$repath_test_output.'</div>';
  82          }
  83  
  84      $Form->end_fieldset();
  85  }
  86  
  87  $Form->begin_fieldset( T_('Settings to decode the returned emails').get_manual_link('return-path-configuration') );
  88  
  89      if( extension_loaded( 'imap' ) )
  90      {
  91          $imap_extenssion_status = T_('(currently loaded)');
  92      }
  93      else
  94      {
  95          $imap_extenssion_status = '<b class="red">'.T_('(currently NOT loaded)').'</b>';
  96      }
  97  
  98      $Form->checkbox_input( 'repath_enabled', $Settings->get('repath_enabled'), T_('Enabled'),
  99          array( 'note' => sprintf(T_('Note: This feature needs the php_imap extension %s.' ), $imap_extenssion_status ) ) );
 100  
 101      $Form->select_input_array( 'repath_method', $Settings->get('repath_method'), array( 'pop3' => T_('POP3'), 'imap' => T_('IMAP'), ), // TRANS: E-Mail retrieval method
 102          T_('Retrieval method'), T_('Choose a method to retrieve the emails.') );
 103  
 104      $Form->text_input( 'repath_server_host', $Settings->get('repath_server_host'), 25, T_('Mail Server'), T_('Hostname or IP address of your incoming mail server.'), array( 'maxlength' => 255 ) );
 105  
 106      $Form->text_input( 'repath_server_port', $Settings->get('repath_server_port'), 5, T_('Port Number'), T_('Port number of your incoming mail server (Defaults: POP3: 110, IMAP: 143, SSL/TLS: 993).'), array( 'maxlength' => 6 ) );
 107  
 108      $Form->radio( 'repath_encrypt', $Settings->get('repath_encrypt'), array(
 109                                                                          array( 'none', T_('None'), ),
 110                                                                          array( 'ssl', T_('SSL'), ),
 111                                                                          array( 'tls', T_('TLS'), ),
 112                                                                      ), T_('Encryption method') );
 113  
 114      $Form->checkbox( 'repath_novalidatecert', $Settings->get( 'repath_novalidatecert' ), T_('Do not validate certificate'),
 115                  T_('Do not validate the certificate from the TLS/SSL server. Check this if you are using a self-signed certificate.') );
 116  
 117      $Form->text_input( 'repath_username', $Settings->get( 'repath_username' ), 25,
 118                  T_('Account Name'), T_('User name for authenticating on your mail server. Usually it\'s your email address or a part before the @ sign.'), array( 'maxlength' => 255 ) );
 119  
 120      if( $current_User->check_perm( 'emails', 'edit' ) )
 121      {
 122          $Form->password_input( 'repath_password', $Settings->get( 'repath_password' ), 25,
 123                      T_('Password'), array( 'maxlength' => 255, 'note' => T_('Password for authenticating on your mail server.') ) );
 124      }
 125  
 126      $Form->checkbox( 'repath_delete_emails', $Settings->get( 'repath_delete_emails' ), T_('Delete processed emails'),
 127                  T_('Check this if you want processed messages to be deleted from server after successful processing.') );
 128  
 129      $Form->textarea( 'repath_subject', $Settings->get( 'repath_subject' ), 5, T_('Strings to match in titles to identify return path emails'),
 130                  T_('Any email that has any of these strings in the title will be detected by b2evolution as the returned emails'), 50, 'large' );
 131  
 132      $Form->textarea( 'repath_body_terminator', $Settings->get('repath_body_terminator'), 5,
 133                  T_('Body Terminator'), T_('Starting from any of these strings, everything will be ignored, including these strings.'), 50, 'large' );
 134  
 135      $Form->textarea( 'repath_errtype', $Settings->get( 'repath_errtype' ), 15, T_('Error message decoding configuration'),
 136                  T_('The first letter means one of the following:<br />S: Spam suspicion<br />P: Permament error<br />T: Temporary error<br />C: Configuration error<br />U: Unknown error (default)<br />The string after the space is a case-insensitive error text.'), 50, 'large' );
 137  
 138  $Form->end_fieldset();
 139  
 140  $Form->begin_fieldset( T_( 'Email notifications' ).get_manual_link( 'email-notification-settings' ) );
 141      // Set notes for notifications sender settings which shows the users custom settings information

 142      $notification_sender_email_note = '';
 143      $notification_sender_name_note = '';
 144      if( $current_User->check_perm( 'users', 'edit' ) )
 145      { // Show infomration and action buttons only for users with edit users permission
 146          $users_url = url_add_param( $admin_url, 'ctrl=users&filter=new', '&' );
 147          $redirect_to = rawurlencode( regenerate_url( '', '', '', '&' ) );
 148          $remove_customization_url = url_add_param( $admin_url, 'ctrl=users&action=remove_sender_customization&'.url_crumb( 'users' ), '&' );
 149          $remove_customization = ' - <a href="%s" class="ActionButton" style="float:none">'.T_('remove customizations').'</a>';
 150  
 151          $notification_sender_email = $Settings->get( 'notification_sender_email' );
 152          $custom_sender_email_count = count_users_with_custom_setting( 'notification_sender_email', $notification_sender_email );
 153          if( $custom_sender_email_count > 0 )
 154          { // There are users with custom sender email settings
 155              $sender_email_remove_customization = sprintf( $remove_customization, url_add_param( $remove_customization_url, 'type=sender_email&redirect_to='.$redirect_to, '&' ) );
 156              $notification_sender_email_note = get_icon( 'warning_yellow' ).' '.sprintf( T_('<a href="%s">%d users</a> have different custom address'), url_add_param( $users_url, 'custom_sender_email=1', '&' ), $custom_sender_email_count ).$sender_email_remove_customization;
 157          }
 158  
 159          $notification_sender_name = $Settings->get( 'notification_sender_name' );
 160          $custom_sender_name_count = count_users_with_custom_setting( 'notification_sender_name', $notification_sender_name );
 161          if( $custom_sender_name_count > 0 )
 162          { // There are users with custom sender name settings
 163              $sender_name_remove_customization = sprintf( $remove_customization, url_add_param( $remove_customization_url, 'type=sender_name&redirect_to='.$redirect_to, '&' ) );
 164              $notification_sender_name_note = get_icon( 'warning_yellow' ).' '.sprintf( T_('<a href="%s">%d users</a> have different custom name'), url_add_param( $users_url, 'custom_sender_name=1', '&' ), $custom_sender_name_count ).$sender_name_remove_customization;
 165          }
 166      }
 167  
 168      // Display settings input fields

 169      $Form->text_input( 'notification_sender_email', $Settings->get( 'notification_sender_email' ), 50, T_( 'Sender email address' ), $notification_sender_email_note, array( 'maxlength' => 127, 'required' => true ) );
 170      $Form->text_input( 'notification_sender_name', $Settings->get( 'notification_sender_name' ), 50, T_( 'Sender name' ), $notification_sender_name_note, array( 'maxlength' => 127, 'required' => true ) );
 171      $Form->text_input( 'notification_return_path', $Settings->get( 'notification_return_path' ), 50, T_( 'Return path' ), '', array( 'maxlength' => 127, 'required' => true ) );
 172      $Form->text_input( 'notification_short_name', $Settings->get( 'notification_short_name' ), 50, T_( 'Short site name' ), '', array( 'maxlength' => 127, 'required' => true ) );
 173      $Form->text_input( 'notification_long_name', $Settings->get( 'notification_long_name' ), 50, T_( 'Long site name' ), '', array( 'maxlength' => 255 ) );
 174      $Form->text_input( 'notification_logo', $Settings->get( 'notification_logo' ), 50, T_( 'Site logo (URL)' ), '', array( 'maxlength' => 5000 ) );
 175  $Form->end_fieldset();
 176  
 177  if( $current_User->check_perm( 'emails', 'edit' ) )
 178  {
 179      $Form->end_form( array(
 180          array( 'submit', '', T_('Update'), 'SaveButton' ),
 181          array( 'reset', '', T_('Reset'), 'ResetButton' ),
 182          ) );
 183  }
 184  
 185  ?>

title

Description

title

Description

title

Description

title

title

Body