cakephp

User Access Control and Data Visibility

I have a Access Control based on Roles and Permissions, meaning That each group has permissions to access Some Controllers and users are part of those groups. (this is implemented in CakePHP framework) But this structure allows me to know what user is authorized to "use" like, access reports or add new users, but I was wondering what ar...

The best way to implement REST in CakePHP 1.3?

Does anyone know of any tutorials that explain clearly how to implement simple REST functionality with authorization. I've seen a few plugins and got also got some basic REST functionality working but there seems no clear guidelines about how to build a secure REST service in Cake. Any help appreciated. ...

Cakephp - How to construct custom URLs from a drop down select input?

Hi I am trying to use a drop down input in my cakephp application, with this I want the drop down on submit to render the url like so: www.example.com/cake/FILE/VALUE However the only url i can get the select input to create is the following: www.example.com/cake/FILE?form_value=VALUE How do I go about making the URL SEO friend...

How can I limit the maximum number of HABTM and hasMany records SAVED per parent Model in CakePHP?

I'm rebuilding one of my sites using the CakePHP Framework (awesome!), and I need to limit the number of hasMany and HABTM records that a Model can have. Let's say for "Profile hasMany Image," I want to limit a profile to only 10 images. I know I can easily accomplish this using the Find method with 'count,' but I'm wondering if there'...

CakePHP Multiple Conditions Not Working as Expected

I have a find() query with multiple conditions, but the returning array contains entries should be excluded by the conditions. I read in the CakePHP docs that the default operator is "AND", which should mean that the results have to meet every condition, right? Here is my code, in case something is wrong with that... $this->set('object...

MVC multi-model data import (fat model?)

I'm developing an app that will need to import data for three models from a single CSV file (with one-to-many associations). I have set up a Datafile model & controller to handle upload / parsing of the file. Right now, all the logic for parsing and saving the records is in the controller. This allows me to save to several different mode...

cakephp multiple select validation

Hi, I am using CakePHP and i have something like: PRODUCT -------> PRODUCT_CATEGORY <---------- CATEGORY so one product can have 'n' categories and viceversa. The problem is that i would like to validate the products so that the have at least one category. Since I am using the Form assistant and the validate functions of CakePHP y have...

Cake php newline character

Hi , i am using the cakephp paranoid function but i want it to not strip new line character. I tried passing \n in allowed chars but it failed ...

CAkePHP calling one controller action from a different controller

In my app, I want to add a user notification each time a user receives a comment on an image or other page. Therefore in my add action in my images controller, I'd like to also call the addNotifications action which is in my Notifications controller. I'm trying to stay away from requestAction based on the warnings, but is there another...

cakephp password validation

var $validate = array( 'password' => array( 'passwordlength' => array('rule' => array('between', 8, 50),'message' => 'Enter 8-50 chars'), 'passwordequal' => array('checkpasswords','message' => 'Passwords dont match') ) ); function checkpasswords() { return strcmp($this->data['Airline']['password'],$this->data['Airlin...

Why Isn't This Model Data Loading Into Pages Controller Properly?

I have a Model with data that I want to use to populate a "Recent XYZ" section on the homepage, which is controlled by the Pages controller. In the Pages controller, I have the following code: $this->loadModel('Model'); $this->set('datas', array($this->Model->find('all', array('limit' => 5)))); Then, in Home.ctp, I have tried to acce...

cakePHP security

I am thinking of using cakePHP to build a web app. My question is how much of security stuff will I have to code myself to prevent (SQL injection etc)? What security stuff cakePHP takes care of by itself and what will I have to code? ...

CakePHP database query - am I overcomplicating things?

So, I need to search a real estate database for all homes belonging to realtors who are part of the same real estate agency as the current realtor. I'm currently doing this something like this: $agency_data = $this->Realtor->find('all',array( 'conditions'=> array(business_name'=>$realtor_settings['Realtor']['business_name']...

Not logged in after manual login in CakePHP if redirected, logged in if no redirect

Hi, I'm using Janrain engage to login to my CakePHP site, and when handling the user data, I want to automatically login using the $this->Auth->login()-function. I manage to login fine if I don't redirect after the call, but if I redirect, I'm not logged in. Does anyone now why or what I can do to straigten this? function janrain()...

Update large CakePHP model, but *don't* touch certain fields?

Using CakePHP 1.3 I have a fairly large model in CakePHP, and I'd like to have some hidden elements on the form page to (manually) compare/validate against before saving, but when doing a saveAll() (with validation), I don't want these fields present (essentially to avoid them being updated). What's the proper way to handle this? Remo...

PHP using exit()

I am using Cakephp but this is a MVC/php doubt letting the view display the message vs echo 'Invalid Data'; exit; I would like to know is there any pitfalls in the second case like memory leak etc.. Which one is better EDIT In case of a ajax call is exit good. and what about memory leak and other issues . Are all variables deall...

cakephp chain select in form with special conditions

hi My form application calls for 2 chained select boxes with special conditions, and I'm using cakephp 1.3 to build this application. The hierarchy and order of choices for the sections is this: 1 - hotel 2 - roomtype the hotel has limits of how many visitors can be in each room The relationships are: customer hasOne hotel->roomty...

cakephp swiftmailer config

hi i am using swiftmailer component in my app and am looking for a way to have a separate config (perhaps in config folder?) for swiftmailer that checks what debug mode i am using and thus uses different settings? case 1: on production mode use simple smtp server without auth. case 2: on debug mode use gmail settings or other settings s...

Cakephp - Baking custom models

Hi, I need to bake a large project but a requirement is each model has its schema listed at the top as a multi-line comment. Any ideas ? Thanks, Alex ...

confirm page with form result in cakephp

hi i am making a form with a confirm page where I would like to display what was input from the form and give the user a chance to check it before sending it in. I have successfully done this by saving the form elements in the session: $this->Session->write('Visitor.confirm', $this->data); and get it by: <? $fields = $this->Sess...