cakephp-1.3

Take user back to previous page after logging in?

一世执手 提交于 2019-12-20 01:41:21
问题 I have a controller called Accounts, with the views signin and signout. The corresponding functions look like this: function signin() { if (!empty($this->data)) { //handle login ... //save login to session $this->Session->write('Account', $data["Account"]); //redirect to previous page ??? } } function signout() { //delete login $this->Session->delete('Account'); //redirect to previous page ??? } If the user goes to accounts/signin it first checks to see if the form is submited if(!empty($this

CakePHP 1.3 - Unknown column in where clause

淺唱寂寞╮ 提交于 2019-12-19 16:52:14
问题 I'm working on an already existing cakephp 1.3 project and I needed to add a new table to the database. I have this in my controller: $conditions = array('ShootingPlacement.person_id' => $id, 'Email.person_id' => $id, 'Email.shooting_placement_id' => 'ShootingPlacement.id'); $shootingPlacements = $this->ShootingPlacement->find('all', compact('conditions')); And it's giving me this error: Warning (512): SQL Error: 1054: Unknown column 'Email.person_id' in 'where clause' [CORE/cake/libs/model

Binding multiple models Cakephp

陌路散爱 提交于 2019-12-19 11:28:07
问题 I am trying to bind 3 models in cakephp.The relation is as follows Member hasMany Member_Organaization Member_Organisations belongs to Organaization i try to use $this->Member->find('all',conditions) it just show me only data upto hasMany association. I understand that the Member model is not related directly to the organization one. but how can we do it? My code is as follows: $this->Member->bindModel( array( 'hasMany'=>array( 'NpoMember' =>array( 'className' => 'NpoMember', 'foreignKey' =>

cakePHP optional validation for file upload

久未见 提交于 2019-12-19 09:54:05
问题 How to make file uploading as optional with validation? The code below validates even if i didn't selected any file. I want to check the extension only if i selected the the file. If i am not selecting any file it should not return any validation error. class Catalog extends AppModel{ var $name = 'Catalog'; var $validate = array( 'name' => array( 'rule' => '/^[a-z0-9 ]{0,}$/i', 'allowEmpty' => false, 'message' => 'Invalid Catalog name' ), 'imageupload' => array( 'rule' => array('extension'

Strict standards: Redefining already defined constructor for class Object in path\cake\libs\object.php on line 54

a 夏天 提交于 2019-12-18 16:12:33
问题 I am trying to configure MS-MSQL database on cakephp (Not mysql). My Wampserver is 2.2e-php5.4.3-httpd2.2.22-mysql5.5.24-32b on my laptop (which is windows x64-bit. I already invited these two dlls to run sql server extension=php_sqlsrv_54_ts.dll extension=php_pdo_sqlsrv_54_ts.dll I've got these two errors in running cakephp 1.3 Strict standards: Redefining already defined constructor for class Object in C:\wamp\www\project\cake\libs\object.php on line 54<br/> Strict standards: Non-static

Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual

被刻印的时光 ゝ 提交于 2019-12-17 20:42:43
问题 Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@g.com, 'User'.'phone' = 87665r5, 'User'.'address' = 23lsdhf, 'User'.'location' ' at line 1 SQL Query: UPDATE 'cake'.'users' AS 'User' SET 'User'.'username' = paul, 'User'.'password' = eben, 'User'.'email' = paul@g.com, 'User'.'phone' = 87665r5, 'User'.'address' = 23lsdhf, 'User'.'location' =

Cakephp Override HtmlHelper::link

孤街醉人 提交于 2019-12-14 00:15:20
问题 I want to setup HtmlHelper::link() method so the default options array have escape = false. How can I achieve this without changing the core class? OBS: I already sanitized form input, so I guess this will have no problem. Thanks in advance. 回答1: Cake 2.1.5 I just implemented this and I wanted to point out a few things: Your custom html helper should extend HTML helper (and don't forget to include the HTML helper class) App::uses('HtmlHelper', 'View/Helper'); class CustomHtmlHelper extends

Fatal error: Class 'AppController' not found

十年热恋 提交于 2019-12-13 09:39:43
问题 We got the error in cakephp 1.3.6. version.No idea why and how, please give your advice or solution. error: Class 'AppController' not found....... in cakephp 1.3.6. Thanks Ajay 回答1: In your controller class , use at the top as 1st statement App::uses('AppController', 'Controller'); Because you are extending AppController , so you first need to import it.Like below. App::uses('AppController', 'Controller'); class CoursesController extends AppController {/*Your code*/ } 回答2: Just in case this

Insert data into two tables (foreign key joined) from one form in CakePHP

你说的曾经没有我的故事 提交于 2019-12-13 07:24:27
问题 I have a form in CakePHP as following addticket.ctp <html> <?php echo $this->Form->create('Ticket', array('url' => array('controller' => 'tickets', 'action' =>'addtickets'), 'enctype' => 'multipart/form-data')); echo $this->Form->input('title',array('label'=>'Title')); echo $this->Form->input('attachment', array('between'=>'<br />','type'=>'file', 'label'=>'Attachment')); echo $this->Form->input('stepstoreproduce',array('label'=>'Steps To Reproduce')); echo $this->Form->input('category',array

Cakephp: login does nothing

瘦欲@ 提交于 2019-12-13 06:01:32
问题 I'm starting with cakephp, and i'm trying to build a login system. The problem is that the server responds to my login requests reloading the login page, without any messages, and the login is not done, because it doesn't let me enter in protected pages. This is my users table: mysql> show columns from users; +----------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+------------------+------+-----+---------+------------