Saturday, October 5, 2013

Thunderbird backup and restore

I have been using Thunderbird as a mail client for a while now. Have been also not-so-regularly backing up the mail profile. Found out recently how convenient Thunderbird makes it to backup and restore mail, contacts & even calendar.
I will not go details of how to restore the profile, mails and contacts because there is tons of help available on:
MozillaZine
Thunderbird Help

But in short, the mail folders, contacts, preferences, calendar data are simple, and mostly single, data files that can be easily replaced and Thunderbird will happily recognize and use them when it starts. Oh, you have to remember to close any open Thunderbird session before replacing files physically.

Another useful program to remember is "thunderbird.exe -ProfileManager" which you can run from Windows start menu > Run... option. It lets you manage & switch between multiple profiles.

Thank you Mozilla for a great product! And who says there is no free lunch?? :-)

Thursday, May 16, 2013

Joomla installation hangs during Configuration

If you are installing Joomla 2.5.6 on IIS (I have 5.1 on WinXP), there is a strong possibility that the installation may get stuck during the Configuration stage. Chances are the folder in which you are trying to install is NOT shared & writeable. Go to Windows Explorer and make the folder Shared & Writeable. Then try the configuration stage again and it should go through.

Monday, April 8, 2013

WordPress: Remove link from author name in Recent comments



In the Recent comments section, the author name is linked to his/her website while the actual comment title is linked to the comment page. Lot of times, site visitors click on the author name instead of comment title - thinking THAT is the comment link. They end up on the author's website instead.
So we decided to de-link (or unlink) the author name. Here's what we did:

1. We changed 2 files in the wp-includes folder: default-widgets.php and comment-template.php

2. In comment-template file, we made a copy of the function: get_comment_author_link, and pasted it as a new function: get_comment_author_name. The new function has following code:

function get_comment_author_name( $comment_ID = 0 ) {
$author = get_comment_author($comment_ID);

$return = $author;
return apply_filters('get_comment_author_link', $return);
}

3. In default-widgets file, we located the function widget() and replaced the get_comment_author_link call with get_comment_author_name as below:

foreach ( (array) $comments as $comment)
 {
$output .=  '
  • ' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_name(), '' . get_the_title($comment->comment_post_ID) . '') . '
  • ';

    }

    4. That's it. We uploaded the changed files and the author names did not have links any more.


    Tuesday, February 5, 2013

    Restoring Joomla 1.5 site from hack

    One of our clients got their Joomla 1.5 site hacked. The site started giving PHP errors. When they upgraded PHP, the home page was restored but all other pages were leading to "Page not found" message. After a couple of days of effort, we were able to restore the website. Here are the findings:

    Signature images found
    "hacked by Hmei7" logo image (Indonesian Hacker) and sejeal.jpg

    Suspicious files found in the listed locations
    /images/stories/susu.php
    /images/stories/0day.php
    /images/x.txt
    /tmp/x.txt
    /tmp/m.txt
    /tmp/zzzzx.php

    Original files modified during the attack
    /.htaccess (most important)
    /configuration.php
    /index.php
    /index.html

    Here is a list of some other files that may be found in the folders. Their locations are random though!
    susu.php, x.txt, 000-aaz.gif, 0day.php, c99.php, config.root, css.php, en-gt.php, index.old.php, lib.php, maroc.php, r57.php, rc.php, story.php, tar.tmp, toy.php, web1.php, wh.php, Wos.php, xxu.php, xxx.php, s.php, user.pl, 404.php, cpanelhorde5.txt

    How we restored the site
    1. Created a PHP script to automate the task of locating the suspicious files (see list above).
    2. Removed all the suspicious files.
    3. Checked configuration.php, index.php, index.html, css.php and .htaccess to see if they were modified. In our case, configuration file was modified, so we checked each and every variable value and changed the incorrect ones. We also restored the .htaccess from another installation and modified it so that SEF URLs were working again.
    4. If configuration.php and index.php file are changed then best way is to delete and restore them from backup. Or check inside configuration.php for the values of $host, $db, $user, $dbprefix, $log_path, $tmp_path, $offline, $password variables. If the values are not correct, then modify them with help from your hosting provider.
    5. If '/.htaccess' is modified, then delete and restore it from backup. Do not try to edit this file because small changes in .htaccess can badly affect your website. If the file was not backed up, you can use this file from another Joomla installation but the exact same version.

    Not all files will be affected on every site and there may be more files affected than in this list. Only those files with write permission will be changed by the hacker's script.

    Simple ways to making your Joomla site hackproof
    --Regularly upgrade to latest Joomla version
    --Take regular backups
        --Zip up the entire Joomla folder
        --Export Joomla DB as a zip file
        --Store both zips offline (preferably in 2 places) and also online, but outside public_html folder