kohana-3

Kohana 3: What are Validate::label and Validate::labels for?

What are the Validate::label and Validate::labels functions for in Kohana 3? What are they meant to be used for? ...

Kohana 3: Example of model with validation

I find examples and tutorials about models and about validation. And I places that say the validation (or most of it at least) should be in the model, which I agree with. But I can't any examples or tutorials that show how that should be done. Could anyone help me with a simple example on how that could be done? Where would you have th...

How can I test a CRON job with PHP?

This is the first time I've ever used a CRON. I'm using it to parse external data that is automatically FTP'd to a subdirectory on our site. I have created a controller and model which handles the data. I can access the URL fine in my browser and it works (however I will be restricting this soon). My problem is, how can I test if it's...

Help with Kohana 3 and a CRON

I've set up a CRON to call a URL in Kohana 3. php /home/user/public_html/index.php my/route/in/bootstrap.php It seems to access the URL fine. However, I have received this error (send back in an email that my host sends per CRON) Undefined index: HTTP_HOST SYSPATH/classes/kohana/url.php [ 40 ] Source of url.php Which is in a Ko...

Kohana 3 and CRON always accessing index.php (not following the URI argument)

OK, I hope this is my last question about CRON jobs and Kohana 3. Note: others are not duplicates, just other problems. Here is my CRON job (setup in cPanel) php /home/user/public_html/index.php --uri=properties/update As per this answer. I have set it up so it emails me the output. It is running every 5 mins. Unfortunately, it alw...

PHP shorthand syntax

I've just came across this on GitHub. ($config === NULL) and $config = Kohana::config('email'); Is that the equivalent of if ($config === NULL) { $config = Kohana::config('email'); } Is this commonplace? Would I expect other developers looking at my code if I used that first way to instantly know what it was doing? ...

Need help with Swift mailer with Kohana wrapper

My current code is this $swift = email::connect(); $swift->setSubject('hello') ->setFrom(array('[email protected]' => 'Alex')) ->setTo(array('[email protected]' => 'Alex')) ->setBody('hello') ->attach(Swift_Attachment::fromPath(DOCROOT . 'assets/attachments/instruct...

Kohana3: Different .htaccess rewritebase and kohana base_url for dev and production environment

In my bootstrap.php I have the following: if($_SERVER['SERVER_NAME'] == 'localhost') Kohana::$environment = 'development'; else Kohana::$environment = 'production'; ... switch(Kohana::$environment) { case 'development': $settings = array('base_url' => '/kohana/', 'index_file' => FALSE); break; default:...

Kohana Auth Module without ORM

Hi, I am using Kohana 3.0.3. I have been searching Auth module without ORM support,for couple of days. But didn't get any useful information. Could you please suggest and/or tutorial something here? ...

Kohana v3 ACL A2 with database support

Hi, I am using Kohana V 3.0.3. I was looking for ACL library and found from http://dev.kohanaphp.com/projects A2 Kohana's ACL module. Apparently it's found that, it manages Roles,Resources and Rules using config file and authenticate object basis. I want it to be dynamic, like Resources and Rules should be loaded from database dyn...

RESTful WebServices with Kohana PHP 3

Hi, Is it possible to make restful services with kohana 3 , i reviewed the source and found an abstract class Kohana_Controller_REST, how to use it ? If someone can post a snippet with routing as Example code, it will be very appreciated. Also, the lack of documentation on KO3 is making me crazy, if someone knows a well documented, fa...

Kohana V3 return query result as object

Hi, In Kohana V3 is it possible to return result set as an array() or any method exists? For example: $user = DB::select('*')->from("users")->where('username', '=', $username); If method is there,then it is possible to get password like echo $user->password; Is it possible without ORM? Please suggest. ...

Kohana V3 Auth module user_token functionality

Hi, Could anybody brief about user_token functionality in Auth module? What is a use and how this incorporates in Auth module? ...

What is the correct way to bootstrap Drupal with Kohana 3?

Hi, I am trying to implement single sign on between an existing Drupal site a Kohana 3 based webapp. Ideally I would like to load Drupal's session information into $GLOBALS using the bootstap: require_once('../includes/bootstrap.inc'); drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION); A post on the Kohana forum suggested that this should b...

How to perform an external request in Kohana 3?

I've always used cURL for this sort of stuff, but this article got me thinking I could request another page easily using the Request object in Kohana 3. $url = 'http://www.example.com'; $update = Request::factory($url); $update->method = 'POST'; $update->post = array( 'key' => 'value' ); $update->ex...

How to override module classes in Kohana 3?

In Kohana 3, how can I override/extend a module class? E.g. I want to add functionality to the Auth module that is specific to my application. In this case I want to extend the abstract Auth class located in the classes folder of the Auth module. What naming convention should I use for my Auth class and where in the file system do I p...

What sort of exceptions should I be throwing from inside Kohana 3?

I've seen the code examples on this article, but throwing Controller_Exception_404 produces an error. I've just been throwing plain exceptions. I remember in Kohana 2.3 there were different ones you could throw, depending on the situation. Does anyone have a list of what exceptions should be thrown when? ...

Problem with DOMPDF and Kohana 3

I have used DOMPDF many times before successfully, however outside of the Kohana Framework. I created a module for DOMPDF and called it simply pdf. Here is it's code. class Pdf { private $domPdfInstance; public function __construct($html) { if ( ! class_exists('DOMPDF', FALSE)) { // Load DOMPDF ...

How can I skip headers in Kohana 3 and just get raw output from a route?

I have a method that returns a PDF file using DOMPDF. It sends all the right headers. It is generated on the fly (not stored on the server anywhere). I now have to attach this PDF to outgoing emails. I did this in Kohana 3 $routeUrl = Route::get('secure_view_pdf')->uri(array('id' => $id)); $response = Request::factory(...

Kohana v3, automatically escape illegal characters?

Quick question, does Kohana (version 3) automatically escape data that is passed into ORM::factory..... (and everywhere else that has to do with the database)? For example: $thread = ORM::factory('thread', $this->request->param('id')); Would the data passed in the second argument be auto-escaped before it goes in the SQL query or do ...