kohana

How to delete all user roles in Kohana 3

I'm using ORM Auth module and it's difficult to figure out how to do it. I've tried this case: $user = ORM::factory('user', $id); $user->roles->delete_all(); And got error ErrorException [ Fatal Error ]: Call to undefined method Database_Query_Builder_Delete::join() However $user->roles->find_all(); gives me exactly what i want. ...

Change Content-type header in Kohana3

Hello. I'm trying to create a rss feed in my Kohana app. I did this in my controller: public function action_rss() { $games = ORM::factory('game') ->order_by('name','ASC') ->find_all() ->as_array(); $view = View::factory('home/rss') ->bind('games', $games); $this->request->$headers['Content...

Kohana 2 ORM - created_at & updated_at

I know it's possible in KO3 via protected $_updated_column = array(' column' => 'updated_at', 'format' => 'Y-m-d H:i:s '); any way to do created_at and updated_at in the model on save (Kohana 2.3.4 ORM)? ...

kohana 3 + swift mailer

i'm using swift mailer from github for kohana framework 3, on localhost i have no troubles, but when i use it on hoster server it throws an error: Fatal error: Class 'Swift_DependencyContainer' not found in */application/vendor/swift/dependency_maps/cache_deps.php on line 3 how can i bypass it? ...

Session::instance() and push array data to session array

for example i have Session::instance()->get('orders') which is an array of some arrays: $first = array('id' = 1, 'name' => 'first', 'price' => 100); $second = array('id' => 2, 'name' => 'second', 'price' => 200); $_SESSION['orders'] = array($first, $second); but if i use this Session::instance()->set('orders', array(array('id' => 3, '...

jQuery AJAX call, how to handle

Hello, I'm wondering what is the best method to handle AJAX calls with jQuery? Right now I'm doing something like following: $("#test").live('click', function(){ // Process form $.ajax({ type: "post", url: "test.php", success: function(html){ if(html.success == 0) { alert('Err...

AJAX call and JSON data

Good day! I'm learning to create AJAX calls to PHP scripts. Basically, I want to find the best solution to handle AJAX calls. In this question you can find my client-side part of the code. Basically, I'd like to verify my knowledge here and if I'm wrong, get any tips how to make it correct way. So... I'm using KohanaPHP framework (b...

Facebook error "Missing redirect_uri parameter."

Kohana_Exception [ 0 ]: Error fetching remote https://graph.facebook.com/oauth/access_token?client_id=&client_secret=&code=&redirect_uri=http%3A%2F%2F%2Flogin%3Fmethod%3Dfboauth%26redirect_uri%3Dhttp%253A%252F%252F%252F [ status 400 ] {"error":{"type":"OAuthException","message":"Missing redirect_uri parameter."}} Even though...

how to show complete sql string in kohana orm object?

this is probably trivial, but i have a quite long sql query and echo Kohana::debug( $obj ); cuts off the tail of the query, replacing it with '...'. how would i go about getting the full thing? (something nicer than var_dump if possible ;-)) ...

Kohana "has many through" relation

Hi, I was wondering what the best method is to edit a 'has many through' relation with a form. Let's say I have a bunch of users that can belong to multiple categories. The form would have some checkboxes like this: <input type="checkbox" name="category_ids" value="1" /> <input type="checkbox" name="category_ids" value="2" /> Th...

Kohana ORM relationships question

I have tables: users {id, name} projects {id, name} roles {id, name} projects_users {id, user_id, project_id, role_id} I have models: project { has many users through projects_users } user { has many projects through projects_users } Question: How i get user roles for one project? Or maybe i have to reconstruct my tables? Code: ...

MVC/HMVC and Object Oriented programming

I've been reading and learning about Object-Oriented programming (Head First Object-Oriented Analysis and Design and Code Complete: A Practical Handbook of Software Construction – thanks to suggestions found on StackOverflow). I've also been learning how to use a couple PHP MVC frameworks (specifically Codeigniter and Kohana). Some of ...

i18n and Error messages in Kohana 3

Hello. I am developping an administration application with Kohana 3 and I'm obviously working with a lot of forms. The application needs to be multilangual and I'm very confused about how to manage my messages files and especially how to access them. Does i18n support different folders and files inside le language folder? E.g: i18n...

Kohana 3 - Can I change a configuration file's settings at runtime?

NOTE: This question has been asked on the kohana forums at: http://forum.kohanaframework.org/comments.php?DiscussionID=6451 Hey everyone! I am attempting to use HTML Purifier - I have it installed and working correctly. I have two helper functions, clean_all and clean_whitelist. /config/purifier.php <?php defined('SYSPATH') or die('N...

Why does HTML Purifier ignore my runtime created configuration settings?

Hello again, everyone! Naturally I am still fighting with HTML Purifier… So, my /config/purifier.php looks like: <?php defined('SYSPATH') or die('No direct access allowed.'); return array( 'settings' => array( 'HTML.Allowed' =>'a,b,strong,p,ul,ol,li,img[src],i,u,span,', 'HTML.MaxImgLength' => 250, 'CSS.MaxImgLength' =>...

Is there something in Kohana similar to CakePHP's requestAction?

I have taken over a Kohana project that needs some modifications. It doesn't really seem to follow the conventional MVC patterns (at least what I've learned from CakePHP). I need to do some dirty hacks to get data from a controller within a view which I would use $this->requestAction(...) in CakePHP. My question is, is there anything si...

Has anyone successfully transfered a CodeIgniter app to Kohana 3.x?

Since they are fundamentally different (PHP4 vs PHP5 based), this could be quite a headache I imagine. I would love to transfer my CI app to Kohana 3, but they only have migration tuts for transferring to Kohana 1.x and 2.x. ...

how to code breadcrumbs (php kohana framework)?

hello! is this good way to code breadcrumbs? create table "categories" using mysql create after neccessary columns "parent_id" column if parent_id column have null value it means that this category is parent and if else this columns parent is a column with id which marked in "parent_id" column recursively query to "parent_id" column st...

Execution time in kohana 3

Hello, How to get execution time and etc. in simplest way in Kohana 3. ...

How can I use phpFlickr in Kohana

Hi everyone ! I'm beginning a website using Kohana Framework, and I couldn't find how to include external libraries "the proper way". I want to use the phpFlickr library to allow my website to interact with flickr, and I was wondering if there was a better way to include the files than : require_once("path/to/phpFlickr.php"); // Fire u...