Demo Joomla! 1.5

Visit the Joomla! 1.5 demo site to see my extensions live running

Demo Joomla! 2.5

Visit the Joomla! 2.5 demo site to see my extensions live running

Support

Do not submit a bug report if you need technical support or have questions.

Forums

Post your suggestions ask for help in the community forums

Wiki

Visit the Wiki extensive and up to date documentation at your fingertips.

Contact Me

Missing images/links, any comments, suggestions, need help? Contact me

Skype

Need desperately help?
Skype Me™! But dont abuse of it!

Migration SecurityImages 4.X to SecurityImages 5.X how to

User Rating:  / 0
PoorBest 

SecurityImages 5.X is only running with Joomla! 1.5 and the redesign of API has introduced some incompatibilities.
Developers/Hackers/Individuals who want to use the latest version of SecurityImages may want to read the
following. Basic PHP knowledge  is recommended.

joomla_1.5

Architecture

SecurityImages 4.0.X

  • Only work with Joomla! 1.0.X
  • Provide 2 files that 3rd party code must include:
  • client.php in order to quickly create a captcha and the input box
  • server.php in order to validate user entries and check correctness
  • Everything is packed in one component.
  • Patches for common 3rd party tool are included in code so it ca be referenced by external extensions :
    akobook, akocomment, joomla to name a few.
  • You have to overwrite Joomla! files to add protection of form for login, register, lost password, contact

SecurityImages 5.0.X

  • Only work with Joomla! 1.5.X
  • Use the event handling mechanism of Joomla! 1.5 to  create captcha and check correctness
  • You'll have to install a system content plugin and a component,
  • it do not contains any patches anymore
  • You have to overwrite Joomla! files to add protection of form for login, register, lost password, contact

Main differences in securityImages 5.X

  1. There is no client.php and server.php file anymore
  2. API are a lot simpler, and dependency are reduced (no PHP code to include) as it use events.
  3. More object oriented
  4. Image creation is done inside the Joomla! framework while in 4.0.X it was done without any Joomla!
    framework support.

 

with SecurityImages 4.0.X


In your PHP code displaying the form, can be a Pat template or a html code

1. Include my library in page scope

if (file_exist($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php')) {
<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
}
$packageName = 'securityChooseUniqueKeyName';
 
2. At the position where You want the Captcha image to be inserted 
 
<?php echo insertSecurityImage($packageName); ?>

3. This insert the help text and the input box where the user will have to enter his text
<?php echo getSecurityImageText($packageName); ?>

Line at point 3. can be, in some case, depending how much space You have in the presentation HTML layer, replace with
 //will be replace at runtime, depending on user locale 
//with "Please Enter what You see:" 
<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
0
<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
1
<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
2
<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
3
<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
4
<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
5
<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
6
<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
7

The code above insert the image, and the text, You page normally submit information to the server for processing. Most of the time, the last 2 lines are inserted in a <form> </form> HTML tags

In the server code where you process the data...
Few lines are required...

<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
8
<?php include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php'); ?>
9
}
0
}
1
}
2
}
3
}
4
}
5


If the has entered the right text then $checkSecurity = true

 


with SecurityImages 5.0.X   joomla_1.5

Due to the Joomla! 1.5 object model, you have basically 2 options:

  1. If your component has been made for running natively and follow Joomla! 1.5 best practices and
    recommendations..you' did probably use a real MVC paradigm in the front end part (N views,
    M models and one controller), go to point A
  2. If your component has been made for running natively or in legacy mode and do not use a MVC pattern
    (HTML code embedded in PHP code, or you use pat templates), go to point B

Point A, MVC approach joomla_1.5

Lets take the contact section of Joomla! 1.5 as  an example.

It is always recommended to use a switch in all your component to activate deactivate SecurityImages per
components  through the administrator control panel.

This is done by adding to administrator/components/com_contact/contact_items.xml the following code:

}
6
}
7
}
8
}
9
$packageName = 'securityChooseUniqueKeyName';
0
$packageName = 'securityChooseUniqueKeyName';
1
$packageName = 'securityChooseUniqueKeyName';
2

Joomla will read this xml file on the fly  and build the graphical user interface for the contact settings.

Since Joomla! 1.5 now use a Model View Controller paradigm, we have to alter the controller, and add a new Task displaySecurityImagesCaptcha()in  components/com_contact/controller.php:

$packageName = 'securityChooseUniqueKeyName';
3
$packageName = 'securityChooseUniqueKeyName';
4
$packageName = 'securityChooseUniqueKeyName';
5
$packageName = 'securityChooseUniqueKeyName';
6
$packageName = 'securityChooseUniqueKeyName';
7
$packageName = 'securityChooseUniqueKeyName';
8
$packageName = 'securityChooseUniqueKeyName';
9
 
0
 
1
 
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9

As you can see, the event "onSecurityImagesDisplay" is triggered on a per contact name basis.
That mean that some contact can have a Captcha while other have not.  You are free to define
your own activation rules in the controller method.
The next step is to add the task checkSecurityImagesCaptcha() checking the captcha in the
components/com_contact/controller.php

