hi,

from what i can see, it seems a default behavior to redirect to homepage, while i think it should not. i think it should remain on the page where the module have been used.
and by the way, i think it should not refresh at all anyway. the text size is changing even before the page have been refreshed. so is that redirect necessary?!

pht3k

Comments

CZ’s picture

Category: bug » feature

This is not a bug. It is a feature request. The modul have to be JavaScript indipendend.

Anonymous’s picture

I'd second that as a feature request.

I suppose the workaround is to only publish the block on the homepage and that way the users won't really be redirected away from what they're looking at.

Otherwise - nice module. Really easy to use.

Cheers,

markj’s picture

Adding this feature would be great as many users find the current behavior counterintuitive.

silurius’s picture

Subscribing because I agree that this feature is probably a requirement in my case.

jonahan’s picture

Yeah this functionality seems wrong. If you click to enlarge the text, you get redirected to the front page. You then have to click 'back' to see what you wanted to enlarge.

This is not intuitive and can throw users off.

Awesome module otherwise!

jonahan’s picture

The following code will have the page redirect to itself:

$nid = $_GET['q'];
$path = drupal_get_path_alias($nid);
$ps_url = base_path().$path;

Put it in the textsize.module file, in the function theme_textsize_html3() function. I put it right after:

$path_textsize = drupal_get_path('module', 'textsize');

I noticed that the textsize module doesn't affect the size of content that is styled in pixels, so I had to set many things to use 'em' instead.

scottrigby’s picture

Hi jonahan,
This does seem to work when adding into the module code itself...

But wouldn't it be better to override this using a theme function?
I tried to do that in my template.php (using a zen subtheme), and added the code there.
Unfortunately so far have not been able to get that to work this way... Any advice?

/**
 * Override Text Size links
 * Theme 3. Links not in a list, images in the XHTML source code.
 */
function MYTHEMENAME_textsize_html3() {
$textsize_list = variable_get('textsize_list', 0);
$textsize_list_inline = variable_get('textsize_list_inline', '');
$textsize_current = variable_get('textsize_current', 0);
$textsize_normal = variable_get('textsize_normal', 100);
$textsize_increment = variable_get('textsize_increment', 10);
$textsize_increase = ($_SESSION['textsize'] + $textsize_increment);
$textsize_decrease = ($_SESSION['textsize'] - $textsize_increment);
$textsize_text = array(
    'increase' => t('Increase'),
    'decrease' => t('Decrease'),
    'normal' => t('Normal')
);
$current = array( 'text' => t('Current Size'));
$prefix = array( 'title' => t('Text Size'));
$textsize_link_separator = variable_get('textsize_link_separator', ' | ');
$ps_url = base_path() .''; /* or base_path() .'index.php'; */
$path_textsize = drupal_get_path('module', 'textsize');
// ADD jonahan's CODE TO STAY ON CURRENT PAGE
$nid = $_GET['q'];
$path = drupal_get_path_alias($nid);
$ps_url = base_path().$path;

  $output = '<p class="textsize'. $textsize_list_inline .'">'."\n";
  $output .= '<a title="'. $prefix['title'] .': '. $textsize_text['increase'] .'" class="textsize_'. $textsize_increase .'" href="'. $ps_url .'?textsize=+'. $textsize_increment .'" ><img src="'. base_path() . $path_textsize .'/images/increase_16.gif" alt="'. $textsize_text['increase'] .'" class="rollover" /></a>';
  $output .= '<span class="display_hidden">'. $textsize_link_separator .'</span>';
  $output .= '<a title="'. $prefix['title'] .': '. $textsize_text['decrease'] .'" class="textsize_'. $textsize_decrease .'" href="'. $ps_url .'?textsize=-'. $textsize_increment .'" ><img src="'. base_path() . $path_textsize .'/images/decrease_16.gif" alt="'. $textsize_text['decrease'] .'" class="rollover" /></a>';
  $output .= '<span class="display_hidden">'. $textsize_link_separator .'</span>';
  $output .= '<a title="'. $prefix['title'] .': '. $textsize_text['normal'] .'" class="textsize_'. $textsize_normal .'" href="'. $ps_url .'?textsize_normal='. $textsize_normal .'" ><img src="'. base_path() . $path_textsize .'/images/normal_16.gif" alt="'. $textsize_text['normal'] .'" class="rollover" /></a>';
  $output .= '</p>'."\n";
  $output .= textsize_current_content();
  return $output;
}

Thanks in advance! :)
Scott

banglogic’s picture

I tried this code on a site I am developing. It works when I am logged in but not when logged out... Perhaps something to do with caching?

Either way, I'm turning Text Size off for now until this can be worked out... Great module otherwise!

juanbond’s picture

Title: redirect to homepage » redirect to homepage - (XSS)?
Category: feature » bug
Priority: Normal » Critical

I recently applied this modification to my site and it was working fine. Last week my site was compromised by a hacker though and I believe this modification may have been responsible for making the site vulnerable to a Cross-Site Scripting attack (xss). When it is active along with the search module, if a user inputs code such as <SCRIPT>malicious code</SCRIPT> into the search box, the full bracketed <SCRIPT> tags show in the source code. I'm new to XSS attacks so I may be wrong, but wanted to bring it up for someone with more experience in this area to check out.

CZ’s picture

Thank you jonahan,

But drupal_get_path_alias($_GET['q']); is not for "disabled clean urls". The next version (Text Size Beta 2) have no rederict to homepage and works for anonymus user!

KingMoore’s picture

Christian Zwahlen,

Great module. Why don't you release your beta 2 on your drupal project page on drupal.org? That would be very helpful to everyone.

CZ’s picture

Status: Active » Fixed

Fixed in the 6.x-1.0 release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.