How to check isAuthenticated
or isLogged
in symfony 1.4 from external PHP file?
External PHP file located in /web/js/filemanager.php
The only way to pass isAuthenticated to another external php file is to pass an object of sfUser class
@app/frontend/module/indexAction.class.php
<?php
class modulenameAction extends sfAction
{
public function execute($request)
{
$user = $this->getUser();
$sample = new Sample();
$sample
->setUser($user)
->setOtherFunction($blabla)
->setOtherFunction($blabla);
if ($sample->result()) {
return $this->renderText('Authenticated');
} else return $this->renderText('Not authenticated');
}
}
Then about your Sample class
<?php
class Sample
{
private $user;
public function setUser($user)
{
$this->user = $user;
return $this;
}
public function result()
{
if ($this->user->isAuthenticated())
{
return true;
}
return false;
}
}