kohana

KO 2.3.4 - Accessing validation array from callbacks in models

Hi, Apologies if this is an oversight or sheer stupidity on my part but I can't quite figure out how to access the validation array from a callback in a model (using ORM and KO 2.3.4). I want to be able to add specific error messages to the validation array if a callback returns false. e.g This register method: public function registe...

Kohana 3 get current controller/action/arguments

In Kohana 2 you could easily get that information like this: echo router::$controller; echo router::$method; echo router::$arguments[0-x]; Any idea how that works in Kohana 3? Thanks in advance! ...

kohana v3: using different templates for different subdomains

hi, I have a kohana v3 app. 2 subdomains pointing to this app. what I have to setup that kohana uses a different template if the app called with subdomain2.example.com? at the moment all calls (from subdomain1 and subdomain2) use the standard template: 'templates/default' thank you! daniel ...

Kohana 3 - get orm validation errors

if ($user->values($_POST)->check()) { $user->save(); } else { // How can i get the errors? } Any idea how that works? Thanks in advance! ...

Best way to get session id in Kohana 3?

What is the best way to get the current visitors session id in Kohana v3? session_id() doesn't seem to work and only returns null for me.. At the moment Im using cookie::get('session'), but that doesn't work on the first time you access the site, which I need to do. I know you could do $this->session->id() in Kohana v2, but that doesn'...

[MySQL/PHP] Avoid using RAND()

So... I have never had a need to do a random SELECT on a MySQL DB until this project I'm working on. After researching it seems the general populous says that using RAND() is a bad idea. I found an article that explains how to do another type of random select. Basically, if I want to select 5 random elements, I should do the following (I...

Kohana 3 - Blog like route "/post/YYYY/MM/DD/search-engine-optimized-url"

Hi Guys, I'm trying to create the above mentioned route... year, month, day and title should be passed to the method. Any idea how that works? Thanks in advance! ...

Kohana 3, problem with m2m data adding

Hello I posted this on official forum but with no result. I am getting :Undefined index: enrollment error when trying to save data. My pivot model: class Model_Enrollment extends ORM { protected $_belongs_to = array('page' => array(), 'menugroup' => array()); } Model_Page protected $_has_many = array('te...

Kohana3 ORM save problem

Hi, Can anyone help me with Kohana ORM. I can take out name and value. I can give them new values and I try to save them back to base, but in phpmyadmin i can see still old values for these option attributes. What is wrong with this code (it works and echos right value but i can't see it in db): $option = ORM::factory('draft') ->where(...

Ko3 - URL Rewriting problem - Removing index.php

Hi there. I'm developing a website using Kohana 3 (1rst time I use a framework). Locally, everything works perfectly. At the moment, I have a default template controller, a multi-language support and my 'index.php' is correctly removed. So before going further, I tested if it worked on my server and I got an endless loop. I followed the...

From where to send mails in a MVC framework, so that there is no duplication of code?

It's a MVC question. Here is the situation: I am writing an application where I have "groups". You can invite other persons to your groups by typing their email and clicking "invite". There are two ways this functionality can be called: a) web interface and b) API After the mail sending is over I want to report to the user which mails ...

Kohana ORM Aliasing and "Trying to get property of non-object"

I have the following tables in the database: teams: id name matches: id team1_id team2_id I've defined the following ORM models in my Kohana v2.3.4 application: class Match_Model extends ORM { protected $belongs_to = array('team1_id' => 'team', 'team2_id' => 'team'); } class Team_Model extends ORM { protected $has_many = ar...

Avoiding session hijacking with Kohana

Do I have to do anything special to avoid session hijacking using Kohana framework? (Assuming the session is manipulated only with the Kohana Session library) Thanks in advance ...

Kohana3 - ErrorException [ Notice ]: Undefined index: id - Error calling Auth::instance()

Hello everybody, I've now a Problem with the newest Version of KohanaPHP (kohanaphp.com). After I've registered me and logged in into my test page, some minutes later, there is now the error: ErrorException [ Notice ]: Undefined index: id MODPATH/orm/classes/kohana/orm.php [ 1316 ] 1311 * 1312 * @return mixed primary key 1313 ...

Kohana3 - Auth Module deleting User while he is logged in bug

Hello Stackoverflow Users, Today I've tested the Kohana3, which has been changed a lot. I'm working so much with the Auth Module, and need this in my new Project also. Now I found a Bug, I think it is a bug, what can I do? Problem: After I'm deleting a user from the Database, who is at this Moment logged_in() in my Website, and he i...

Kohana 3 jQuery/AJAX request not working

I am trying to post some data to a controller in Kohana 3 using the jQuery AJAX method. I seem to have an issue with the data not getting to where I want it to be. I want the data to go to the /application/classes/controller/stock.php file where the file will process the data. I can't seem to figure this one out. Hopefully someone ca...

How to handle this "session failed to write file" error in PHP?

I am using the Kohana 3 framework, and am using the native session driver. For some reason, occasionally the sessions fail to write to their file. Warning: session_start() [function.session-start]: open(/tmp/sess_*****, O_RDWR) failed: Permission denied (13) in /home/site/public_html/system/classes/kohana/session/native.php on line 27...

Incorporate Wordpress into Kohana 3

I now need to make a Kohana 3 site have a Wordpress blog. I've seen Kerkness' Kohana For Wordpress, but it seems to be the opposite of what I want. Here are the options I have thought of Style a template to look exactly like the Kohana site (time consuming, non DRY and may not work) Include the blog within an iframe (ugly as all hell...

Where do I place a set_locale in Kohana PHP framework?

In the following tutorial: http://pinoytech.org/blog/post/Kohana-2.4-I18N-internationalization-and-localization-Library the author says: I'd put it in a Base Controller so that all Controllers inherit it. this is the code: I18n::set_locale('tl_PH'); I tried placing it in all the controller and places I could but is not working...

Kohana 3 - How do I make the Default Route pass arguments to the Controller's Action?

My controller action requires a parameter, but I can't get KO3's router to pass this parameter in the Default route. This sort of thing works with other routes. Here is an example to clarify... In bootstrap.php... Route::set('default', '(<controller>(/<action>(/<the_required_param>)))') ->defaults(array( 'controller' => 'DefaultCont...