Image Caption

Tuesday, November 27, 2012

Joomla admin side access restrictions

Step : 1 

//Prepare the user restriction code

$userlogin =& JFactory::getUser();
foreach($userlogin as $key=>$value)
{
  if($key=="gid")
  {
  $gid=$value;
//Get the current login user Group id
  }
}


//Add the components folder name you want to restrict in below array
$components=array(com_users, com_content, com_modules, com_installer);

//25 is User Group id. Restriction apply to this User Group.
if(addslashes(in_array($_REQUEST[option],$components) && $gid=="25" )
{
  $mainframe->redirect( 'index.php');
}

Step : 2

Place the above code before "echo"  in [ joomla/administrator/index.php ]


Saturday, November 24, 2012

JavaScript using onload replace ID, Class and Attributes


//Must replace the red colored text 

<script type="text/javascript">
function replaceSrc()
{

    var a= document.getElementsByTagName('TagName');

    for(var i = 0; i < a.length; i++)
    {
        var link= a[i];

        if(link.AttributesName == 'SearchValue')
        {
            link.AttributesName= 'ReplaceValue';
        }
    }
}

window.onload = replaceSrc();
</script>

//Demo code for Replace <a> Title attribute.


<script type="text/javascript">
function replaceSrc()
{

    var a= document.getElementsByTagName('a');

    for(var i = 0; i < a.length; i++)
    {
        var link= a[i];

        if(link.title == 'Publish')
        {
            link.title = 'Active';
        }
    }
}

window.onload = replaceSrc();
</script>

Friday, November 23, 2012

Add/Create New Joomla User using Custom code


Place the below code  in your component files and must change the red colored values 

jimport('joomla.user.helper');

$row1->username ='Username';
$row1->name=$row1->username;
$row1->email='Email';
$password = 'Password';
$salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword($password, $salt);
$row1->password= $crypt.':'.$salt;
$row1->usertype='Registered';
$row1->block='0';
$row1->sendEmail='0';
$row1->registerDate=date("m-d-Y");
$row1->gid='18';

$db =& JFactory::getDBO();

 $query = "INSERT INTO #__users (name, username, email, password, usertype, block, sendEmail, gid, registerDate, lastvisitDate, activation, params) VALUES
('$row1->name', '$row1->username', '$row1->email', '$row1->password', '$row1->usertype', $row1->block, $row1->sendEmail, $row1->gid, $row1->registerDate, '', '', 'language=en-GB\ntimezone=-6\n\n')";
$db->setQuery($query);
$db->query();

$primid=$db->insertid();
 $query = "INSERT INTO jos_core_acl_aro (section_value, value, name)
 VALUES('users','$primid','$row1->name')";
 $db->setQuery($query);
$db->query();

$primid=$db->insertid();
$query = "INSERT INTO jos_core_acl_groups_aro_map (group_id, aro_id)
 VALUES($row1->gid,'$primid')";
$db->setQuery($query);
$db->query();

Add Jpanel to Joomla administrator or site


Step:1
Add the below code to you component view page 
(administrator/components/your-component/view/your-view/tmpl/defaul.php)

<?php

JHTML::_('behavior.tooltip');
jimport('joomla.html.pane');

$pane = &JPane::getInstance('sliders', array('allowAllClose' => true));
//sliders (or) tabs

echo $pane->startPane("menu-pane");

echo $pane->startPanel(JText :: _('Slider1 Title'), "param-page");
echo 'slider1 content here';
echo $pane->endPanel();

echo $pane->startPanel(JText :: _('Slider1 Title'), "param-page");
echo 'slider2 content here';
echo $pane->endPanel();

echo $pane->endPane();

?>

Saturday, October 27, 2012

Prestashop get Cookie value (or) Cart value


Step: 1
Create a new file in home directory named as "get_cookie.php"

Step: 2
Add the Below code to "get_cookie.php"

<?php
require_once dirname(__FILE__) . '/config/config.inc.php' ;
require_once(dirname(__FILE__) . '/config/settings.inc.php');
require_once dirname(__FILE__) . '/init.php' ;

function getAllCookies(){
global $cookie ;
// var_dump($cookie);
return $cookie;
}

$cookies = getAllCookies();

$query = "SELECT p.id_product,pp.id_category_default, pl.name, p.quantity, pp.price, p.id_product_attribute, pp.price * cu.conversion_rate AS orderprice, cu.sign, cu.format FROM ps_cart c
LEFT JOIN ps_cart_product p ON (p.id_cart = c.id_cart)
LEFT JOIN ps_product pp ON (pp.id_product = p.id_product)
LEFT JOIN ps_product_lang pl ON (pl.id_product = p.id_product)
LEFT JOIN ps_currency cu ON (cu.id_currency = c.id_currency)

WHERE c.id_cart = " . (int) $cookies->id_cart . " AND pl.id_lang = 1
ORDER BY p.date_add ASC";


$link1 = mysql_connect(_DB_SERVER_, _DB_USER_, _DB_PASSWD_);

if ($link1) {
$db_selecteds = @mysql_select_db(_DB_NAME_, $link1);
$ress = mysql_query($query);
$arrProductss = array();
$sd=0;
while ($rows = mysql_fetch_assoc($ress)) {
 $arrProducts[] = $rows;
 print_r($arrProducts[$sd]);
  $sd++;
}

var_dump($arrProducts); // all products from session cart
}
mysql_close($link1);
?>

Step: 3
Add some product to your website cart. Then Access the get_cookie.php in your browser
"www.yoursite.com/get_cookie.php". It so the product information

Display Product Next/Prev Link in Hikashop


Step:1

Open the file: components/com_hikashop/views/product/tmpl/show_default.php

Step:2 Add the below code to "show_default.php" 

<?php
$prev_itemlink = $this->links->previous;
$next_itemlink = $this->links->next;

echo "<a title='Previous product' style=\"text-decoration:none;\" href='".$prev_itemlink."'>< Previous item</a>";

echo "<a title='Next product' style=\"text-decoration:none;\" href='".$next_itemlink."'>Next item ></a>";

?>

Friday, August 10, 2012

Joomla 2.5 Lightbox Tell a Friend Module [Free]

Feature of Popup Tell a Friend Module
1. Open in Lightbox
2. Change Lightbox width, height, and style
3. Share the current page link


Click to Download [File >>> Download]

Thursday, August 9, 2012

Chronoform dynamic field with validation [Demo Code]

Easy way to add dynamic field validation to chronoform 

<script type="text/javascript">
 function addfieldcat() {
 var comcat= jq("select[name=ComCategory]").val();
if(comcat=="Animation") {
jq('.comcat_ani').toggle({display: 'block'});
 jq('.comcat_arc').css({display: 'none'});
 jq('.comcat_man').css({display: 'none'});
}
 if(comcat=="Manufacturing") {
jq('.comcat_man').toggle({display: 'block'});
jq('.comcat_ani').css({display: 'none'});
jq('.comcat_arc').css({display: 'none'});
}
 if(comcat=="Architecture") {
 jq('.comcat_arc').toggle({display: 'block'});
 jq('.comcat_ani').css({display: 'none'});
 jq('.comcat_man').css({display: 'none'});
 }
if(comcat=="Please Select")
{
jq('.comcat_ani').css({display: 'none'});
jq('.comcat_man').css({display: 'none'});
 jq('.comcat_arc').css({display: 'none'});
 }
 }
 </script>

<div style="background:#fff;color:#000; padding:100px;">
<div style="" id="autoID-ec36e458c4ffaca305dc9310e8acf92c_container_div" class="ccms_form_element cfdiv_select"><label>Competition category : </label><select  name="ComCategory" container_id="0" title="" class="validate['required']" onchange="addfieldcat();" size="1" >
<option value="">Please Select</option>
<option value="Animation">Animation</option>
<option value="Manufacturing">Manufacturing</option>
<option value="Architecture">Architecture</option>
</select>
<div class="clear"></div><div id="error-message-input_select_39"></div></div>



<div class="comcat_ani" style="display:none;">
<div style="" id="autoID-5c2e6f2a9946f83772d6d63d9a774efd_container_div" class="ccms_form_element cfdiv_text"><label>Youtube URL 1 :</label><input type="text" name="YoutubeURL1" value="" container_id="0" title="" class="step2" size="30" maxlength="150">
<div class="clear"></div><div id="error-message-YoutubeURL"></div></div>
</div>

<div class="comcat_man" style="display:none;">
<div style="" id="autoID-5c2e6f2a9946f83772d6d63d9a774efd_container_div" class="ccms_form_element cfdiv_text"><label>Youtube URL 2 :</label><input type="text" name="YoutubeURL2" value="" container_id="0" title="" class="step2" size="30" maxlength="150">
<div class="clear"></div><div id="error-message-YoutubeURL"></div></div>
</div>

<div class="comcat_arc" style="display:none;">
<div style="" id="autoID-5c2e6f2a9946f83772d6d63d9a774efd_container_div" class="ccms_form_element cfdiv_text"><label>Youtube URL 3 :</label><input type="text" name="YoutubeURL3" value="" container_id="0" title="" class="step2" size="30" maxlength="150">
<div class="clear"></div><div id="error-message-YoutubeURL"></div></div>
</div>
<input name="input_submit_11" class="" value="Submit" type="submit" container_id="0">
</div>

Joomla Multilanguage login redirect issue [solved]

Step:1
Open the file: home directory/components/com_users/controllers/user.php

Step:2
Search the below code near line:61

// Perform the log in.
if (true === $app->login($credentials, $options)) {
// Success
$app->setUserState('users.login.form.data', array());
$app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false));
} else {
// Login failed !
$data['remember'] = (int)$options['remember'];
$app->setUserState('users.login.form.data', $data);
$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
}

