Book Image

Mastering Mambo : E-Commerce, Templates, Module Development, SEO, Security, and Performance

By : Christian Wenz, Tobias Hauser
Book Image

Mastering Mambo : E-Commerce, Templates, Module Development, SEO, Security, and Performance

By: Christian Wenz, Tobias Hauser

Overview of this book

<p>Mambo is a PHP-based Open Source CMS. Mambo is both easy to use at the entry level for creating basic websites, while having the power and flexibility to support complex web applications. <br /> <br /> Mambo implements the core requirements of a full featured CMS. It has a powerful and extensible templating system with the ability to upload and manage many different data types. User access control, content approval, rich administrative control, content display scheduling are all built-in. New features and extensions are constantly added to the core system, with many more being available and supported by the community.<br /> <br /> Most of the Mambo development team now works on a fork of Mambo known as Joomla. Mastering Mambo is fully compatible with Joomla's 1.0 release.</p>
Table of Contents (18 chapters)
Mastering Mambo
Credits
About the Authors
Preface
Index

Your Own Modules


The production of your own module is the easiest. You need only two things for it—an XML file, which describes exactly what the module does and in which files it is located, and the module itself. The first step in the creation of every Mambo extension is to prevent the direct call of the PHP file in order to avoid possible security gaps. A popular trick is to check for the presence of the _VALID_MOS constant. If it isn't there, the file is not called by Mambo, but directly by PHP. In that case, the following code aborts the script execution immediately:

if (!defined('_VALID_MOS')) {
  die('direct access is prohibited!');
}

The rest of the module is very simple. As a small new feature for the website, we are using a lottery system that pulls six numbers from a block of 49 (plus a bonus number). It is possible and easy to adapt this to other lottery systems. Every user gets six randomly selected lottery numbers. That, however, does not happen every time, but with a probability...