Merge remote branch 'friendica/master'

This commit is contained in:
fabrixxm 2012-07-18 06:31:16 -04:00
commit eab6873cf4
43 changed files with 1665 additions and 300 deletions

14
altpager/altpager.css Executable file
View File

@ -0,0 +1,14 @@
#altpager-label {
float: left;
width: 200px;
margin-bottom: 25px;
}
#altpager {
float: left;
}

89
altpager/altpager.php Executable file
View File

@ -0,0 +1,89 @@
<?php
/**
* Name: Alternate Pagination
* Description: Change pagination from using explicit page numbers to simple "newer" and "older" page links. This will speed up page load times.
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*
*
*/
function altpager_install() {
register_hook('plugin_settings', 'addon/altpager/altpager.php', 'altpager_settings');
register_hook('plugin_settings_post', 'addon/altpager/altpager.php', 'altpager_settings_post');
logger("installed altpager");
}
function altpager_uninstall() {
unregister_hook('plugin_settings', 'addon/altpager/altpager.php', 'altpager_settings');
unregister_hook('plugin_settings_post', 'addon/altpager/altpager.php', 'altpager_settings_post');
logger("removed altpager");
}
/**
*
* Callback from the settings post function.
* $post contains the $_POST array.
* We will make sure we've got a valid user account
* and if so set our configuration setting for this person.
*
*/
function altpager_settings_post($a,$post) {
if(! local_user() || (! x($_POST,'altpager-submit')))
return;
set_pconfig(local_user(),'system','alt_pager',intval($_POST['altpager']));
info( t('Altpager settings updated.') . EOL);
}
/**
*
* Called from the Plugin Setting form.
* Add our own settings info to the page.
*
*/
function altpager_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/altpager/altpager.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variable */
$altpager = get_pconfig(local_user(),'system','alt_pager');
if($altpager === false)
$altpager = 0;
$checked = (($altpager) ? ' checked="checked" ' : '');
/* Add some HTML to the existing form */
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Alternate Pagination Setting') . '</h3>';
$s .= '<div id="altpager-wrapper">';
$s .= '<label id="altpager-label" for="altpager">' . t('Use links to "newer" and "older" pages in place of page numbers?') . '</label>';
$s .= '<input id="altpager-input" type="checkbox" name="altpager" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="altpager-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
}

Binary file not shown.

View File