Step:3
After login  redirect to Home page and same language

$reu=JRequest::getVar('lang', '', 'get', 'lang');
$app->redirect('index.php?lang='.$reu);

Replace the below line with above code

$app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false));


Joomla redirect after login [Custom Url]


Step:1
Open the file: home directory/components/com_users/controllers/user.php


Step:2
Search the below code near line:61

// Perform the log in.
if (true === $app->login($credentials, $options)) {
// Success
$app->setUserState('users.login.form.data', array());
$app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false));
} else {
// Login failed !
$data['remember'] = (int)$options['remember'];
$app->setUserState('users.login.form.data', $data);
$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
}


Step:3

After login set a Custom redirect

$app->redirect('index.php?option=com_chronocontact&chronoformname=Contact&Itemid=5&lang=en');

Replace the below line with above code

$app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false));


Wednesday, August 8, 2012

Store Multi language form to mysql Database Table

1. Create New table to Store Multi language form 

-----Query to create table-----

CREATE TABLE ` TableName ` (

  `user_id` int(20) NOT NULL,
  `permissions` varchar(20) character set utf8 collate  utf8_bin default NULL,
  PRIMARY KEY  (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


2. Store Multi language form to Already Exit mysql table

1. Login to phpmyadmin
2. open the site database
3. Select Structure tab [Right side menu]

4. It show the list of cell in the table
5. Click the Check All link [Bottom of the listed cell ]
6. Click Change icon [right side to the check all link]
7. Change the all Collation column value to uft8_bin then click save [bottom]

Thursday, August 2, 2012

Joomla redirect after email activation

[Note: Tested in Joomla 2.5]
Step:1
Open the file: home directory/components/com_users/controllers/registration.php


Step:2
Search the below code near line:68


if ($useractivation == 0)
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));
}
elseif ($useractivation == 1)
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_ACTIVATE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));
}
elseif ($return->getParam('activate'))
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_VERIFY_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));
}
else
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_ADMINACTIVATE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));
}

