HaLe Blog twitter
HaLe Blog Rss

Drupal cache headers are driving me nuts!

Posted by Kim | Posted in Coding, Content Management Systems, Drupal, PHP | Posted on 10-10-2011

0

A client of ours had this problem on their website, where users who had logged out, could still see their profile page as if they were connected!

After googling (what else!) I found the answer to be in a slight change of the headers being sent by Drupal:

File: /includes/bootstrap.inc, line 728 / 765

From:

Cache-Control:store, no-cache, must-revalidate, post-check=0, pre-check=0

To:

Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0

More info on this issue can be found here: http://drupal.org/node/197786#comment-1565612, the patch is right here: http://drupal.org/files/issues/login_linger.patch

Magento : menu items order

Posted by lhe | Posted in Coding, Databases, E-Commerce, Magento, MySQL, PHP | Posted on 19-10-2010

5

We have been working on some Magento e-shops and it needs to be said, its a nice enough system.
However, it is not a CMS. This means that when you create pages, you dont have all the freedom you would enjoy when using Drupal or WordPress for example.
You can create pages and they will appear in the main menu. But then you start looking at the sort order of those menu items.
Guess what, nothing to be found in the admin interface to control it. So you go ” NOOOOOOOOOOoooooooooo….”……

No panic! Stay calm… with some minor db data changes and a little coding we can get it all to work.
First of all, let’s ask the obvious question “Why on earth is it not a standard admin function to be able to manipulate the page order?”
No idea, but it is foreseen in the database.
In the table

cms_page

you will find a collumn called

sort_order

. You can use this collumn to decide on the order.

Go refresh your page… Nothing changed, right? Hehe, well you need to do one more thing.
Open this file :

magento/app/design/frontend/default/maried/template/catalog/navigation

Find this line (should be line number 60):

$cms_pages->getSelect()->where('is_active = 1');

And add the sortorder so the line becomes :

$cms_pages->getSelect()->where('is_active = 1')->order('sort_order');

Now go and refresh your page… TADA!!!

.htpasswd protecting your phpMyAdmin installation (Debian)

Posted by lhe | Posted in Databases, General, Linux (Ubuntu), MySQL, PHP | Posted on 16-03-2010

3

So you got yourself a LAMP webserver and started hosting some sites on it. Now, for easy access to your databases, you opt to chose phpMyAdmin.

When installing phpMyAdmin on a Debian system via the synaptic manager (apt-get install phpmyadmin), the installation will be done in this folder

/usr/share/phpmyadmin

You will be able to access your phpMyAdmin via

http://www.mydomain.com/phpmyadmin

You will notice that you are asked for a username and password. This is great! It means that your database is protected…. but what if i want to protect it even more?
What if i would like to add some extra folder protection by using the good old .htpasswd technique?

Well, I looked around for a while but did not find any satisfying solutions. This meant I had to mess around a bit myself and after not too long, success! I had a phpMyAdmin installation where it would first use the .htpasswd protection before bringing me to the phpMyAdmin login page.

How did we do this?

1) create a .htpasswd file in the installation directory (cfr. supra). You can use handy .htpasswd generators like this one: http://www.htaccesstools.com/htpasswd-generator/

2) find and edit the phpMyAdmin apache2 config file:

/etc/apache2/conf.d/phpmyadmin.conf

3) add the necessary lines in the conf file to tell Apache2 it should use the .htpasswd file. Below you will find the before and after of the code.

Before:

# phpMyAdmin default Apache configuration
 
Alias /phpmyadmin /usr/share/phpmyadmin
 
		AllowOverride All
		Options Indexes FollowSymLinks
		DirectoryIndex index.php
 
		# Authorize for setup

After:

# phpMyAdmin default Apache configuration
 
Alias /phpmyadmin /usr/share/phpmyadmin
 
        AllowOverride All
        Options Indexes FollowSymLinks
        DirectoryIndex index.php
 
        AuthType Basic
        AuthName "HaLe MySQL"
        AuthUserFile /usr/share/phpmyadmin/.htpasswd
        Require valid-user
 
        # Authorize for setup

4) reload your Apache2

sudo /etc/init.d/apache2 reload

5) your phpMyAdmin is now .htpasswd protected!

Cheers
Lajfi