*
* PHP version 5
*
- * Copyright © 2013-2023 The Galette Team
+ * Copyright © 2013-2024 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
*
* @package Galette
*
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2013-2022 The Galette Team
+ * @copyright 2013-2024 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since Available since 0.7.5dev - 2013-02-08
require_once GALETTE_ROOT . 'includes/routes/groups.routes.php';
require_once GALETTE_ROOT . 'includes/routes/contributions.routes.php';
if ($cron) {
- $container->get('login')->logCron(basename($argv[0], '.php'));
+ $container->get('login')->logCron(
+ basename($argv[0], '.php'),
+ $container->get('preferences')
+ );
define('GALETTE_CRON', true);
}
*
* PHP version 5
*
- * Copyright © 2009-2023 The Galette Team
+ * Copyright © 2009-2024 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
*
* @package Galette
*
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2009-2023 The Galette Team
+ * @copyright 2009-2024 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since Available since 0.7dev - 2009-02-28
* @name Authentication
* @package Galette
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2009-2023 The Galette Team
+ * @copyright 2009-2024 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since Available since 0.7dev - 2009-02-28
/**
* Authenticate from cron
*
- * @param string $name Service name
+ * @param string $name Service name
+ * @param Preferences $preferences Preferences instance
*
* @return void
*/
- public function logCron($name)
+ public function logCron($name, Preferences $preferences)
{
//known cronable files
$ok = array('reminder');
$this->logged = true;
$this->cron = true;
$this->login = 'cron';
+ $this->lang = $preferences->pref_lang;
} else {
trigger_error('Not authorized!', E_USER_ERROR);
}
$this->superadmin = false;
$this->staff = false;
$this->uptodate = false;
+ $this->lang = null;
}
/**
*
* PHP version 5
*
- * Copyright © 2016-2023 The Galette Team
+ * Copyright © 2016-2024 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
*
* @package GaletteTests
*
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2016-2023 The Galette Team
+ * @copyright 2016-2024 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since 2016-12-05
* @name Login
* @package GaletteTests
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2016-2023 The Galette Team
+ * @copyright 2016-2024 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since 2016-12-05
$this->assertFalse($this->login->isCron());
$this->assertFalse($this->login->isUp2Date());
$this->assertFalse($this->login->isImpersonated());
+ $this->assertFalse($this->login->lang);
}
/**
$this->assertFalse($this->login->isCron());
$this->assertFalse($this->login->isUp2Date());
$this->assertFalse($this->login->isImpersonated());
+ $this->assertSame($this->preferences->pref_lang, $this->login->lang);
//test logout
$this->login->logOut();
*/
public function testLogCron()
{
- $this->login->logCron('reminder');
+ $this->login->logCron('reminder', $this->preferences);
$this->assertTrue($this->login->isLogged());
$this->assertFalse($this->login->isStaff());
$this->assertFalse($this->login->isAdmin());
$this->assertFalse($this->login->isUp2Date());
$this->assertFalse($this->login->isImpersonated());
$this->assertSame('cron', $this->login->login);
+ $this->assertSame($this->preferences->pref_lang, $this->login->lang);
$this->expectException('Exception');
$this->expectExceptionMessage('Not authorized!');
- $this->login->logCron('filename');
+ $this->login->logCron('filename', $this->preferences);
}
}