"Make secure every page" does not work when empty

mikestefff - September 2, 2009 - 18:59
Project:Secure Pages
Version:6.x-1.8
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

I want every page secure. So I checked "Make secure every page except the listed pages." and left the listed pages blank. Logically, that should do it. But it doesn't. So to achieve what I want, I had to check "Make secure only the listed pages." and leave a * in the listed below. It works that way but obviously there is something wrong in the module. I haven't looked at the source yet to determine the issue.

#1

mikestefff - September 2, 2009 - 19:23

My guess at first glance..

function securepages_match($path) {
  /**
   * Check to see if the page matches the current settings
   */
  $secure = variable_get('securepages_secure', 1);
  $pages = variable_get('securepages_pages', "node/add*\nnode/*/edit\nuser/*\nadmin*");
  $ignore = variable_get('securepages_ignore', "*/autocomplete/*\n*/ajax/*");

  if ($ignore) {
    $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($ignore, '/')) .')$/';
    if (preg_match($regexp, $path)) {
      return securepages_is_secure() ? 1 : 0;
    }
  }
/********
*** THIS IF STATEMENT BELOW ***
********/
  if ($pages) {
    $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($pages, '/')) .')$/';
    $result = preg_match($regexp, $path);
    if (function_exists('drupal_get_path_alias')) {
      $path_alias = drupal_get_path_alias($path);
      $result |= preg_match($regexp, $path_alias);
    }
    return !($secure xor $result) ? 1 : 0;
  }
  else {
    return;
  }
}

#2

fjroman - September 8, 2009 - 11:05

I just want some pages secure, but I found out that my Securepages only works when there is just one page on the box. I tried with \n, same line, different line... but nothing... Any clue?

#3

jamesfk - October 1, 2009 - 12:54

Getting the same issue, fixed it by putting in a non existing page into the show all apart from box.

#4

mikestefff - October 1, 2009 - 21:28

Yeah I did the same thing too but felt it still should be address in the module.

#5

Earl Grey - November 3, 2009 - 16:43

Same problem here. subscribing.

 
 

Drupal is a registered trademark of Dries Buytaert.