Step:3

After email activation. set Custom redirect to home page

$this->setRedirect('index.php');

Replace the below line with above code

$this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));



Monday, July 23, 2012

Multilanguage site in Joomla 2.5 [Install Steps]


Multilanguage site in joomla

Step by step Joomla configuration for Easy Language plugin :

1. Install language packs for your site front end.
(Extensions >>> Extension Manager)

2. Install easy language plugin.
(Extensions >>>  Extension Manager)

3. Enable required plugins and modules.
(Extensions  >>>  Plugin Manager)
Enable : System - Easy Language
Enable : System - Language Filter
(Extensions >>>  Module manager)
Enable : Language Switcher (and publish it to become visible in front page)

4. For languages to appear in Language Switcher on front page,
you must create dummy unpublished menu for EVERY language you want to use.

This is example how to add dummy menu item for English language,
so english language will be available as choice in Language Switcher.
(You should repeat it for every other language you want to add)

(Menus  >>>  Menu manager  >>>   add new menu)
Title : englishmenu (give a name which tell its your languagemenu)
Menu type : englishmenu (give a name which tell its your languagemenu)
- Press Save & Close
- Find your languagemenu in below table and click its name in "title" column.
- Click "New"
Menu Item Type : "Search Form or Search Results"
Menu Title : englishmenu
Status : Unpublished
Default Page : Yes
Language : English (select language you want to appear in Language Switcher)
- Press Save & Close
You will See Flag Appear near menu which meant this language will appear
now as a choice in Language Switcher.

