. // Copyright © 2007-2014 Erwan Briand // // This program is free software: you can redistribute it and/or modify it // under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, version 3 only. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public // License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . class head_member { private $ct_session, $ct_db, $page; function __construct($ct_session, $ct_db, $page) { $this->ct_session = $ct_session; $this->ct_db = $ct_db; $this->page = $page; $this->config = getClass('config', $this->ct_db); } function treatForms() { if (isset($_SERVER['HTTP_REFERER'])) $server_referer = $_SERVER['HTTP_REFERER']; else $server_referer = 'index'; // SQL authentification method (default) if (CT_AUTHENTIFICATION_METHOD == 'sql') { if (isset($_POST['login_nickname']) && isset($_POST['login_password'])) { if (!is_scalar($_POST['login_nickname']) && !is_scalar($_POST['login_password'])) exit('Error.'); if (!$this->ct_session->isLogged()) { if(!empty($_POST['auto'])) $auto = 0; else $auto = 1; $nick = $this->ct_db->cleanentry($_POST['login_nickname'], TRUE); $pass = $this->ct_db->cleanentry($_POST['login_password'], TRUE); // Clean POST values unset($_POST['login_nickname'], $_POST['login_password'], $_POST['auto']); $this->ct_session->login($nick, $pass, $auto, $server_referer); } } } // XMPP authentification method elseif (CT_AUTHENTIFICATION_METHOD == 'xmpp') { if (isset($_POST['login_jabberid'])) { if (!is_scalar($_POST['login_jabberid'])) exit('Error.'); if (!$this->ct_session->isLogged()) { if(!empty($_POST['auto'])) $auto = 0; else $auto = 1; $jid = $this->ct_db->cleanentry($_POST['login_jabberid'], TRUE); // Clean POST values unset($_POST['login_jabberid'], $_POST['auto']); $this->ct_session->login($jid, $auto, $server_referer); } } } } function getPageContent() { if (!$this->ct_session->isLogged($this->ct_db)) { echo '
'; if (CT_AUTHENTIFICATION_METHOD == 'sql') echo '
'; elseif (CT_AUTHENTIFICATION_METHOD == 'xmpp') echo '
'; echo '
'; } else { $user = getUser($_SESSION['id'], $this->ct_db); $firstname =htmlspecialchars($user->getName()); $lastname = htmlspecialchars($user->getSurname()); $nickname = htmlspecialchars($user->getNickname()); $avatar = htmlspecialchars($user->getAvatar()); $jid = md5(htmlspecialchars($user->getJid())); $omnipresence = $this->config->get('jabber', 'omnipresence-url'); $file = 'public/upload/avatars/'.$nickname; $none = 'public/images/icons/user-avatar_128.png'; if ($avatar == '!jabber!') $logourl = $omnipresence.'avatar.php?hash='.$jid. '&default='.CT_BASEURL.$none; elseif ($avatar == '!no!') $logourl = $none; elseif (file_exists(CT_BASEDIR.'/'.$file)) $logourl = 'users/avatar/'.$nickname; if ($user->getUnread_messages() > 0) $mess = TRUE; else $mess = FALSE; // Get unread messages number $unread = $user->getUnread_messages(); // Ask if there are any new activity on projects $activities = count_new_dashboard_elements($this->ct_db, $user->getId(), $nickname, $user->getDashboard_lastelement()); echo ' '; } } } ?>