Heine

  • drupal
  • drupal core commits
  • about

Menu access, a new pitfall when going back to Drupal 5

Submitted by Heine on Mon, 25/05/2009 - 11:56.

If you spend a lot of time exclusively in one Drupal version, you develop muscle memory for its API. This can be pretty dangerous as I caught myself writing the following menu item while backporting a Drupal 6 module.

$items[] = array(
  'path' => 'admin/settings/foo',
  'access' => array('administer foo'),
  // ...
);

Note the array('adminster foo') instead of user_access('administer foo'). As non-empty arrays evaluate to TRUE in non-strict comparisons this is equivalent to 'access' => TRUE, granting access to all users.

Because I do not believe in the "Found a bug? Blog about it!"-approach to bugfixing, I filed #472160, but still wanted to share.

  • Drupal
  • Pitfalls
  • Planet Drupal
  • Add new comment

Drupal 6: $base_path doesn't always point to the frontpage

Submitted by Heine on Sun, 17/05/2009 - 18:13.

Dear themers,

<a href="<?php print $base_path ?>" title="<?php print t('Home'); ?>" ...

.... in page.tpl.php breaks Home functionality on many multilingual sites.

Consider a multilingual site with English (prefix 'en') as the default language and Dutch (prefix 'nl') as a second language. While browsing the site in Dutch (eg http://example.com/nl/node/5), the homelink created with $base_path leads to http://example.com/, which is the default English content. Quite an unpleasant surprise for your visitors.

The correct URL to the homepage is $front_page. As this variable holds a URL, you still need to convert it to HTML by calling check_url on it:

<a href ="<?php print check_url($front_page) ?>" ...

If you maintain a theme on Drupal.org that doesn't use $front_page, please consider this a bugreport. Thanks.

  • Drupal
  • Multilingual
  • Planet Drupal
  • Theming
  • 2 comments

A new form element in Drupal core

Submitted by Heine on Wed, 28/01/2009 - 08:48.

With Commit #167487, a new form element has been added to Drupal core (7.x) to provide an alternative means of selecting items. Now, next to 'select' (combobox, list), checkboxes and radios, core carries the 'tableselect' element. This element allows developers to easily create tables with selectable rows. Ideal for those situations where you have to provide a lot of data on the items to the user.

  • Drupal
  • FAPI
  • Planet Drupal
  • 11 comments
  • Read more

The backstabbing March-Hare

Submitted by Heine on Thu, 22/01/2009 - 00:19.

If you use the CVSNT free/open source edition to commit to Drupal.org, drop to the command line and check your version with:

cvs --version

CVSNT version 2.5.04 or later inserts advertising in every commit message. Please, either buy a license for the CVSNT Suite, download an older version, or switch to another client.

Update: If you are a masochist and write your commit messages on the commandline, you may work around this issue with cvs -M "message" instead of cvs -m "message".

My apologies for Commit #160834 & Commit #165785.

  • Let's hope it doesn't become popular
  • Planet Drupal
  • 2 comments

Drupal HEAD and HTTP 500 errors on IIS 7

Submitted by Heine on Fri, 09/01/2009 - 11:41.

If you use PHP via FastCGI on IIS 7 and installing Drupal HEAD (7.x-dev) results in an HTTP 500 error, you may need to increase a number of timeout settings. The PHP.ini ones are fairly straightforward, but setting the activityTimeout for the FastCGI module is not intuitive.

Open a Command prompt with Administrative rights and enter:

%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='C:\path_to_cgi\php-cgi.exe'].activityTimeout:600

The path to cgi should be replaced with the path of the PHP binary you registered with IIS. You must wrap the path in additional double quotes if it contains spaces. Example:

%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='"C:\Program Files (x86)\PHP\php-cgi.exe"'].activityTimeout:600

To get easier access to such settings, install the Administration Pack for IIS:

  • Administration Pack for IIS 7.0 CTP2 - x86
  • Administration Pack for IIS 7.0 CTP2 - x64
  • Drupal
  • IIS
  • Add new comment

Drupal clean URLs on IIS 7

Submitted by Heine on Thu, 16/10/2008 - 08:57.

To get Clean URLs working on IIS 7, install the new URL rewriter module (x86, x64) and add the following to the system.webServer section of the sites' web.config:

<rewrite>
  <rules>
    <rule name="Drupal clean URLs" enabled="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />    
        <add input="{REQUEST_URI}" negate="true" pattern="/favicon.ico$" />
      </conditions>
      <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />
    </rule>
  </rules>
</rewrite>

You also need to install a hotfix to correct REQUEST_URI behaviour when using PHP via the FastCGI module. See KB954946 for more information. A symptom of this problem is when all form submissions get redirected to the frontpage of the site.

  • Drupal
  • IIS
  • 3 comments
  • Read more
12345next ›last »
Syndicate content

Planet Highlights

  • DrupalconParis: DrupalConParis registration opens
  • Lullabot: Podcast 73: Back On The Horse
  • Development Seed: Aegir From Scratch - Installing Aegir 0.2 RC 1
  • CivicActions: Drupal 6 vs. Drupal 7 Performance (and Comments vs. Nodes)
  • Acquia: What shall we do about Themes?
more

Recent posts

  • Menu access, a new pitfall when going back to Drupal 5
  • Drupal 6: $base_path doesn't always point to the frontpage
  • XNA SoundEffect ContentLoadException
  • A new form element in Drupal core
  • The backstabbing March-Hare

All-time popular content

  • Update UID 1 password via JS
  • Keeping an eye on Drupal core
  • Subversion on Strato V-PowerServer
  • A new form element in Drupal core
  • Access denied - Are you sure?
more

Tags

Captcha Coding Drupal FAPI IIS Let's hope it doesn't become popular Performance PHP Planet Drupal Quiz Security V-PowerServer
more tags
  • drupal
  • drupal core commits
  • about

Copyright © 2009 by Heine Deelstra. All rights reserved.