Example #1
0
 public function testGetAndSetLang()
 {
     $this->user->setLang('en');
     $this->assertEquals('en', $this->user->getLang());
 }
Example #2
0
// | Boston, MA 02110-1301, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <*****@*****.**>                             |
// | Authors: Elan Ruusamäe <*****@*****.**>                               |
// +----------------------------------------------------------------------+
// delay language init if we're saving language
if (!empty($_POST['language'])) {
    define('SKIP_LANGUAGE_INIT', true);
}
require_once dirname(__FILE__) . '/../init.php';
$cat = isset($_POST['cat']) ? (string) $_POST['cat'] : null;
$usr_id = Auth::getUserID();
// must do Language::setPreference before template is initialized
if ($cat == 'update_account') {
    if (isset($_POST['language'])) {
        $res = User::setLang($usr_id, $_POST['language']);
        Language::setPreference();
    }
}
$tpl = new Template_Helper();
$tpl->setTemplate('preferences.tpl.html');
Auth::checkAuthentication(APP_COOKIE);
if (Auth::isAnonUser()) {
    Auth::redirect('index.php');
}
$res = null;
if ($cat == 'update_account') {
    $preferences = $_POST;
    // if the user is trying to upload a new signature, override any changes to the textarea
    if (!empty($_FILES['file_signature']['name'])) {
        $preferences['email_signature'] = file_get_contents($_FILES['file_signature']['tmp_name']);