Man YeeGeology ParkBondi Beach at 45.3C!Summer Palace - BeiJingMykonosLotus purpleLotus pinkLotus pink yellow

       水泛金光 萬宜水庫


Hong Kong Global Geopark of China

45.3°C @Bondi Beach!

日落 頤和園-北京

The Unforgettable @Mykonos

zPanel Webmail Password Change


zPanel is using RoundCube as the webmail frontend. It's clean and user-friendly. However, if it is going to be used by ordinary mailbox users without zPanel admin access, users cannot change their own password through RoundCube. Deploying the Password plugin is not easy for zPanel as RoundCube is an open source webmail software, and it is not dedicated for zPanel.


  1. Open /etc/zpanel/configs/roundcube/
  2. Deploy password plugin by modifying: $rcmail_config['plugins'] = array() -> $rcmail_config['plugins'] = array('password')
  3. change dir to /etc/zpanel/panel/etc/apps/webmail/plugins/password/
  4. Copy to
  5. Change the line: $rcmail_config['password_driver'] = 'sql' -> $rcmail_config['password_driver'] = 'zpmail'
  6. Add the following driver contributed by setris.
  7. Name it as zpmail.php and put it under directory ../plugins/password/drivers/:


 * ZpanelX SQL Password Driver
 * Driver for passwords stored in SQL database
 * @version 1.1
 * @author 
class rcube_zpmail_password
    function save($curpass, $passwd)
        $rcmail = rcmail::get_instance();
        $local_part  = $rcmail->user->get_username('local');
        $domain_part = $rcmail->user->get_username('domain');
        $username    = $_SESSION['username'];
        $host        = $_SESSION['imap_host'];
        // convert domains to/from punnycode
        if ($rcmail->config->get('password_idn_ascii')) {
            $domain_part = rcube_idn_to_ascii($domain_part);
            $username    = rcube_idn_to_ascii($username);
            $host        = rcube_idn_to_ascii($host);
        else {
            $domain_part = rcube_idn_to_utf8($domain_part);
            $username    = rcube_idn_to_utf8($username);
            $host        = rcube_idn_to_utf8($host);
        $sql = 'SELECT password FROM mailbox WHERE username="'.$username.'"';
        $host = "DBHOST"; // Usually localhost
        $dbName = "zpanel_postfix"; // your ZPanelX postfix database. Default value here
        $dbUser = "DBUSERNAME";
        $dbPass = "DBPASSWORD";
        try {
            $db = new PDO("mysql:host={$host};dbname={$dbName}", $dbUser, $dbPass);
            $db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
        } catch (PDOException $e) {
            //echo 'Database error: '. $e->getMessage() . '';
            return PASSWORD_CONNECT_ERROR;
        $res = $db->query($sql);
        $result = $res->fetch();$pass = $result["password"];
        $hash = str_replace("{PLAIN-MD5}", "", $pass);
        if (md5($curpass) != $hash)
            // echo "Password mismatch error";
            return PASSWORD_ERROR;
        $pass = "{PLAIN-MD5}".md5($passwd);
        $sql = 'UPDATE mailbox SET password="'.$pass.'" WHERE username="'.$username.'"';
        $res = $db->query($sql);
        if ($res) {
                return PASSWORD_SUCCESS;
        return PASSWORD_ERROR;
Don't forget to change parameters: $host, $db_User, $db_Pass above appropriately.
  • zPanel   10.1.1
  • RoundCube   0.9.5
  • Password plugin  3.2
There are many drivers in Password plugin inlcuding the default: sql, but none of them works with zPanel. That is the reason why we need to create new driver for the plugin.

WordPress qTranslate Add Language Select on Header


qTranslate is the best free multilingual plugin of WordPress, but its standard method to include language selector is adding widget. One deficiency of WordPress is that most themes do not provide many defined widget areas (same as regions in other CMS). In case the language select is to be displayed on the header, then some codes modification has to be done.


1.  Create child theme (if not yet available)

2.  Copy header.php from mother theme to child theme

3.  Include the following codes before </div></div></header> of file header.php under child theme

<div style="float:left; margin-top:25px; margin-left:40px;">

<?php qtrans_generateLanguageSelectCode('both'); ?>

4.  To remove the bullet points at the front of each language, add the following codes at the end of file style.css under child theme:
.qtrans_language_chooser { list-style-type:none }
.qtrans_flag { border:1px solid #b6b6b6 }
#qtranslate-chooser li {
margin-bottom: -3px;
  • WordPress    3.8.2
  • qTranslate    2.5.39
  • shopifiq theme 2.0.8


Correct Pricing Tables Ready Plugin's Currency Position


Ready! Pricing Tables is a great free plugin for making price tables in WordPress, but its gray template has a weird behaviour that the currency sign appear after the price instead of leading the price.


Open the file under the plugins directory:  pricing-table-ready/constructor/gray/column.php

Change line 2 from:

...{prt Price} {prtCurrency}...

to become:



Under WordPress admin panel, the file to be modified does not appear when you click "edit" to the plugin Pricing Tables Ready.

WordPress qTranslate Home URL Issue


Using qTranslate on WordPress is good choice as it is a free plugin that can provide multilingual feature to WordPress, and present various languages neatly.


After choosing secondary language, whenever clicking the Home menu, it goes back to default language.


Create and activate a child theme (if not done) of the current deploying theme

Create functions.php under the child theme with the following (suggested by Luis Alegandre's blog):

// Fix for qTranslate plugin and "Home" menu link reverting back to default language
if (function_exists('qtrans_convertURL')) {
function qtrans_in_nav_el($output, $item, $depth, $args) {
$attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
$attributes .=!empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
$attributes .=!empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
// Integration with qTranslate Plugin
$attributes .=!empty($item->url) ? ' href="' . esc_attr( qtrans_convertURL($item->url) ) . '"' : '';
$output = $args->before;
$output .= '<a' . $attributes . '>';
$output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
$output .= '</a>';
$output .= $args->after;
return $output;
add_filter('walker_nav_menu_start_el', 'qtrans_in_nav_el', 10, 4);

GIMP No Transparent Background


After correctly using Gimp's Color to Alpha feature to turn white (or other colour) background into transparency. It appears also correctly in Gimp. However, every time export the image, there is no transparent background, instead the white background appears.


Export image to PNG format instead of JPG


GIMP   2.8


In case the image to be edited is in JPG format, then whenever it is to be exported, GIMP makes the default format same as the original, i.e. JPG, and you can never get the expected transparent background even the process of editing is correct.

Deployment of WordPress Shopp


Need to apply tiered pricing schedule for the service, however, WooCommerce Dynamic Pricing Extension is unreasonably high at US$129 for single-site license.


There are some ecommerce plugins in WordPress, but like WP-ecommerce, the pricing discount setting is too complicated, and I wonder if it works for my pricing schedule.


Shopp plugin comes with clean and logical admin interface.


  • WordPress:    3.7.1
  • Shopp:        1.3.1


Most of the WordPress ecommerce plugins claimed them as free, but some require upgrade to chargeable pro version even for very basic function, few free plugins are offering comprehensive features. Shopp is definitely offering quite comprehensive features. WooCommerce is good but not as a free plugin. There is no pro version for WooCommerce as they want to charge every bit of feature as chargeable extension at unreasonably high price.