kohana

KO3/Kohana3: How do we escape quotes (double and single) before saving to db with ORM using values()?

Hello everyone! I allow users to submit a question, and they should be able to have single quotes in their title. Currently, if a title contains a single quote, it will submit properly. $question->values($post_data); $question->save(); Any ideas on how I can set Kohana to escape that single quote / escape my information automatically? ...

Extends class [PHP]

In kohana 2.3.4 system load first application, after modules and system. I want to extends User_Model in application with User_Model in modules. How to do that? ...

Read returned XML by function with SimpleXML

This is sort of confusing to explain, so thank you ahead of time for bearing with me. I am using Kohana PHP framework to develop an application. I have a model function that accepts parameters for a search, and should return an XML styled page. I need this to be read by the controller with SimpleXML. Any ideas how to do this? $o = ...

kohana framework, using Security:xss_clean in validation filters

Hello! I have this part of code: ->filter('username', 'Security::xss_clean') ->filter('url', 'Security::xss_clean') ->filter('text', 'Security::xss_clean') but it not works and after validation parametres will be inserted via ORM into table columns with html tags. so, what i do wrong? or this metho...

KohanaPHP Controller. Should I group them?

Hi, I'm new to OOPHP and frameworks at all. I'm just wondering... I have few controllers: dashboard signup login and few more I've put them into users directory. Everything is working correctly, I'm just wondering if I should put everything in one controller and signup, etc. should be a method of users controller? Or am I doing it co...

php function foo(array $arg = NULL) -- why the array and NULL?

I've seen the following a few times lately: function foo(array $arg = NULL) { ... } My question being why make the default of $arg NULL when it will be just cast into an array? Why not do: function foo(array $arg = array()) { ... } I know it doesn't really make much difference--it's mostly just reading code--but why encourage PHP...

Create array of hierarchical directories in PHP

I have the following code (I know that this code is not optimized but it's not for discussion): function select_categories($cat_id) { $this->db = ORM::factory('category') ->where('parent', '=', $cat_id) ->find_all(); foreach ($this->db as $num => $category) { if($category->parent == 0) ...

"Visiting" a URL in PHP

The way my site is setup, I need to manually visit two URLs to trigger the mail system. One URL compiles a list of emails, another sends them off. I'd like to automate this using a cronjob, but here's the problem. I am using the Kohana framework and I don't think copy pasting the code within the controllers will work. The easiest way t...

Payment module in Kohana 3?

I've been using Kohana 2.3.7. There are somethings that are holding us back to using Kohana 3 and one is the lack of modules compared to 2.3.7. For instance, I can't seem to find the Payment module (Paypal, 2C0, Authorize.net, etc) present in 2.3 to 3. If there is already, can you please direct me to it? Thanks for the help. ...

Kohana 2.3/3 routing?

Hi, I've been thinking how to make something like this in Kohana: domain.com/variable the "variable" is the identifier for a user. So, is this possible? http://domain.com/username/controller/action If yes, can you point me to the right direction, please? Thanks. ...

Kohana and OpenX

I am trying to install OpenX in a website that I use Kohana. It worked fine, until I found this error: Fatal error: Uncaught Kohana_Request_Exception [ 0 ]: Unable to find a route to match the URI: 500.shtml ~ SYSPATH/classes/kohana/request.php [ 635 ] thrown in /home/xxxxxx/public_html/plugb/system/classes/kohana/request.p...

What's the best way to pass additional POST variables into a validation rule in Kohana 3?

I'm trying to validate some POST data. One of the validations I need to do is a registration code, which is based off another POST variable - an IMEI number. In my POST data I have 2 fields, register_imei and register_code. My code currently looks like this: $post = Validate::factory($_POST); $post->rule('register_imei', 'not_empty') ...

Flash and Sessions

Howdy, First of all, I'm using KohanaPHP Framework. I've impletemented SWFUpload successfully, working quite nice. I'm having only one issue. The main problem is I need to allow users to upload attachments before submitting form. So I decided to use Session var to store attachments array. Unfortunately, it is working inly if I use HTM...

Php framework to slowly refactor an inherited site

Hi, I've recently inherited a medium-sized php site which is horribly coded. It violates every best-practices methodology, from MVC to DRY, is vulnerable to SQL-injection and everything in between. I've visited the other questions and already put everything on a VCS and am considering the framework alternatives. However I'd like your ...

Kohana model for data spread across multiple tables

I am putting together a DB driven website with kohana and I need to be able to track revisions. So I have the data behind the individual pages in two tables. The first is the generic entity table that I use for keeping track of all the sites content. It contains basic information: resource uid, uri alias, creating user, creation date,...

Modeling a many-to-many with multiple object types in Kohana w/ ORM

I'm working on building an app with Kohana 3.0.7, using the ORM module. I want to build an object, such as tag, where many different kinds of objects can be tagged, and these options can have multiple tags. So let's say for example I have 3 models: Tag, Post and Page. how would I structure the tables and the models to make this work bes...

How not to repeat myself in Kohana 3's routes?

Let's say I want to make a system which can afford a multilingual web project. The system will consist of the modules that are put in Kohana's standard directory modules. Let's say that the standard access to the particular language can be done via lang parameter (i.e. somesite.com/en/somepage). The problem is that I have to repeat mysel...

Kohana 3 - SphinxQL Configuration

Hey everyone, I have Sphinx up and running on my server and I have created an index of my data. I have installed SphinxQL into my modules folder and enabled it in my bootstrap. Is there something else that I need to have done or to do to? I have also moved a copy of the sphinxql.php config file into the kohana/application/config di...

Working on localhost but server returns "Failed to open stream: No such file or directory"

On my local machine the script works fine, but when I put it on the server I get: application/hooks/zend.php [9]: require_once(Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory Stack Trace application/hooks/zend.php [9]: require_once( ) system/core/Kohana.php ...

Rewrite logic breaking?

Hello, I have the following rewrite logic in my vHost and everything seems to be working in regards to redirecting subdomains, but as soon as I add a path to the URI I'm getting an error in my apache_error.log. Here is the rewrite logic: RewriteEngine On # Remove the www alias RewriteCond %{HTTP_HOST} ^www\.13labs\.net$ [...