Merge pull request #845 from annando/master

Many small bugfixes and features ...
This commit is contained in:
tobiasd 2013-12-03 10:39:23 -08:00
commit 916b2e7438
7 changed files with 73 additions and 68 deletions

View File

@ -260,6 +260,11 @@ function bb_ShareAttributes($match) {
$profile = $matches[1]; $profile = $matches[1];
$posted = ""; $posted = "";
$itemcache = get_config("system","itemcache");
// relative dates only make sense when they aren't cached
if ($itemcache == "") {
preg_match("/posted='(.*?)'/ism", $attributes, $matches); preg_match("/posted='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") if ($matches[1] != "")
$posted = $matches[1]; $posted = $matches[1];
@ -269,6 +274,7 @@ function bb_ShareAttributes($match) {
$posted = $matches[1]; $posted = $matches[1];
$reldate = (($posted) ? " " . relative_date($posted) : ''); $reldate = (($posted) ? " " . relative_date($posted) : '');
}
$headline = '<div class="shared_header">'; $headline = '<div class="shared_header">';
//$headline = '<br /><div class="shared_header">'; //$headline = '<br /><div class="shared_header">';

View File

@ -1041,10 +1041,10 @@ function diaspora_reshare($importer,$xml,$msg) {
$datarray['owner-link'] = $contact['url']; $datarray['owner-link'] = $contact['url'];
$datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']); $datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']);
if (!intval(get_config('system','wall-to-wall_share'))) { if (!intval(get_config('system','wall-to-wall_share'))) {
$prefix = "[share author='".str_replace("'", "&#039;",$person['name']). $prefix = "[share author='".str_replace(array("'", "[", "]"), array("&#x27;", "&#x5B;", "&#x5D;"),$person['name']).
"' profile='".$person['url']. "' profile='".$person['url'].
"' avatar='".((x($person,'thumb')) ? $person['thumb'] : $person['photo']). "' avatar='".((x($person,'thumb')) ? $person['thumb'] : $person['photo']).
"' link='".$orig_url."']"; "' link='".str_replace(array("'", "[", "]"), array("&#x27;", "&#x5B;", "&#x5D;"),$orig_url)."']";
$datarray['author-name'] = $contact['name']; $datarray['author-name'] = $contact['name'];
$datarray['author-link'] = $contact['url']; $datarray['author-link'] = $contact['url'];
$datarray['author-avatar'] = $contact['thumb']; $datarray['author-avatar'] = $contact['thumb'];

View File

@ -29,7 +29,7 @@ function oembed_fetch_url($embedurl){
if (!in_array($ext, $noexts)){ if (!in_array($ext, $noexts)){
// try oembed autodiscovery // try oembed autodiscovery
$redirects = 0; $redirects = 0;
$html_text = fetch_url($embedurl, false, $redirects, 15, "text/*"); $html_text = fetch_url($embedurl, false, $redirects, 15, "text/*"); /**/
if($html_text){ if($html_text){
$dom = @DOMDocument::loadHTML($html_text); $dom = @DOMDocument::loadHTML($html_text);
if ($dom){ if ($dom){
@ -111,10 +111,12 @@ function oembed_format_object($j){
// add link to source if not present in "rich" type // add link to source if not present in "rich" type
if ($j->type!='rich' || !strpos($j->html,$embedurl) ){ if ($j->type!='rich' || !strpos($j->html,$embedurl) ){
if (isset($j->provider_name)) $ret .= $j->provider_name.": ";
$embedlink = (isset($j->title))?$j->title:$embedurl; $embedlink = (isset($j->title))?$j->title:$embedurl;
$ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>"; $ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
if (isset($j->author_name)) $ret.=" by ".$j->author_name; if (isset($j->author_name)) $ret.=" (".$j->author_name.")";
if (isset($j->provider_name)) $ret.=" on ".$j->provider_name; //if (isset($j->author_name)) $ret.=" by ".$j->author_name;
//if (isset($j->provider_name)) $ret.=" on ".$j->provider_name;
} else { } else {
// add <a> for html2bbcode conversion // add <a> for html2bbcode conversion
$ret .= "<a href='$embedurl' rel='oembed'></a>"; $ret .= "<a href='$embedurl' rel='oembed'></a>";
@ -195,6 +197,3 @@ function oembed_html2bbcode($text) {
return $text; return $text;
} }
} }

View File

@ -145,7 +145,7 @@ if(! function_exists('load_hooks')) {
function load_hooks() { function load_hooks() {
$a = get_app(); $a = get_app();
$a->hooks = array(); $a->hooks = array();
$r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC"); $r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC, `file`");
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if(! array_key_exists($rr['hook'],$a->hooks)) if(! array_key_exists($rr['hook'],$a->hooks))

View File

@ -98,7 +98,7 @@ function dfrn_request_post(&$a) {
} }
if(is_array($contact_record)) { if(is_array($contact_record)) {
$r = q("UPDATE `contact` SET `ret-aes` = %d, hidden = %d WHERE `id` = %d LIMIT 1", $r = q("UPDATE `contact` SET `ret-aes` = %d, hidden = %d WHERE `id` = %d",
intval($aes_allow), intval($aes_allow),
intval($hidden), intval($hidden),
intval($contact_record['id']) intval($contact_record['id'])
@ -406,7 +406,7 @@ function dfrn_request_post(&$a) {
`uri-date` = '%s', `uri-date` = '%s',
`avatar-date` = '%s', `avatar-date` = '%s',
`hidden` = 0, `hidden` = 0,
WHERE `id` = %d LIMIT 1 WHERE `id` = %d
", ",
dbesc($photos[0]), dbesc($photos[0]),
dbesc($photos[1]), dbesc($photos[1]),
@ -486,7 +486,7 @@ function dfrn_request_post(&$a) {
if(is_array($contact_record)) { if(is_array($contact_record)) {
// There is a contact record but no issued-id, so this // There is a contact record but no issued-id, so this
// is a reciprocal introduction from a known contact // is a reciprocal introduction from a known contact
$r = q("UPDATE `contact` SET `issued-id` = '%s' WHERE `id` = %d LIMIT 1", $r = q("UPDATE `contact` SET `issued-id` = '%s' WHERE `id` = %d",
dbesc($issued_id), dbesc($issued_id),
intval($contact_record['id']) intval($contact_record['id'])
); );
@ -741,7 +741,7 @@ function dfrn_request_content(&$a) {
// If we are auto_confirming, this record will have already been nuked // If we are auto_confirming, this record will have already been nuked
// in dfrn_confirm_post() // in dfrn_confirm_post()
$r = q("UPDATE `intro` SET `blocked` = 0 WHERE `hash` = '%s' LIMIT 1", $r = q("UPDATE `intro` SET `blocked` = 0 WHERE `hash` = '%s'",
dbesc($_GET['confirm_key']) dbesc($_GET['confirm_key'])
); );
} }

View File

@ -49,7 +49,7 @@ function notifications_post(&$a) {
goaway($a->get_baseurl(true) . '/notifications/intros'); goaway($a->get_baseurl(true) . '/notifications/intros');
} }
if($_POST['submit'] == t('Ignore')) { if($_POST['submit'] == t('Ignore')) {
$r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d LIMIT 1", $r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d",
intval($intro_id)); intval($intro_id));
goaway($a->get_baseurl(true) . '/notifications/intros'); goaway($a->get_baseurl(true) . '/notifications/intros');
} }

View File

@ -50,7 +50,7 @@ function completeurl($url, $scheme) {
return($complete); return($complete);
} }
function parseurl_getsiteinfo($url) { function parseurl_getsiteinfo($url, $no_guessing = false) {
$siteinfo = array(); $siteinfo = array();
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
@ -184,7 +184,7 @@ function parseurl_getsiteinfo($url) {
} }
} }
if (@$siteinfo["image"] == "") { if ((@$siteinfo["image"] == "") AND !$no_guessing) {
$list = $xpath->query("//img[@src]"); $list = $xpath->query("//img[@src]");
foreach ($list as $node) { foreach ($list as $node) {
$attr = array(); $attr = array();
@ -223,7 +223,7 @@ function parseurl_getsiteinfo($url) {
"height"=>$photodata[1]); "height"=>$photodata[1]);
} }
if (@$siteinfo["text"] == "") { if ((@$siteinfo["text"] == "") AND (@$siteinfo["title"] != "") AND !$no_guessing) {
$text = ""; $text = "";
$list = $xpath->query("//div[@class='article']"); $list = $xpath->query("//div[@class='article']");