authparams : in CLI, return the user "cli"

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1833 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-09-19 07:29:23 +00:00
parent b2b1048bee
commit 853280c19d

View File

@@ -14,19 +14,27 @@ class authparams
If non is found, return "anonymous", "anonymous" */ If non is found, return "anonymous", "anonymous" */
public function __construct ($authprocesses=array("session","post")) public function __construct ($authprocesses=array("session","post"))
{ {
foreach ($authprocesses as $authprocess) if (php_sapi_name () === "cli")
{ {
try $this->email = "cli";
$this->password = "";
}
else
{
foreach ($authprocesses as $authprocess)
{ {
$res = $this->$authprocess(); try
$this->email = $res["email"]; {
$this->password = $res["password"]; $res = $this->$authprocess();
break; $this->email = $res["email"];
} $this->password = $res["password"];
catch (Exception $e) break;
{ }
$this->email = "anonymous"; catch (Exception $e)
$this->password = "anonymous"; {
$this->email = "anonymous";
$this->password = "anonymous";
}
} }
} }
} }