X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=gravatar%2Fgravatar.php;h=eb38db78f6cc3859ac37d962c87c4c2c111a2c93;hb=cb28355e043b070f91fbaed1e2d6f8e89466e97a;hp=b9435a317d16c06bfc2809a276f52d648c1cd0ff;hpb=9ac891c4949ea5a429fc59ada2816a992633ac1f;p=friendica-addons.git diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index b9435a31..eb38db78 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -2,7 +2,7 @@ /** * Name: Gravatar Support * Description: If there is no avatar image for a new user or contact this plugin will look for one at Gravatar. - * Version: 1.0 + * Version: 1.1 * Author: Klaus Weidenbach */ @@ -12,7 +12,7 @@ function gravatar_install() { register_hook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup'); - logger("installed gravatar"); + logger("registered gravatar in avatar_lookup hook"); } /** @@ -21,7 +21,7 @@ function gravatar_install() { function gravatar_uninstall() { unregister_hook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup'); - logger("uninstalled gravatar"); + logger("unregistered gravatar in avatar_lookup hook"); } /** @@ -42,7 +42,7 @@ function gravatar_lookup($a, &$b) { $hash = md5(trim(strtolower($b['email']))); - $url = 'http://www.gravatar.com/avatar/' .$hash .'.jpg'; + $url = 'https://secure.gravatar.com/avatar/' .$hash .'.jpg'; $url .= '?s=' .$b['size'] .'&r=' .$rating; if ($default_avatar != "gravatar") $url .= '&d=' .$default_avatar; @@ -55,7 +55,7 @@ function gravatar_lookup($a, &$b) { * Display admin settings for this addon */ function gravatar_plugin_admin (&$a, &$o) { - $t = file_get_contents( dirname(__file__)."/admin.tpl"); + $t = get_markup_template( "admin.tpl", "addon/gravatar/" ); $default_avatar = get_config('gravatar', 'default_img'); $rating = get_config('gravatar', 'rating'); @@ -81,9 +81,18 @@ function gravatar_plugin_admin (&$a, &$o) { 'x' => 'x' ); - $o = ''; + // Check if Libravatar is enabled and show warning + $r = q("SELECT * FROM `addon` WHERE `name` = '%s' and `installed` = 1", + dbesc('libravatar') + ); + if (count($r)) { + $o = '
' .t('Information') .'

' .t('Libravatar addon is installed, too. Please disable Libravatar addon or this Gravatar addon.
The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.') .'



'; + } + + // output Gravatar settings + $o .= ''; $o .= replace_macros( $t, array( - '$submit' => t('Submit'), + '$submit' => t('Save Settings'), '$default_avatar' => array('avatar', t('Default avatar image'), $default_avatar, t('Select default avatar image if none was found at Gravatar. See README'), $default_avatars), '$rating' => array('rating', t('Rating of images'), $rating, t('Select the appropriate avatar rating for your site. See README'), $ratings), ));