Skip to content

Commit

Permalink
some people points his domains to our IPS, so... check the domain and…
Browse files Browse the repository at this point in the history
… goto hell if not *.foofind.*
  • Loading branch information
daniel.remeseiro committed Jun 24, 2010
1 parent 3c49466 commit 7910c5e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
6 changes: 3 additions & 3 deletions application/controllers/DownloadController.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php


class DownloadController extends Zend_Controller_Action
{

public function init()
{

//validate domain foofind
$this->_helper->checkdomain->check();

require_once APPLICATION_PATH . '/models/ContentType.php';
require_once APPLICATION_PATH . '/models/Files.php';
require_once APPLICATION_PATH . '/models/Users.php';
Expand Down
14 changes: 3 additions & 11 deletions application/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ class IndexController extends Zend_Controller_Action
public function init()
{

//validate domain foofind
$this->_helper->checkdomain->check();

require_once APPLICATION_PATH . '/models/Files.php';

$this->_flashMessenger = $this->_helper->getHelper ( 'FlashMessenger' );
Expand Down Expand Up @@ -42,17 +45,6 @@ public function setlangAction()
public function indexAction()
{

//some people point his domains to our ips, so ... goto hell
$domain = $_SERVER['HTTP_HOST'];
$domain = explode(".", $domain);

if ($domain[0] != 'foofind'){
header('Location: http://example.com' ,301);
exit;
}



$this->view->totalFilesIndexed = Zend_Locale_Format::toNumber($this->fetchQuery(new ff_file(), "SELECT COUNT(IdFile) as res FROM ff_file"),
array( 'locale' => $this->view->lang));

Expand Down
2 changes: 2 additions & 0 deletions application/controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ public function count()
class SearchController extends Zend_Controller_Action {

public function init() {
//validate domain foofind
$this->_helper->checkdomain->check();
$this->_flashMessenger = $this->_helper->getHelper ( 'FlashMessenger' );
$this->view->mensajes = $this->_flashMessenger->getMessages ();
}
Expand Down
17 changes: 17 additions & 0 deletions application/controllers/helpers/Checkdomain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
class Zend_Controller_Action_Helper_Checkdomain extends Zend_Controller_Action_Helper_Abstract {

function check(){
//some people point his domains to our ips, so if not *.foofind.* ... goto hell
$domain = $_SERVER['HTTP_HOST'];
$domain = explode(".", $domain);

if ($domain[0] != 'foofind'){
header('Location: http://example.com' ,301);
exit;
}
}



}

0 comments on commit 7910c5e

Please sign in to comment.