ubuntu

If mod-rewrite is not enabled, follow the on-screen instructions to install it.

2.Next, edit the site config file for which you want to enable mod-rewrite. This is likely to be /etc/apache2/sites-available/default. Edit the file as root using your text editor of choice (try sudo Nano default)

Notice (1024): Please change the value of 'Security.salt'
in aa01/config/core.php to a salt value specific to your application
[CORE\cake\libs\debugger.php, line 535]

The security salt is used for generating hashes, particularly for password security. The Cake build has a default salt which should be changed otherwise there is the potential that another site with the same build and thus the same default salt could be well on the way to crack your passwords. Note that the first Cake bake pass should have modified this salt, but you can manually change it. Sometimes I manually generate a project salt based on the project name and build version so that I can check it during subsequent processing.
Change one or more characters of the salt or generate yourself a completely new salt. Use something like echo sha1(’my own security salt string’) and copy the 40 character hashed string. The security.salt is stored in \htdocs\aa01\config\core.php at around line 153.

//d'abord, on vérifie l'IP de la requête$adresse_ip=$_SERVER['REMOTE_ADDR'];if($adresse_ip!=IPADRESSTRUSTEDSERVER){echo"Your IP adress ".$_SERVER['REMOTE_ADDR']." is not allowed to access that url, we'll inform your provider of your hacking activities!";exit;}//et maintenant on contrôle la clé$user=$_GET['user'];$crypt=$_GET['crypt'];$secretkey="pVV3Mz9bqHMWTTmCPcT3znf";$cryptcheck=sha1($secretkey.$user);if($crypt==$cryptcheck){//ok, the keys are matching, do sthing...}else{echo"There is a problem, the system was unable to log you, please inform your webmaster";exit;}

function edit($id=null){.../*
* tip: do not include any ingredients, so that the quantities are preserved in the link table ingredients_recettes
*///$ingredients = $this->Recette->Ingredient->find('list');

email Validation

After working for about one year, the BHJS Alumni website phase 2 is completed. But after it is deployed in production server, i found that some email addresses are regarded as invalid email address. The email validation rule which i used is provided by CakePHP. Only email addresses ended with .com, .org etc… could pass the validation rule.
So i ask the Google teacher and luckily i am not the only one to come across this problem.
Email Validation in cakephp
What i can do is writing my own validation rule which can be doned by regular expression in the model.php. Again, Google is really helpful and there are many regular expressions for email validation. Finally, i pick the following one.
^[A-Za-z0-9._%+-]+@([A-Za-z0-9-]+\.)+([A-Za-z0-9]{2,4}|museum)$
Reference: TIP: Simple Regular Expression for Email Validation
And so in the model.php, i replaced the email validation as follow.
var $validate = array(
'id' => array('numeric'),
/* CakePHP has problem on email validate. Reference: http://groups.google.com.tw/group/cake-php/browse_thread/thread/3d0a47d4...
'email_address' => array('notempty', 'email' => array('rule' => array('email', true),'message' => 'Please supply a valid email address.')),
*/
// The following change is done for the above problem. Reference: http://gofedora.com/tip-simple-regular-expressi-email-validation/
'email_address' => array('notempty', 'email' => array('rule' => '/^[A-Za-z0-9._%+-]+@([A-Za-z0-9-]+\.)+([A-Za-z0-9]{2,4}|museum)$/','message' => 'Please supply a valid email address.'))
);

Baking Controllers

You can go through all the prompts, but in my opinion this takes too much time for me. Here are some straight to the point commands to get you on your way:

cake bake controller Users

This bakes an empty controller using scaffolding. If you don’t know, Scaffolding is sort of like baking, except with no functions and no views. This is usually used to test of database schema, model association, model validation, etc.

cake bake controller Users scaffold

This does the same thing as the command above, except it actually creates the functions: index, add, view, edit, and delete.

cake bake controller Users scaffold admin

Again, this does the same thing as the top, but with admin_index, admin_add, admin_view, admin_edit and admin_delete functions. Starting to get the picture?

Baking Views

This couldn’t be simpler:

cake bake view Users

Creates views for all the functions created in the Users controller.

To generate only the admin functions you have to provide “null” instead of “scaffold”:

cake bake controller Users null admin

All

With the “all” parameter it is now possible to bake with one command a model plus the corresponding controller with its views: