forumlist: added a "div" for styling reasons

privacy_image_cache: If a picture comes from another picture cache (like facebook) take the original picture
This commit is contained in:
Michael Vogel 2012-12-23 03:24:55 +01:00
parent e58decc5f2
commit ec95e5a2da
2 changed files with 29 additions and 1 deletions

View file

@ -74,7 +74,7 @@ function forumlist_network_mod_init($a,$b) {
if(count($contacts)) { if(count($contacts)) {
foreach($contacts as $contact) { foreach($contacts as $contact) {
$forumlist .= '<a href="' . $a->get_baseurl() . '/redir/' . $contact["id"] . '" title="' . $contact['url'] . '" class="label sparkle" target="external-link"><img class="forumlist-img" height="20" width="20" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /></a> <a href="' . $a->get_baseurl() . '/network?f=&cid=' . $contact['id'] . '" >' . $contact["name"]."</a><br />"; $forumlist .= '<div><a href="' . $a->get_baseurl() . '/redir/' . $contact["id"] . '" title="' . $contact['url'] . '" class="label sparkle" target="external-link"><img class="forumlist-img" height="20" width="20" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /></a> <a href="' . $a->get_baseurl() . '/network?f=&cid=' . $contact['id'] . '" >' . $contact["name"]."</a></div>";
} }
} }
else { else {

View file

@ -119,6 +119,15 @@ function privacy_image_cache_init() {
// It shouldn't happen but it does - spaces in URL // It shouldn't happen but it does - spaces in URL
$_REQUEST['url'] = str_replace(" ", "+", $_REQUEST['url']); $_REQUEST['url'] = str_replace(" ", "+", $_REQUEST['url']);
// if the picture seems to be from another picture cache then take the original source
$queryvar = privacy_image_cache_parse_query($_REQUEST['url']);
if ($queryvar['url'] != "")
$_REQUEST['url'] = urldecode($queryvar['url']);
// if fetching facebook pictures don't fetch the thumbnail but the big one
if (strpos($_REQUEST['url'], ".fbcdn.net/") and (substr($_REQUEST['url'], -6) == "_s.jpg"))
$_REQUEST['url'] = substr($_REQUEST['url'], 0, -6)."_n.jpg";
$img_str = fetch_url($_REQUEST['url'],true); $img_str = fetch_url($_REQUEST['url'],true);
$tempfile = tempnam(get_config("system","temppath"), "cache"); $tempfile = tempnam(get_config("system","temppath"), "cache");
@ -372,3 +381,22 @@ function privacy_image_cache_plugin_admin_post(&$a = null, &$o = null){
q('DELETE FROM `photo` WHERE `uid` = 0 AND `resource-id` LIKE "pic:%%"'); q('DELETE FROM `photo` WHERE `uid` = 0 AND `resource-id` LIKE "pic:%%"');
} }
} }
function privacy_image_cache_parse_query($var) {
/**
* Use this function to parse out the query array element from
* the output of parse_url().
*/
$var = parse_url($var, PHP_URL_QUERY);
$var = html_entity_decode($var);
$var = explode('&', $var);
$arr = array();
foreach($var as $val) {
$x = explode('=', $val);
$arr[$x[0]] = $x[1];
}
unset($val, $x, $var);
return $arr;
}