Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Cvetan <[email protected]>
  • Loading branch information
SomethingSexy committed Jan 27, 2015
1 parent 5bd82dc commit 5761f2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion app/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ public function checkAdmin() {
$this->handleNotLoggedIn();
}
}


function my_array_unique($array, $keep_key_assoc = false) {
$duplicate_keys = array();
Expand Down Expand Up @@ -181,5 +180,14 @@ public function convertErrorsJSON($errors = null, $model = null) {

return $retVal;
}

protected function getClientIP() {
// this is for production
if (isset($_SERVER['HTTP_X_REAL_IP'])) {
return $_SERVER['HTTP_X_REAL_IP'];
} else {
return $this->request->clientIp();
}
}
}
?>
2 changes: 1 addition & 1 deletion app/Controller/CollectiblesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ function view($id = null) {
$this->set('userUploads', $extractUserUploads);
$this->layout = 'require';

$this->getEventManager()->dispatch(new CakeEvent('Controller.Track.view', $this, array('type' => 'collectible', 'id' => $id, 'ip' => $this->request->clientIp(), 'user_id' => $this->getUserId())));
$this->getEventManager()->dispatch(new CakeEvent('Controller.Track.view', $this, array('type' => 'collectible', 'id' => $id, 'ip' => $this->getClientIP(), 'user_id' => $this->getUserId())));
} else {
$this->render('viewMissing');
}
Expand Down

0 comments on commit 5761f2c

Please sign in to comment.