@ -4,121 +4,121 @@
* Name: Blogger Post Connector
* Description: Post to Blogger (or anything else which uses blogger XMLRPC API)
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*
*/
function blpost_install() {
register_hook('post_local', 'addon/blpost/blpost.php', 'blpost_post_local');
register_hook('notifier_normal', 'addon/blpost/blpost.php', 'blpost_send');
register_hook('jot_networks', 'addon/blpost/blpost.php', 'blpost_jot_nets');
register_hook('connector_settings', 'addon/blpost/blpost.php', 'blpost_settings');
register_hook('connector_settings_post', 'addon/blpost/blpost.php', 'blpost_settings_post');
function blogger_install() {
register_hook('post_local', 'addon/blogger/blogger.php', 'blogger_post_local');
register_hook('notifier_normal', 'addon/blogger/blogger.php', 'blogger_send');
register_hook('jot_networks', 'addon/blogger/blogger.php', 'blogger_jot_nets');
register_hook('connector_settings', 'addon/blogger/blogger.php', 'blogger_settings');
register_hook('connector_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
}
function blpost_uninstall() {
unregister_hook('post_local', 'addon/blpost/blpost.php', 'blpost_post_local');
unregister_hook('notifier_normal', 'addon/blpost/blpost.php', 'blpost_send');
unregister_hook('jot_networks', 'addon/blpost/blpost.php', 'blpost_jot_nets');
unregister_hook('connector_settings', 'addon/blpost/blpost.php', 'blpost_settings');
unregister_hook('connector_settings_post', 'addon/blpost/blpost.php', 'blpost_settings_post');
function blogger_uninstall() {
unregister_hook('post_local', 'addon/blogger/blogger.php', 'blogger_post_local');
unregister_hook('notifier_normal', 'addon/blogger/blogger.php', 'blogger_send');
unregister_hook('jot_networks', 'addon/blogger/blogger.php', 'blogger_jot_nets');
unregister_hook('connector_settings', 'addon/blogger/blogger.php', 'blogger_settings');
unregister_hook('connector_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
// obsolete - remove
unregister_hook('post_local_end', 'addon/blpost/blpost.php', 'blpost_send');
unregister_hook('plugin_settings', 'addon/blpost/blpost.php', 'blpost_settings');
unregister_hook('plugin_settings_post', 'addon/blpost/blpost.php', 'blpost_settings_post');
unregister_hook('post_local_end', 'addon/blogger/blogger.php', 'blogger_send');
unregister_hook('plugin_settings', 'addon/blogger/blogger.php', 'blogger_settings');
unregister_hook('plugin_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
}
function blpost_jot_nets(&$a,&$b) {
function blogger_jot_nets(&$a,&$b) {
if(! local_user())
return;
$bl_post = get_pconfig(local_user(),'blpost','post');
$bl_post = get_pconfig(local_user(),'blogger','post');
if(intval($bl_post) == 1) {
$bl_defpost = get_pconfig(local_user(),'blpost','post_by_default');
$bl_defpost = get_pconfig(local_user(),'blogger','post_by_default');
$selected = ((intval($bl_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="blpost_enable" ' . $selected . ' value="1" /> '
$b .= '<div class="profile-jot-net"><input type="checkbox" name="blogger_enable" ' . $selected . ' value="1" /> '
. t('Post to blogger') . '</div>';
}
}
function blpost_settings(&$a,&$s) {
function blogger_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/blpost/blpost.css' . '" media="all" />' . "\r\n";
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/blogger/blogger.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variables */
$enabled = get_pconfig(local_user(),'blpost','post');
$enabled = get_pconfig(local_user(),'blogger','post');
$checked = (($enabled) ? ' checked="checked" ' : '');
$def_enabled = get_pconfig(local_user(),'blpost','post_by_default');
$def_enabled = get_pconfig(local_user(),'blogger','post_by_default');
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
$bl_username = get_pconfig(local_user(), 'blpost', 'bl_username');
$bl_password = get_pconfig(local_user(), 'blpost', 'bl_password');
$bl_blog = get_pconfig(local_user(), 'blpost', 'bl_blog');
$bl_username = get_pconfig(local_user(), 'blogger', 'bl_username');
$bl_password = get_pconfig(local_user(), 'blogger', 'bl_password');
$bl_blog = get_pconfig(local_user(), 'blogger', 'bl_blog');
/* Add some HTML to the existing form */
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Blogger Post Settings') . '</h3>';
$s .= '<div id="blpost-enable-wrapper">';
$s .= '<label id="blpost-enable-label" for="blpost-checkbox">' . t('Enable Blogger Post Plugin') . '</label>';
$s .= '<input id="blpost-checkbox" type="checkbox" name="blpost" value="1" ' . $checked . '/>';
$s .= '<div id="blogger-enable-wrapper">';
$s .= '<label id="blogger-enable-label" for="blogger-checkbox">' . t('Enable Blogger Post Plugin') . '</label>';
$s .= '<input id="blogger-checkbox" type="checkbox" name="blogger" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="blpost-username-wrapper">';
$s .= '<label id="blpost-username-label" for="blpost-username">' . t('Blogger username') . '</label>';
$s .= '<input id="blpost-username" type="text" name="bl_username" value="' . $bl_username . '" />';
$s .= '<div id="blogger-username-wrapper">';
$s .= '<label id="blogger-username-label" for="blogger-username">' . t('Blogger username') . '</label>';
$s .= '<input id="blogger-username" type="text" name="bl_username" value="' . $bl_username . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="blpost-password-wrapper">';
$s .= '<label id="blpost-password-label" for="blpost-password">' . t('Blogger password') . '</label>';
$s .= '<input id="blpost-password" type="password" name="bl_password" value="' . $bl_password . '" />';
$s .= '<div id="blogger-password-wrapper">';
$s .= '<label id="blogger-password-label" for="blogger-password">' . t('Blogger password') . '</label>';
$s .= '<input id="blogger-password" type="password" name="bl_password" value="' . $bl_password . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="blpost-blog-wrapper">';
$s .= '<label id="blpost-blog-label" for="blpost-blog">' . t('Blogger API URL') . '</label>';
$s .= '<input id="blpost-blog" type="text" name="bl_blog" value="' . $bl_blog . '" />';
$s .= '<div id="blogger-blog-wrapper">';
$s .= '<label id="blogger-blog-label" for="blogger-blog">' . t('Blogger API URL') . '</label>';
$s .= '<input id="blogger-blog" type="text" name="bl_blog" value="' . $bl_blog . '" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div id="blpost-bydefault-wrapper">';
$s .= '<label id="blpost-bydefault-label" for="blpost-bydefault">' . t('Post to Blogger by default') . '</label>';
$s .= '<input id="blpost-bydefault" type="checkbox" name="bl_bydefault" value="1" ' . $def_checked . '/>';
$s .= '<div id="blogger-bydefault-wrapper">';
$s .= '<label id="blogger-bydefault-label" for="blogger-bydefault">' . t('Post to Blogger by default') . '</label>';
$s .= '<input id="blogger-bydefault" type="checkbox" name="bl_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="blpost-submit" name="blpost-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="blogger-submit" name="blogger-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
}
function blpost_settings_post(&$a,&$b) {
function blogger_settings_post(&$a,&$b) {
if(x($_POST,'blpost-submit')) {
if(x($_POST,'blogger-submit')) {
set_pconfig(local_user(),'blpost','post',intval($_POST['blpost']));
set_pconfig(local_user(),'blpost','post_by_default',intval($_POST['bl_bydefault']));
set_pconfig(local_user(),'blpost','bl_username',trim($_POST['bl_username']));
set_pconfig(local_user(),'blpost','bl_password',trim($_POST['bl_password']));
set_pconfig(local_user(),'blpost','bl_blog',trim($_POST['bl_blog']));
set_pconfig(local_user(),'blogger','post',intval($_POST['blogger']));
set_pconfig(local_user(),'blogger','post_by_default',intval($_POST['bl_bydefault']));
set_pconfig(local_user(),'blogger','bl_username',trim($_POST['bl_username']));
set_pconfig(local_user(),'blogger','bl_password',trim($_POST['bl_password']));
set_pconfig(local_user(),'blogger','bl_blog',trim($_POST['bl_blog']));
}
}
function blpost_post_local(&$a,&$b) {
function blogger_post_local(&$a,&$b) {
// This can probably be changed to allow editing by pointing to a different API endpoint
@ -131,11 +131,11 @@ function blpost_post_local(&$a,&$b) {
if($b['private'] || $b['parent'])
return;
$bl_post = intval(get_pconfig(local_user(),'blpost','post'));
$bl_post = intval(get_pconfig(local_user(),'blogger','post'));
$bl_enable = (($bl_post && x($_REQUEST,'blpost_enable')) ? intval($_REQUEST['blpost_enable']) : 0);
$bl_enable = (($bl_post && x($_REQUEST,'blogger_enable')) ? intval($_REQUEST['blogger_enable']) : 0);
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'blpost','post_by_default')))
if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'blogger','post_by_default')))
$bl_enable = 1;
if(! $bl_enable)
@ -143,27 +143,27 @@ function blpost_post_local(&$a,&$b) {
if(strlen($b['postopts']))
$b['postopts'] .= ',';
$b['postopts'] .= 'blpost';
$b['postopts'] .= 'blogger';
}
function blpost_send(&$a,&$b) {
function blogger_send(&$a,&$b) {
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
return;
if(! strstr($b['postopts'],'blpost'))
if(! strstr($b['postopts'],'blogger'))
return;
if($b['parent'] != $b['id'])
return;
$bl_username = xmlify(get_pconfig($b['uid'],'blpost','bl_username'));
$bl_password = xmlify(get_pconfig($b['uid'],'blpost','bl_password'));
$bl_blog = get_pconfig($b['uid'],'blpost','bl_blog');
$bl_username = xmlify(get_pconfig($b['uid'],'blogger','bl_username'));
$bl_password = xmlify(get_pconfig($b['uid'],'blogger','bl_password'));
$bl_blog = get_pconfig($b['uid'],'blogger','bl_blog');
if($bl_username && $bl_password && $bl_blog) {
@ -189,7 +189,7 @@ function blpost_send(&$a,&$b) {
EOT;
logger('blpost: data: ' . $xml, LOGGER_DATA);
logger('blogger: data: ' . $xml, LOGGER_DATA);
if($bl_blog !== 'test')
$x = post_url($bl_blog,$xml);

Binary file not shown.

View File

@ -55,7 +55,7 @@ function communityhome_home(&$a, &$o){
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile-link' => $profile_link,
'$photo' => $rr[$photo],
'$photo' => $a->get_cached_avatar_image($rr[$photo]),
'$alt-text' => $rr['name'],
));
$aside['$lastusers_items'][] = $entry;

View File

@ -52,8 +52,11 @@ class FriendicaVirtualCalSourceBackend extends VirtualCalSourceBackend
}
*/
$subject = substr(preg_replace("/\[[^\]]*\]/", "", $row["desc"]), 0, 100);
$description = preg_replace("/\[[^\]]*\]/", "", $row["desc"]);
// 2012-06-29 - change to Friendica new event behaviour where summary is present and required,
// but use desc for older events where summary wasn't present or required (but desc was)
$subject = (($row["summary"]) ? $row["summary"] : substr(preg_replace("/\[[^\]]*\]/", "", $row["desc"]), 0, 100));
$description = (($row["desc"]) ? preg_replace("/\[[^\]]*\]/", "", $row["desc"]) : $row["summary"]);
$vevent = dav_create_vevent(wdcal_mySql2icalTime($row["start"]), wdcal_mySql2icalTime($row["finish"]), false);
$vevent->setLocation(icalendar_sanitize_string($row["location"]));

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/>
*
*/
/**
@ -79,38 +80,38 @@ function facebook_init(&$a) {
if (x($_REQUEST, "realtime_cb") && x($_REQUEST, "realtime_cb")) {
logger("facebook_init: Facebook Real-Time callback called", LOGGER_DEBUG);
if (x($_REQUEST, "hub_verify_token")) {
// this is the verification callback while registering for real time updates
$verify_token = get_config('facebook', 'cb_verify_token');
if ($verify_token != $_REQUEST["hub_verify_token"]) {
logger('facebook_init: Wrong Facebook Callback Verifier - expected ' . $verify_token . ', got ' . $_REQUEST["hub_verify_token"]);
return;
}
if (x($_REQUEST, "hub_challenge")) {
logger('facebook_init: Answering Challenge: ' . $_REQUEST["hub_challenge"], LOGGER_DATA);
echo $_REQUEST["hub_challenge"];
die();
}
}
require_once('include/items.php');
// this is a status update
$content = file_get_contents("php://input");
if (is_numeric($content)) $content = file_get_contents("php://input");
$js = json_decode($content);
logger(print_r($js, true), LOGGER_DATA);
if (!isset($js->object) || $js->object != "user" || !isset($js->entry)) {
logger('facebook_init: Could not parse Real-Time Update data', LOGGER_DEBUG);
return;
}
$affected_users = array("feed" => array(), "friends" => array());
foreach ($js->entry as $entry) {
$fbuser = $entry->uid;
foreach ($entry->changed_fields as $field) {
@ -119,20 +120,20 @@ function facebook_init(&$a) {
continue;
}
if (in_array($fbuser, $affected_users[$field])) continue;
$r = q("SELECT `uid` FROM `pconfig` WHERE `cat` = 'facebook' AND `k` = 'self_id' AND `v` = '%s' LIMIT 1", dbesc($fbuser));
if(! count($r))
continue;
$uid = $r[0]['uid'];
$access_token = get_pconfig($uid,'facebook','access_token');
if(! $access_token)
return;
switch ($field) {
case "feed":
logger('facebook_init: FB-User ' . $fbuser . ' / feed', LOGGER_DEBUG);
if(! get_pconfig($uid,'facebook','no_wall')) {
$private_wall = intval(get_pconfig($uid,'facebook','private_wall'));
$s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token);
@ -146,11 +147,11 @@ function facebook_init(&$a) {
}
}
}
break;
case "friends":
logger('facebook_init: FB-User ' . $fbuser . ' / friends', LOGGER_DEBUG);
fb_get_friends($uid, false);
set_pconfig($uid,'facebook','friend_check',time());
break;
@ -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)
@ -188,7 +190,7 @@ function facebook_init(&$a) {
$x = fetch_url('https://graph.facebook.com/oauth/access_token?client_id='
. $appid . '&client_secret=' . $appsecret . '&redirect_uri='
. urlencode($a->get_baseurl() . '/facebook/' . $nick)
. urlencode($a->get_baseurl() . '/facebook/' . $nick)
. '&code=' . $auth_code);
logger('facebook_init: returned access token: ' . $x, LOGGER_DATA);
@ -316,7 +318,7 @@ function fb_get_friends_sync_parsecontact($uid, $contact) {
dbesc($contact->id),
dbesc('facebook ' . $contact->id),
dbesc($contact->name),
dbesc(($contact->nickname) ? $contact->nickname : strtolower($contact->first_name)),
dbesc(($contact->nickname) ? $contact->nickname : mb_convert_case($contact->first_name, MB_CASE_LOWER, "UTF-8")),
dbesc('https://graph.facebook.com/' . $contact->id . '/picture'),
dbesc(NETWORK_FACEBOOK),
intval(CONTACT_IS_FRIEND),
@ -408,6 +410,7 @@ function fb_get_friends($uid, $fullsync = true) {
$access_token = get_pconfig($uid,'facebook','access_token');
$no_linking = get_pconfig($uid,'facebook','no_linking');
if($no_linking)
return;
@ -432,7 +435,7 @@ function fb_get_friends($uid, $fullsync = true) {
}
// This is the POST method to the facebook settings page
// Content is posted to Facebook in the function facebook_post_hook()
// Content is posted to Facebook in the function facebook_post_hook()
/**
* @param App $a
@ -443,7 +446,7 @@ function facebook_post(&$a) {
if($uid){
$fb_limited = get_config('facebook','restrict');
$fb_limited = get_config('facebook','crestrict');
$value = ((x($_POST,'post_by_default')) ? intval($_POST['post_by_default']) : 0);
@ -456,7 +459,7 @@ function facebook_post(&$a) {
$private_wall = ((x($_POST,'facebook_private_wall')) ? intval($_POST['facebook_private_wall']) : 0);
set_pconfig($uid,'facebook','private_wall',$private_wall);
set_pconfig($uid,'facebook','blocked_apps',escape_tags(trim($_POST['blocked_apps'])));
@ -466,7 +469,7 @@ function facebook_post(&$a) {
if($linkvalue == 0)
set_pconfig($uid,'facebook','no_linking', 1);
}
else
else
set_pconfig($uid,'facebook','no_linking', (($linkvalue) ? 0 : 1));
// FB linkage was allowed but has just been turned off - remove all FB contacts and posts
@ -508,6 +511,13 @@ function facebook_content(&$a) {
return '';
}
if(! service_class_allows(local_user(),'facebook_connect')) {
notice( t('Permission denied.') . EOL);
return upgrade_bool_message();
}
if($a->argc > 1 && $a->argv[1] === 'remove') {
del_pconfig(local_user(),'facebook','post');
info( t('Facebook disabled') . EOL);
@ -750,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;">';
@ -940,7 +950,7 @@ function facebook_post_hook(&$a,&$b) {
if($fb_token && ($toplevel || $b['private'] || $reply)) {
logger('facebook: able to post');
require_once('library/facebook.php');
require_once('include/bbcode.php');
require_once('include/bbcode.php');
$msg = $b['body'];
@ -1015,7 +1025,7 @@ function facebook_post_hook(&$a,&$b) {
}
// At first convert the text to html
$html = bbcode($body);
$html = bbcode($body, false, false);
// Then convert it to plain text
$msg = trim($b['title']." \n\n".html2plain($html, 0, true));
@ -1132,8 +1142,8 @@ function facebook_post_hook(&$a,&$b) {
} else {
// if its only a message and a subject and the message is larger than 500 characters then post it as note
$postvars = array(
'access_token' => $fb_token,
'message' => bbcode($b['body']),
'access_token' => $fb_token,
'message' => bbcode($b['body'], false, false),
'subject' => $b['title'],
);
$url = 'https://graph.facebook.com/me/notes';

1
fromgplus/README Normal file
View File

@ -0,0 +1 @@
This extension is a preparation of the upcoming import of items via Google+

183
fromgplus/fromgplus.php Normal file
View File

@ -0,0 +1,183 @@
<?php
/**
* Name: From GPlus
* Description: Imports posts from a Google+ account and repeats them - not working by now
* Version: 0.1
* Author: Michael Vogel <ike@piratenpartei.de>
*
*/
function fromgplus_install() {
register_hook('plugin_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings');
register_hook('plugin_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post');
}
function fromgplus_uninstall() {
unregister_hook('plugin_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings');
unregister_hook('plugin_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post');
}
function fromgplus_addon_settings(&$a,&$s) {
if(! local_user())
return;
$enable_checked = (intval(get_pconfig(local_user(),'fromgplus','enable')) ? ' checked="checked"' : '');
$account = get_pconfig(local_user(),'fromgplus','account');
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Google+ Import Settings').'</h3>';
$s .= '<div id="fromgplus-wrapper">';
$s .= '<label id="fromgplus-enable-label" for="fromgplus-enable">'.t('Enable Google+ Import').'</label>';
$s .= '<input id="fromgplus-enable" type="checkbox" name="fromgplus-enable" value="1"'.$enable_checked.' />';
$s .= '<div class="clear"></div>';
$s .= '<label id="fromgplus-label" for="fromgplus-account">'.t('Google Account ID').' </label>';
$s .= '<input id="fromgplus-account" type="text" name="fromgplus-account" value="'.$account.'" />';
$s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="fromgplus-submit" name="fromgplus-submit"
class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= '</div>';
return;
}
function fromgplus_addon_settings_post(&$a,&$b) {
if(! local_user())
return;
if($_POST['fromgplus-submit']) {
set_pconfig(local_user(),'fromgplus','account',trim($_POST['fromgplus-account']));
$enable = ((x($_POST,'fromgplus-enable')) ? intval($_POST['fromgplus-enable']) : 0);
set_pconfig(local_user(),'fromgplus','enable', $enable);
info( t('Google+ Import Settings saved.') . EOL);
}
}
/*
function html2bbcode($html) {
$bbcode = html_entity_decode($html, ENT_QUOTES, 'UTF-8');
$bbcode = str_replace(array("\n"), array(""), $bbcode);
$bbcode = str_replace(array("<b>", "</b>"), array("[b]", "[/b]"), $bbcode);
$bbcode = str_replace(array("<i>", "</i>"), array("[i]", "[/i]"), $bbcode);
$bbcode = str_replace(array("<s>", "</s>"), array("[s]", "[/s]"), $bbcode);
$bbcode = str_replace(array("<br />"), array("\n"), $bbcode);
$bbcode = trim(strip_tags($bbcode));
return($bbcode);
}
function friendicapost($post) {
global $friendica;
$api = new Statusnet($friendica["user"], $friendica["pw"], "GooglePlus", $friendica["server"]);
$ret = $api->updateStatus($post);
$api->endSession();
}
function handleattachments($item) {
$post = "";
foreach ($item->object->attachments as $attachment) {
switch($attachment->objectType) {
case "video":
//$post .= "\n\n[url=".$attachment->url."]".
// "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n";
$post .= "\n\n[bookmark=".$attachment->url."]".html2bbcode($attachment->displayName)."[/bookmark]\n";
//if (strpos($attachment->embed->url, "youtube.com"))
// $post .= "[youtube]".$attachment->url."[/youtube]\n";
//else
/// $post .= "[url=".$attachment->url."][img]".$attachment->image->url."[/img][/url]\n";
///$post .= "[quote]".trim(html2bbcode($attachment->content))."[/quote]";
break;
case "article":
//$post .= "\n\n[url=".$attachment->url."]".
// "[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n";
$post .= "\n\n[bookmark=".$attachment->url."]".html2bbcode($attachment->displayName)."[/bookmark]\n";
$post .= "[quote]".trim(html2bbcode($attachment->content))."[/quote]";
break;
case "photo":
//$post .= "\n\n[url=".$attachment->fullImage->url."]".
// "[img]".$attachment->fullImage->url."[/img][/url]\n";
$post .= "\n\n[img]".$attachment->fullImage->url."[/img]\n";
if ($attachment->displayName != "")
$post .= html2bbcode($attachment->displayName)."\n";
break;
case "photo-album":
$post .= "\n\n[url=".$attachment->url."]".
"[size=large][b]".html2bbcode($attachment->displayName)."[/b][/size][/url]\n";
break;
default:
print_r($attachment);
die();
break;
}
}
return($post);
}
$result =
file_get_contents("https://www.googleapis.com/plus/v1/people/".$google["id"]."/activities/public?alt=json&pp=1&key=".$google["key"]."&maxResults=".$google["maxfetch"]);
$activities = json_decode($result);
$state = array("lastid"=>'');
if (file_exists($statefile))
$state = unserialize(file_get_contents($statefile));
$lastid = "";
foreach($activities->items as $item) {
if ($item->id == $state["lastid"])
break;
if ($lastid == "")
$lastid = $item->id;
switch($item->object->objectType) {
case "note":
$post = html2bbcode($item->object->content);
if (is_array($item->object->attachments))
$post .= handleattachments($item);
friendicapost($post);
break;
case "activity":
$post = html2bbcode($item->annotation)."\n";
//$post .= html2bbcode("&#x2672; ");
$post .= html2bbcode("&#x267B; ");
$post .= "[url=".$item->object->actor->url."]".$item->object->actor->displayName."[/url]";
$post .= " \n";
//$post .= "[quote]";
$post .= html2bbcode($item->object->content);
if (is_array($item->object->attachments))
$post .= "\n".trim(handleattachments($item));
//$post .= "[/quote]";
friendicapost($post);
break;
default:
print_r($item);
die();
break;
}
}
if ($lastid != "") {
$state['lastid'] = $lastid;
file_put_contents($statefile, serialize($state));
}
*/

Binary file not shown.

View File

@ -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 <http://friendica.dszdw.net/profile/klaus>
*/
@ -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");
}
/**
@ -81,7 +81,16 @@ function gravatar_plugin_admin (&$a, &$o) {
'x' => 'x'
);
$o = '<input type="hidden" name="form_security_token" value="' .get_form_security_token("gravatarsave") .'">';
// 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 = '<h5>' .t('Information') .'</h5><p>' .t('Libravatar addon is installed, too. Please disable Libravatar addon or this Gravatar addon.<br>The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.') .'</p><br><br>';
}
// output Gravatar settings
$o .= '<input type="hidden" name="form_security_token" value="' .get_form_security_token("gravatarsave") .'">';
$o .= replace_macros( $t, array(
'$submit' => t('Submit'),
'$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),

Binary file not shown.

View File

@ -1,4 +1,3 @@
section {
padding-left: 0px;
}
section {padding-left: 0px;}
iframe {border: none;}

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)
);
@ -488,6 +488,9 @@ function jappixmini_cron(&$a, $d) {
$users = q("SELECT `uid` FROM `pconfig` WHERE `cat`='jappixmini' AND (`k`='autosubscribe' OR `k`='autoapprove') AND `v`='1'");
logger("jappixmini: Update list of contacts' jabber accounts for ".count($users)." users.");
if(! count($users))
return;
foreach ($users as $row) {
$uid = $row["uid"];

Binary file not shown.

View File

@ -118,7 +118,7 @@ function libertree_post_local(&$a,&$b) {
if($b['private'] || $b['parent'])
return;
$ltree_post = intval(get_pconfig(local_user(),'libertree','post'));
$ltree_post = intval(get_pconfig(local_user(),'libertree','post'));
$ltree_enable = (($ltree_post && x($_REQUEST,'libertree_enable')) ? intval($_REQUEST['libertree_enable']) : 0);
@ -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();
@ -167,16 +167,42 @@ function libertree_send(&$a,&$b) {
}
}
if(count($tag_arr))
$tags = implode(',',$tag_arr);
$tags = implode(',',$tag_arr);
$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);
// Removal of tags and mentions
// #-tags
$body = preg_replace('/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $body);
// @-mentions
$body = preg_replace('/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $body);
// remove multiple newlines
do {
$oldbody = $body;
$body = str_replace("\n\n\n", "\n\n", $body);
} while ($oldbody != $body);
// convert to markdown
$body = bb2diaspora($body);
// Adding the title
if(strlen($title))
$body = "## ".html_entity_decode($title)."\n\n".$body;
$params = array(
'text' => bb2diaspora($b['body'])
'text' => $body,
'source' => $ltree_source
// 'token' => $ltree_api_token
);
$result = post_url($ltree_blog,$params);
logger('libertree: ' . $result);
logger('libertree: ' . $result);
}
}

BIN
libravatar.tgz Normal file

Binary file not shown.

36
libravatar/README.md Normal file
View File

@ -0,0 +1,36 @@
# Libravatar Plugin
by [Klaus Weidenbach](http://friendica.dszdw.net/profile/klaus)
This addon allows you to look up an avatar image for new users and contacts at [Libravatar](http://www.libravatar.com). It will be used if there have not been found any other avatar images yet for example through OpenID.
Libravatar is a free and open replacement for Gravatar. It is a service where people can store an avatar image for their email-addresses. These avatar images can get looked up for example in comment functions, profile pages, etc. on other sites. There exists a central installation at [www.libravatar.com](http://www.libravatar.com), but you can also host it on your own server. If no avatar was found Libravatar will look up at Gravatar as a fallback.
There is no rating available, as it is on Gravatar, so all avatar lookups are g-rated. (Suitable for all audiences.)
PHP >= 5.3 is required for this plugin!
You can not use the Libravatar and Gravatar addon at the same time. You need to choose one. If you need other ratings than g you better stay with Gravatar, otherwise it is safe to use Libravatar, because it will fall back to Gravatar if nothing was found at Libravatar.
* * *
# Configuration
## Default Avatar Image
If no avatar was found for an email Libravatar can create some pseudo-random generated avatars based on an email hash. You can choose between these presets:
* __MM__: (mystery-man) a static image
* __Identicon__: a generated geometric pattern based on email hash
* __Monsterid__: a generated 'monster' with different colors, faces, etc. based on email hash
* __Wavatar__: faces with different features and backgrounds based on email hash
* __Retro__: 8-bit arcade-styled pixelated faces based on email hash
See examples at [Libravatar][1].
## Alternative Configuration
Open the .htconfig.php file and add "libravatar" to the list of activated addons:
$a->config['system']['addon'] = "..., libravatar";
You can add one configuration variable for the addon:
$a->config['libravatar']['default_avatar'] = "identicon";
[1]: http://wiki.libravatar.org/api/ "See API documentation at Libravatar for more information"

View File

@ -0,0 +1,669 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* PHP support for the Libravatar.org service.
*
* PHP version 5
*
* The MIT License
*
* Copyright (c) 2011 Services_Libravatar committers.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @category Services
* @package Services_Libravatar
* @author Melissa Draper <melissa@meldraweb.com>
* @copyright 2011 Services_Libravatar committers.
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://pear.php.net/package/Services_Libravatar
* @since File available since Release 0.1.0
*/
/**
* PHP support for the Libravatar.org service.
*
* Using this class is easy. After including or requiring
* Services/Libravatar.php simply do:
* <code>
* $libravatar = new Services_Libravatar();
* $url = $libravatar->getUrl('melissa@meldraweb.com');
* </code>
*
* This would populate $url with the string:
* <code>
* http://cdn.libravatar.org/avatar/4db84629c121f2d443d33bdb9fd149bc
* </code>
*
* A complicated lookup using all the options is:
* <code>
* $libravatar = new Services_Libravatar();
* $libravatar->setSize(40);
* $libravatar->setAlgorithm('sha256');
* $libravatar->setHttps(true);
* $libravatar->setDefault(
* 'http://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png'
* );
* $url = $libravatar->getUrl('melissa@meldraweb.com');
* </code>
*
* @category Services
* @package Services_Libravatar
* @author Melissa Draper <melissa@meldraweb.com>
* @copyright 2011 Services_Libravatar committers.
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version Release: 0.2.1
* @link http://pear.php.net/package/Services_Libravatar
* @since Class available since Release 0.1.0
*/
class Services_Libravatar
{
/**
* Hashing algorithm to use
*
* @var string
* @see processAlgorithm()
* @see setAlgorithm()
*/
protected $algorithm = 'md5';
/**
* Default image URL to use
*
* @var string
* @see processDefault()
* @see setDefault()
*/
protected $default;
/**
* If HTTPS URLs should be used
*
* @var boolean
* @see detectHttps()
* @see setHttps()
*/
protected $https;
/**
* Image size in pixels
*
* @var integer
* @see processSize()
* @see setSize()
*/
protected $size;
/**
* Composes a URL for the identifier and options passed in
*
* Compose a full URL as specified by the Libravatar API, based on the
* email address or openid URL passed in, and the options specified.
*
* @param string $identifier a string of either an email address
* or an openid url
* @param array $options an array of (bool) https, (string) algorithm
* (string) size, (string) default.
* See the set* methods.
*
* @return string A string of a full URL for an avatar image
*
* @since Method available since Release 0.2.0
* @deprecated Use getUrl() instead
*/
public function url($identifier, $options = array())
{
return $this->getUrl($identifier, $options);
}
/**
* Composes a URL for the identifier and options passed in
*
* Compose a full URL as specified by the Libravatar API, based on the
* email address or openid URL passed in, and the options specified.
*
* @param string $identifier a string of either an email address
* or an openid url
* @param array $options an array of (bool) https, (string) algorithm
* (string) size, (string) default.
* See the set* methods.
*
* @return string A string of a full URL for an avatar image
*
* @since Method available since Release 0.2.0
* @throws InvalidArgumentException When an invalid option is passed
*/
public function getUrl($identifier, $options = array())
{
// If no identifier has been passed, set it to a null.
// This way, there'll always be something returned.
if (!$identifier) {
$identifier = null;
} else {
$identifier = $this->normalizeIdentifier($identifier);
}
// Load all options
$options = $this->checkOptionsArray($options);
$https = $this->https;
if (isset($options['https'])) {
$https = (bool)$options['https'];
}
$algorithm = $this->algorithm;
if (isset($options['algorithm'])) {
$algorithm = $this->processAlgorithm($options['algorithm']);
}
$default = $this->default;
if (isset($options['default'])) {
$default = $this->processDefault($options['default']);
}
$size = $this->size;
if (isset($options['size'])) {
$size = $this->processSize($options['size']);
}
$identifierHash = $this->identifierHash($identifier, $algorithm);
// Get the domain so we can determine the SRV stuff for federation
$domain = $this->domainGet($identifier);
// If https has been specified in $options, make sure we make the
// correct SRV lookup
$service = $this->srvGet($domain, $https);
$protocol = $https ? 'https' : 'http';
$params = array();
if ($size !== null) {
$params['size'] = $size;
}
if ($default !== null) {
$params['default'] = $default;
}
$paramString = '';
if (count($params) > 0) {
$paramString = '?' . http_build_query($params);
}
// Compose the URL from the pieces we generated
$url = $protocol . '://' . $service . '/avatar/' . $identifierHash
. $paramString;
// Return the URL string
return $url;
}
/**
* Checks the options array and verify that only allowed options are in it.
*
* @param array $options Array of options for getUrl()
*
* @return void
* @throws Exception When an invalid option is used
*/
protected function checkOptionsArray($options)
{
//this short options are deprecated!
if (isset($options['s'])) {
$options['size'] = $options['s'];
unset($options['s']);
}
if (isset($options['d'])) {
$options['default'] = $options['d'];
unset($options['d']);
}
$allowedOptions = array(
'algorithm' => true,
'default' => true,
'https' => true,
'size' => true,
);
foreach ($options as $key => $value) {
if (!isset($allowedOptions[$key])) {
throw new InvalidArgumentException(
'Invalid option in array: ' . $key
);
}
}
return $options;
}
/**
* Normalizes the identifier (E-mail address or OpenID)
*
* @param string $identifier E-Mail address or OpenID
*
* @return string Normalized identifier
*/
protected function normalizeIdentifier($identifier)
{
if (filter_var($identifier, FILTER_VALIDATE_EMAIL)) {
return strtolower($identifier);
} else {
return self::normalizeOpenId($identifier);
}
}
/**
* Create a hash of the identifier.
*
* Create a hash of the email address or openid passed in. Algorithm
* used for email address ONLY can be varied. Either md5 or sha256
* are supported by the Libravatar API. Will be ignored for openid.
*
* @param string $identifier A string of the email address or openid URL
* @param string $hash A string of the hash algorithm type to make
* Uses the php implementation of hash()
* MD5 preferred for Gravatar fallback
*
* @return string A string hash of the identifier.
*
* @since Method available since Release 0.1.0
*/
protected function identifierHash($identifier, $hash = 'md5')
{
if (filter_var($identifier, FILTER_VALIDATE_EMAIL) || $identifier === null) {
// If email, we can select our algorithm. Default to md5 for
// gravatar fallback.
return hash($hash, $identifier);
}
//no email, so the identifier has to be an OpenID
return hash('sha256', $identifier);
}
/**
* Normalizes an identifier (URI or XRI)
*
* @param mixed $identifier URI or XRI to be normalized
*
* @return string Normalized Identifier.
* Empty string when the OpenID is invalid.
*
* @internal Adapted from OpenID::normalizeIdentifier()
*/
public static function normalizeOpenId($identifier)
{
// XRI
if (preg_match('@^xri://@i', $identifier)) {
return preg_replace('@^xri://@i', '', $identifier);
}
if (in_array($identifier[0], array('=', '@', '+', '$', '!'))) {
return $identifier;
}
// URL
if (!preg_match('@^http[s]?://@i', $identifier)) {
$identifier = 'http://' . $identifier;
}
if (strpos($identifier, '/', 8) === false) {
$identifier .= '/';
}
if (!filter_var($identifier, FILTER_VALIDATE_URL)) {
return '';
}
$parts = parse_url($identifier);
$parts['scheme'] = strtolower($parts['scheme']);
$parts['host'] = strtolower($parts['host']);
//http://openid.net/specs/openid-authentication-2_0.html#normalization
return $parts['scheme'] . '://'
. (isset($parts['user']) ? $parts['user'] : '')
. (isset($parts['pass']) ? ':' . $parts['pass'] : '')
. (isset($parts['user']) || isset($parts['pass']) ? '@' : '')
. $parts['host']
. (
(isset($parts['port'])
&& $parts['scheme'] === 'http' && $parts['port'] != 80)
|| (isset($parts['port'])
&& $parts['scheme'] === 'https' && $parts['port'] != 443)
? ':' . $parts['port'] : ''
)
. $parts['path']
. (isset($parts['query']) ? '?' . $parts['query'] : '');
//leave out fragment as requested by the spec
}
/**
* Grab the domain from the identifier.
*
* Extract the domain from the Email or OpenID.
*
* @param string $identifier A string of the email address or openid URL
*
* @return string A string of the domain to use
*
* @since Method available since Release 0.1.0
*/
protected function domainGet($identifier)
{
if ($identifier === null) {
return null;
}
// What are we, email or openid? Split ourself up and get the
// important bit out.
if (filter_var($identifier, FILTER_VALIDATE_EMAIL)) {
$email = explode('@', $identifier);
return $email[1];
}
//OpenID
$url = parse_url($identifier);
$domain = $url['host'];
if (isset($url['port']) && $url['scheme'] === 'http'
&& $url['port'] != 80
|| isset($url['port']) && $url['scheme'] === 'https'
&& $url['port'] != 443
) {
$domain .= ':' . $url['port'];
}
return $domain;
}
/**
* Get the target to use.
*
* Get the SRV record, filtered by priority and weight. If our domain
* has no SRV records, fall back to Libravatar.org
*
* @param string $domain A string of the domain we extracted from the
* provided identifier with domainGet()
* @param boolean $https Whether or not to look for https records
*
* @return string The target URL.
*
* @since Method available since Release 0.1.0
*/
protected function srvGet($domain, $https = false)
{
// Are we going secure? Set up a fallback too.
if (isset($https) && $https === true) {
$subdomain = '_avatars-sec._tcp.';
$fallback = 'seccdn.';
} else {
$subdomain = '_avatars._tcp.';
$fallback = 'cdn.';
}
// Lets try get us some records based on the choice of subdomain
// and the domain we had passed in.
$srv = dns_get_record($subdomain . $domain, DNS_SRV);
// Did we get anything? No?
if (count($srv) == 0) {
// Then let's try Libravatar.org.
return $fallback . 'libravatar.org';
}
// Sort by the priority. We must get the lowest.
usort($srv, array($this, 'comparePriority'));
$top = $srv[0];
$sum = 0;
// Try to adhere to RFC2782's weighting algorithm, page 3
// "arrange all SRV RRs (that have not been ordered yet) in any order,
// except that all those with weight 0 are placed at the beginning of
// the list."
shuffle($srv);
$srvs = array();
foreach ($srv as $s) {
if ($s['weight'] == 0) {
array_unshift($srvs, $s);
} else {
array_push($srvs, $s);
}
}
foreach ($srvs as $s) {
if ($s['pri'] == $top['pri']) {
// "Compute the sum of the weights of those RRs"
$sum += (int) $s['weight'];
// "and with each RR associate the running sum in the selected
// order."
$pri[$sum] = $s;
}
}
// "Then choose a uniform random number between 0 and the sum computed
// (inclusive)"
$random = rand(0, $sum);
// "and select the RR whose running sum value is the first in the selected
// order which is greater than or equal to the random number selected"
foreach ($pri as $k => $v) {
if ($k >= $random) {
return $v['target'];
}
}
}
/**
* Sorting function for record priorities.
*
* @param mixed $a A mixed value passed by usort()
* @param mixed $b A mixed value passed by usort()
*
* @return mixed The result of the comparison
*
* @since Method available since Release 0.1.0
*/
protected function comparePriority($a, $b)
{
return $a['pri'] - $b['pri'];
}
/**
* Automatically set the https option depending on the current connection
* value.
*
* If the current connection is HTTPS, the https options is activated.
* If it is not HTTPS, the https option is deactivated.
*
* @return self
*/
public function detectHttps()
{
$this->setHttps(
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']
);
return $this;
}
/**
* Verify and cast the email address hashing algorithm to use.
*
* @param string $algorithm Algorithm to use, "sha256" or "md5".
*
* @return string Algorithm
*
* @throws InvalidArgumentException When an unsupported algorithm is given
*/
protected function processAlgorithm($algorithm)
{
$algorithm = (string)$algorithm;
if ($algorithm !== 'md5' && $algorithm !== 'sha256') {
throw new InvalidArgumentException(
'Only md5 and sha256 hashing supported'
);
}
return $algorithm;
}
/**
* Verify and cast the default URL to use when no avatar image can be found.
* If none is set, the libravatar logo is returned.
*
* @param string $url Full URL to use OR one of the following:
* - "404" - give a "404 File not found" instead of an image
* - "mm"
* - "identicon"
* - "monsterid"
* - "wavatar"
* - "retro"
*
* @return string Default URL
*
* @throws InvalidArgumentException When an invalid URL is given
*/
protected function processDefault($url)
{
if ($url === null) {
return $url;
}
$url = (string)$url;
switch ($url) {
case '404':
case 'mm':
case 'identicon':
case 'monsterid':
case 'wavatar':
case 'retro':
break;
default:
$valid = filter_var($url, FILTER_VALIDATE_URL);
if (!$valid) {
throw new InvalidArgumentException('Invalid default avatar URL');
}
break;
}
return $url;
}
/**
* Verify and cast the required size of the images.
*
* @param integer $size Size (width and height in pixels) of the image.
* NULL for the default width.
*
* @return integer Size
*
* @throws InvalidArgumentException When a size <= 0 is given
*/
protected function processSize($size)
{
if ($size === null) {
return $size;
}
$size = (int)$size;
if ($size <= 0) {
throw new InvalidArgumentException('Size has to be larger than 0');
}
return (int)$size;
}
/**
* Set the email address hashing algorithm to use.
* To keep gravatar compatibility, use "md5".
*
* @param string $algorithm Algorithm to use, "sha256" or "md5".
*
* @return self
* @throws InvalidArgumentException When an unsupported algorithm is given
*/
public function setAlgorithm($algorithm)
{
$this->algorithm = $this->processAlgorithm($algorithm);
return $this;
}
/**
* Set the default URL to use when no avatar image can be found.
* If none is set, the gravatar logo is returned.
*
* @param string $url Full URL to use OR one of the following:
* - "404" - give a "404 File not found" instead of an image
* - "mm"
* - "identicon"
* - "monsterid"
* - "wavatar"
* - "retro"
*
* @return self
* @throws InvalidArgumentException When an invalid URL is given
*/
public function setDefault($url)
{
$this->default = $this->processDefault($url);
return $this;
}
/**
* Set if HTTPS URLs shall be returned.
*
* @param boolean $useHttps If HTTPS url shall be returned
*
* @return self
*
* @see detectHttps()
*/
public function setHttps($useHttps)
{
$this->https = (bool)$useHttps;
return $this;
}
/**
* Set the required size of the images.
* Every avatar image is square sized, which means you need to set only number.
*
* @param integer $size Size (width and height) of the image
*
* @return self
* @throws InvalidArgumentException When a size <= 0 is given
*/
public function setSize($size)
{
$this->size = $this->processSize($size);
return $this;
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/
?>

2
libravatar/admin.tpl Normal file
View File

@ -0,0 +1,2 @@
{{ inc field_select.tpl with $field=$default_avatar}}{{ endinc }}
<div class="submit"><input type="submit" value="$submit" /></div>

114
libravatar/libravatar.php Normal file
View File

@ -0,0 +1,114 @@
<?php
/**
* Name: Libravatar Support
* Description: If there is no avatar image for a new user or contact this plugin will look for one at Libravatar. Please disable Gravatar addon if you use this one. (requires PHP >= 5.3)
* Version: 1.1
* Author: Klaus Weidenbach <http://friendica.dszdw.net/profile/klaus>
*/
/**
* Installs the plugin hook
*/
function libravatar_install() {
if (! version_compare(PHP_VERSION, '5.3.0', '>=')) {
info(t('Could NOT install Libravatar successfully.<br>It requires PHP >= 5.3') .EOL);
// avoid registering the hook
return false;
}
register_hook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
logger("registered libravatar in avatar_lookup hook");
}
/**
* Removes the plugin hook
*/
function libravatar_uninstall() {
unregister_hook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
logger("unregistered libravatar in avatar_lookup hook");
}
/**
* Looks up the avatar at Libravatar and returns the URL.
*
* @param $a array
* @param &$b array
*/
function libravatar_lookup($a, &$b) {
$default_avatar = get_config('libravatar', 'default_img');
if (! $default_avatar) {
// if not set, look up if there was one from the gravatar addon
$default_avatar = get_config('gravatar', 'default_img');
// setting default avatar if nothing configured
if (! $default_avatar)
$default_avatar = 'identicon'; // default image will be a random pattern
}
require_once 'Services/Libravatar.php';
$libravatar = new Services_Libravatar();
$libravatar->setSize($b['size']);
$libravatar->setDefault($default_avatar);
$avatar_url = $libravatar->getUrl($b['email']);
$b['url'] = $avatar_url;
$b['success'] = true;
}
/**
* Display admin settings for this addon
*/
function libravatar_plugin_admin (&$a, &$o) {
$t = file_get_contents( dirname(__file__)."/admin.tpl");
$default_avatar = get_config('libravatar', 'default_img');
// set default values for first configuration
if(! $default_avatar)
$default_avatar = 'identicon'; // pseudo-random geometric pattern based on email hash
// Available options for the select boxes
$default_avatars = array(
'mm' => t('generic profile image'),
'identicon' => t('random geometric pattern'),
'monsterid' => t('monster face'),
'wavatar' => t('computer generated face'),
'retro' => t('retro arcade style face'),
);
// Show warning if PHP version is too old
if (! version_compare(PHP_VERSION, '5.3.0', '>=')) {
$o = '<h5>' .t('Warning') .'</h5><p>';
$o .= sprintf(t('Your PHP version %s is lower than the required PHP >= 5.3.'), PHP_VERSION);
$o .= '<br>' .t('This addon is not functional on your server.') .'<p><br>';
return;
}
// Libravatar falls back to gravatar, so show warning about gravatar addon if enabled
$r = q("SELECT * FROM `addon` WHERE `name` = '%s' and `installed` = 1",
dbesc('gravatar')
);
if (count($r)) {
$o = '<h5>' .t('Information') .'</h5><p>' .t('Gravatar addon is installed. Please disable the Gravatar addon.<br>The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.') .'</p><br><br>';
}
// output Libravatar settings
$o .= '<input type="hidden" name="form_security_token" value="' .get_form_security_token("libravatarsave") .'">';
$o .= replace_macros( $t, array(
'$submit' => t('Submit'),
'$default_avatar' => array('avatar', t('Default avatar image'), $default_avatar, t('Select default avatar image if none was found. See README'), $default_avatars),
));
}
/**
* Save admin settings
*/
function libravatar_plugin_admin_post (&$a) {
check_form_security_token('libravatarrsave');
$default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon');
set_config('libravatar', 'default_img', $default_avatar);
info(t('Libravatar settings updated.') .EOL);
}
?>

BIN
page.tgz

Binary file not shown.

13
page/page.css Normal file
View File

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

View File

@ -1,7 +1,7 @@
<?php
/**
* Name: Page
* Description: Shows lists of community pages (improved performance over 'pages')
* Description: Shows list of subscribed community pages/forums on network sidebar
* Version: 1.0
* Author: Mike Macgirvin <mike@macgirvin.com>
* based on pages plugin by
@ -10,22 +10,35 @@
*/
function page_install() {
register_hook('page_end', 'addon/page/page.php', 'page_page_end');
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');
}
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) {
function page_getpage($uid,$showhidden = true,$randomise = false) {
$pagelist = array();
$contacts = q("SELECT `id`, `url`, `name`, `micro`FROM `contact`
$order = (($showhidden) ? '' : " and hidden = 0 ");
$order .= (($randomise) ? ' order by rand() ' : ' order by name asc ');
$contacts = q("SELECT `id`, `url`, `name`, `micro` FROM `contact`
WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d
order by name asc ",
$order ",
intval($uid)
);
@ -55,7 +68,7 @@ function page_page_end($a,&$b) {
$more = false;
foreach($contacts as $contact) {
$page .= '<li style="list-style-type: none;" class="tool"><img height="20" width="20" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /> <a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" title="' . $contact['url'] . '" class="label" target="external-link">'.
$page .= '<li style="list-style-type: none;" class="tool"><img height="20" width="20" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /> <a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" title="' . $contact['url'] . '" class="label sparkle" target="external-link">'.
$contact["name"]."</a></li>";
$total_shown ++;
if($total_shown == 6) {
@ -71,5 +84,131 @@ function page_page_end($a,&$b) {
$a->page['aside'] = $page . $a->page['aside'];
}
function page_network_mod_init($a,$b) {
$page = '<div id="page-sidebar" class="widget">
<div class="title tool">
<h3>'.t("Forums").'</h3></div>
<div id="sidebar-page-list"><ul>';
$show_total = intval(get_pconfig(local_user(),'page','max_pages'));
if($show_total === false)
$show_total = 6;
$randomise = intval(get_pconfig(local_user(),'page','randomise'));
$contacts = page_getpage($a->user['uid'],true,$randomise);
$total_shown = 0;
$more = false;
foreach($contacts as $contact) {
$page .= '<li style="list-style-type: none;" class="tool"><img height="20" width="20" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /> <a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" title="' . $contact['url'] . '" class="label sparkle" target="external-link">'.
$contact["name"]."</a></li>";
$total_shown ++;
if(($show_total) && ($total_shown == $show_total)) {
$more = true;
$page .= '</ul><div id="hide-comments-page-widget" class="fakelink" onclick="showHideComments(\'page-widget\');" >' . t('show more')
. '</div><div id="collapsed-comments-page-widget" style="display: none;" ><ul>';
}
}
if($more)
$page .= '</div>';
$page .= "</ul></div></div>";
if (sizeof($contacts) > 0)
$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);
}
function page_plugin_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/page/page.css' . '" media="all" />' . "\r\n";
/* Get the current state of our config variable */
$max_pages = get_pconfig(local_user(),'page','max_pages');
if($max_pages === false)
$max_pages = 6;
$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 */
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Page Settings') . '</h3>';
$s .= '<div id="page-settings-wrapper">';
$s .= '<label id="page-settings-label" for="page-max-pages">' . t('How many forums to display on sidebar without paging') . '</label>';
$s .= '<input id="page-max-pages" type="text" name="page_max_pages" value="' . intval($max_pages) . '" ' . '/>';
$s .= '<div class="clear"></div>';
$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>';
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="page-settings-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
}

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?php
/**
* Name: Poor Man Cron
* Description: Execute updates on pageviews, without the need of commandline php
* Description: Execute updates on pageviews, without the need of commandline php - only for use in total desperation as page loads will take forever
* Version: 1.2
* Author: Fabio Comuni <http://kirgroup.com/profile/fabrix>
*/

Binary file not shown.

View File

@ -36,16 +36,18 @@ function privacy_image_cache_init() {
}
$urlhash = 'pic:' . sha1($_REQUEST['url']);
$r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $urlhash );
if (count($r)) {
$img_str = $r[0]['data'];
// Double encoded url - happens with Diaspora
$urlhash2 = 'pic:' . sha1(urldecode($_REQUEST['url']));
$r = q("SELECT * FROM `photo` WHERE `resource-id` in ('%s', '%s') LIMIT 1", $urlhash, $urlhash2);
if (count($r)) {
$img_str = $r[0]['data'];
$mime = $r[0]["desc"];
if ($mime == "") $mime = "image/jpeg";
}
else {
require_once("Photo.php");
} else {
require_once("Photo.php");
$img_str = fetch_url($_REQUEST['url'],true);
$img_str = fetch_url($_REQUEST['url'],true);
if (substr($img_str, 0, 6) == "GIF89a") {
$mime = "image/gif";
$image = @imagecreatefromstring($img_str);
@ -77,16 +79,16 @@ function privacy_image_cache_init() {
}
$mime = "image/jpeg";
}
}
}
header("Content-type: $mime");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + (3600*24)) . " GMT");
header("Cache-Control: max-age=" . (3600*24));
header("Content-type: $mime");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + (3600*24)) . " GMT");
header("Cache-Control: max-age=" . (3600*24));
echo $img_str;
echo $img_str;
killme();
killme();
}
/**
@ -210,4 +212,4 @@ function privacy_image_cache_plugin_admin_post(&$a = null, &$o = null){
if (isset($_REQUEST['delete_all'])) {
q('DELETE FROM `photo` WHERE `uid` = 0 AND `resource-id` LIKE "pic:%%"');
}
}
}

Binary file not shown.

View File

@ -33,463 +33,463 @@ function smiley_pack_smilies(&$a,&$b) {
#Animal smileys.
$b['texts'][] = ':bunnyflowers';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/bunnyflowers.gif' . '" alt="' . ':bunnyflowers' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/bunnyflowers.gif' . '" alt="' . ':bunnyflowers' . '" />';
$b['texts'][] = ':chick';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/chick.gif' . '" alt="' . ':chick' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/chick.gif' . '" alt="' . ':chick' . '" />';
$b['texts'][] = ':bumblebee';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/bee.gif' . '" alt="' . ':bee' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/bee.gif' . '" alt="' . ':bee' . '" />';
$b['texts'][] = ':ladybird';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/ladybird.gif' . '" alt="' . ':ladybird' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/ladybird.gif' . '" alt="' . ':ladybird' . '" />';
$b['texts'][] = ':bigspider';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/bigspider.gif' . '" alt="' . ':bigspider' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/bigspider.gif' . '" alt="' . ':bigspider' . '" />';
$b['texts'][] = ':cat';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/cat.gif' . '" alt="' . ':cat' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/cat.gif' . '" alt="' . ':cat' . '" />';
$b['texts'][] = ':bunny';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/bunny.gif' . '" alt="' . ':bunny' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/bunny.gif' . '" alt="' . ':bunny' . '" />';
$b['texts'][] = ':cow';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/cow.gif' . '" alt="' . ':cow' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/cow.gif' . '" alt="' . ':cow' . '" />';
$b['texts'][] = ':crab';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/crab.gif' . '" alt="' . ':crab' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/crab.gif' . '" alt="' . ':crab' . '" />';
$b['texts'][] = ':dolphin';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/dolphin.gif' . '" alt="' . ':dolphin' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/dolphin.gif' . '" alt="' . ':dolphin' . '" />';
$b['texts'][] = ':dragonfly';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/dragonfly.gif' . '" alt="' . ':dragonfly' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/dragonfly.gif' . '" alt="' . ':dragonfly' . '" />';
$b['texts'][] = ':frog';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/frog.gif' . '" alt="' . ':frog' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/frog.gif' . '" alt="' . ':frog' . '" />';
$b['texts'][] = ':hamster';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/hamster.gif' . '" alt="' . ':hamster' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/hamster.gif' . '" alt="' . ':hamster' . '" />';
$b['texts'][] = ':monkey';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/monkey.gif' . '" alt="' . ':monkey' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/monkey.gif' . '" alt="' . ':monkey' . '" />';
$b['texts'][] = ':horse';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/horse.gif' . '" alt="' . ':horse' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/horse.gif' . '" alt="' . ':horse' . '" />';
$b['texts'][] = ':parrot';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/parrot.gif' . '" alt="' . ':parrot' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/parrot.gif' . '" alt="' . ':parrot' . '" />';
$b['texts'][] = ':tux';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/tux.gif' . '" alt="' . ':tux' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/tux.gif' . '" alt="' . ':tux' . '" />';
$b['texts'][] = ':snail';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/snail.gif' . '" alt="' . ':snail' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/snail.gif' . '" alt="' . ':snail' . '" />';
$b['texts'][] = ':sheep';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/sheep.gif' . '" alt="' . ':sheep' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/sheep.gif' . '" alt="' . ':sheep' . '" />';
$b['texts'][] = ':dog';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/dog.gif' . '" alt="' . ':dog' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/dog.gif' . '" alt="' . ':dog' . '" />';
$b['texts'][] = ':elephant';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/elephant.gif' . '" alt="' . ':elephant' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/elephant.gif' . '" alt="' . ':elephant' . '" />';
$b['texts'][] = ':fish';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/fish.gif' . '" alt="' . ':fish' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/fish.gif' . '" alt="' . ':fish' . '" />';
$b['texts'][] = ':giraffe';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/giraffe.gif' . '" alt="' . ':giraffe' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/giraffe.gif' . '" alt="' . ':giraffe' . '" />';
$b['texts'][] = ':pig';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/pig.gif' . '" alt="' . ':pig' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/animals/pig.gif' . '" alt="' . ':pig' . '" />';
#Baby Smileys
$b['texts'][] = ':baby';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/babies/baby.gif' . '" alt="' . ':baby' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/babies/baby.gif' . '" alt="' . ':baby' . '" />';
$b['texts'][] = ':babycot';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/babies/babycot.gif' . '" alt="' . ':babycot' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/babies/babycot.gif' . '" alt="' . ':babycot' . '" />';
$b['texts'][] = ':pregnant';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/babies/pregnant.gif' . '" alt="' . ':pregnant' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/babies/pregnant.gif' . '" alt="' . ':pregnant' . '" />';
$b['texts'][] = ':stork';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/babies/stork.gif' . '" alt="' . ':stork' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/babies/stork.gif' . '" alt="' . ':stork' . '" />';
#Confused Smileys
$b['texts'][] = ':confused';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/confused/confused.gif' . '" alt="' . ':confused' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/confused/confused.gif' . '" alt="' . ':confused' . '" />';
$b['texts'][] = ':shrug';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/confused/shrug.gif' . '" alt="' . ':shrug' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/confused/shrug.gif' . '" alt="' . ':shrug' . '" />';
$b['texts'][] = ':stupid';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/confused/stupid.gif' . '" alt="' . ':stupid' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/confused/stupid.gif' . '" alt="' . ':stupid' . '" />';
$b['texts'][] = ':dazed';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/confused/dazed.gif' . '" alt="' . ':dazed' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/confused/dazed.gif' . '" alt="' . ':dazed' . '" />';
#Cool Smileys
$b['texts'][] = ':affro';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/cool/affro.gif' . '" alt="' . ':affro' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/cool/affro.gif' . '" alt="' . ':affro' . '" />';
#Devil/Angel Smileys
$b['texts'][] = ':angel';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/angel.gif' . '" alt="' . ':angel' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/angel.gif' . '" alt="' . ':angel' . '" />';
$b['texts'][] = ':cherub';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/cherub.gif' . '" alt="' . ':cherub' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/cherub.gif' . '" alt="' . ':cherub' . '" />';
$b['texts'][] = ':devilangel';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/blondedevil.gif' . '" alt="' . ':devilangel' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/blondedevil.gif' . '" alt="' . ':devilangel' . '" />';
$b['texts'][] = ':catdevil';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/catdevil.gif' . '" alt="' . ':catdevil' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/catdevil.gif' . '" alt="' . ':catdevil' . '" />';
$b['texts'][] = ':devillish';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/devil.gif' . '" alt="' . ':devillish' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/devil.gif' . '" alt="' . ':devillish' . '" />';
$b['texts'][] = ':daseesaw';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/daseesaw.gif' . '" alt="' . ':daseesaw' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/daseesaw.gif' . '" alt="' . ':daseesaw' . '" />';
$b['texts'][] = ':turnevil';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/turnevil.gif' . '" alt="' . ':turnevil' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/turnevil.gif' . '" alt="' . ':turnevil' . '" />';
$b['texts'][] = ':saint';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/saint.gif' . '" alt="' . ':saint' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/saint.gif' . '" alt="' . ':saint' . '" />';
$b['texts'][] = ':graveside';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/graveside.gif' . '" alt="' . ':graveside' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/devilangel/graveside.gif' . '" alt="' . ':graveside' . '" />';
#Unpleasent smileys.
$b['texts'][] = ':toilet';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/disgust/toilet.gif' . '" alt="' . ':toilet' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/disgust/toilet.gif' . '" alt="' . ':toilet' . '" />';
$b['texts'][] = ':fartinbed';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/disgust/fartinbed.gif' . '" alt="' . ':fartinbed' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/disgust/fartinbed.gif' . '" alt="' . ':fartinbed' . '" />';
$b['texts'][] = ':fartblush';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/disgust/fartblush.gif' . '" alt="' . ':fartblush' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/disgust/fartblush.gif' . '" alt="' . ':fartblush' . '" />';
#Drinks
$b['texts'][] = ':tea';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/drink/tea.gif' . '" alt="' . ':tea' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/drink/tea.gif' . '" alt="' . ':tea' . '" />';
$b['texts'][] = ':drool';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/drool/drool.gif' . '" alt="' . ':drool' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/drool/drool.gif' . '" alt="' . ':drool' . '" />';
#Sad smileys
$b['texts'][] = ':crying';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sad/crying.png' . '" alt="' . ':crying' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sad/crying.png' . '" alt="' . ':crying' . '" />';
$b['texts'][] = ':prisoner';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sad/prisoner.gif' . '" alt="' . ':prisoner' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sad/prisoner.gif' . '" alt="' . ':prisoner' . '" />';
$b['texts'][] = ':sigh';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sad/sigh.gif' . '" alt="' . ':sigh' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sad/sigh.gif' . '" alt="' . ':sigh' . '" />';
#Smoking - only one smiley in here, maybe it needs moving elsewhere?
$b['texts'][] = ':smoking';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/smoking/smoking.gif' . '" alt="' . ':smoking' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/smoking/smoking.gif' . '" alt="' . ':smoking' . '" />';
#Sport smileys
$b['texts'][] = ':basketball';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/basketball.gif' . '" alt="' . ':basketball' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/basketball.gif' . '" alt="' . ':basketball' . '" />';
$b['texts'][] = '~bowling';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/bowling.gif' . '" alt="' . '~bowling' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/bowling.gif' . '" alt="' . '~bowling' . '" />';
$b['texts'][] = ':cycling';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/cycling.gif' . '" alt="' . ':cycling' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/cycling.gif' . '" alt="' . ':cycling' . '" />';
$b['texts'][] = ':darts';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/darts.gif' . '" alt="' . ':darts' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/darts.gif' . '" alt="' . ':darts' . '" />';
$b['texts'][] = ':fencing';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/fencing.gif' . '" alt="' . ':fencing' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/fencing.gif' . '" alt="' . ':fencing' . '" />';
$b['texts'][] = ':juggling';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/juggling.gif' . '" alt="' . ':juggling' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/juggling.gif' . '" alt="' . ':juggling' . '" />';
$b['texts'][] = ':skipping';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/skipping.gif' . '" alt="' . ':skipping' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/skipping.gif' . '" alt="' . ':skipping' . '" />';
$b['texts'][] = ':archery';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/archery.gif' . '" alt="' . ':archery' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/archery.gif' . '" alt="' . ':archery' . '" />';
$b['texts'][] = ':surfing';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/surfing.gif' . '" alt="' . ':surfing' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/surfing.gif' . '" alt="' . ':surfing' . '" />';
$b['texts'][] = ':snooker';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/snooker.gif' . '" alt="' . ':snooker' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/snooker.gif' . '" alt="' . ':snooker' . '" />';
$b['texts'][] = ':horseriding';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/horseriding.gif' . '" alt="' . ':horseriding' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/horseriding.gif' . '" alt="' . ':horseriding' . '" />';
#Love smileys
$b['texts'][] = ':iloveyou';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/iloveyou.gif' . '" alt="' . ':iloveyou' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/iloveyou.gif' . '" alt="' . ':iloveyou' . '" />';
$b['texts'][] = ':inlove';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/inlove.gif' . '" alt="' . ':inlove' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/inlove.gif' . '" alt="' . ':inlove' . '" />';
$b['texts'][] = '~love';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/love.gif' . '" alt="' . ':love' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/love.gif' . '" alt="' . ':love' . '" />';
$b['texts'][] = ':lovebear';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/lovebear.gif' . '" alt="' . ':lovebear' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/lovebear.gif' . '" alt="' . ':lovebear' . '" />';
$b['texts'][] = ':lovebed';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/lovebed.gif' . '" alt="' . ':lovebed' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/lovebed.gif' . '" alt="' . ':lovebed' . '" />';
$b['texts'][] = ':loveheart';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/loveheart.gif' . '" alt="' . ':loveheart' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/love/loveheart.gif' . '" alt="' . ':loveheart' . '" />';
#Tired/Sleep smileys
$b['texts'][] = ':countsheep';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/tired/countsheep.gif' . '" alt="' . ':countsheep' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/tired/countsheep.gif' . '" alt="' . ':countsheep' . '" />';
$b['texts'][] = ':hammock';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/tired/hammock.gif' . '" alt="' . ':hammock' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/tired/hammock.gif' . '" alt="' . ':hammock' . '" />';
$b['texts'][] = ':pillow';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/tired/pillow.gif' . '" alt="' . ':pillow' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/tired/pillow.gif' . '" alt="' . ':pillow' . '" />';
$b['texts'][] = ':yawn';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/tired/yawn.gif' . '" alt="' . ':yawn' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/tired/yawn.gif' . '" alt="' . ':yawn' . '" />';
#Fight/Flame/Violent smileys
$b['texts'][] = ':2guns';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/2guns.gif' . '" alt="' . ':2guns' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/2guns.gif' . '" alt="' . ':2guns' . '" />';
$b['texts'][] = ':alienfight';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/alienfight.gif' . '" alt="' . ':alienfight' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/alienfight.gif' . '" alt="' . ':alienfight' . '" />';
$b['texts'][] = ':army';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/army.gif' . '" alt="' . ':army' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/army.gif' . '" alt="' . ':army' . '" />';
$b['texts'][] = ':arrowhead';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/arrowhead.gif' . '" alt="' . ':arrowhead' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/arrowhead.gif' . '" alt="' . ':arrowhead' . '" />';
$b['texts'][] = ':bfg';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/bfg.gif' . '" alt="' . ':bfg' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/bfg.gif' . '" alt="' . ':bfg' . '" />';
$b['texts'][] = ':bowman';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/bowman.gif' . '" alt="' . ':bowman' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/bowman.gif' . '" alt="' . ':bowman' . '" />';
$b['texts'][] = ':chainsaw';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/chainsaw.gif' . '" alt="' . ':chainsaw' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/chainsaw.gif' . '" alt="' . ':chainsaw' . '" />';
$b['texts'][] = ':crossbow';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/crossbow.gif' . '" alt="' . ':crossbow' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/crossbow.gif' . '" alt="' . ':crossbow' . '" />';
$b['texts'][] = ':crusader';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/crusader.gif' . '" alt="' . ':crusader' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/crusader.gif' . '" alt="' . ':crusader' . '" />';
$b['texts'][] = ':dead';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/dead.gif' . '" alt="' . ':dead' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/dead.gif' . '" alt="' . ':dead' . '" />';
$b['texts'][] = ':hammersplat';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/hammersplat.gif' . '" alt="' . ':hammersplat' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/hammersplat.gif' . '" alt="' . ':hammersplat' . '" />';
$b['texts'][] = ':lasergun';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/lasergun.gif' . '" alt="' . ':lasergun' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/lasergun.gif' . '" alt="' . ':lasergun' . '" />';
$b['texts'][] = ':machinegun';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/machinegun.gif' . '" alt="' . ':machinegun' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/machinegun.gif' . '" alt="' . ':machinegun' . '" />';
$b['texts'][] = ':acid';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/acid.gif' . '" alt="' . ':acid' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/acid.gif' . '" alt="' . ':acid' . '" />';
#Fantasy smileys - monsters and dragons fantasy. The other type of fantasy belongs in adult smileys
$b['texts'][] = ':alienmonster';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/alienmonster.gif' . '" alt="' . ':alienmonster' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/alienmonster.gif' . '" alt="' . ':alienmonster' . '" />';
$b['texts'][] = ':barbarian';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/barbarian.gif' . '" alt="' . ':barbarian' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/barbarian.gif' . '" alt="' . ':barbarian' . '" />';
$b['texts'][] = ':dinosaur';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/dinosaur.gif' . '" alt="' . ':dinosaur' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/dinosaur.gif' . '" alt="' . ':dinosaur' . '" />';
$b['texts'][] = ':dragon';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/dragon.gif' . '" alt="' . ':dragon' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/dragon.gif' . '" alt="' . ':dragon' . '" />';
$b['texts'][] = ':draco';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/dragonwhelp.gif' . '" alt="' . ':draco' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/dragonwhelp.gif' . '" alt="' . ':draco' . '" />';
$b['texts'][] = ':ghost';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/ghost.gif' . '" alt="' . ':ghost' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/ghost.gif' . '" alt="' . ':ghost' . '" />';
$b['texts'][] = ':mummy';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/mummy.gif' . '" alt="' . ':mummy' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fantasy/mummy.gif' . '" alt="' . ':mummy' . '" />';
#Food smileys
$b['texts'][] = ':apple';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/apple.gif' . '" alt="' . ':apple' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/apple.gif' . '" alt="' . ':apple' . '" />';
$b['texts'][] = ':broccoli';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/broccoli.gif' . '" alt="' . ':brocolli' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/broccoli.gif' . '" alt="' . ':brocolli' . '" />';
$b['texts'][] = ':cake';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/cake.gif' . '" alt="' . ':cake' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/cake.gif' . '" alt="' . ':cake' . '" />';
$b['texts'][] = ':carrot';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/carrot.gif' . '" alt="' . ':carrot' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/carrot.gif' . '" alt="' . ':carrot' . '" />';
$b['texts'][] = ':popcorn';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/popcorn.gif' . '" alt="' . ':popcorn' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/popcorn.gif' . '" alt="' . ':popcorn' . '" />';
$b['texts'][] = ':tomato';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/tomato.gif' . '" alt="' . ':tomato' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/tomato.gif' . '" alt="' . ':tomato' . '" />';
$b['texts'][] = ':banana';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/banana.gif' . '" alt="' . ':banana' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/banana.gif' . '" alt="' . ':banana' . '" />';
$b['texts'][] = ':cooking';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/cooking.gif' . '" alt="' . ':cooking' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/cooking.gif' . '" alt="' . ':cooking' . '" />';
$b['texts'][] = ':fryegg';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/fryegg.gif' . '" alt="' . ':fryegg' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/food/fryegg.gif' . '" alt="' . ':fryegg' . '" />';
#Happy smileys
$b['texts'][] = ':cloud9';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/happy/cloud9.gif' . '" alt="' . ':cloud9' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/happy/cloud9.gif' . '" alt="' . ':cloud9' . '" />';
$b['texts'][] = ':tearsofjoy';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/happy/tearsofjoy.gif' . '" alt="' . ':tearsofjoy' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/happy/tearsofjoy.gif' . '" alt="' . ':tearsofjoy' . '" />';
#Repsect smileys
$b['texts'][] = ':bow';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/respect/bow.gif' . '" alt="' . ':bow' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/respect/bow.gif' . '" alt="' . ':bow' . '" />';
$b['texts'][] = ':bravo';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/respect/bravo.gif' . '" alt="' . ':bravo' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/respect/bravo.gif' . '" alt="' . ':bravo' . '" />';
$b['texts'][] = ':hailking';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/respect/hailking.gif' . '" alt="' . ':hailking' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/respect/hailking.gif' . '" alt="' . ':hailking' . '" />';
$b['texts'][] = ':number1';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/respect/number1.gif' . '" alt="' . ':number1' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/respect/number1.gif' . '" alt="' . ':number1' . '" />';
#Laugh smileys
$b['texts'][] = ':hahaha';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/laugh/hahaha.gif' . '" alt="' . ':hahaha' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/laugh/hahaha.gif' . '" alt="' . ':hahaha' . '" />';
$b['texts'][] = ':loltv';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/laugh/loltv.gif' . '" alt="' . ':loltv' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/laugh/loltv.gif' . '" alt="' . ':loltv' . '" />';
$b['texts'][] = ':rofl';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/laugh/rofl.gif' . '" alt="' . ':rofl' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/laugh/rofl.gif' . '" alt="' . ':rofl' . '" />';
#Music smileys
$b['texts'][] = ':drums';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/drums.gif' . '" alt="' . ':drums' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/drums.gif' . '" alt="' . ':drums' . '" />';
$b['texts'][] = ':guitar';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/guitar.gif' . '" alt="' . ':guitar' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/guitar.gif' . '" alt="' . ':guitar' . '" />';
$b['texts'][] = ':trumpet';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/trumpet.gif' . '" alt="' . ':trumpet' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/trumpet.gif' . '" alt="' . ':trumpet' . '" />';
#Smileys that used to be in core
$b['texts'][] = ':headbang';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/headbang.gif' . '" alt="' . ':headbang' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/headbang.gif' . '" alt="' . ':headbang' . '" />';
$b['texts'][] = ':beard';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/beard.png' . '" alt="' . ':beard' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/beard.png' . '" alt="' . ':beard' . '" />';
$b['texts'][] = ':whitebeard';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/whitebeard.png' . '" alt="' . ':whitebeard' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/whitebeard.png' . '" alt="' . ':whitebeard' . '" />';
$b['texts'][] = ':shaka';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/shaka.gif' . '" alt="' . ':shaka' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/shaka.gif' . '" alt="' . ':shaka' . '" />';
$b['texts'][] = ':\\.../';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/shaka.gif' . '" alt="' . ':\\.../' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/shaka.gif' . '" alt="' . ':\\.../' . '" />';
$b['texts'][] = ':\\ooo/';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/shaka.gif' . '" alt="' . ':\\ooo/' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/shaka.gif' . '" alt="' . ':\\ooo/' . '" />';
$b['texts'][] = ':headdesk';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/headbang.gif' . '" alt="' . ':headdesk' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/headbang.gif' . '" alt="' . ':headdesk' . '" />';
#These two are still in core, so oldcore isn't strictly right, but we don't want too many directories
$b['texts'][] = ':-d';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/laughing.gif' . '" alt="' . ':-d' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/laughing.gif' . '" alt="' . ':-d' . '" />';
$b['texts'][] = ':-o';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/surprised.gif' . '" alt="' . ':-o' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/oldcore/surprised.gif' . '" alt="' . ':-o' . '" />';
# Regex killers - stick these at the bottom so they appear at the end of the English and
# at the start of $OtherLanguage.
$b['texts'][] = ':cool';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/cool/cool.gif' . '" alt="' . ':cool' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/cool/cool.gif' . '" alt="' . ':cool' . '" />';
$b['texts'][] = ':vomit';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/disgust/vomit.gif' . '" alt="' . ':vomit' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/disgust/vomit.gif' . '" alt="' . ':vomit' . '" />';
$b['texts'][] = ':golf';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/golf.gif' . '" alt="' . ':golf' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/golf.gif' . '" alt="' . ':golf' . '" />';
$b['texts'][] = ':football';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/football.gif' . '" alt="' . ':football' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/football.gif' . '" alt="' . ':football' . '" />';
$b['texts'][] = ':tennis';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/tennis.gif' . '" alt="' . ':tennis' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/sport/tennis.gif' . '" alt="' . ':tennis' . '" />';
$b['texts'][] = ':alpha';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/alpha.png' . '" alt="' . ':alpha' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/alpha.png' . '" alt="' . ':alpha' . '" />';
$b['texts'][] = ':marine';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/marine.gif' . '" alt="' . ':marine' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/marine.gif' . '" alt="' . ':marine' . '" />';
$b['texts'][] = ':sabre';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/sabre.gif' . '" alt="' . ':sabre' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/sabre.gif' . '" alt="' . ':sabre' . '" />';
$b['texts'][] = ':tank';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/tank.gif' . '" alt="' . ':tank' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/tank.gif' . '" alt="' . ':tank' . '" />';
$b['texts'][] = ':viking';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/viking.gif' . '" alt="' . ':viking' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/viking.gif' . '" alt="' . ':viking' . '" />';
$b['texts'][] = ':gangs';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/gangs.gif' . '" alt="' . ':gangs' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/fight/gangs.gif' . '" alt="' . ':gangs' . '" />';
$b['texts'][] = ':dj';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/dj.gif' . '" alt="' . ':dj' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/dj.gif' . '" alt="' . ':dj' . '" />';
$b['texts'][] = ':elvis';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/elvis.gif' . '" alt="' . ':elivs' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/elvis.gif' . '" alt="' . ':elivs' . '" />';
$b['texts'][] = ':violin';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/violin.gif' . '" alt="' . ':violin' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smiley_pack/icons/music/violin.gif' . '" alt="' . ':violin' . '" />';
}

Binary file not shown.

View File

@ -22,21 +22,21 @@ function smilies_adult_uninstall() {
function smilies_adult_smilies(&$a,&$b) {
$b['texts'][] = '(o)(o)';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/tits.gif' . '" alt="' . '(o)(o)' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/tits.gif' . '" alt="' . '(o)(o)' . '" />';
$b['texts'][] = '(.)(.)';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/tits.gif' . '" alt="' . '(.)(.)' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/tits.gif' . '" alt="' . '(.)(.)' . '" />';
$b['texts'][] = ':bong';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/bong.gif' . '" alt="' . ':bong' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/bong.gif' . '" alt="' . ':bong' . '" />';
$b['texts'][] = ':sperm';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/sperm.gif' . '" alt="' . ':sperm' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/sperm.gif' . '" alt="' . ':sperm' . '" />';
$b['texts'][] = ':drunk';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/drunk.gif' . '" alt="' . ':drunk' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/drunk.gif' . '" alt="' . ':drunk' . '" />';
$b['texts'][] = ':finger';
$b['icons'][] = '<img src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/finger.gif' . '" alt="' . ':finger' . '" />';
$b['icons'][] = '<img class="smiley" src="' . $a->get_baseurl() . '/addon/smilies_adult/icons/finger.gif' . '" alt="' . ':finger' . '" />';
}

Binary file not shown.

View File

@ -426,15 +426,15 @@ function statusnet_post_hook(&$a,&$b) {
if($ckey && $csecret && $otoken && $osecret) {
require_once('include/bbcode.php');
require_once('include/bbcode.php');
$dent = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret);
$max_char = $dent->get_maxlength(); // max. length for a dent
// we will only work with up to two times the length of the dent
// we can later send to StatusNet. This way we can "gain" some
// information during shortening of potential links but do not
// we can later send to StatusNet. This way we can "gain" some
// information during shortening of potential links but do not
// shorten all the links in a 200000 character long essay.
if (! $b['title']=='') {
$tmp = $b['title'] . ' : '. $b['body'];
$tmp = $b['title'].": \n".$b['body'];
// $tmp = substr($tmp, 0, 4*$max_char);
} else {
$tmp = $b['body']; // substr($b['body'], 0, 3*$max_char);
@ -453,10 +453,16 @@ function statusnet_post_hook(&$a,&$b) {
// that is, don't send if the option is not set in the
// connector settings
if ($linksenabled=='0') {
// #-tags
$tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
// @-mentions
$tmp = preg_replace( '/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $tmp);
// #-tags
$tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
// @-mentions
$tmp = preg_replace( '/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $tmp);
// recycle 1
$recycle = html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8');
$tmp = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', $recycle.'$2', $tmp);
// recycle 2
//$recycle = html_entity_decode("&#x267B; ", ENT_QUOTES, 'UTF-8');
//$tmp = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', 'RT @$2:', $tmp);
}
// preserve links to webpages
$tmp = preg_replace( '/\[url\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/url\]/i', '$2 $1', $tmp);
@ -476,7 +482,7 @@ function statusnet_post_hook(&$a,&$b) {
}
// ok, all the links we want to send out are save, now strip
// away the remaining bbcode
$msg = strip_tags(bbcode($tmp));
$msg = strip_tags(bbcode($tmp, false, false));
// quotes not working - let's try this
$msg = html_entity_decode($msg);
if (( strlen($msg) > $max_char) && $max_char > 0) {

Binary file not shown.

View File

@ -166,19 +166,58 @@ function tumblr_send(&$a,&$b) {
}
}
if(count($tag_arr))
$tags = implode(',',$tag_arr);
$tags = implode(',',$tag_arr);
$link = "";
$video = false;
$title = trim($b['title']);
// Checking for a bookmark
if(preg_match("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/is",$b['body'],$matches)) {
$link = $matches[1];
if ($title == '')
$title = html_entity_decode($matches[2],ENT_QUOTES,'UTF-8');
$body = $b['body'];
// splitting the text in two parts:
// before and after the bookmark
$pos = strpos($body, "[bookmark");
$body1 = substr($body, 0, $pos);
$body2 = substr($body, $pos);
// Removing the bookmark
$body2 = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'',$body2);
$body = $body1.$body2;
$video = ((stristr($link,'youtube')) || (stristr($link,'youtu.be')) || (stristr($mtch[1],'vimeo')));
}
$params = array(
'email' => $tmbl_username,
'password' => $tmbl_password,
'title' => $b['title'],
'type' => 'regular',
'format' => 'html',
'generator' => 'Friendica',
'tags' => $tags,
'body' => bbcode($b['body'])
);
'tags' => $tags);
if (($link != '') and $video) {
$params['type'] = "video";
$params['embed'] = $link;
if ($title != '')
$params['caption'] = '<h1><a href="'.$link.'">'.$title.
"</a></h1><p>".bbcode($body)."</p>";
else
$params['caption'] = bbcode($body);
} else if (($link != '') and !$video) {
$params['type'] = "link";
$params['name'] = $title;
$params['url'] = $link;
//$params['description'] = bbcode($body);
$params['description'] = bbcode($b["body"]);
} else {
$params['type'] = "regular";
$params['title'] = $title;
$params['body'] = bbcode($b['body']);
}
$x = post_url($tmbl_blog,$params);
$ret_code = $a->get_curl_code();
@ -187,7 +226,7 @@ function tumblr_send(&$a,&$b) {
elseif($ret_code == 403)
logger('tumblr_send: authentication failure');
else
logger('tumblr_send: general error: ' . print_r($x,true));
logger('tumblr_send: general error: ' . print_r($x,true));
}
}

Binary file not shown.

View File

@ -290,7 +290,7 @@ function twitter_post_hook(&$a,&$b) {
logger('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG);
require_once('library/twitteroauth.php');
require_once('include/bbcode.php');
require_once('include/bbcode.php');
$tweet = new TwitterOAuth($ckey,$csecret,$otoken,$osecret);
// in theory max char is 140 but T. uses t.co to make links
// longer so we give them 10 characters extra
@ -316,18 +316,24 @@ function twitter_post_hook(&$a,&$b) {
$tmp = preg_replace( '/\[\\/?audio(\\s+.*?\]|\])/i', '', $tmp);
$linksenabled = get_pconfig($b['uid'],'twitter','post_taglinks');
// if a #tag is linked, don't send the [url] over to SN
// that is, don't send if the option is not set in the
// that is, don't send if the option is not set in the
// connector settings
if ($linksenabled=='0') {
// #-tags
$tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
// @-mentions
$tmp = preg_replace( '/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $tmp);
// #-tags
$tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
// @-mentions
$tmp = preg_replace( '/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $tmp);
// recycle 1
$recycle = html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8');
$tmp = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', $recycle.'$2', $tmp);
// recycle 2
//$recycle = html_entity_decode("&#x267B; ", ENT_QUOTES, 'UTF-8');
//$tmp = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', 'RT @$2:', $tmp);
}
$tmp = preg_replace( '/\[url\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/url\]/i', '$2 $1', $tmp);
$tmp = preg_replace( '/\[bookmark\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/bookmark\]/i', '$2 $1', $tmp);
// find all http or https links in the body of the entry and
// apply the shortener if the link is longer then 20 characters
// find all http or https links in the body of the entry and
// apply the shortener if the link is longer then 20 characters
if (( strlen($tmp)>$max_char ) && ( $max_char > 0 )) {
preg_match_all ( '/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/i', $tmp, $allurls );
foreach ($allurls as $url) {
@ -341,7 +347,7 @@ function twitter_post_hook(&$a,&$b) {
}
// ok, all the links we want to send out are save, now strip
// away the remaining bbcode
$msg = strip_tags(bbcode($tmp));
$msg = strip_tags(bbcode($tmp, false, false));
// quotes not working - let's try this
$msg = html_entity_decode($msg);
if (( strlen($msg) > $max_char) && $max_char > 0) {

Binary file not shown.

View File

@ -179,24 +179,26 @@ function wppost_send(&$a,&$b) {
require_once('include/bbcode.php');
require_once('include/html2plain.php');
$wptitle = trim($b['title']);
// If the title is empty then try to guess
if ($b['title'] == '') {
if ($wptitle == '') {
// Take the description from the bookmark
if(preg_match("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/is",$b['body'],$matches))
$b['title'] = $matches[2];
$wptitle = $matches[2];
// If no bookmark is found then take the first line
if ($b['title'] == '') {
if ($wptitle == '') {
$title = html2plain(bbcode($b['body']), 0, true);
$pos = strpos($title, "\n");
if (($pos == 0) or ($pos > 60))
$pos = 60;
$b['title'] = substr($title, 0, $pos);
$wptitle = substr($title, 0, $pos);
}
}
$title = '<title>' . (($b['title']) ? $b['title'] : t('Post from Friendica')) . '</title>';
$title = '<title>' . (($wptitle) ? $wptitle : t('Post from Friendica')) . '</title>';
$post = $title . bbcode($b['body']);
$wp_backlink = intval(get_pconfig($b['uid'],'wppost','backlink'));