Added default icon and referrer tracking

This commit is contained in:
Deon George 2013-04-14 18:31:53 +10:00
parent 00a9d3a057
commit 7d670ef236
4 changed files with 37 additions and 1 deletions

View File

@ -29,6 +29,18 @@ class HTTP_Exception_404 extends Kohana_HTTP_Exception_404 {
$ro->date_last_refer = time();
$ro->save();
// Update our referrer info
$rfo = $ro->referrer->where('referrer','=',$this->request()->referrer())->find();
if (! $rfo->loaded()) {
$rfo->redir_id = $ro->id;
$rfo->referrer = $this->request()->referrer();
}
$rfo->count++;
$rfo->date_last_refer = $ro->date_last_refer;
$rfo->save();
// Prepare the response object.
$response = Response::factory();

View File

@ -4,13 +4,17 @@
* Main redirector model
*
* @package Redir
* @subpackage Events
* @category Models
* @author Deon George
* @copyright (c) 2010-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Model_Redir extends ORM {
protected $_model_names_plural = FALSE;
protected $_table_names_plural = FALSE;
protected $_has_many = array(
'referrer'=>array('far_key'=>'id'),
);
}
?>

View File

@ -0,0 +1,20 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Main redirector model
*
* @package Redir
* @category Models
* @author Deon George
* @copyright (c) 2010-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Model_Referrer extends ORM {
protected $_model_names_plural = FALSE;
protected $_table_names_plural = FALSE;
protected $_belongs_to = array(
'redir'=>array(),
);
}
?>

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B