mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3106 201d5d3c-b55e-5fd7-737f-ddc643e51545
60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* @class refererController
|
|
* @author haneul (haneul0318@gmail.com)
|
|
* @brief referer 모듈의 controller class
|
|
**/
|
|
|
|
class refererController extends referer {
|
|
/**
|
|
* @brief initialization
|
|
**/
|
|
function init() {
|
|
}
|
|
|
|
function procRefererExecute() {
|
|
if(empty($_SERVER["HTTP_REFERER"])) return;
|
|
|
|
// Log only from different hosts
|
|
$referer = parse_url($_SERVER["HTTP_REFERER"]);
|
|
if($referer['host'] == $_SERVER['HTTP_HOST']) return;
|
|
|
|
$oDB = &DB::getInstance();
|
|
$oDB -> begin();
|
|
$this->insertRefererLog($referer['host'], $_SERVER["HTTP_REFERER"]);
|
|
$this->deleteOlddatedRefererLogs();
|
|
$this->updateRefererStatistics($referer['host']);
|
|
$oDB -> commit();
|
|
}
|
|
|
|
function updateRefererStatistics($host)
|
|
{
|
|
$oRefererModel = &getModel('referer');
|
|
$args->host = $host;
|
|
if($oRefererModel->isInsertedHost($host))
|
|
{
|
|
$output = executeQuery('referer.updateRefererStatistics', $args);
|
|
}
|
|
else
|
|
{
|
|
$output = executeQuery('referer.insertRefererStatistics', $args);
|
|
}
|
|
|
|
return $output;
|
|
}
|
|
|
|
function insertRefererLog($host, $url)
|
|
{
|
|
$args->regdate = date("YmdHis");
|
|
$args->host = $host;
|
|
$args->url = $url;
|
|
return executeQuery('referer.insertRefererLog', $args);
|
|
}
|
|
|
|
function deleteOlddatedRefererLogs()
|
|
{
|
|
$args->regdate = date("YmdHis", strtotime("-1 week"));
|
|
return executeQuery('referer.deleteOlddatedLogs', $args);
|
|
}
|
|
}
|
|
?>
|