b2evolution PHP Cross Reference Blogging Systems

Source: /inc/settings/views/_eblog.form.php - 155 lines - 7579 bytes - Text - Print

Description: This file implements the UI view for Post by Email 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 Post by Email 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   *
  10   * @package admin
  11   *
  12   * @version $Id: _eblog.form.php 6136 2014-03-08 07:59:48Z manuel $
  13   */
  14  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  15  
  16  
  17  /**
  18   * @var User
  19   */
  20  global $current_User;
  21  /**
  22   * @var GeneralSettings
  23   */
  24  global $Settings;
  25  
  26  global $Plugins, $baseurl, $eblog_test_output, $eblog_saved_test_mode_value, $comment_allowed_tags;
  27  
  28  
  29  $Form = new Form( NULL, 'remotepublish_checkchanges' );
  30  
  31  $Form->begin_form('fform');
  32  
  33  $Form->add_crumb( 'globalsettings' );
  34  $Form->hidden( 'ctrl', 'remotepublish' );
  35  $Form->hidden( 'tab', 'eblog' );
  36  $Form->hidden( 'action', 'update' );
  37  
  38  $Form->begin_fieldset( T_('Test saved settings') );
  39  
  40      $url = '?ctrl=remotepublish&amp;tab=eblog&amp;'.url_crumb('globalsettings').'&amp;action=';
  41      $Form->info_field( T_('Perform tests'),
  42                  '<a href="'.$url.'test_1">['.T_('server connection').']</a>&nbsp;&nbsp;
  43                  <a href="'.$url.'test_2">['.T_('simulate posting').']</a>&nbsp;&nbsp;
  44                  <a href="'.$url.'test_3">['.T_('create one post').']</a>' );
  45  
  46      if( !empty($eblog_test_output) )
  47      {
  48          echo '<div style="margin-top:25px"></div>';
  49          if( $action == 'test_2' )
  50          {
  51              echo '<div class="red center">'.T_('This is just a test run. Nothing will be posted to the database nor
  52   will your inbox be altered').'</div>';
  53          }
  54          // Display scrollable div
  55          echo '<div style="padding: 6px; margin:5px; border: 1px solid #CCC; overflow:scroll; height: 350px">'.$eblog_test_output.'</div>';
  56      }
  57      
  58  $Form->end_fieldset();
  59  
  60  $Form->begin_fieldset( T_('General settings').get_manual_link('blog_by_email') );
  61  
  62      if( extension_loaded( 'imap' ) )
  63      {
  64          $imap_extenssion_status = T_('(INSTALLED)');
  65      }
  66      else
  67      {
  68          $imap_extenssion_status = '<b class="red">'.T_('(NOT INSTALLED)').'</b>';
  69      }
  70  
  71      $Form->checkbox_input( 'eblog_enabled', $Settings->get('eblog_enabled'), T_('Enable Post by email'),
  72          array( 'note' => sprintf(T_('Note: This feature needs the php_imap extension %s.' ), $imap_extenssion_status) ) );
  73  
  74      $eblog_test_mode_value = isset($eblog_saved_test_mode_value) ? $eblog_saved_test_mode_value : $Settings->get('eblog_test_mode');
  75      $Form->checkbox_input( 'eblog_test_mode', $eblog_test_mode_value, T_('Test Mode'),
  76                  array( 'note' => T_('Check to run Post by Email in test mode. Nothing will be posted to the database nor will your inbox be altered.' ) ) );
  77  
  78      // sam2kb> TODO: javascript to preset default eblog_server_port when eblog_method and/or eblog_encrypt change
  79      $Form->select_input_array( 'eblog_method', $Settings->get('eblog_method'), array( 'pop3' => T_('POP3'), 'imap' => T_('IMAP'), ), // TRANS: E-Mail retrieval method
  80          T_('Retrieval method'), T_('Choose a method to retrieve the emails.') );
  81  
  82      $Form->text_input( 'eblog_server_host', $Settings->get('eblog_server_host'), 25, T_('Mail Server'), T_('Hostname or IP address of your incoming mail server.'), array( 'maxlength' => 255 ) );
  83  
  84      $Form->text_input( 'eblog_server_port', $Settings->get('eblog_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 ) );
  85  
  86      $Form->radio( 'eblog_encrypt', $Settings->get('eblog_encrypt'), array(
  87                                                                          array( 'none', T_('None'), ),
  88                                                                          array( 'ssl', T_('SSL'), ),
  89                                                                          array( 'tls', T_('TLS'), ),
  90                                                                      ), T_('Encryption method') );
  91  
  92      $Form->checkbox( 'eblog_novalidatecert', $Settings->get('eblog_novalidatecert'), T_('Do not validate certificate'),
  93                  T_('Do not validate the certificate from the TLS/SSL server. Check this if you are using a self-signed certificate.') );
  94  
  95      $Form->text_input( 'eblog_username', $Settings->get('eblog_username'), 25,
  96                  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 ) );
  97  
  98      $Form->password_input( 'eblog_password', $Settings->get('eblog_password'), 25,
  99                  T_('Password'), array( 'maxlength' => 255, 'note' => T_('Password for authenticating on your mail server.') ) );
 100  
 101      $Form->checkbox( 'eblog_delete_emails', $Settings->get('eblog_delete_emails'), T_('Delete processed emails'),
 102                  T_('Check this if you want processed messages to be deleted form server after successful processing.') );
 103  
 104  $Form->end_fieldset();
 105  
 106  $Form->begin_fieldset( T_('Posting settings') );
 107  
 108      // TODO: provide a list of categories to choose from
 109      $Form->text_input( 'eblog_default_category', $Settings->get('eblog_default_category'), 5,
 110                  T_('Default Category ID'), sprintf( T_('This is a default category for your posts.').'<br />'.
 111                  T_('You can use the following code in message body to define categories: %s. In this example 2 will be main category and 5, 47 extra categories.'), '<b>&lt;category&gt;2, 5, 47&lt;/category&gt;</b>' ), array( 'maxlength' => 6 ) );
 112  
 113      $Form->text_input( 'eblog_default_title', $Settings->get('eblog_default_title'), 50,
 114                  T_('Default title'), sprintf( T_('This is a default title for your posts.').'<br />'.
 115                  T_('You can use the following code in message body to define post title: %s.'), '<b>&lt;title&gt;Post title here&lt;/title&gt;</b>' ), array( 'maxlength' => 255 ) );
 116  
 117      $Form->checkbox( 'eblog_add_imgtag', $Settings->get('eblog_add_imgtag'), T_('Add &lt;img&gt; tags'),
 118                  T_('Display image attachments using &lt;img&gt; tags (instead of linking them through file manager).') );
 119  
 120      $Form->text_input( 'eblog_subject_prefix', $Settings->get('eblog_subject_prefix'), 15,
 121                  T_('Subject Prefix'), T_('Email subject must start with this prefix to be imported, messages that don\'t have this tag will be skipped.'), array( 'maxlength' => 255 ) );
 122  
 123      $Form->text_input( 'eblog_body_terminator', $Settings->get('eblog_body_terminator'), 15,
 124                  T_('Body Terminator'), T_('Starting from this string, everything will be ignored, including this string.').
 125                  '<br />'.T_('You can use this to remove signature from message body.'), array( 'maxlength' => 255 ) );
 126  
 127      /* Automatically select a blog from where get plugins collection settings ( current_User should be able to create post on the selected blog )*/
 128      $autoselect_blog = autoselect_blog( 'blog_post_statuses', 'edit' );
 129      $BlogCache = & get_BlogCache();
 130      $setting_Blog = & $BlogCache->get_by_ID( $autoselect_blog );
 131      $Form->info( T_('Text Renderers'), $Plugins->get_renderer_checkboxes( $Settings->get('eblog_renderers'), array( 'name_prefix' => 'eblog_', 'Blog' => & $setting_Blog ) ) );
 132  
 133  $Form->end_fieldset();
 134  
 135  $Form->begin_fieldset( T_('HTML messages') );
 136  
 137  // sam2kb> TODO: display some warning message about potential risk with HTML emails
 138  $Form->checkbox( 'eblog_html_enabled', $Settings->get('eblog_html_enabled'), T_('Enable HTML messages'),
 139                  T_('Check this if you want HTML messages to be processed and posted in your blog.') );
 140  
 141  $Form->checkbox( 'eblog_html_tag_limit', $Settings->get('eblog_html_tag_limit'), T_('Limit allowed tags'),
 142                  T_('Check this if you want to limit allowed HTML tags to the following list:').
 143                  '<br /><b>'.htmlspecialchars(str_replace( '>', '> ', $comment_allowed_tags )).'</b>' );
 144  
 145  $Form->end_fieldset();
 146  
 147  if( $current_User->check_perm( 'options', 'edit' ) )
 148  {
 149      $Form->end_form( array(
 150          array( 'submit', '', T_('Update'), 'SaveButton' ),
 151          array( 'reset', '', T_('Reset'), 'ResetButton' ),
 152          ) );
 153  }
 154  
 155  ?>

title

Description

title

Description

title

Description

title

title

Body