summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVesa Palmu2010-03-03 17:40:52 (GMT)
committer Vesa Palmu2010-03-03 17:40:52 (GMT)
commit282c00e223694b2dbeaaa62f2c42338856c9a931 (patch)
treec177690223e888cefb41fb2c291f715dd24f72f7
parent1b9671c0d86ddeef85df66974ea98cf6b7d116ef (diff)
Security fix SA-CONTRIB-2010-021 http://drupal.org/node/7315686.x-2.9
-rw-r--r--addthis.admin.inc2
-rw-r--r--addthis.module56
-rw-r--r--addthis_handler_field_service_links.inc1
3 files changed, 33 insertions, 26 deletions
diff --git a/addthis.admin.inc b/addthis.admin.inc
index 005dc65..f60ab48 100644
--- a/addthis.admin.inc
+++ b/addthis.admin.inc
@@ -117,7 +117,7 @@ function addthis_admin_settings() {
'#default_value' => variable_get('addthis_options', 'favorites, email, digg, delicious, myspace, facebook, google, live, more'),
'#description' => t('A comma-separated ordered list of options to include in the drop-down. Example: favorites, email, digg, delicious, more<br/>Currently supported options:<br/>
aim, aolfav, ask, backflip, ballhype, blinklist, blogmarks, bluedot, buzz, delicious, digg, diigo, email, facebook, favorites, fark, feedmelinks, friendfeed, furl, google, kaboodle, kirtsy, linkedin, live, magnolia, misterwong, mixx, multiply, myweb, myspace, netvous, newsvine, pownce, propeller, reddit, segnalo, sharedstuff, slashdot, spurl, stumbleupon, stylehive, tailrank, technorati, thisnext, twitter, yardbarker, yahoobkm, more<br />
- The most up-to-date list can be found <a href="!url">here</a>.', array('!url' => url('http://addthis.com/customization.php'))),
+ The most up-to-date list can be found <a href="!url">here</a>.', array('!url' => url('http://addthis.com/services/list'))),
);
$form['addthis_widget_settings']['addthis_offset_top'] = array(
'#type' => 'textfield',
diff --git a/addthis.module b/addthis.module
index c715a8d..7b1f7f7 100644
--- a/addthis.module
+++ b/addthis.module
@@ -60,7 +60,7 @@ function addthis_block($op = 'list', $delta = 0) {
$blocks[0]['info'] = t('AddThis button');
return $blocks;
}
- else if ($op == 'view' && user_access('view addthis')) {
+ elseif ($op == 'view' && user_access('view addthis')) {
$block['subject'] = t('AddThis');
$block['content'] = _addthis_create_button();
return $block;
@@ -129,12 +129,12 @@ function _addthis_create_button($node=NULL, $teaser = FALSE) {
addthis_options = \'%s\';
addthis_disable_flash = \'%s\';
',
- addslashes(variable_get('addthis_username', 'my-username')),
- addslashes(variable_get('addthis_logo', 'http://www.addthis.com/images/yourlogo.png')),
- addslashes(variable_get('addthis_logo_background', 'EFEFFF')),
- addslashes(variable_get('addthis_logo_color', '666699')),
- addslashes($brand),
- addslashes(variable_get('addthis_options', 'favorites, email, digg, delicious, myspace, facebook, google, live, more')),
+ addslashes(check_plain(variable_get('addthis_username', 'my-username'))),
+ addslashes(check_plain(variable_get('addthis_logo', 'http://www.addthis.com/images/yourlogo.png'))),
+ addslashes(check_plain(variable_get('addthis_logo_background', 'EFEFFF'))),
+ addslashes(check_plain(variable_get('addthis_logo_color', '666699'))),
+ addslashes(check_plain($brand)),
+ addslashes(check_plain(variable_get('addthis_options', 'favorites, email, digg, delicious, myspace, facebook, google, live, more'))),
variable_get('addthis_options', FALSE) ? 'true' : 'false'
), 'inline');
}
@@ -146,6 +146,8 @@ function _addthis_create_button($node=NULL, $teaser = FALSE) {
* Theme the AddThis button.
*/
function theme_addthis_button($node, $teaser) {
+ global $_addthis_counter;
+
// Fix IE's bug.
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
drupal_add_link(array(
@@ -156,32 +158,36 @@ function theme_addthis_button($node, $teaser) {
}
if (variable_get('addthis_dropdown_disabled', '0')) {
- return ( sprintf('
+ $button = sprintf('
<a class="addthis-button" href="http://www.addthis.com/bookmark.php"
onclick="addthis_url = location.href; addthis_title = document.title; return addthis_click(this);">
- <img src="%s" width="%d" height="%d" %s /></a>
- ',
- $_SERVER['HTTPS'] == 'on' ? addslashes(variable_get('addthis_image_secure', 'https://secure.addthis.com/button1-share.gif')) : addslashes(variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif')),
- addslashes(variable_get('addthis_image_width', '125')),
- addslashes(variable_get('addthis_image_height', '16')),
- addslashes(variable_get('addthis_image_attributes', 'alt=""'))
- ));
+ <img src="%s" width="%d" height="%d" %s /></a>',
+ $_SERVER['HTTPS'] == 'on' ? addslashes(check_plain(variable_get('addthis_image_secure', 'https://secure.addthis.com/button1-share.gif'))) : addslashes(check_plain(variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif'))),
+ variable_get('addthis_image_width', '125'),
+ variable_get('addthis_image_height', '16'),
+ addslashes(filter_xss(variable_get('addthis_image_attributes', 'alt=""')))
+ );
}
else {
- return ( sprintf('
+ $button = sprintf('
<a class="addthis-button" href="http://www.addthis.com/bookmark.php"
onmouseover="return addthis_open(this, \'\', \'%s\', \'%s\')"
onmouseout="addthis_close()"
- onclick="return addthis_sendto()"><img src="%s" width="%d" height="%d" %s /></a>
- <script type="text/javascript" src="%s/js/' . variable_get('addthis_widget_version', '152') . '/addthis_widget.js"></script>
- ',
+ onclick="return addthis_sendto()"><img src="%s" width="%d" height="%d" %s /></a>',
$teaser ? url('node/'. $node->nid, array('absolute' => 1) ) : '[URL]',
$teaser ? addslashes($node->title) : '[TITLE]',
- $_SERVER['HTTPS'] == 'on' ? addslashes(variable_get('addthis_image_secure', 'https://secure.addthis.com/button1-share.gif')) : addslashes(variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif')),
- addslashes(variable_get('addthis_image_width', '125')),
- addslashes(variable_get('addthis_image_height', '16')),
- variable_get('addthis_image_attributes', 'alt=""'),
- $_SERVER['HTTPS'] == 'on' ? 'https://secure.addthis.com' : 'http://s7.addthis.com'
- ));
+ $_SERVER['HTTPS'] == 'on' ? addslashes(check_plain(variable_get('addthis_image_secure', 'https://secure.addthis.com/button1-share.gif'))) : addslashes(check_plain(variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif'))),
+ variable_get('addthis_image_width', '125'),
+ variable_get('addthis_image_height', '16'),
+ check_plain(variable_get('addthis_image_attributes', 'alt=""'))
+ );
+ if ($_addthis_counter == 1) {
+ $button .= sprintf('<script type="text/javascript" src="%s/js/%d/addthis_widget.js">',
+ $_SERVER['HTTPS'] == 'on' ? 'https://secure.addthis.com' : 'http://s7.addthis.com',
+ variable_get('addthis_widget_version', '152')
+ );
+ }
+ $button .= '</script>';
}
+ return $button;
}
diff --git a/addthis_handler_field_service_links.inc b/addthis_handler_field_service_links.inc
index 02ac426..2c2a57b 100644
--- a/addthis_handler_field_service_links.inc
+++ b/addthis_handler_field_service_links.inc
@@ -2,6 +2,7 @@
// $Id$
/**
+ * @file
* A handler to provide an AddThis field for a particular node.
*
* @ingroup views_field_handlers