Redir developed and tested

This commit is contained in:
Deon George 2011-07-21 09:53:38 +10:00
parent 1dd63fc044
commit 3c2f30a5f9
2 changed files with 29 additions and 2 deletions

View File

@ -10,11 +10,23 @@
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html * @license http://dev.leenooks.net/license.html
*/ */
class Controller_Redir extends Controller_TemplateDefault { class Controller_Redir extends Controller {
protected $auth_required = FALSE; protected $auth_required = FALSE;
public function action_index() { public function action_index() {
echo debug::vars($_SERVER['SERVER_NAME']); $ro = ORM::factory('redir',array('servername'=>$_SERVER['SERVER_NAME']));
if (! $ro->loaded())
$ro = ORM::factory('redir',0);
$ro->count++;
$ro->date_last_refer = time();
$ro->save();
if (! is_null($ro->redirect) AND trim($ro->redirect))
$this->request->redirect($ro->redirect);
else
$this->response->body(file_get_contents(Kohana::config('config.defaultfile')));
} }
} }
?> ?>

View File

@ -0,0 +1,15 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Main redirector model
*
* @package Redir
* @subpackage Events
* @category Models
* @author Deon George
* @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Model_Redir extends ORM {
}
?>