/[drupal]/contributions/modules/ezmlm/ezmlm.module
ViewVC logotype

Diff of /contributions/modules/ezmlm/ezmlm.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.18.4.2, Sat Dec 29 15:48:02 2007 UTC revision 1.18.4.3, Sat May 31 19:33:59 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: ezmlm.module,v 1.18.4.1 2007/12/10 21:32:36 hutch Exp $  // $Id: ezmlm.module,v 1.18.4.2 2007/12/29 15:48:02 hutch Exp $
3  // $Name: DRUPAL-5 $  // $Name: DRUPAL-5 $
4  // for drupal 5.x  // for drupal 5.x
5    
# Line 146  function ezmlm_settings() { Line 146  function ezmlm_settings() {
146      );      );
147    
148      $lists = variable_get('ezmlmmailinglists', '');      $lists = variable_get('ezmlmmailinglists', '');
149      if(is_array($lists) ) {      if (is_array($lists)) {
150        foreach ($lists as $list_text => $list_email) {        foreach ($lists as $list_text => $list_email) {
151          $form['ezmlm_delete'][$list_text] = array(          $form['ezmlm_delete'][$list_text] = array(
152            '#type' => 'checkbox',            '#type' => 'checkbox',
# Line 273  function _ezmlm_subscribe_form() { Line 273  function _ezmlm_subscribe_form() {
273      );      );
274      $ct++;      $ct++;
275    }    }
276    $form['ezmlm_email'] = array (    $form['ezmlm_email'] = array(
277      '#type' => 'textfield',      '#type' => 'textfield',
278      '#title' => t('Your email address'),      '#title' => t('Your email address'),
279      '#default_value' => ($user->mail ? $user->mail : ''),      '#default_value' => ($user->mail ? $user->mail : ''),
# Line 291  function _ezmlm_subscribe_form_validate( Line 291  function _ezmlm_subscribe_form_validate(
291    $arr = array();    $arr = array();
292    $lists = _ezmlm_get_lists();    $lists = _ezmlm_get_lists();
293    $ct = 1;    $ct = 1;
294    foreach ($form_values as $key=>$address) {    foreach ($form_values as $key => $address) {
295      $address = trim($address);      $address = trim($address);
296      if( $key == "ezmlm_list_$ct" && $address && in_array($address, $lists)) {      if ($key == "ezmlm_list_$ct" && $address && in_array($address, $lists)) {
297         $arr[] = $address;         $arr[] = $address;
298      }      }
299      $ct++;      $ct++;
300    }    }
301    if ( count($arr) < 1 ) {    if (count($arr) < 1) {
302        form_set_error('', t('No lists selected!'));        form_set_error('', t('No lists selected!'));
303    }    }
304    if ( $error = user_validate_mail($form_values['ezmlm_email'])) {    if ($error = user_validate_mail($form_values['ezmlm_email'])) {
305      form_set_error('ezmlm_email', $error);      form_set_error('ezmlm_email', $error);
306    }    }
307  }  }
# Line 311  function _ezmlm_subscribe_form_submit($f Line 311  function _ezmlm_subscribe_form_submit($f
311    $arr = array();    $arr = array();
312    $ct = 1;    $ct = 1;
313    // get the selected mailing list addresses    // get the selected mailing list addresses
314    foreach ($form_values as $key=>$address) {    foreach ($form_values as $key => $address) {
315      $address = trim($address);      $address = trim($address);
316      if( $key == "ezmlm_list_$ct" && $address && in_array($address, $lists)) {      if ($key == "ezmlm_list_$ct" && $address && in_array($address, $lists)) {
317        $arr[] = $address;        $arr[] = $address;
318     }     }
319      $ct++;      $ct++;
320    }    }
321    $email = trim($form_values['ezmlm_email']);    $email = trim($form_values['ezmlm_email']);
322    $ret = _ezmlm_subscribe_process($arr, $email);    $ret = _ezmlm_subscribe_process($arr, $email);
323    if ( is_array($ret)) {    if (is_array($ret)) {
324      $output = (t('Please check your mail at %mail to confirm registration of:', array('%mail' => $email)));      $output = (t('Please check your mail at %mail to confirm registration of:', array('%mail' => $email)));
325      drupal_set_message($output . "<br>" . implode('<br>', $ret));      drupal_set_message($output ."<br>". implode('<br>', $ret));
326    }    }
327    else {    else {
328      drupal_set_message($ret, 'error');      drupal_set_message($ret, 'error');
# Line 351  function _ezmlm_subscribe_process($subs, Line 351  function _ezmlm_subscribe_process($subs,
351        }        }
352      }      }
353    }    }
354    return($mylists);    return ($mylists);
355  }  }
356    
357  /**  /**

Legend:
Removed from v.1.18.4.2  
changed lines
  Added in v.1.18.4.3

  ViewVC Help
Powered by ViewVC 1.1.2