2. At the position where You want the Captcha image to be inserted 
0
2. At the position where You want the Captcha image to be inserted 
1
2. At the position where You want the Captcha image to be inserted 
2
2. At the position where You want the Captcha image to be inserted 
3
2. At the position where You want the Captcha image to be inserted 
4
2. At the position where You want the Captcha image to be inserted 
5
2. At the position where You want the Captcha image to be inserted 
6
2. At the position where You want the Captcha image to be inserted 
7
2. At the position where You want the Captcha image to be inserted 
8
2. At the position where You want the Captcha image to be inserted 
9
<?php echo insertSecurityImage($packageName); ?>
0
<?php echo insertSecurityImage($packageName); ?>
1
<?php echo insertSecurityImage($packageName); ?>
2
<?php echo insertSecurityImage($packageName); ?>
3
<?php echo insertSecurityImage($packageName); ?>
4
<?php echo insertSecurityImage($packageName); ?>
5
<?php echo insertSecurityImage($packageName); ?>
6

One more step is to alter the original submit() method of the controller in components/com_contact/controller.php

<?php echo insertSecurityImage($packageName); ?>
7
<?php echo insertSecurityImage($packageName); ?>
8
<?php echo insertSecurityImage($packageName); ?>
9
<?php echo getSecurityImageText($packageName); ?>
0
<?php echo getSecurityImageText($packageName); ?>
1
<?php echo getSecurityImageText($packageName); ?>
2

And finally altering the view /com_contact/views/contact/tmpl/default_form.php
to display the Captcha field

<?php echo getSecurityImageText($packageName); ?>
3
<?php echo getSecurityImageText($packageName); ?>
4
<?php echo getSecurityImageText($packageName); ?>
5
<?php echo getSecurityImageText($packageName); ?>
6
<?php echo getSecurityImageText($packageName); ?>
7
<?php echo getSecurityImageText($packageName); ?>
8

Point B, Legacy approachjoomla_1.5


In your PHP code displaying the form, can be a Pat template or a html code

if you want to display the captcha define in administrator panel

<?php echo getSecurityImageText($packageName); ?>
9
 //will be replace at runtime, depending on user locale 
0
 //will be replace at runtime, depending on user locale 
1

If you want to use a particular implementation different than the one define in administrator panel, useful where you know that you want to use a smaller/bigger captcha than usual

 //will be replace at runtime, depending on user locale 
2
 //will be replace at runtime, depending on user locale 
3
 //will be replace at runtime, depending on user locale 
4
 //will be replace at runtime, depending on user locale 
5
 //will be replace at runtime, depending on user locale 
6
 //will be replace at runtime, depending on user locale 
7
 //will be replace at runtime, depending on user locale 
8
 //will be replace at runtime, depending on user locale 
9
//with "Please Enter what You see:" 
0
//with "Please Enter what You see:" 
1
//with "Please Enter what You see:" 
2
//with "Please Enter what You see:" 
3
//with "Please Enter what You see:" 
4
//with "Please Enter what You see:" 
5
//with "Please Enter what You see:" 
6
//with "Please Enter what You see:" 
7

 

 Post your questions in the forums or enhance the WIKI with your finding. I will start to maintain more and more the WIKI and put
good documentation there.

You might also like:
Nasty Bug in SecurityImages 5.1.2
258 days ago
Nasty Bug in SecurityImages 5.1.2
Thanks to Margus Pala, a security Flaw has been reported and corrected in SecurityImages version 5
HOW to make your own patches for securityimages
916 days ago
HOW to make your own patches for securityimages
Just in case I take too much time to deliver a ready to use download, duration 5 minutes, but you ne
Joomla_1.5.13-Stable-Full_PackageForSecurityImages5.1.x_v01.
926 days ago
Joomla_1.5.13-Stable-Full_PackageForSecurityImages5.1.x_v01.
Only for SecurityImages 5.1.x and Joomla! 1.5.13 Allow login views, login modules, register, lost
Joomla_1.5.12-Stable-Full_PackageForSecurityImages5.1.x_v01.
948 days ago
Joomla_1.5.12-Stable-Full_PackageForSecurityImages5.1.x_v01.
Only for SecurityImages 5.1.x and Joomla! 1.5.12 Allow login views, login modules, register, lost
blog comments powered by Disqus
Parent Category: Extensions
Category: SecurityImages

Donations

Thank You for supporting my work

Follow Me

Follow cedricwalter on Twitter Subscribe via RSS Subscribe via RSS Follow us on Facebook Follow us on Google+

Latest Articles

  • Thanks to Nathan Rennie-Waldock. you can have the latest PHP5 5.3.10 running in Ubuntu Oneiric, Natty, Maverick and Lu... ...
  • Download and install the latest  VMware Player 4.0.2 to run this Virtual Appliance “Ubuntu 11.10 x64 Server” ... ...
  • Download and install VMware Player 4.0.2 to run this Virtual Appliance “Ubuntu 11.10 x64 Server” Ready to user st... ...
  • Thanks to Ondřej Surý,  maintainer for some Debian packages, you can have the latest PHP5 maintained by Debian ... ...
  • Munin is a networked resource monitoring tool that can help analyze resource trends and "what just happened to ki... ...

Latest Comments

Popular Posts

rockettheme advertisement

dropbox logo

Help Us & Leave Feedback!

  • Do you have an excellent article idea you would like to read about here? Share it!
  • Do you have some interesting tips how we could improve our site?
  • Something missing here? Help us make this blog a better place, leave feedback!
We would love to hear from you! Be active! Write us now!

Blogs

Didier Beck Tech Head Brothers

google+ badge