Thursday, 31 July 2014

Quick way to check for IMAP Enabled/Disabled on PHP Web server

Please execute the below syntax to check for IMAP feature enabled/disabled on your CPanel

// Code to check for just for IMAP info

// Below code is to get the server configuration and check for PHP IMAP status

If IMAP is enabled, the var_dump should return array of string related to imap as below;
array(75) { [0]=> string(9) "imap_open" [1]=> string(11) "imap_reopen..........

Also, if IMAP is enabled, you should able to see below information when you execute phpinfo(); as below;
IMAP c-Client Version 2007f
SSL Support enabled

If IMAP is disabled,
Otherwise you would just able to see:  bool(false)

To add Very Custom Global Functions on Joomla 2.5 / 3+

If you are struggling to find a place to put any custom global functions (not exclusive to any components, plugins or modules) on Joomla 2.5, 3.0 & more, the best place I reckon would be under;


Where I have created the custom/ folder and created the global.php file where you can put all the global functions as you like;

But, before that please add the below lines of code at the bottom of the loader.php file which is located /root/libraries/loader.php

// Import the custom library for global loader if necessary.
if ( file_exists(JPATH_PLATFORM.'/custom/global.php'))
    require_once JPATH_PLATFORM.'/custom/global.php';
Once you completed above steps, you can access those functions on global.php from anywhere from within project.

Below is the example of function written on global.php file.

// To print passed parameter string on preformatted text format.
function print_me($str)
    echo '<pre>';
    echo '</pre>';

May be there would be better approach to this issue, but I did as above. Please keep on comment me if you guys have any other way.

Wednesday, 23 July 2014

How to enable a ReCaptcha for both HTTP / HTTPS (SSL enabled domain)

Please use the blow code to enable the Google ReCaptcha for HTTP & SSL enabled domain (i.e. HTTPS URL).
In fact, it will work for both types;
// Works only for HTTP - Get reCAPTCHA JS/HTML Code
$html = recaptcha_get_html($this->config->item('recaptcha_public_key', 'tank_auth'));

// Works for both HTTP / HTTPS - Get reCAPTCHA JS/HTML Code
$html = recaptcha_get_html($this->config->item('recaptcha_public_key', 'tank_auth'), null, true); // just added ", null, true" for ssl
The above code is snapshot of CodeIgniter (CI) based project.