github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

mfb / vozmob

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 9
    • 7
  • Source
  • Commits
  • Network (7)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Tree: 3cd2e64

click here to add a description

click here to add a homepage

  • Branches (2)
    • 0.1
    • master
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Voces Moviles / Mobile Voices — Read more

  cancel

http://www.mobilevoices.net/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

bugs... grr 
Gabriela Rodriguez (author)
Fri May 22 12:01:31 -0700 2009
commit  3cd2e645e63192e174a7710bdeb3000c26b44efa
tree    567e252eab2f45997d8f9bcf19d32aaed6ce3cfb
parent  f4379affd8ae4e3a1c08863f0d2692f05a79d932
vozmob / html / sites / all / modules / sms_registration / sms_registration.module html/sites/all/modules/sms_registration/sms_registration.module
100644 189 lines (161 sloc) 8.47 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
// $Id: sms_registration.module
 
 
/**
 * Implementation of hook_perm().
 */
function sms_registration_perm() {
  return array('administer sms registration');
}
 
 
/**
 * Implementation of hook_menu().
 */
function sms_registration_menu() {
 
  $items = array();
 
  $items['admin/content/sms_registration'] = array(
    'title' => t('SMS Registration'),
    'description' => t('Manage mailboxes that will be receiving the registration.'),
    'page callback' => 'sms_registration_list_mailboxes',
    'access arguments' => array('administer sms_registration'),
    'file' => 'sms_registration.admin.inc',
  );
 
$items['admin/content/sms_registration/list'] = array(
    'title' => t('List'),
    'description' => t('Manage mailboxes and retrieve messages.'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'access arguments' => array('administer sms registration'),
    'weight' => -10,
  );
 
  $items['admin/content/sms_registration/add'] = array(
    'title' => t('Add mailbox'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('sms_registration_add_edit_mailbox', NULL),
    'access arguments' => array('administer sms_registration'),
    'type' => MENU_LOCAL_TASK,
    'file' => 'sms_registration.admin.inc',
  );
 
  $items['admin/content/sms_registration/clone/%'] = array(
    'title' => t('Add mailbox'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('sms_registration_add_edit_mailbox', 4, TRUE),
    'access arguments' => array('administer sms_registration'),
    'type' => MENU_CALLBACK,
    'file' => 'sms_registration.admin.inc',
  );
 
  $items['admin/content/sms_registration/retrieve/%'] = array(
    'title' => t('Retrieve'),
    'page callback' => 'sms_registration_admin_retrieve',
    'page arguments' => array(4),
    'access arguments' => array('administer sms_registration'),
    'type' => MENU_CALLBACK,
    'file' => 'sms_registration.retrieve.inc',
  );
 
  $items['admin/content/sms_registration/edit/%'] = array(
    'title' => t('Edit mailbox'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('sms_registration_add_edit_mailbox', 4),
    'access arguments' => array('administer sms_registration'),
    'type' => MENU_CALLBACK,
    'file' => 'sms_registration.admin.inc',
  );
 
  $items['admin/content/sms_registration/delete/%'] = array(
    'title' => t('Delete mailbox'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('sms_registration_admin_delete_confirm', 4),
    'access arguments' => array('administer sms_registration'),
    'type' => MENU_CALLBACK,
    'file' => 'sms_registration.admin.inc',
  );
 
  $items['admin/settings/sms_registration'] = array(
    'title' => 'sms_registration',
    'description' => t('Set the cron limit.'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('sms_registration_admin_settings'),
    'access arguments' => array('administer sms_registration'),
    'file' => 'sms_registration.admin.inc',
  );
 
  return $items;
}
 
 
/**
 * Implementation of hook_help().
 */
function sms_registration_help($path = 'admin/help#sms_registration', $arg) {
  $output = '';
  $link->add = l(t('Add mailbox'), 'admin/content/sms_registration/add');
 
  $commands_list = '<dl>';
  foreach ($commands as $command) {
    $commands_list .= '<dt>'. $command['command'] .'</dt>';
    $commands_list .= '<dl>'. $command['description'] .'</dl>';
  }
  $commands_list .= '</dl>';
 
  switch ($path) {
    case 'admin/help#sms_registration':
      $output = '<p>'. t('The sms_registration module allows users to register themselves via e-mail. This module is useful because e-mail is the preferred method of communication by community members.') .'</p>';
      $output .= '<p>'. t('The sms_registration module requires the use of a custom mailbox. Administrators can add mailboxes that should be customized to meet the needs of a mailing list. This mailbox will then be checked on every cron job. Administrators may also initiate a manual retrieval of messages.') .'</p>';
      $output .= '<p>'. t('This is particularly useful when you want multiple sets of default commands. For example , if you want to authenticate based on a non-standard mail header like Sender: which is useful for accepting submissions from a listserv. Authentication is usually based on the From: e-mail address. Administrators can edit the individual mailboxes when they administer sms_registration.') .'</p>';
      $output .= t('<p>You can</p>
<ul>
<li><a href="@run-cron">run cron</a> to retrieve messages from all cron enabled mailboxes.</li>
<li>list mailboxes at <a href="@admin-sms_registration">Administer &gt;&gt; Content management &gt;&gt; sms_registration</a>.</li>
<li>add a mailbox at <a href="@admin-sms_registration-add">Administer &gt;&gt; Content management &gt;&gt; sms_registration &gt;&gt; Add mailbox.</a></li>
<li>set default commands, (password, type, taxonomy, promote, status), for how to work with incoming mail at <a href="%admin-sms_registration">Administer &gt;&gt; Content management &gt;&gt; sms_registration</a> and select <strong>edit</strong> for the email address being handled. Set commands in the default command field.</li>
<li>post email, such as from a mailing list, to a forum by adding the term id (number found in the URL) to the default commands using <strong>tid: #</strong>.</li>
<li>alter sms_registration settings (default content type and cron threshold) at <a href="@admin-sms_registration-settings">Administer &gt;&gt; Site configuration &gt;&gt; sms_registration</a>.</li>
</ul>',
   array(
     '@run-cron' => url('admin/logs/status/run-cron'),
     '@admin-sms_registration-add' => url('admin/content/sms_registration/add'),
     '@admin-sms_registration' => url('admin/content/sms_registration'),
     '@admin-sms_registration-settings' => url('admin/settings/sms_registration'),
   ));
      $output .= '<h3 id="commands">'. t('Useful Commands') .'</h3>';
      $output .= $commands_list;
      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%sms_registration">sms_registration page</a>.', array('%sms_registration' => 'http://www.drupal.org/handbook/modules/sms_registration/')) .'</p>';
      return $output;
    case 'admin/content/sms_registration':
      return t('The sms_registration module allows registered users to create or edit nodes and comments via email. Authentication is usually based on the From: email address. There is also an email filter that can be used to prettify incoming email. Users may post taxonomy terms, teasers, and other node parameters using the Command capability.');
    case 'admin/content/sms_registration/add':
      return t('Add a mailbox whose mail you wish to import into Drupal. Can be IMAP, POP3, or local folder.');
    case 'admin/content/sms_registration/edit/%':
      return t('Edit the mailbox whose mail you wish to import into Drupal. Can be IMAP, POP3, or local folder.');
    case 'admin/settings/sms_registration':
      return t('The sms_registration module allows registered users to create or edit nodes and comments via e-mail.');
  }
}
 
/**
 * Implementation of hook_init to add sms_registration.css
 */
function sms_registration_init() {
  drupal_add_css(drupal_get_path('module', 'sms_registration') .'/sms_registration.css');
  return;
}
 
// The following functions are called by both sms_registration.admin.inc and sms_registration.retrieve.inc so they
// are defined here to make them available to both
 
/**
 * Establish a connection to the mailbox specified by the array $mailbox
 */
function sms_registration_open_mailbox($mailbox) {
 
  if ($mailbox['domain']) {
    if ($mailbox['imap'] == 1) {
      $box = '{'. $mailbox['domain'] .':'. $mailbox['port'] . $mailbox['extraimap'] .'}'. $mailbox['folder'];
    }
    else {
      $box = '{'. $mailbox['domain'] .':'. $mailbox['port'] .'/pop3'. $mailbox['extraimap'] .'}'. $mailbox['folder'];
    }
    $result = imap_open($box, $mailbox['name'], $mailbox['pass']);
    $err = 'domain';
  }
  else {
    $box = $mailbox['folder'];
    $result = imap_open($box, '', '');
  }
 
  return $result;
 
}
 
function sms_registration_mail_alter(&$message){
 
$options = $message['params']['options'];
watchdog('debug','message es:');
watchdog('debug', print_r($message, TRUE));
if ($options['action'] == 'registration') {
$message['headers']['Return-Path'] = 'vozmob.sandbox.reg@gmail.com';
}
}
 
?>
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server