kohana

How do I relate tables with different foreign key names in Kohana ORM?

◇◆丶佛笑我妖孽 提交于 2019-12-13 18:11:47
问题 I'm building a Kohaha application to manage sip lines in asterisk. I'm wanting to use ORM but I'm wondering how do relate certain tables that are already well established. e.g. the table sip_lines looks like this. +--------------------+------------------+------+-----+-------------------+-----------------------------+ | Field | Type | Null | Key | Default | Extra | +--------------------+------------------+------+-----+-------------------+-----------------------------+ | id | int(10) unsigned |

Kohana 3 Auth in IE

↘锁芯ラ 提交于 2019-12-13 08:45:18
问题 I'm finding I can't log in to my Kohana site through IE. (just IE, works fine everywhere else) It's validating, so much as, it knows if you get your username and password wrong, but its not creating the session. I've added to: application/config/session.php <?php return array( 'cookie' => array( 'name' => 'session_cookie', 'encrypted' => TRUE, 'lifetime' => 43200, ), 'native' => array( 'name' => 'session_native', 'encrypted' => TRUE, 'lifetime' => 43200, ), 'database' => array( 'name' =>

how to set cookie in kohana framework

北慕城南 提交于 2019-12-13 08:29:58
问题 I am trying to set and get a cookie in kohana framework, but I don't know how to call the class cookie in my controller. <?php class Landing_Page_Controller extends Controller { public function __construct() { parent::__construct(); } public function index() { setcookie("kohanaSalt", "testKohanadata" , time()+3600); } } ?> The above is a simple way to set a cookie from php, but I want to set this cookie into session and do so using kohana, if its possible. 回答1: Use this: Landing_Page

Difference between the Kohana's Request cookie(), Response cookie() and the Cookie class?

放肆的年华 提交于 2019-12-13 07:49:22
问题 I'm working on a program dealing with cookies under the kohana's HMVC structure, and I find that Kohana has 3 ways to get/set the cookie. They are Request::current()->cookie() , Response->cookie() , and the cookie class ( Cookie::set(), get() ) And PHP has a native setcookie() function and $_COOKIE to deal with cookies too. Could anyone explain their differences and, what are the situations that they should be used respectively. 回答1: Request::cookie() prior to calling Request::execute() on

Kohana 3.2 Route - controllers in subdirectories

霸气de小男生 提交于 2019-12-13 05:21:07
问题 I need to create next structure: +controller ++admin +++catalog ++++category.php ++++product.php +++users and I need to open them by url /admin/catalog/category/action/param I tried to create route: Route::set('admin', '(<directory>(/<controller>(/<action>(/<custom_param>))))',array( 'directory' => '(admin/.*)' )) ->defaults(array( 'controller' => 'dashboard', 'action' => 'index' )); 回答1: Not tested: Route::set('admin', 'admin/<directory>/(<controller>(/<action>(/<custom_param>)))', array(

how to hide part of HTML form depending on user role

℡╲_俬逩灬. 提交于 2019-12-13 05:06:09
问题 I am developing a website using Kohana 3.3 and i want to selectively display HTML UI elements depending on the role of the user. e:- If user is an admin then show the 'edit' hyperlink, and when the admin clicks the edit button change the textbox's from 'readonly' to 'normal'. If user is an registered normal user than enable the button to 'ask a question'. If user is a visitor then he have no priviliges. Right now i am using a single view file and changing the visbility after checking the

insert_id in Kohana 3

霸气de小男生 提交于 2019-12-12 23:04:58
问题 I'm using Kohana 3 framework with Mysql stored procedures. How can I get id of the last inserted record? Here's the code: class Model_MyModel extends Kohana_Model { public function insertNew($param1, $param2) { $result = $this->_db->query(Database::INSERT, 'CALL insertNew('.$param1.', '.$param2.', false)'; return $result; } ... ... } Documentation says, the query() method returns an array with the last insert id and affected rows number, when executing an insert query. When I call: print_r(

Create tables from SQL dump generated by phpmyadmin using kohana

a 夏天 提交于 2019-12-12 20:36:10
问题 I have a PHPMyAdmin SQL dump in a file. I want to use PHP to execute this SQL. How could I do that? I've tried a simple query (with Kohana but without it is enough too!) but I got a syntax error. How could I do that? 回答1: Well this has nothing to do with Kohana. I would recommend you not do this through PHP as you then have memory and time constraints. If you can, use the terminal. mysql -u [username] -p [password] [database name] < [filename.sql] Replacing [value] with their respective

Architecture: API as core for a website & mobile-app

送分小仙女□ 提交于 2019-12-12 08:48:52
问题 I have different questions about a full architecture idea. I hope someone with great experience could help me out because I am pretty much getting stuck in all possibilities. I'm planning to rewrite a community website. Our customer wants to make use of native mobile apps in the future. So I will need to take this into account. Because of this I have decided to create a 100% REST API architecture based on the PHP framework Kohana. I have choosen Kohana because this makes scaling the internal

Kohana 3.0 installation problems - New controller issues

南楼画角 提交于 2019-12-12 06:59:02
问题 I've been trying to install Kohana on my own WAMP server but have been running into a bit of a dead end. I've followed the instructions here up until the .htaccess file modification; I redirect as specified but then get an 'internal sever error' stating that it is a configuration error. I've tried a bunch of combinations and I still get the same error. The only working method I've found is not including the .htaccess file and simply correctly pointing the bootstrap.php to the right path. This