[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/ -> preferences.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */
   3  // +----------------------------------------------------------------------+
   4  // | Eventum - Issue Tracking System                                      |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 2003, 2004, 2005, 2006, 2007 MySQL AB                  |
   7  // |                                                                      |
   8  // | This program is free software; you can redistribute it and/or modify |
   9  // | it under the terms of the GNU General Public License as published by |
  10  // | the Free Software Foundation; either version 2 of the License, or    |
  11  // | (at your option) any later version.                                  |
  12  // |                                                                      |
  13  // | This program is distributed in the hope that it will be useful,      |
  14  // | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
  15  // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
  16  // | GNU General Public License for more details.                         |
  17  // |                                                                      |
  18  // | You should have received a copy of the GNU General Public License    |
  19  // | along with this program; if not, write to:                           |
  20  // |                                                                      |
  21  // | Free Software Foundation, Inc.                                       |
  22  // | 59 Temple Place - Suite 330                                          |
  23  // | Boston, MA 02111-1307, USA.                                          |
  24  // +----------------------------------------------------------------------+
  25  // | Authors: João Prado Maia <jpm@mysql.com>                             |
  26  // +----------------------------------------------------------------------+
  27  //
  28  // @(#) $Id: preferences.php 3468 2007-11-12 20:55:27Z glen $
  29  
  30  // skip language init if we're saving language
  31  if (@$_POST['language']) {
  32      define('SKIP_LANGUAGE_INIT', true);
  33  }
  34  require_once(dirname(__FILE__) . "/init.php");
  35  require_once (APP_INC_PATH . "class.template.php");
  36  require_once (APP_INC_PATH . "class.auth.php");
  37  require_once (APP_INC_PATH . "class.prefs.php");
  38  require_once (APP_INC_PATH . "class.setup.php");
  39  require_once (APP_INC_PATH . "class.date.php");
  40  require_once (APP_INC_PATH . "db_access.php");
  41  
  42  // must do Language::setPreference before template is initialized
  43  if (@$_POST["cat"] == "update_account") {
  44      $res = User::setLang(Auth::getUserID(), $_POST['language']);
  45      Language::setPreference();
  46  }
  47  
  48  $tpl = new Template_API();
  49  $tpl->setTemplate("preferences.tpl.html");
  50  
  51  Auth::checkAuthentication(APP_COOKIE);
  52  
  53  $usr_id = Auth::getUserID();
  54  
  55  if (@$_POST["cat"] == "update_account") {
  56      $tpl->assign('update_lang_result', $res);
  57      $res = Prefs::set($usr_id);
  58      $tpl->assign('update_account_result', $res);
  59      User::updateSMS($usr_id, @$_POST['sms_email']);
  60  } elseif (@$_POST["cat"] == "update_name") {
  61      $res = User::updateFullName($usr_id);
  62      $tpl->assign('update_name_result', $res);
  63  } elseif (@$_POST["cat"] == "update_email") {
  64      $res = User::updateEmail($usr_id);
  65      $tpl->assign('update_email_result', $res);
  66  } elseif (@$_POST["cat"] == "update_password") {
  67      $res = User::updatePassword($usr_id);
  68      $tpl->assign('update_password_result', $res);
  69  }
  70  
  71  $prefs = Prefs::get($usr_id);
  72  $prefs['sms_email'] = User::getSMS($usr_id);
  73  // if the user has no preferences set yet, get it from the system-wide options
  74  if (empty($prefs)) {
  75      $prefs = Setup::load();
  76  }
  77  $tpl->assign("user_prefs", $prefs);
  78  $tpl->assign("assigned_projects", Project::getAssocList($usr_id, false, true));
  79  $tpl->assign("zones", Date_API::getTimezoneList());
  80  $tpl->assign('avail_langs', Language::getAvailableLanguages());
  81  $tpl->assign('current_locale', User::getLang(Auth::getUserID(), true));
  82  
  83  $tpl->displayTemplate();


Generated: Wed Dec 19 21:21:33 2007 Cross-referenced by PHPXref 0.7