| 1 |
<?php |
<?php |
| 2 |
// $Id: posterous.module,v 1.5 2008/12/20 02:42:08 sethfreach Exp $ |
// $Id: posterous.module,v 1.5.2.1 2009/04/03 04:08:34 sethfreach Exp $ |
| 3 |
|
|
| 4 |
define("POSTEROUS_TO_EMAIL", "post@posterous.com"); |
define("POSTEROUS_TO_EMAIL", "post@posterous.com"); |
| 5 |
|
|
| 31 |
function posterous_admin_settings() { |
function posterous_admin_settings() { |
| 32 |
$form['posterous_content_types'] = array( |
$form['posterous_content_types'] = array( |
| 33 |
'#title' => t('Select the content types that may be posted to Posterous'), |
'#title' => t('Select the content types that may be posted to Posterous'), |
| 34 |
'#description' => t('Individual users\' roles still need permission to post, but, even with appropriate roles, these are |
'#description' => t('Individual users\' roles still need permission to post, but, even with appropriate roles, these are the only content types that may be posted to Posterous.'), |
|
the only content types that may be posted to Posterous.'), |
|
| 35 |
'#type' => 'checkboxes', |
'#type' => 'checkboxes', |
| 36 |
'#options' => node_get_types('names'), |
'#options' => node_get_types('names'), |
| 37 |
'#default_value' => variable_get('posterous_content_types', array('story')), |
'#default_value' => variable_get('posterous_content_types', array('story')), |
| 38 |
); |
); |
| 39 |
$form['posterous_allow_on_edit'] = array( |
$form['posterous_allow_on_edit'] = array( |
| 40 |
'#title' => t('Allow Posterous option on node edit?'), |
'#title' => t('Allow Posterous option on node edit?'), |
| 41 |
'#description' => t('Checking this will make the "Send to Posterous also?" option available when editing existing |
'#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.'), |
|
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.'), |
|
| 42 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 43 |
'#default_value' => variable_get('posterous_allow_on_edit', 0), |
'#default_value' => variable_get('posterous_allow_on_edit', 0), |
| 44 |
); |
); |
| 60 |
global $user; |
global $user; |
| 61 |
$form['posterous'] = array( |
$form['posterous'] = array( |
| 62 |
'#title' => t('Posterous'), |
'#title' => t('Posterous'), |
| 63 |
'#description' => t('Selecting this option will also mail this content to post@posterous.com from your account |
'#description' => t('Selecting this option will also mail this content to post@posterous.com from your account email, '. $user->mail .'.'), |
|
email, '. $user->mail .'.'), |
|
| 64 |
'#type' => 'checkboxes', |
'#type' => 'checkboxes', |
| 65 |
'#options' => array( 'post_to_posterous' => t('Send to Posterous also?') ), |
'#options' => array( 'post_to_posterous' => t('Send to Posterous also?') ), |
| 66 |
'#weight' => 5, |
'#weight' => 5, |
| 71 |
// are we editing a previously submitted form AND have we been told to not allow submission here? |
// are we editing a previously submitted form AND have we been told to not allow submission here? |
| 72 |
if ( !empty($form['changed']['#default_value']) && !variable_get('posterous_allow_on_edit', 0) ) { |
if ( !empty($form['changed']['#default_value']) && !variable_get('posterous_allow_on_edit', 0) ) { |
| 73 |
$form['posterous']['#disabled'] = true; |
$form['posterous']['#disabled'] = true; |
| 74 |
$form['posterous']['#description'] = t('This option has been disabled by the site administrator on edits to |
$form['posterous']['#description'] = t('This option has been disabled by the site administrator on edits to previously submitted content.'); |
|
previously submitted content.'); |
|
| 75 |
} |
} |
| 76 |
|
|
| 77 |
} |
} |
| 84 |
if ($node->posterous['post_to_posterous']) { |
if ($node->posterous['post_to_posterous']) { |
| 85 |
switch ($op) { |
switch ($op) { |
| 86 |
case 'update': |
case 'update': |
| 87 |
drupal_set_message("Edits to Drupal content will not edit existing Posterous posts, it will create dupliates. Your |
drupal_set_message("Edits to Drupal content will not edit existing Posterous posts, it will create dupliates. Your post has been sent as indicated, however, to Posterous.", "error"); |
|
post has been sent as indicated, however, to Posterous.", "error"); |
|
| 88 |
case 'insert': |
case 'insert': |
| 89 |
global $user; |
global $user; |
| 90 |
$language = user_preferred_language($account); |
$language = user_preferred_language($account); |