message_die(GENERAL_ERROR, "YubiCloud authentication not configured. Add \$Config['YubiCloud']['ClientID'] and \$Config['YubiCloud']['SecretKey'] to your config.");
}
if (!$key = $_GET['OTP']) {
message_die(GENERAL_ERROR, "Please add in URL ?OTP=, then put your cursor at right of the = and press your YubiKey button");
}
$yubi = new Auth_Yubico($Config['YubiCloud']['ClientID'], $Config['YubiCloud']['SecreyKey']);
if (!$data = $yubi->parsePasswordOTP($key)) {
message_die(GENERAL_ERROR, "This is not an YubiKey OTP.");
* @param float $angle angle in radians (use deg2rad() if you've degrees)
* @return an angle in the 0 =< angle < 2 PI interval
*/
static function normalizeAngle ($angle) {
while ($angle < 0) {
$angle += 2 * M_PI;
}
while ($angle >= 2 * M_PI) {
$angle -= 2 * M_PI;
}
return $angle;
}
/**
* Converts (x, y, z) cartesian to (ρ, φ, θ) spherical coordinates
*
* The algo used is from http://fr.wikipedia.org/wiki/Coordonn%C3%A9es_sph%C3%A9riques#Relation_avec_les_autres_syst.C3.A8mes_de_coordonn.C3.A9es_usuels
*
* @param int $x the x coordinate
* @param int $y the y coordinate
* @param int $z the z coordinate
* @return array an array of 3 floats number, representing the (ρ, φ, θ) spherical coordinates
*/
- static function cartesian_to_spherical ($x, $y, $z) {
+ static function cartesianToSpherical ($x, $y, $z) {
message_die(GENERAL_ERROR, "Can't check if a local place exists for the following location: " . $this->data[0], "GeoLocation exists method", __LINE__, __FILE__);
}
if (!$place->is_valid_local_location($this->data[1])) {
return false;
}
}
return true;
}
/**
* Checks if the place is equals at the specified expression or place
*
* @return bool true if the places are equals ; otherwise, false.
*
* @todo Create a better set of rules to define when 2 locations are equal.
*/
function equals ($expression) {
//Are global location equals?
//TODO: create a better set of rules to define when 2 locations are equal.
if (is_a($expression, 'GeoLocation')) {
if (!$this->equals($expression->data[0])) {
return false;
}
if (count($expression->data) + count($this->data) > 2) {
* Gets the (ρ, φ, θ) spherical coordinates from the current x, y, z cartesian point
*
* The algo used is from http://fr.wikipedia.org/wiki/Coordonn%C3%A9es_sph%C3%A9riques#Relation_avec_les_autres_syst.C3.A8mes_de_coordonn.C3.A9es_usuels
*
* @return array an array of 3 floats number, representing the (ρ, φ, θ) spherical coordinates
* Gets the (x, y, z) cartesian coordinates from the current ρ, θ, z polar+z point
*
* @return array an array of 3 floats number, representing the (x, y, z) cartesian coordinates
*/
- function to_cartesian () {
+ function toCartesian () {
$x = $this->r * cos(self::get_radians($this->t));
$y = $this->r * sin(self::get_radians($this->t));
return array($x, $y, $this->z);
}
/**
* Converts the current GeoPointPolarZ instance to a GeoPoint3D instance
*
* @return GeoPoint3D an instance of the GeoPoint3D class representing the (x, y, z) cartesian coordinates
*/
function to_Point3D () {
- $pt = $this->to_cartesian();
+ $pt = $this->toCartesian();
return new GeoPoint3D($pt[0], $pt[1], $pt[2]);
}
/**
* Gets the (ρ, φ, θ) spherical coordinates from the current (ρ, θ, z) polar+z point
*
* The algo used is from http://fr.wikipedia.org/wiki/Coordonn%C3%A9es_sph%C3%A9riques#Relation_avec_les_autres_syst.C3.A8mes_de_coordonn.C3.A9es_usuels
*
* @return array an array of 3 floats number, representing the (ρ, φ, θ) spherical coordinates