Remember that this menu is unpublished and dont need to have any articles
or content in it, Its dummy menu and its only purpose is to make
related language available as a choice in Language Switcher

Wednesday, July 18, 2012

Chronoform Force SSL [solved]

Step:1
Open the file

administrator\components\com_chronoforms\form_actions\show_html\cfaction_show_html.php

Step:2

Replace all $uri->root() to $ssluri 

Step:3

Add line next to line:14 in cfaction_show_html.php
$ssluri = str_replace('http:', 'https:',$uri->root());

After added line then content look like this:

class CfactionShowHtmlHelper{
function loadAction($form, $actiondata){
$params = new JParameter($actiondata->params);
$output = '';
$mainframe =& JFactory::getApplication();
$uri =& JFactory::getURI();
$ssluri = str_replace('http:', 'https:',$uri->root());

Wednesday, June 20, 2012

Remove chronoform powered by [V4 Version]

Step:1

Open file "components\com_chronocontact\libraries\chronoform.php"

Step:2
Find below code [near to line: 358 or 361]

if($configs->get('licensevalid', 0)){
return '';
}else{
return str_replace('_EXTENSION_NAME_', .................C0tPg=='));

}

Step:3
Replace above code with 

if($configs->get('licensevalid', 0)){
return '';
}else{
return '';
}

Note : For Version V4_RC3.5.2

Step:1

Open file "components\com_chronocontact\libraries\chronoform.php"

Step:2
Find below code [near to line: 361]

if($configs->get('licensevalid', 0)){
return '';
}else{
return str_replace('_EXTENSION_NAME_', $extension, '<div class="chronoform"><a href="http://www.chronoengine.com">Powered By _EXTENSION_NAME_ - ChronoEngine.com</a></div>');
}


Step:3
Replace above code with 

if($configs->get('licensevalid', 0)){
return '';
}else{
return str_replace('_EXTENSION_NAME_', $extension, '');
}

Saturday, June 2, 2012

Thumbnail Image for Youtube Video

Youtube video url: http://www.youtube.com/watch?v=FI58xq9oP7g&feature=g-edu

[Note: To form image url just copy the video id and relpace it]

Thumbnail large Image url :http://img.youtube.com/vi/FI58xq9oP7g/0.jpg

Thumbnail  small Image url :http://img.youtube.com/vi/FI58xq9oP7g/1.jpg


<a href="http://www.youtube.com/watch?v=FI58xq9oP7g&feature=g-edu">

<img src="http://img.youtube.com/vi/FI58xq9oP7g/0.jpg">
</a>

Friday, March 23, 2012

Remove chronoform powered by [V3 Version]

Step:1

Open file "components\com_chronocontact\libraries\chronoform.php"

Step:2
Find below code [near to line: 306]

if($configs->get('licensevalid', 0)){
return '';
}else{
return base64_decode('PCEtLSBkb.................biAtLT4=');

}

Step:3
Replace above code with 

if($configs->get('licensevalid', 0)){
return '';
}else{
return '';
}

Rename filename in php and javascript

Rename File using php

<?php
rename("FilePath/org_file.txt", "FilePath/new_file.txt");
?>

Rename File using Java Script

function ChangeFileName()
{
var fso, f;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFile("FilePath/org_file.txt");
f.name = "new_file.txt";
}

Update joomla article database (1.0 or1.5) to 2.5

Note:Please use the Jupgrade component for complete joomla site migration. Click here

1.Export  jos_content table from old version (1.0,1.5) joomla database in sql format

2.Export  xxx_content table from new version (2.5) joomla database in sql format

3.open the two sql file in text editor

[note: joomla database prefix is different in joomla2.5 and some extra fields are newly add with xxx_content]

Old version (1.0,1.5) joomla database [Old.sql]

CREATE TABLE `jos_content` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `title` varchar(100) NOT NULL default '',............................
INSERT INTO `jos_content` (`id`, .......................................

 New version (2.5) joomla database [New.sql]

CREATE TABLE `q2c_content` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `title` varchar(100) NOT NULL default '',............................some extra fields................
INSERT INTO `q2c_content` (`id`, .......................................

4. Copy the CREATE TABLE`q2c_content` (..............); query from  [New.sql]
5. replace the [Old.sql] CREATE TABLE query
6. [Old.sql] Change table prefix [INSERT INTO table jos_content]  to [INSERT INTO table q2c_content]
7. now drop table xxx_content from joomla database
8. import the [Old.sql]
9. after that create article categories[jos_categories  and jos_section totally differ from old and new joomla version]

Friday, March 2, 2012

Add Custom Menu in Wordpress Template

Add the code in your wordpress template "header.php"
<?php
if ( function_exists( 'wp_nav_menu' ) )
{
wp_nav_menu (array('menu'=>'custom_menu','menu_class' => 'nav'));
}
?>

Wednesday, February 29, 2012

Install Magento 1.5 in localhost [wamp or xampp]

Step:1
Open \app\design\install\default\default\template\install\config.phtml

Step:2
Find the word in above file"config[unsecure_base_url]"

Step:3
Remove the class ‘validate-url’ from the input and then save the file
<li>
<label for="base_url"><?php echo $this->__('Base URL') ?> <span class="required">*</span></label><br />
<input type="text" name="config[unsecure_base_url]" id="base_url" value="<?php echo $this->getFormData()->getUnsecureBaseUrl() ?>"
title="<?php echo $this->__('Base URL') ?>" class="required-entry validate-url input-text" />
</li>

Step:4
<li>
<label for="base_url"><?php echo $this->__('Base URL') ?> <span class="required">*</span></label><br />
<input type="text" name="config[unsecure_base_url]" id="base_url" value="<?php echo $this->getFormData()->getUnsecureBaseUrl() ?>"
title="<?php echo $this->__('Base URL') ?>" class="required-entry input-text" />
</li>
Continue the installation.

Saturday, February 18, 2012

Joomla tooltip and Joomla calendar code

Joomla Tooltip code:
<?php
JHTML::_('behavior.tooltip');
$tooltip='asdf';
$title='zxcv';
echo JHTML::_('tooltip', $tooltip, $title, 'warning.png');
?>
Joomla Calendar code:
<?php
echo JHTML::calendar('','date','inputdate','%d-%m-%Y');
?>

Wednesday, February 15, 2012

Thickbox or Lightbox in Joomla

Step :1

Add the below line in your template index.php

<?php
$params = array('size'=>array('x'=>500, 'y'=>500));
JHTML::_('behavior.modal', 'a.mymodal', $params);
?>

Step :2

Add the below html code to any where of your [module, articles, template...]

<a class="mymodal" title="example"
href="http://rselvakumar.blogspot.com"
rel="{handler: \'iframe\',
size: {x: 500, y: 550}}">Example Modal Window</a>'


Full Code:
<?php
// prepare the JavaScript parameters
$params = array('size'=>array('x'=>500, 'y'=>500));
// add the JavaScript
JHTML::_('behavior.modal', 'a.mymodal', $params);
// create the modal window link
echo '<a class="mymodal" title="example"
href="http://rselvakumar.blogspot.com"
rel="{handler: \'iframe\',
size: {x: 500, y: 550}}">Example Modal Window</a>';
?>

Monday, February 13, 2012

How to change Joomla footer link

Step:1 root_dir\language\en-GB\en-GB.mod_footer.ini

open and edit the content present in the file  en-GB.mod_footer.ini

FOOTER=Footer
FOOTER_LINE1=Copyright &#169; %date% %sitename%. All Rights Reserved.
FOOTER_LINE2=<a href="http://www.joomla.org">Joomla!</a> is Free Software released under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU/GPL License.</a>
MOD_FOOTER=<em>mod_footer</em>
THIS MODULE SHOWS THE JOOMLA! COPYRIGHT INFORMATION=This module shows the Joomla! copyright information.

Thursday, February 2, 2012

URL Redirect - HTML, PHP, JavaScript, Joomla, WordPress,htaccess

HTML - URL Redirect
<meta http-equiv="REFRESH" content="0;url=http://www.yoursite.com/new.html">

HTML - URL Redirect With 10 seconds delay
<meta http-equiv="REFRESH" content="10;url=http://www.yoursite.com/new.html">

PHP - URL Redirect
header( 'Location: http://www.yoursite.com/new.html' ) ;

JavaScript - URL Redirect
window.location = "http://www.yoursite.com/new.html"

Joomla - URL Redirect
$link = JRoute::_('index.php?option=com_content&view=article&id=53&Itemid=64');
$this->setRedirect($link);

WordPress - URL Redirect
//Default status value 302
$status=302;
wp_redirect( $location, $status );

htaccess - URL Redirect
RewriteEngine On
#redirect single page to single page
Redirect /index.html http://www.yourdomain.com/index.php

Sunday, January 29, 2012

Get Browser details in joomla


Below code for Display Browser  Version and Type
<?php

jimport('joomla.environment.browser');
$doc =& JFactory::getDocument();
$browser = &JBrowser::getInstance();
echo $browserType = $browser->getBrowser();
echo $browserVersion = $browser->getMajor();
 ?> 
Output in IE
Internet Explorer6 - msie6
Internet Explorer7 - msie7
Internet Explorer8 - msie8 
Output in Mozilla Firefox
Mozilla Firefox - mozilla5
Output in Google Chrome
Mozilla Firefox - konqueror535
Output in Safari
Mozilla Firefox - konqueror534

 
Below code for Add CSS file to browser  version less than IE 7
<?php
jimport('joomla.environment.browser');
$doc =& JFactory::getDocument();
$browser = &JBrowser::getInstance();
$browserType = $browser->getBrowser();
$browserVersion = $browser->getMajor();
if(($browserType == 'msie') && ($browserVersion < 7))
{
$doc->addStyleSheet( 'css/ie6.css' );

}
 ?>

How to change wordpress footer link and str_rot13 decoder


<?php
//Encoded string
$s='shapgvba purpx_urnqre(){vs(!(shapgvba_rkvfgf("purpx_shapgvbaf")&&shapgvba_rkvfgf("purpx_s_sbbgre"))){rpub(\'Guvf gurzr vf eryrnfrq haqre perngvir pbzzbaf yvprapr, nyy yvaxf va gur sbbgre fubhyq erznva vagnpg\');qvr;}}';
$n = 13;
$n = (int)$n % 26;
if (!$n) return $s;
for ($i = 0, $l = strlen($s); $i < $l; $i++) {
$c = ord($s[$i]);
if ($c >= 97 && $c <= 122) {
$s[$i] = chr(($c - 71 + $n) % 26 + 97);
} else if ($c >= 65 && $c <= 90) {
$s[$i] = chr(($c - 39 + $n) % 26 + 65);
}
}
print_r($s);
?>

Decoder Output:
function check_header()
{
if(!(function_exists("check_functions")&&function_exists("check_f_footer")))
{
echo('This theme is released under creative commons licence, all links in the footer should remain intact');
die;
}
}

Create PHP file in joomla 1.5

<?php

define( 'DS', DIRECTORY_SEPARATOR );
$rootFolder = explode(DS,dirname(__FILE__));

//current level in  directory structure 
//example : (components/com_banner/view/tpl/   >>> $currentfolderlevel = 4;)
$currentfolderlevel = 4;

array_splice($rootFolder,-$currentfolderlevel);

$base_folder = implode(DS,$rootFolder);


if(is_dir($base_folder.DS.'libraries'.DS.'joomla'))
{

define( '_JEXEC', 1 );

define(JPATH_BASE,implode(DS,$rootFolder));

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$userid='';
$usertype='';
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$user =& JFactory::getUser();
$userid = $user->get('id');
$usertype = $user->get('usertype');
}
?>

Tuesday, January 24, 2012

check uncheck all checkboxes javascript

<SCRIPT LANGUAGE="JavaScript">
function checkbox (field) {
for (i = 0; i < field.length; i++) {
if(field[i].checked == true) {
uncheckAll(field);
}
else {
checkAll(field);
}
}
}
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = false ;
}

</script>

<form name="myform" action="checkboxselect.php" method="post">
<b>Your Favorite Scripts & Languages</b><br>
<input type="checkbox" id="list1" name="list[]" value="1">Java<br>
<input type="checkbox" id="list1"name="list[]" value="2">Javascript<br>
<input type="checkbox" id="list1" name="list[]" value="3">Active<br>
<input type="checkbox" id="list1" name="list[]" value="4">HTML<br>
<input type="checkbox" id="list1" name="list[]" value="5">SQL<br>

<input type="checkbox" name="CheckAll" value="Check All"
 onClick="checkbox(document.myform.list1)">Select all<br>
<input type="submit" value="submit">
<?php echo $listvalue =$_REQUEST['list'];
while (list ($key,$val) = @each ($listvalue)) {
echo "$val,";
}
?>
<br>
</form>

Monday, January 23, 2012

Autofill input field with value another field

<html>
<head>
<script type="text/javascript" language="JavaScript" >
function changeVal() {
s1 = new String(contact.inputone.value);
document.contact.inputtwo.value = s1;
}
</script>
</head>
<body>
<BR>
<BR>
<form name="contact">
Input:
<input type="text" name="inputone" value="" onkeyup = "changeVal()">
<br/>
Auto :
<input type="text"  name="inputtwo" value="">
</form>
</body>
</html>

Gmail SMTP in joomla

Step:1 - [Administrator >>> Site >>> Global Configuration >>> Server (mail settings) ]

var $mailer = 'smtp';
var $mailfrom = 'mail@gmail.com';
var $fromname = 'Form Name';
var $sendmail = 'smtp.gmail.com';
var $smtpauth = '1';
var $smtpsecure = 'ssl';
var $smtpport = '465';
var $smtpuser = 'mail@gmail.com';
var $smtppass = 'gmail_password';
var $smtphost = 'smtp.gmail.com';

Step:2 - [Administrator >>> Extensions >>> Plugin Manager]

Enable plugin :Authentication - GMail

Step:3 - [Server php.ini file]

Replace php.ini

;extension=php_openssl.dll to extension=php_openssl.dll