Merge remote branch 'upstream/master'

Conflicts:
	libertree/libertree.php
This commit is contained in:
Michael Vogel 2012-07-13 23:47:21 +02:00
commit 95e6e5efd5
9 changed files with 62 additions and 15 deletions

Binary file not shown.

View file

@ -3,7 +3,8 @@
* Name: Facebook Connector
* Version: 1.3
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
* Tobias Hößl <https://github.com/CatoTH/>
* Author: Tobias Hößl <https://github.com/CatoTH/>
*
*/
/**
@ -162,10 +163,11 @@ function facebook_init(&$a) {
}
}
if($a->argc != 2)
return;
$nick = $a->argv[1];
if(strlen($nick))
$r = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
dbesc($nick)
@ -758,7 +760,7 @@ function facebook_plugin_admin(&$a, &$o){
elseif (is_array($subs)) {
$o .= t('The given API Key seems to work correctly.') . '<br>';
$working_connection = true;
} else $o .= t('The correctness of the API Key could not be detected. Somthing strange\'s going on.') . '<br>';
} else $o .= t('The correctness of the API Key could not be detected. Something strange\'s going on.') . '<br>';
}
$o .= '<label for="fb_appid">' . t('App-ID / API-Key') . '</label><input id="fb_appid" name="appid" type="text" value="' . escape_tags($appid ? $appid : "") . '"><br style="clear: both;">';

Binary file not shown.

View file

@ -435,7 +435,7 @@ function jappixmini_script(&$a,&$s) {
$key = $row['k'];
$pos = strpos($key, ":");
$dfrn_id = substr($key, $pos+1);
$r = q("SELECT `name` FROM `contact` WHERE `uid`=$uid AND `dfrn-id`='%s' OR `issued-id`='%s'",
$r = q("SELECT `name` FROM `contact` WHERE `uid`=$uid AND (`dfrn-id`='%s' OR `issued-id`='%s')",
dbesc($dfrn_id),
dbesc($dfrn_id)
);

Binary file not shown.

View file

@ -153,8 +153,8 @@ function libertree_send(&$a,&$b) {
$ltree_api_token = get_pconfig($b['uid'],'libertree','libertree_api_token');
$ltree_url = get_pconfig($b['uid'],'libertree','libertree_url');
$ltree_blog = "$ltree_url/api/v1/posts/create/?token=$ltree_api_token";
if($ltree_url && $ltree_api_token && $ltree_blog) {
$ltree_source = "Friendica";
if($ltree_url && $ltree_api_token && $ltree_blog && $ltree_source) {
require_once('include/bb2diaspora.php');
$tag_arr = array();
@ -171,7 +171,6 @@ function libertree_send(&$a,&$b) {
$title = $b['title'];
$body = $b['body'];
// Insert a newline before and after a quote
$body = str_ireplace("[quote", "\n\n[quote", $body);
$body = str_ireplace("[/quote]", "[/quote]\n\n", $body);
@ -195,9 +194,10 @@ function libertree_send(&$a,&$b) {
if(strlen($title))
$body = "## ".html_entity_decode($title)."\n\n".$body;
$params = array(
'text' => $body,
'source' => "friendica"
'source' => $ltree_source
// 'token' => $ltree_api_token
);

BIN
page.tgz

Binary file not shown.

View file

@ -1,14 +1,13 @@
#page-settings-label, #page-random-label {
#page-settings-label, #page-random-label, #page-profile-label {
float: left;
width: 200px;
margin-bottom: 25px;
}
#page-max-pages, #page-random {
#page-max-pages, #page-random, #page-profile {
float: left;
}

View file

@ -13,6 +13,7 @@ function page_install() {
register_hook('network_mod_init', 'addon/page/page.php', 'page_network_mod_init');
register_hook('plugin_settings', 'addon/page/page.php', 'page_plugin_settings');
register_hook('plugin_settings_post', 'addon/page/page.php', 'page_plugin_settings_post');
register_hook('profile_advanced', 'addon/page/page.php', 'page_profile_advanced');
}
@ -20,20 +21,22 @@ function page_uninstall() {
unregister_hook('network_mod_init', 'addon/page/page.php', 'page_network_mod_init');
unregister_hook('plugin_settings', 'addon/page/page.php', 'page_plugin_settings');
unregister_hook('plugin_settings_post', 'addon/page/page.php', 'page_plugin_settings_post');
unregister_hook('profile_advanced', 'addon/page/page.php', 'page_profile_advanced');
// remove only - obsolete
unregister_hook('page_end', 'addon/page/page.php', 'page_page_end');
}
function page_getpage($uid,$randomise = false) {
function page_getpage($uid,$showhidden = true,$randomise = false) {
$pagelist = array();
$order = (($randomise) ? ' order by rand() ' : ' order by name asc ');
$order = (($showhidden) ? '' : " and hidden = 0 ");
$order .= (($randomise) ? ' order by rand() ' : ' order by name asc ');
$contacts = q("SELECT `id`, `url`, `name`, `micro`FROM `contact`
$contacts = q("SELECT `id`, `url`, `name`, `micro` FROM `contact`
WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d
$order ",
intval($uid)
@ -93,7 +96,7 @@ function page_network_mod_init($a,$b) {
$show_total = 6;
$randomise = intval(get_pconfig(local_user(),'page','randomise'));
$contacts = page_getpage($a->user['uid'],$randomise);
$contacts = page_getpage($a->user['uid'],true,$randomise);
$total_shown = 0;
$more = false;
@ -115,12 +118,49 @@ function page_network_mod_init($a,$b) {
$a->page['aside'] = $page . $a->page['aside'];
}
function page_profile_advanced($a,&$b) {
$profile = intval(get_pconfig($a->profile['profile_uid'],'page','show_on_profile'));
if(! $profile)
return;
$page = '<div id="page-profile">
<div class="title">'.t("Forums:").'</div>
<div id="profile-page-list">';
// place holder in case somebody wants configurability
$show_total = 9999;
$randomise = true;
$contacts = page_getpage($a->user['uid'],false,$randomise);
$total_shown = 0;
$more = false;
foreach($contacts as $contact) {
$page .= micropro($contact,false,'page-profile-advanced');
$total_shown ++;
if($total_shown == $show_total)
break;
}
$page .= '</div></div><div class="clear"></div>';
if(count($contacts) > 0)
$b .= $page;
}
function page_plugin_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'page-settings-submit')))
return;
set_pconfig(local_user(),'page','max_pages',intval($_POST['page_max_pages']));
set_pconfig(local_user(),'page','randomise',intval($_POST['page_random']));
set_pconfig(local_user(),'page','show_on_profile',intval($_POST['page_profile']));
info( t('Page settings updated.') . EOL);
}
@ -144,6 +184,9 @@ function page_plugin_settings(&$a,&$s) {
$randomise = intval(get_pconfig(local_user(),'page','randomise'));
$randomise_checked = (($randomise) ? ' checked="checked" ' : '');
$profile = intval(get_pconfig(local_user(),'page','show_on_profile'));
$profile_checked = (($profile) ? ' checked="checked" ' : '');
/* Add some HTML to the existing form */
@ -156,6 +199,9 @@ function page_plugin_settings(&$a,&$s) {
$s .= '<label id="page-random-label" for="page-random">' . t('Randomise Page/Forum list') . '</label>';
$s .= '<input id="page-random" type="checkbox" name="page_random" value="1" ' . $randomise_checked . '/>';
$s .= '<div class="clear"></div>';
$s .= '<label id="page-profile-label" for="page-profile">' . t('Show pages/forums on profile page') . '</label>';
$s .= '<input id="page-profile" type="checkbox" name="page_profile" value="1" ' . $profile_checked . '/>';
$s .= '<div class="clear"></div>';
$s .= '</div>';