| 1 |
<?php |
<?php |
| 2 |
// $Id: posterous.module,v 1.3 2008/07/19 14:31:54 sethfreach Exp $ |
// $Id: posterous.module,v 1.4 2008/12/19 17:43:31 sethfreach Exp $ |
| 3 |
|
|
| 4 |
define("POSTEROUS_TO_EMAIL", "post@posterous.com"); |
define("POSTEROUS_TO_EMAIL", "post@posterous.com"); |
| 5 |
|
|
| 40 |
'#options' => node_get_types('names'), |
'#options' => node_get_types('names'), |
| 41 |
'#default_value' => variable_get('posterous_content_types', array('story')), |
'#default_value' => variable_get('posterous_content_types', array('story')), |
| 42 |
); |
); |
| 43 |
$form['array_filter'] = array( |
$form['posterous_allow_on_edit'] = array( |
| 44 |
'#type' => 'hidden', |
'#title' => t('Allow Posterous option on node edit?'), |
| 45 |
|
'#description' => t('Checking this will make the "Send to Posterous also?" option available when editing existing content (at node/$nid/edit). This will not edit the content at Posterous, however, it will create a new (and presumably, similar, slightly edited) Posterous post.'), |
| 46 |
|
'#type' => 'checkbox', |
| 47 |
|
'#default_value' => variable_get('posterous_allow_on_edit', 0), |
| 48 |
); |
); |
| 49 |
|
|
| 50 |
return system_settings_form($form); |
return system_settings_form($form); |
| 56 |
//and this user has permission to post? |
//and this user has permission to post? |
| 57 |
if (user_access('post to posterous')) { |
if (user_access('post to posterous')) { |
| 58 |
global $user; |
global $user; |
| 59 |
|
$dis = variable_get('posterous_allow_on_edit', 0) ? FALSE : TRUE; |
| 60 |
$form['posterous'] = array( |
$form['posterous'] = array( |
| 61 |
'#title' => t('Posterous'), |
'#title' => t('Posterous'), |
| 62 |
'#description' => t('Selecting this option will also mail this content to post@posterous.com from your account email, '. $user->mail .'.'), |
'#description' => t('Selecting this option will also mail this content to post@posterous.com from your account email, '. $user->mail .'.'), |
| 63 |
'#type' => 'checkboxes', |
'#type' => 'checkboxes', |
| 64 |
'#options' => array( 'post_to_posterous' => t('Send to Posterous also?') ), |
'#options' => array( 'post_to_posterous' => t('Send to Posterous also?') ), |
| 65 |
'#weight' => 5, |
'#weight' => 5, |
| 66 |
|
'#disabled' => $dis, |
| 67 |
); |
); |
| 68 |
} |
} |
| 69 |
} |
} |
| 76 |
drupal_set_message("Only new content will be posted to Posterous. Edits to Drupal content will not edit existing Posterous posts; it would create dupliates.", "error"); |
drupal_set_message("Only new content will be posted to Posterous. Edits to Drupal content will not edit existing Posterous posts; it would create dupliates.", "error"); |
| 77 |
break; |
break; |
| 78 |
case 'insert': |
case 'insert': |
| 79 |
if ($node->posterous['post_to_posterous'] == 'post_to_posterous') { |
if ($node->posterous['post_to_posterous']) { |
| 80 |
global $user; |
global $user; |
| 81 |
$mailkey = 'posterous_email'; |
$mailkey = 'posterous_email'; |
| 82 |
$headers = array(); |
$headers = array(); |