Merge remote-tracking branch 'friendica/master'
commit
f8c9d26dd3
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 134 B |
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Name: BugLink
|
||||||
|
* Description: Show link to Friendica bug site at bottom of page
|
||||||
|
* Version: 1.0
|
||||||
|
* Author: Mike Macgirvin <mike@macgirvin.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function buglink_install() { register_hook('page_end', 'addon/buglink/buglink.php', 'buglink_active'); }
|
||||||
|
|
||||||
|
|
||||||
|
function buglink_uninstall() { unregister_hook('page_end', 'addon/buglink/buglink.php', 'buglink_active'); }
|
||||||
|
|
||||||
|
function buglink_active(&$a,&$b) { $b .= '<div style="position: fixed; bottom: 5px; left: 5px;"><a href="http://bugs.friendica.com" title="' . t('Report Bug') . '"><img src="addon/buglink/bug-x.gif" alt="' . t('Report Bug') . '" /></a></div>'; }
|
|
@ -17,7 +17,7 @@ function calc_uninstall() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function calc_app_menu($a,&$b) {
|
function calc_app_menu($a,&$b) {
|
||||||
$b['app_menu'] .= '<div class="app-title"><a href="calc">Calculator</a></div>';
|
$b['app_menu'][] = '<div class="app-title"><a href="calc">Calculator</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ function convert_uninstall() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function convert_app_menu($a,&$b) {
|
function convert_app_menu($a,&$b) {
|
||||||
$b['app_menu'] .= '<div class="app-title"><a href="convert">Units Conversion</a></div>';
|
$b['app_menu'][] = '<div class="app-title"><a href="convert">Units Conversion</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
facebook.tgz
BIN
facebook.tgz
Binary file not shown.
|
@ -48,7 +48,8 @@ define('FACEBOOK_MAXPOSTLEN', 420);
|
||||||
|
|
||||||
|
|
||||||
function facebook_install() {
|
function facebook_install() {
|
||||||
register_hook('post_local_end', 'addon/facebook/facebook.php', 'facebook_post_hook');
|
register_hook('post_local', 'addon/facebook/facebook.php', 'facebook_post_local');
|
||||||
|
register_hook('notifier_normal', 'addon/facebook/facebook.php', 'facebook_post_hook');
|
||||||
register_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
|
register_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
|
||||||
register_hook('connector_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
|
register_hook('connector_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
|
||||||
register_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
|
register_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
|
||||||
|
@ -57,12 +58,16 @@ function facebook_install() {
|
||||||
|
|
||||||
|
|
||||||
function facebook_uninstall() {
|
function facebook_uninstall() {
|
||||||
unregister_hook('post_local_end', 'addon/facebook/facebook.php', 'facebook_post_hook');
|
unregister_hook('post_local', 'addon/facebook/facebook.php', 'facebook_post_local');
|
||||||
|
unregister_hook('notifier_normal', 'addon/facebook/facebook.php', 'facebook_post_hook');
|
||||||
unregister_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
|
unregister_hook('jot_networks', 'addon/facebook/facebook.php', 'facebook_jot_nets');
|
||||||
unregister_hook('connector_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
|
unregister_hook('connector_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
|
||||||
unregister_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
|
|
||||||
unregister_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
|
unregister_hook('cron', 'addon/facebook/facebook.php', 'facebook_cron');
|
||||||
unregister_hook('queue_predeliver', 'addon/facebook/facebook.php', 'fb_queue_hook');
|
unregister_hook('queue_predeliver', 'addon/facebook/facebook.php', 'fb_queue_hook');
|
||||||
|
|
||||||
|
// hook moved
|
||||||
|
unregister_hook('post_local_end', 'addon/facebook/facebook.php', 'facebook_post_hook');
|
||||||
|
unregister_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,7 +145,7 @@ function fb_get_self($uid) {
|
||||||
|
|
||||||
function fb_get_friends($uid) {
|
function fb_get_friends($uid) {
|
||||||
|
|
||||||
$r = q("SELECT `id` FROM `user` WHERE `uid` = %d AND `account_expired` = 0 LIMIT 1",
|
$r = q("SELECT `uid` FROM `user` WHERE `uid` = %d AND `account_expired` = 0 LIMIT 1",
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
if(! count($r))
|
if(! count($r))
|
||||||
|
@ -209,13 +214,14 @@ function fb_get_friends($uid) {
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// create contact record
|
// create contact record
|
||||||
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `addr`, `alias`, `notify`, `poll`,
|
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
||||||
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
`name`, `nick`, `photo`, `network`, `rel`, `priority`,
|
||||||
`writable`, `blocked`, `readonly`, `pending` )
|
`writable`, `blocked`, `readonly`, `pending` )
|
||||||
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
|
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($jp->link),
|
dbesc($jp->link),
|
||||||
|
dbesc(normalise_link($jp->link)),
|
||||||
dbesc(''),
|
dbesc(''),
|
||||||
dbesc(''),
|
dbesc(''),
|
||||||
dbesc($jp->id),
|
dbesc($jp->id),
|
||||||
|
@ -429,6 +435,16 @@ function facebook_cron($a,$b) {
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
if(get_pconfig($rr['uid'],'facebook','no_linking'))
|
if(get_pconfig($rr['uid'],'facebook','no_linking'))
|
||||||
continue;
|
continue;
|
||||||
|
$ab = intval(get_config('system','account_abandon_days'));
|
||||||
|
if($ab > 0) {
|
||||||
|
$z = q("SELECT `uid` FROM `user` WHERE `uid` = %d AND `login_date` > UTC_TIMESTAMP() - INTERVAL %d DAY LIMIT 1",
|
||||||
|
intval($rr['uid']),
|
||||||
|
intval($ab)
|
||||||
|
);
|
||||||
|
if(! count($z))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// check for new friends once a day
|
// check for new friends once a day
|
||||||
$last_friend_check = get_pconfig($rr['uid'],'facebook','friend_check');
|
$last_friend_check = get_pconfig($rr['uid'],'facebook','friend_check');
|
||||||
if($last_friend_check)
|
if($last_friend_check)
|
||||||
|
@ -472,6 +488,10 @@ function facebook_jot_nets(&$a,&$b) {
|
||||||
|
|
||||||
function facebook_post_hook(&$a,&$b) {
|
function facebook_post_hook(&$a,&$b) {
|
||||||
|
|
||||||
|
|
||||||
|
if($b['deleted'] || ($b['created'] !== $b['edited']))
|
||||||
|
return;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post to Facebook stream
|
* Post to Facebook stream
|
||||||
*/
|
*/
|
||||||
|
@ -483,18 +503,16 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
$reply = false;
|
$reply = false;
|
||||||
$likes = false;
|
$likes = false;
|
||||||
|
|
||||||
if((local_user()) && (local_user() == $b['uid'])) {
|
$toplevel = (($b['id'] == $b['parent']) ? true : false);
|
||||||
|
|
||||||
// Facebook is not considered a private network
|
if(strstr($b['postopts'],'facebook')) {
|
||||||
if($b['prvnets'] && $b['private'])
|
|
||||||
return;
|
|
||||||
|
|
||||||
$linking = ((get_pconfig(local_user(),'facebook','no_linking')) ? 0 : 1);
|
$linking = ((get_pconfig($b['uid'],'facebook','no_linking')) ? 0 : 1);
|
||||||
|
|
||||||
if(($b['parent']) && ($linking)) {
|
if((! $toplevel) && ($linking)) {
|
||||||
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
intval($b['parent']),
|
intval($b['parent']),
|
||||||
intval(local_user())
|
intval($b['uid'])
|
||||||
);
|
);
|
||||||
if(count($r) && substr($r[0]['uri'],0,4) === 'fb::')
|
if(count($r) && substr($r[0]['uri'],0,4) === 'fb::')
|
||||||
$reply = substr($r[0]['uri'],4);
|
$reply = substr($r[0]['uri'],4);
|
||||||
|
@ -562,24 +580,14 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
|
|
||||||
logger('facebook: have appid+secret');
|
logger('facebook: have appid+secret');
|
||||||
|
|
||||||
$fb_post = intval(get_pconfig(local_user(),'facebook','post'));
|
$fb_token = get_pconfig($b['uid'],'facebook','access_token');
|
||||||
$fb_enable = (($fb_post && x($_POST,'facebook_enable')) ? intval($_POST['facebook_enable']) : 0);
|
|
||||||
$fb_token = get_pconfig(local_user(),'facebook','access_token');
|
|
||||||
|
|
||||||
// if API is used, default to the chosen settings
|
|
||||||
if($_POST['api_source'] && intval(get_pconfig(local_user(),'facebook','post_by_default')))
|
|
||||||
$fb_enable = 1;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logger('facebook: $fb_post: ' . $fb_post . ' $fb_enable: ' . $fb_enable . ' $fb_token: ' . $fb_token,LOGGER_DEBUG);
|
|
||||||
|
|
||||||
// post to facebook if it's a public post and we've ticked the 'post to Facebook' box,
|
// post to facebook if it's a public post and we've ticked the 'post to Facebook' box,
|
||||||
// or it's a private message with facebook participants
|
// or it's a private message with facebook participants
|
||||||
// or it's a reply or likes action to an existing facebook post
|
// or it's a reply or likes action to an existing facebook post
|
||||||
|
|
||||||
if($fb_post && $fb_token && ($fb_enable || $b['private'] || $reply)) {
|
if($fb_token && ($toplevel || $b['private'] || $reply)) {
|
||||||
logger('facebook: able to post');
|
logger('facebook: able to post');
|
||||||
require_once('library/facebook.php');
|
require_once('library/facebook.php');
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
@ -711,15 +719,8 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
else {
|
else {
|
||||||
if(! $likes) {
|
if(! $likes) {
|
||||||
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $postvars));
|
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $postvars));
|
||||||
q("INSERT INTO `queue` ( `network`, `cid`, `created`, `last`, `content`)
|
require_once('include/queue_fn.php');
|
||||||
VALUES ( '%s', %d, '%s', '%s', '%s') ",
|
add_to_queue($a->contact,NETWORK_FACEBOOK,$s);
|
||||||
dbesc(NETWORK_FACEBOOK),
|
|
||||||
intval($a->contact),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc($s)
|
|
||||||
);
|
|
||||||
|
|
||||||
notice( t('Facebook post failed. Queued for retry.') . EOL);
|
notice( t('Facebook post failed. Queued for retry.') . EOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -732,6 +733,32 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function facebook_post_local(&$a,&$b) {
|
||||||
|
|
||||||
|
// Figure out if Facebook posting is enabled for this post and file it in 'postopts'
|
||||||
|
// where we will discover it during background delivery.
|
||||||
|
|
||||||
|
// This can only be triggered by a local user posting to their own wall.
|
||||||
|
|
||||||
|
if((local_user()) && (local_user() == $b['uid'])) {
|
||||||
|
|
||||||
|
$fb_post = intval(get_pconfig(local_user(),'facebook','post'));
|
||||||
|
$fb_enable = (($fb_post && x($_REQUEST,'facebook_enable')) ? intval($_REQUEST['facebook_enable']) : 0);
|
||||||
|
|
||||||
|
// if API is used, default to the chosen settings
|
||||||
|
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'facebook','post_by_default')))
|
||||||
|
$fb_enable = 1;
|
||||||
|
|
||||||
|
if(! $fb_enable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(strlen($b['postopts']))
|
||||||
|
$b['postopts'] .= ',';
|
||||||
|
$b['postopts'] .= 'facebook';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function fb_queue_hook(&$a,&$b) {
|
function fb_queue_hook(&$a,&$b) {
|
||||||
|
|
||||||
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
|
$qi = q("SELECT * FROM `queue` WHERE `network` = '%s'",
|
||||||
|
|
BIN
js_upload.tgz
BIN
js_upload.tgz
Binary file not shown.
|
@ -96,6 +96,7 @@ function createUploader() {
|
||||||
uploader.setParams( {
|
uploader.setParams( {
|
||||||
newalbum : document.getElementById('photos-upload-newalbum').value,
|
newalbum : document.getElementById('photos-upload-newalbum').value,
|
||||||
album : document.getElementById('photos-upload-album-select').value,
|
album : document.getElementById('photos-upload-album-select').value,
|
||||||
|
not_visible : document.getElementById('photos-upload-noshare').checked,
|
||||||
group_allow : acl.allow_gid.join(','),
|
group_allow : acl.allow_gid.join(','),
|
||||||
contact_allow : acl.allow_cid.join(','),
|
contact_allow : acl.allow_cid.join(','),
|
||||||
group_deny : acl.deny_gid.join(','),
|
group_deny : acl.deny_gid.join(','),
|
||||||
|
@ -105,6 +106,7 @@ function createUploader() {
|
||||||
uploader.setParams( {
|
uploader.setParams( {
|
||||||
newalbum : document.getElementById('photos-upload-newalbum').value,
|
newalbum : document.getElementById('photos-upload-newalbum').value,
|
||||||
album : document.getElementById('photos-upload-album-select').value,
|
album : document.getElementById('photos-upload-album-select').value,
|
||||||
|
not_visible : document.getElementById('photos-upload-noshare').checked,
|
||||||
group_allow : getSelected(document.getElementById('group_allow')).join(','),
|
group_allow : getSelected(document.getElementById('group_allow')).join(','),
|
||||||
contact_allow : getSelected(document.getElementById('contact_allow')).join(','),
|
contact_allow : getSelected(document.getElementById('contact_allow')).join(','),
|
||||||
group_deny : getSelected(document.getElementById('group_deny')).join(','),
|
group_deny : getSelected(document.getElementById('group_deny')).join(','),
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name: MemberSince
|
||||||
|
* Description: Display membership date in profile
|
||||||
|
* Version: 1.0
|
||||||
|
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once('include/datetime.php');
|
||||||
|
|
||||||
|
function membersince_install(){ register_hook('profile_advanced','addon/membersince/membersince.php','membersince_display'); }
|
||||||
|
|
||||||
|
function membersince_uninstall(){ unregister_hook('profile_advanced','addon/membersince/membersince.php','membersince_display'); }
|
||||||
|
|
||||||
|
function membersince_display(&$a,&$b) { $b = str_replace('</div>' . "\n" . '<div id="advanced-profile-name-end"></div>',sprintf( t(' - Member since: %s') . EOL, datetime_convert('UTC',date_default_timezone_get(),$a->profile['register_date'])) . '</div>' . "\n" . '<div id="advanced-profile-name-end"></div>',$b); }
|
|
@ -0,0 +1,8 @@
|
||||||
|
NSFW
|
||||||
|
|
||||||
|
"Not safe for work"
|
||||||
|
|
||||||
|
Scans the message content for the string 'nsfw'
|
||||||
|
(case insensitive) and if found replaces the content
|
||||||
|
with a "click to open/close" link, default is closed.
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
#nsfw-label {
|
||||||
|
float: left;
|
||||||
|
width: 300px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nsfw-words {
|
||||||
|
float: left;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nsfw-submit {
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name: NSFW
|
||||||
|
* Description: Collapse posts with inappropriate content
|
||||||
|
* Version: 1.0
|
||||||
|
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function nsfw_install() {
|
||||||
|
register_hook('prepare_body', 'addon/nsfw/nsfw.php', 'nsfw_prepare_body');
|
||||||
|
register_hook('plugin_settings', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings');
|
||||||
|
register_hook('plugin_settings_post', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings_post');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function nsfw_uninstall() {
|
||||||
|
unregister_hook('prepare_body', 'addon/nsfw/nsfw.php', 'nsfw_prepare_body');
|
||||||
|
unregister_hook('plugin_settings', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings');
|
||||||
|
unregister_hook('plugin_settings_post', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings_post');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function nsfw_addon_settings(&$a,&$s) {
|
||||||
|
|
||||||
|
|
||||||
|
if(! local_user())
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Add our stylesheet to the page so we can make our settings look nice */
|
||||||
|
|
||||||
|
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/nsfw/nsfw.css' . '" media="all" />' . "\r\n";
|
||||||
|
|
||||||
|
|
||||||
|
$words = get_pconfig(local_user(),'nsfw','words');
|
||||||
|
if(! $words)
|
||||||
|
$words = 'nsfw,';
|
||||||
|
|
||||||
|
$s .= '<div class="settings-block">';
|
||||||
|
$s .= '<h3>' . t('"Not Safe For Work" Settings') . '</h3>';
|
||||||
|
$s .= '<div id="nsfw-wrapper">';
|
||||||
|
$s .= '<label id="nsfw-label" for="nsfw-words">' . t('Comma separated words to treat as NSFW') . ' </label>';
|
||||||
|
$s .= '<input id="nsfw-words" type="text" name="nsfw-words" value="' . $words .'" />';
|
||||||
|
$s .= '</div><div class="clear"></div>';
|
||||||
|
|
||||||
|
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="nsfw-submit" name="nsfw-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function nsfw_addon_settings_post(&$a,&$b) {
|
||||||
|
|
||||||
|
if(! local_user())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if($_POST['nsfw-submit']) {
|
||||||
|
set_pconfig(local_user(),'nsfw','words',trim($_POST['nsfw-words']));
|
||||||
|
info( t('NSFW Settings saved.') . EOL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function nsfw_prepare_body(&$a,&$b) {
|
||||||
|
|
||||||
|
$words = null;
|
||||||
|
if(local_user()) {
|
||||||
|
$words = get_pconfig(local_user(),'nsfw','words');
|
||||||
|
}
|
||||||
|
if($words) {
|
||||||
|
$arr = explode(',',$words);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$arr = array('nsfw');
|
||||||
|
}
|
||||||
|
|
||||||
|
$found = false;
|
||||||
|
if(count($arr)) {
|
||||||
|
foreach($arr as $word) {
|
||||||
|
if(! strlen(trim($word))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stristr($b['html'],$word)) {
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(stristr($b['item']['tag'], ']' . $word . '[' )) {
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($found) {
|
||||||
|
$rnd = random_string(8);
|
||||||
|
$b['html'] = '<div id="nsfw-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'nsfw-' . $rnd . '\'); >' . sprintf( t('%s - Click to open/close'),$word ) . '</div><div id="nsfw-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ function sniper_uninstall() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sniper_app_menu($a,&$b) {
|
function sniper_app_menu($a,&$b) {
|
||||||
$b['app_menu'] .= '<div class="app-title"><a href="sniper">Hot Shot Sniper</a></div>';
|
$b['app_menu'][] = '<div class="app-title"><a href="sniper">Hot Shot Sniper</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
statusnet.tgz
BIN
statusnet.tgz
Binary file not shown.
|
@ -108,7 +108,8 @@ function statusnet_install() {
|
||||||
// we need some hooks, for the configuration and for sending tweets
|
// we need some hooks, for the configuration and for sending tweets
|
||||||
register_hook('connector_settings', 'addon/statusnet/statusnet.php', 'statusnet_settings');
|
register_hook('connector_settings', 'addon/statusnet/statusnet.php', 'statusnet_settings');
|
||||||
register_hook('connector_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post');
|
register_hook('connector_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post');
|
||||||
register_hook('post_local_end', 'addon/statusnet/statusnet.php', 'statusnet_post_hook');
|
register_hook('notifier_normal', 'addon/statusnet/statusnet.php', 'statusnet_post_hook');
|
||||||
|
register_hook('post_local', 'addon/statusnet/statusnet.php', 'statusnet_post_local');
|
||||||
register_hook('jot_networks', 'addon/statusnet/statusnet.php', 'statusnet_jot_nets');
|
register_hook('jot_networks', 'addon/statusnet/statusnet.php', 'statusnet_jot_nets');
|
||||||
logger("installed statusnet");
|
logger("installed statusnet");
|
||||||
}
|
}
|
||||||
|
@ -117,10 +118,15 @@ function statusnet_install() {
|
||||||
function statusnet_uninstall() {
|
function statusnet_uninstall() {
|
||||||
unregister_hook('connector_settings', 'addon/statusnet/statusnet.php', 'statusnet_settings');
|
unregister_hook('connector_settings', 'addon/statusnet/statusnet.php', 'statusnet_settings');
|
||||||
unregister_hook('connector_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post');
|
unregister_hook('connector_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post');
|
||||||
|
unregister_hook('notifier_normal', 'addon/statusnet/statusnet.php', 'statusnet_post_hook');
|
||||||
|
unregister_hook('post_local', 'addon/statusnet/statusnet.php', 'statusnet_post_local');
|
||||||
|
unregister_hook('jot_networks', 'addon/statusnet/statusnet.php', 'statusnet_jot_nets');
|
||||||
|
|
||||||
|
// old setting - remove only
|
||||||
|
unregister_hook('post_local_end', 'addon/statusnet/statusnet.php', 'statusnet_post_hook');
|
||||||
unregister_hook('plugin_settings', 'addon/statusnet/statusnet.php', 'statusnet_settings');
|
unregister_hook('plugin_settings', 'addon/statusnet/statusnet.php', 'statusnet_settings');
|
||||||
unregister_hook('plugin_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post');
|
unregister_hook('plugin_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post');
|
||||||
unregister_hook('post_local_end', 'addon/statusnet/statusnet.php', 'statusnet_post_hook');
|
|
||||||
unregister_hook('jot_networks', 'addon/statusnet/statusnet.php', 'statusnet_jot_nets');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusnet_jot_nets(&$a,&$b) {
|
function statusnet_jot_nets(&$a,&$b) {
|
||||||
|
@ -349,40 +355,53 @@ function statusnet_settings(&$a,&$s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function statusnet_post_local(&$a,&$b) {
|
||||||
|
if($b['edit'])
|
||||||
|
return;
|
||||||
|
|
||||||
|
if((local_user()) && (local_user() == $b['uid']) && (! $b['private'])) {
|
||||||
|
|
||||||
|
$statusnet_post = get_pconfig(local_user(),'statusnet','post');
|
||||||
|
$statusnet_enable = (($statusnet_post && x($_REQUEST,'statusnet_enable')) ? intval($_REQUEST['statusnet_enable']) : 0);
|
||||||
|
|
||||||
|
// if API is used, default to the chosen settings
|
||||||
|
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'statusnet','post_by_default')))
|
||||||
|
$statusnet_enable = 1;
|
||||||
|
|
||||||
|
if(! $statusnet_enable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(strlen($b['postopts']))
|
||||||
|
$b['postopts'] .= ',';
|
||||||
|
$b['postopts'] .= 'statusnet';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function statusnet_post_hook(&$a,&$b) {
|
function statusnet_post_hook(&$a,&$b) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post to statusnet
|
* Post to statusnet
|
||||||
*/
|
*/
|
||||||
|
|
||||||
logger('StatusNet post invoked');
|
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
|
||||||
|
|
||||||
if((local_user()) && (local_user() == $b['uid']) && (! $b['private'])) {
|
|
||||||
|
|
||||||
// mike 2-9-11 there was a restriction to only allow this for top level posts
|
|
||||||
// now relaxed so should allow one's own comments to be forwarded through the connector as well.
|
|
||||||
|
|
||||||
// Status.Net is not considered a private network
|
|
||||||
if($b['prvnets'])
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
load_pconfig(local_user(), 'statusnet');
|
if(! strstr($b['postopts'],'statusnet'))
|
||||||
|
return;
|
||||||
|
|
||||||
$api = get_pconfig(local_user(), 'statusnet', 'baseapi');
|
logger('StatusNet post invoked');
|
||||||
$ckey = get_pconfig(local_user(), 'statusnet', 'consumerkey' );
|
|
||||||
$csecret = get_pconfig(local_user(), 'statusnet', 'consumersecret' );
|
|
||||||
$otoken = get_pconfig(local_user(), 'statusnet', 'oauthtoken' );
|
load_pconfig($b['uid'], 'statusnet');
|
||||||
$osecret = get_pconfig(local_user(), 'statusnet', 'oauthsecret' );
|
|
||||||
|
$api = get_pconfig($b['uid'], 'statusnet', 'baseapi');
|
||||||
|
$ckey = get_pconfig($b['uid'], 'statusnet', 'consumerkey' );
|
||||||
|
$csecret = get_pconfig($b['uid'], 'statusnet', 'consumersecret' );
|
||||||
|
$otoken = get_pconfig($b['uid'], 'statusnet', 'oauthtoken' );
|
||||||
|
$osecret = get_pconfig($b['uid'], 'statusnet', 'oauthsecret' );
|
||||||
|
|
||||||
if($ckey && $csecret && $otoken && $osecret) {
|
if($ckey && $csecret && $otoken && $osecret) {
|
||||||
|
|
||||||
$statusnet_post = get_pconfig(local_user(),'statusnet','post');
|
|
||||||
$statusnet_enable = (($statusnet_post && x($_POST,'statusnet_enable')) ? intval($_POST['statusnet_enable']) : 0);
|
|
||||||
// if API is used, default to the chosen settings
|
|
||||||
if($_POST['api_source'] && intval(get_pconfig(local_user(),'statusnet','post_by_default')))
|
|
||||||
$statusnet_enable = 1;
|
|
||||||
|
|
||||||
if($statusnet_enable && $statusnet_post) {
|
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
$dent = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret);
|
$dent = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret);
|
||||||
$max_char = $dent->get_maxlength(); // max. length for a dent
|
$max_char = $dent->get_maxlength(); // max. length for a dent
|
||||||
|
@ -392,13 +411,7 @@ function statusnet_post_hook(&$a,&$b) {
|
||||||
if ( strlen($msg) > $max_char) {
|
if ( strlen($msg) > $max_char) {
|
||||||
$shortlink = "";
|
$shortlink = "";
|
||||||
require_once('library/slinky.php');
|
require_once('library/slinky.php');
|
||||||
// post url = base url + /display/ + owner + post id
|
$slinky = new Slinky( $b['plink'] );
|
||||||
// we construct this from the Owner link and replace
|
|
||||||
// profile by display - this will cause an error when
|
|
||||||
// /profile/ is in the owner url twice but I don't
|
|
||||||
// think this will be very common...
|
|
||||||
$posturl = str_replace('/profile/','/display/',$b['owner-link']).'/'.$b['id'];
|
|
||||||
$slinky = new Slinky( $posturl );
|
|
||||||
// setup a cascade of shortening services
|
// setup a cascade of shortening services
|
||||||
// try to get a short link from these services
|
// try to get a short link from these services
|
||||||
// in the order ur1.ca, trim, id.gd, tinyurl
|
// in the order ur1.ca, trim, id.gd, tinyurl
|
||||||
|
@ -414,8 +427,6 @@ function statusnet_post_hook(&$a,&$b) {
|
||||||
$dent->post('statuses/update', array('status' => $msg));
|
$dent->post('statuses/update', array('status' => $msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function statusnet_plugin_admin_post(&$a){
|
function statusnet_plugin_admin_post(&$a){
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ function tictac_uninstall() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function tictac_app_menu($a,&$b) {
|
function tictac_app_menu($a,&$b) {
|
||||||
$b['app_menu'] .= '<div class="app-title"><a href="tictac">' . t('Three Dimensional Tic-Tac-Toe') . '</a></div>';
|
$b['app_menu'][] = '<div class="app-title"><a href="tictac">' . t('Three Dimensional Tic-Tac-Toe') . '</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
twitter.tgz
BIN
twitter.tgz
Binary file not shown.
|
@ -45,7 +45,8 @@ function twitter_install() {
|
||||||
// we need some hooks, for the configuration and for sending tweets
|
// we need some hooks, for the configuration and for sending tweets
|
||||||
register_hook('connector_settings', 'addon/twitter/twitter.php', 'twitter_settings');
|
register_hook('connector_settings', 'addon/twitter/twitter.php', 'twitter_settings');
|
||||||
register_hook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
|
register_hook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
|
||||||
register_hook('post_local_end', 'addon/twitter/twitter.php', 'twitter_post_hook');
|
register_hook('post_local', 'addon/twitter/twitter.php', 'twitter_post_local');
|
||||||
|
register_hook('notifier_normal', 'addon/twitter/twitter.php', 'twitter_post_hook');
|
||||||
register_hook('jot_networks', 'addon/twitter/twitter.php', 'twitter_jot_nets');
|
register_hook('jot_networks', 'addon/twitter/twitter.php', 'twitter_jot_nets');
|
||||||
logger("installed twitter");
|
logger("installed twitter");
|
||||||
}
|
}
|
||||||
|
@ -54,10 +55,15 @@ function twitter_install() {
|
||||||
function twitter_uninstall() {
|
function twitter_uninstall() {
|
||||||
unregister_hook('connector_settings', 'addon/twitter/twitter.php', 'twitter_settings');
|
unregister_hook('connector_settings', 'addon/twitter/twitter.php', 'twitter_settings');
|
||||||
unregister_hook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
|
unregister_hook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
|
||||||
|
unregister_hook('post_local', 'addon/twitter/twitter.php', 'twitter_post_local');
|
||||||
|
unregister_hook('notifier_normal', 'addon/twitter/twitter.php', 'twitter_post_hook');
|
||||||
|
unregister_hook('jot_networks', 'addon/twitter/twitter.php', 'twitter_jot_nets');
|
||||||
|
|
||||||
|
// old setting - remove only
|
||||||
|
unregister_hook('post_local_end', 'addon/twitter/twitter.php', 'twitter_post_hook');
|
||||||
unregister_hook('plugin_settings', 'addon/twitter/twitter.php', 'twitter_settings');
|
unregister_hook('plugin_settings', 'addon/twitter/twitter.php', 'twitter_settings');
|
||||||
unregister_hook('plugin_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
|
unregister_hook('plugin_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
|
||||||
unregister_hook('post_local_end', 'addon/twitter/twitter.php', 'twitter_post_hook');
|
|
||||||
unregister_hook('jot_networks', 'addon/twitter/twitter.php', 'twitter_jot_nets');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function twitter_jot_nets(&$a,&$b) {
|
function twitter_jot_nets(&$a,&$b) {
|
||||||
|
@ -200,54 +206,68 @@ function twitter_settings(&$a,&$s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function twitter_post_local(&$a,&$b) {
|
||||||
|
|
||||||
|
if($b['edit'])
|
||||||
|
return;
|
||||||
|
|
||||||
|
if((local_user()) && (local_user() == $b['uid']) && (! $b['private']) && (! $b['parent']) ) {
|
||||||
|
|
||||||
|
$twitter_post = intval(get_pconfig(local_user(),'twitter','post'));
|
||||||
|
$twitter_enable = (($twitter_post && x($_REQUEST,'twitter_enable')) ? intval($_REQUEST['twitter_enable']) : 0);
|
||||||
|
|
||||||
|
// if API is used, default to the chosen settings
|
||||||
|
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'twitter','post_by_default')))
|
||||||
|
$twitter_enable = 1;
|
||||||
|
|
||||||
|
if(! $twitter_enable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(strlen($b['postopts']))
|
||||||
|
$b['postopts'] .= ',';
|
||||||
|
$b['postopts'] .= 'twitter';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function twitter_post_hook(&$a,&$b) {
|
function twitter_post_hook(&$a,&$b) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post to Twitter
|
* Post to Twitter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
logger('twitter post invoked');
|
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
|
||||||
|
|
||||||
if((local_user()) && (local_user() == $b['uid']) && (! $b['private']) && (! $b['parent']) ) {
|
|
||||||
|
|
||||||
// Twitter is not considered a private network
|
|
||||||
if($b['prvnets'])
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(! strstr($b['postopts'],'twitter'))
|
||||||
|
return;
|
||||||
|
|
||||||
load_pconfig(local_user(), 'twitter');
|
if($b['parent'] != $b['id'])
|
||||||
|
return;
|
||||||
|
|
||||||
|
logger('twitter post invoked');
|
||||||
|
|
||||||
|
|
||||||
|
load_pconfig($b['uid'], 'twitter');
|
||||||
|
|
||||||
$ckey = get_config('twitter', 'consumerkey' );
|
$ckey = get_config('twitter', 'consumerkey' );
|
||||||
$csecret = get_config('twitter', 'consumersecret' );
|
$csecret = get_config('twitter', 'consumersecret' );
|
||||||
$otoken = get_pconfig(local_user(), 'twitter', 'oauthtoken' );
|
$otoken = get_pconfig($b['uid'], 'twitter', 'oauthtoken' );
|
||||||
$osecret = get_pconfig(local_user(), 'twitter', 'oauthsecret' );
|
$osecret = get_pconfig($b['uid'], 'twitter', 'oauthsecret' );
|
||||||
|
|
||||||
if($ckey && $csecret && $otoken && $osecret) {
|
if($ckey && $csecret && $otoken && $osecret) {
|
||||||
|
logger('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG);
|
||||||
|
|
||||||
$twitter_post = intval(get_pconfig(local_user(),'twitter','post'));
|
|
||||||
$twitter_enable = (($twitter_post && x($_POST,'twitter_enable')) ? intval($_POST['twitter_enable']) : 0);
|
|
||||||
|
|
||||||
// if API is used, default to the chosen settings
|
|
||||||
if($_POST['api_source'] && intval(get_pconfig(local_user(),'twitter','post_by_default')))
|
|
||||||
$twitter_enable = 1;
|
|
||||||
|
|
||||||
if($twitter_post && $twitter_enable) {
|
|
||||||
logger('Posting to Twitter', LOGGER_DEBUG);
|
|
||||||
require_once('library/twitteroauth.php');
|
require_once('library/twitteroauth.php');
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
$tweet = new TwitterOAuth($ckey,$csecret,$otoken,$osecret);
|
$tweet = new TwitterOAuth($ckey,$csecret,$otoken,$osecret);
|
||||||
$max_char = 140; // max. length for a tweet
|
$max_char = 138; // max. length for a tweet
|
||||||
$msg = strip_tags(bbcode($b['body']));
|
$msg = strip_tags(bbcode($b['body']));
|
||||||
if ( strlen($msg) > $max_char) {
|
if ( strlen($msg) > $max_char) {
|
||||||
|
logger('Twitter: have to shorten the message to fit 140 chars', LOGGER_DEBUG);
|
||||||
$shortlink = "";
|
$shortlink = "";
|
||||||
require_once('library/slinky.php');
|
require_once('library/slinky.php');
|
||||||
// post url = base url + /display/ + owner + post id
|
$slinky = new Slinky( $b['plink'] );
|
||||||
// we construct this from the Owner link and replace
|
|
||||||
// profile by display - this will cause an error when
|
|
||||||
// /profile/ is in the owner url twice but I don't
|
|
||||||
// think this will be very common...
|
|
||||||
$posturl = str_replace('/profile/','/display/',$b['owner-link']).'/'.$b['id'];
|
|
||||||
$slinky = new Slinky( $posturl );
|
|
||||||
// setup a cascade of shortening services
|
// setup a cascade of shortening services
|
||||||
// try to get a short link from these services
|
// try to get a short link from these services
|
||||||
// in the order ur1.ca, trim, id.gd, tinyurl
|
// in the order ur1.ca, trim, id.gd, tinyurl
|
||||||
|
@ -261,10 +281,7 @@ function twitter_post_hook(&$a,&$b) {
|
||||||
// and now tweet it :-)
|
// and now tweet it :-)
|
||||||
if(strlen($msg)) {
|
if(strlen($msg)) {
|
||||||
$result = $tweet->post('statuses/update', array('status' => $msg));
|
$result = $tweet->post('statuses/update', array('status' => $msg));
|
||||||
logger('twitter_post returns: ' . $result);
|
logger('twitter_post send', LOGGER_DEBUG);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
widgets.tgz
BIN
widgets.tgz
Binary file not shown.
BIN
wppost.tgz
BIN
wppost.tgz
Binary file not shown.
|
@ -7,17 +7,25 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function wppost_install() {
|
function wppost_install() {
|
||||||
register_hook('post_local_end', 'addon/wppost/wppost.php', 'wppost_send');
|
register_hook('post_local', 'addon/wppost/wppost.php', 'wppost_post_local');
|
||||||
|
register_hook('notifier_normal', 'addon/wppost/wppost.php', 'wppost_send');
|
||||||
register_hook('jot_networks', 'addon/wppost/wppost.php', 'wppost_jot_nets');
|
register_hook('jot_networks', 'addon/wppost/wppost.php', 'wppost_jot_nets');
|
||||||
register_hook('plugin_settings', 'addon/wppost/wppost.php', 'wppost_settings');
|
register_hook('connector_settings', 'addon/wppost/wppost.php', 'wppost_settings');
|
||||||
register_hook('plugin_settings_post', 'addon/wppost/wppost.php', 'wppost_settings_post');
|
register_hook('connector_settings_post', 'addon/wppost/wppost.php', 'wppost_settings_post');
|
||||||
|
|
||||||
}
|
}
|
||||||
function wppost_uninstall() {
|
function wppost_uninstall() {
|
||||||
unregister_hook('post_local_end', 'addon/wppost/wppost.php', 'wppost_send');
|
unregister_hook('post_local', 'addon/wppost/wppost.php', 'wppost_post_local');
|
||||||
|
unregister_hook('notifier_normal', 'addon/wppost/wppost.php', 'wppost_send');
|
||||||
unregister_hook('jot_networks', 'addon/wppost/wppost.php', 'wppost_jot_nets');
|
unregister_hook('jot_networks', 'addon/wppost/wppost.php', 'wppost_jot_nets');
|
||||||
|
unregister_hook('connector_settings', 'addon/wppost/wppost.php', 'wppost_settings');
|
||||||
|
unregister_hook('connector_settings_post', 'addon/wppost/wppost.php', 'wppost_settings_post');
|
||||||
|
|
||||||
|
// obsolete - remove
|
||||||
|
unregister_hook('post_local_end', 'addon/wppost/wppost.php', 'wppost_send');
|
||||||
unregister_hook('plugin_settings', 'addon/wppost/wppost.php', 'wppost_settings');
|
unregister_hook('plugin_settings', 'addon/wppost/wppost.php', 'wppost_settings');
|
||||||
unregister_hook('plugin_settings_post', 'addon/wppost/wppost.php', 'wppost_settings_post');
|
unregister_hook('plugin_settings_post', 'addon/wppost/wppost.php', 'wppost_settings_post');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,31 +117,54 @@ function wppost_settings_post(&$a,&$b) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function wppost_post_local(&$a,&$b) {
|
||||||
|
|
||||||
|
// This can probably be changed to allow editing by pointing to a different API endpoint
|
||||||
|
|
||||||
|
if($b['edit'])
|
||||||
|
return;
|
||||||
|
|
||||||
|
if((! local_user()) || (local_user() != $b['uid']))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if($b['private'] || $b['parent'])
|
||||||
|
return;
|
||||||
|
|
||||||
|
$wp_post = intval(get_pconfig(local_user(),'wppost','post'));
|
||||||
|
|
||||||
|
$wp_enable = (($wp_post && x($_REQUEST,'wppost_enable')) ? intval($_REQUEST['wppost_enable']) : 0);
|
||||||
|
|
||||||
|
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'wppost','post_by_default')))
|
||||||
|
$wp_enable = 1;
|
||||||
|
|
||||||
|
if(! $wp_enable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(strlen($b['postopts']))
|
||||||
|
$b['postopts'] .= ',';
|
||||||
|
$b['postopts'] .= 'wppost';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function wppost_send(&$a,&$b) {
|
function wppost_send(&$a,&$b) {
|
||||||
|
|
||||||
if((! local_user()) || (local_user() != $b['uid']))
|
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if($b['prvnets'] && $b['private'])
|
if(! strstr($b['postopts'],'wppost'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if($b['parent'])
|
if($b['parent'] != $b['id'])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$wp_username = get_pconfig(local_user(),'wppost','wp_username');
|
|
||||||
$wp_password = get_pconfig(local_user(),'wppost','wp_password');
|
|
||||||
$wp_blog = get_pconfig(local_user(),'wppost','wp_blog');
|
|
||||||
$wp_post = intval(get_pconfig(local_user(),'wppost','post'));
|
|
||||||
|
|
||||||
$wp_enable = (($wp_post && x($_POST,'wppost_enable')) ? intval($_POST['wppost_enable']) : 0);
|
$wp_username = get_pconfig($b['uid'],'wppost','wp_username');
|
||||||
|
$wp_password = get_pconfig($b['uid'],'wppost','wp_password');
|
||||||
|
$wp_blog = get_pconfig($b['uid'],'wppost','wp_blog');
|
||||||
|
|
||||||
if($_POST['api_source'] && intval(get_pconfig(local_user(),'wppost','post_by_default')))
|
if($wp_username && $wp_password && $wp_blog) {
|
||||||
$wp_enable = 1;
|
|
||||||
|
|
||||||
if($wp_username && $wp_password && $wp_blog && $wp_post && $wp_enable) {
|
|
||||||
|
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue