Exemplo n.º 1
0
 public function __construct($page, $comment_id, $type = 0)
 {
     $this->_localization = Localization::getInstance();
     $this->type = $type;
     $this->page = $page;
     $this->comment_id = $comment_id;
     $this->form_values['comment_text'] = isset($_POST['comment_text']) ? htmlspecialchars($_POST['comment_text']) : '';
     $this->form_values['name'] = isset($_POST['name']) ? htmlspecialchars($_POST['name']) : '';
     $this->form_values['email_hp'] = isset($_POST['email_hp']) ? htmlspecialchars($_POST['email_hp']) : '';
     $this->_form_session = 'comment_form_session_' . $this->comment_id . '_' . $this->type;
     if ($this->type == 1) {
         if (isset($_GET['get_5'])) {
             $this->current_page = intval($_GET['get_5']);
         } else {
             $this->current_page = 1;
         }
     } else {
         if (isset($_GET['get_1'])) {
             $this->current_page = intval($_GET['get_1']);
         } else {
             $this->current_page = 1;
         }
     }
     if ($this->current_page == 0) {
         $this->current_page = 1;
     }
     if (isset($_SESSION[$this->_form_session])) {
         $this->form_session = $_SESSION[$this->_form_session];
         $form_session_data['name'] = session_name();
         $form_session_data['id'] = session_id();
         $this->form_session_data = $form_session_data;
     }
 }
Exemplo n.º 2
0
 public static function setupSiteInterfaceLocalization(Page $c = null)
 {
     $loc = \Localization::getInstance();
     if (!(\User::isLoggedIn() && Config::get('concrete.multilingual.keep_users_locale'))) {
         if (!$c) {
             $c = Page::getCurrentPage();
         }
         // don't translate dashboard pages
         $dh = \Core::make('helper/concrete/dashboard');
         if ($dh->inDashboard($c)) {
             return;
         }
         $locale = null;
         $ms = Section::getBySectionOfSite($c);
         if ($ms) {
             $locale = $ms->getLocale();
         }
         if (!$locale) {
             if (Config::get('concrete.multilingual.use_previous_locale') && Session::has('previous_locale')) {
                 $locale = Session::get('previous_locale');
             }
             if (!$locale) {
                 $ms = static::getPreferredSection();
                 if ($ms) {
                     $locale = $ms->getLocale();
                 }
             }
         }
         if ($locale) {
             $loc->setLocale($locale);
         }
     }
     Session::set('previous_locale', $loc->getLocale());
 }
Exemplo n.º 3
0
 static function changeLocale($locale)
 {
     // change core language to translate e.g. core blocks/themes
     if (strlen($locale)) {
         Localization::changeLocale($locale);
         // site translations
         $loc = Localization::getInstance();
         $loc->addSiteInterfaceLanguage($locale);
         // add package translations
         $pl = PackageList::get();
         $installed = $pl->getPackages();
         foreach ($installed as $pkg) {
             if ($pkg instanceof Package) {
                 $pkg->setupPackageLocalization($locale);
             }
         }
     }
 }
Exemplo n.º 4
0
 public function __construct($id, $news_per_page)
 {
     $this->id = $id;
     $this->news_per_page = $news_per_page;
     $this->current_time = time();
     $this->_localization = Localization::getInstance();
     $category_identifier_length = strlen(CATEGORY_IDENTIFIER);
     if (isset($_GET['get_1']) && substr($_GET['get_1'], 0, $category_identifier_length) == CATEGORY_IDENTIFIER) {
         $this->category = str_replace(AMPERSAND_REPLACEMENT, '&', substr($_GET['get_1'], $category_identifier_length));
         $this->category_urlencoded = str_replace('%26', AMPERSAND_REPLACEMENT, urlencode($this->category));
     }
     if (isset($_GET['get_2'])) {
         $this->current_page = intval($_GET['get_2']);
     } else {
         $this->current_page = 1;
     }
     if ($this->current_page == 0) {
         $this->current_page = 1;
     }
 }
Exemplo n.º 5
0
 public function __construct($gallery, $commentable = 0)
 {
     $this->_localization = Localization::getInstance();
     $dbr = Database::$content->prepare('SELECT id, photo_thumbnail, photo_normal, title, subtitle, description, photos_per_row FROM ' . Database::$db_settings['photo_table'] . ' WHERE gallery=:gallery ORDER BY sequence ASC');
     $dbr->bindParam(':gallery', $gallery, PDO::PARAM_STR);
     $dbr->execute();
     $i = 0;
     while ($photo_data = $dbr->fetch()) {
         if ($commentable == 1) {
             $count_result = Database::$entries->prepare('SELECT COUNT(*) AS comments FROM ' . Database::$db_settings['comment_table'] . ' WHERE comment_id=:id AND type=1');
             $count_result->bindValue(':id', $photo_data['id'], PDO::PARAM_INT);
             $count_result->execute();
             $count_data = $count_result->fetch();
             $this->photos[$i]['comments'] = $count_data['comments'];
             $this->_localization->bindId('number_of_comments', $photo_data['id']);
             switch ($count_data['comments']) {
                 case 0:
                     $this->_localization->selectBoundVariant('number_of_comments', $photo_data['id'], 0);
                     break;
                 case 1:
                     $this->_localization->selectBoundVariant('number_of_comments', $photo_data['id'], 1);
                     break;
                 default:
                     $this->_localization->selectBoundVariant('number_of_comments', $photo_data['id'], 2);
                     $this->_localization->replacePlaceholderBound('comments', $count_data['comments'], 'number_of_comments', $photo_data['id']);
             }
         }
         $this->photos[$i]['id'] = $photo_data['id'];
         $this->photos[$i]['photo_thumbnail'] = $photo_data['photo_thumbnail'];
         $this->photos[$i]['photo_normal'] = $photo_data['photo_normal'];
         $this->photos[$i]['title'] = htmlspecialchars($photo_data['title']);
         $this->photos[$i]['subtitle'] = htmlspecialchars($photo_data['subtitle']);
         $this->photos[$i]['description'] = htmlspecialchars($photo_data['description']);
         $thumbnail_info = getimagesize(MEDIA_DIR . $photo_data['photo_thumbnail']);
         $this->photos[$i]['width'] = $thumbnail_info[0];
         $this->photos[$i]['height'] = $thumbnail_info[1];
         $this->photos_per_row = $photo_data['photos_per_row'];
         $i++;
     }
     $this->number_of_photos = $i;
 }
Exemplo n.º 6
0
/**
 * ----------------------------------------------------------------------------
 * Load preprocess items
 * ----------------------------------------------------------------------------
 */
require DIR_BASE_CORE . '/bootstrap/preprocess.php';
/**
 * ----------------------------------------------------------------------------
 * Set the active language for the site, based either on the site locale, or the
 * current user record. This can be changed later as well, during runtime.
 * Start localization library.
 * ----------------------------------------------------------------------------
 */
$u = new User();
$lan = $u->getUserLanguageToDisplay();
$loc = Localization::getInstance();
$loc->setLocale($lan);
/**
 * Handle automatic updating
 */
$cms->handleAutomaticUpdates();
/**
 * ----------------------------------------------------------------------------
 * Now that we have languages out of the way, we can run our package on_start
 * methods
 * ----------------------------------------------------------------------------
 */
$cms->setupPackages();
/**
 * ----------------------------------------------------------------------------
 * Load all permission keys into our local cache.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitationsborder: 10px dotted #29C3FF; under the License.
 */
?>

<?php 
$msgs = Localization::getInstance();
?>

<form action="wb.php?do=register" method="post" name="registerForm" onsubmit="return isEmail('registerForm', 'textNewUserEmail', 'emailNewUser');">
	
	<div class="registerForm">
			
		<div class="line">
			<div class="left">
				<?php 
echo $msgs->getText('registerForm.name');
?>
			</div>			
			<input 
				id="textNewUserName" 
				type="text" 
Exemplo n.º 8
0
	/** 
	 * Subsitute for the native date() function that adds localized date support
	 * This uses Zend's Date Object {@link http://framework.zend.com/manual/en/zend.date.constants.html#zend.date.constants.phpformats}
	 * @param string $mask
	 * @param int $timestamp
	 * @return string
	 */
	public function date($mask,$timestamp=false) {
		$loc = Localization::getInstance();
		if ($timestamp === false) {
			$timestamp = time();
		}
		
		if ($loc->getLocale() == 'en_US') {
			return date($mask, $timestamp);			
		}		

		$locale = new Zend_Locale(Localization::activeLocale());
		Zend_Date::setOptions(array('format_type' => 'php'));
		$cache = Cache::getLibrary();
		if (is_object($cache)) {
			Zend_Date::setOptions(array('cache'=>$cache));
		} 
		$date = new Zend_Date($timestamp, false, $locale);

		return $date->toString($mask);
	}
Exemplo n.º 9
0
 /** Returns the current Zend_Translate instance (null if and only if locale is en_US)
  * @var Zend_Translate|null
  */
 public static function getTranslate()
 {
     $loc = Localization::getInstance();
     return $loc->getActiveTranslateObject();
 }
 public function execute($action)
 {
     $msgs = Localization::getInstance();
     $forwards = $action->getForwards();
     //$_POST["course"] = "1";
     //$_POST['manager'] = "*****@*****.**";
     //$_POST["name"] = "Coordenador do Curso";
     //$_POST["email"] ="*****@*****.**";
     $roomCourse = $_POST["course"];
     $roomManager = $_POST['manager'];
     $userName = utf8_decode($_POST["name"]);
     $userEmail = $_POST["email"];
     $userPasswordEduquito = "mude";
     if (!empty($roomCourse) && !empty($roomManager) && !empty($userName) && !empty($userEmail)) {
         // CHECKING USER IN EDUQUITO
         $bdHost = "143.54.193.37";
         $bdUser = "******";
         $bdPassword = "******";
         $bdDataBase = "EduquitoCurso" . $roomCourse;
         // Connect to database
         $mysqli = mysqli_init();
         mysqli_options($mysqli, MYSQLI_OPT_CONNECT_TIMEOUT, 3);
         mysqli_real_connect($mysqli, $bdHost, $bdUser, $bdPassword, $bdDataBase);
         $eduquitoConnected = true;
         // Checks whether any errors occurred
         if (mysqli_connect_errno()) {
             $eduquitoConnected = false;
         }
         if ($eduquitoConnected) {
             $nameLoginEduquito = $userName;
             $emailLoginEduquito = $userEmail;
             // Prepares a SQL query
             if ($sql = $mysqli->prepare("SELECT `cod_usuario` FROM `Usuario` WHERE `email` = ? AND `nome` = ?")) {
                 $sql->bind_param('ss', $emailLoginEduquito, $nameLoginEduquito);
                 // Run the query
                 $sql->execute();
                 $i = 0;
                 $sql->bind_result($id);
                 while ($sql->fetch()) {
                     $i++;
                 }
                 if ($i >= 1) {
                     $permissionEduquito = true;
                 } else {
                     $permissionEduquito = false;
                 }
                 // Close query
                 $sql->close();
             }
             // Closes the connection to the database
             $mysqli->close();
         }
         if (!$eduquitoConnected || $permissionEduquito) {
             // CHECKING USER IN WHITEBOARD
             $user = $this->dao->login($userEmail, $userPasswordEduquito);
             if (count($user) <= 0) {
                 // Not in database, create new user
                 if (!empty($userEmail) && !empty($userName)) {
                     // Instantiates a new user;
                     $user = new User();
                     $user->setName($userName);
                     $user->setEmail($userEmail);
                     $user->setPassword($userPasswordEduquito);
                     $user->setRoomcreator(0);
                     $resultUser = $this->dao->saveNewUser($user);
                     $user = $this->dao->login($userEmail, $userPasswordEduquito);
                 }
             }
             if ($user->getName() != $userName) {
                 // Upadate user;
                 $resultUser = $this->dao->updateUserName($user->getUserId(), $userName);
             }
             // User contained in the database, loggin
             $_SESSION['id'] = $user->getUserId();
             $_SESSION['name'] = $user->getName();
             $_SESSION['roomCreator'] = $user->getRoomcreator();
             $_SESSION['email'] = $user->getEmail();
             $_SESSION['user'] = $user;
             // Verifies and creates, if necessary, the room of course
             $roomEduquito = $this->dao->getRoomByCourse($roomCourse);
             if (count($roomEduquito) <= 0) {
                 $roomName = "Sala do curso " . $roomCourse;
                 $_POST["name"] = $roomName;
                 $_POST["course"] = $roomCourse;
                 $_POST['idsSelecteds'] = $user->getUserId();
                 if ($user->getEmail() == $roomManager) {
                     $_SESSION['id'] = $user->getUserId();
                 } else {
                     $manager = $this->dao->login($roomManager, $userPasswordEduquito);
                     if (count($manager) <= 0) {
                         // Not in database, create new user coordinator
                         $manager = new User();
                         $manager->setName("Coordenador do curso");
                         $manager->setEmail($roomManager);
                         $manager->setPassword($userPasswordEduquito);
                         $manager->setRoomcreator(0);
                         $resultManager = $this->dao->saveNewUser($manager);
                         $manager = $this->dao->login($manager->getEmail(), $userPasswordEduquito);
                     }
                     $_SESSION['id'] = $manager->getUserId();
                 }
                 $createRoomAction = new CreateRoomAction();
                 $createRoomAction->execute($action);
                 $roomEduquito = $this->dao->getRoomByCourse($roomCourse);
                 $_SESSION['id'] = $user->getUserId();
             }
             // Checks permissions
             $permissions = $this->dao->listPermissions($roomEduquito->getRoomId());
             $havePermission = false;
             foreach ($permissions as $permission) {
                 if ($permission->getUserId() == $user->getUserId()) {
                     $havePermission = true;
                 }
             }
             if (!$havePermission) {
                 $permission = new Permission();
                 $permission->setUserId($user->getUserId());
                 $permission->setRoomId($roomEduquito->getRoomId());
                 $resultPermission = $this->dao->savePermission($permission);
             }
             $roomEduquito = $this->dao->getRoomByCourse($roomCourse);
             $_GET["idRoom"] = $roomEduquito->getRoomId();
             $_SESSION['eduquito'] = true;
             if ($roomEduquito->getActive() == 1) {
                 $joinRoomAction = new JoinRoomAction();
                 $joinRoomAction->execute($action);
             } else {
                 if ($user->getUserId() == $roomEduquito->getUserId()) {
                     $startRoomAction = new StartRoomAction();
                     $startRoomAction->execute($action);
                 } else {
                     unset($_SESSION['id']);
                     unset($_SESSION['name']);
                     unset($_SESSION['roomCreator']);
                     unset($_SESSION['email']);
                     unset($_SESSION['user']);
                     session_destroy();
                     // Closed room
                     echo "<script type='text/javascript'>";
                     echo "alert('" . $msgs->getText('error.eduquitoCloseRoom') . "');";
                     echo "history.go(-1);";
                     echo "</script>";
                 }
             }
         } else {
             // Without permission
             echo "<script type='text/javascript'>";
             echo "alert('" . $msgs->getText('error.eduquitoWithoutPermission') . "');";
             echo "history.go(-1);";
             echo "</script>";
         }
     } else {
         // Without permission
         echo "<script type='text/javascript'>";
         echo "alert('" . $msgs->getText('error.eduquitoInsufficientData') . "');";
         echo "history.go(-1);";
         echo "</script>";
     }
 }
Exemplo n.º 11
0
 public function __construct()
 {
     $this->_localization = Localization::getInstance();
 }
 public function __construct()
 {
     $mySqlDAOFactory = DAOFactory::getDAOFactory(DAOFactory::$MYSQL);
     $this->dao = $mySqlDAOFactory->getDataBaseOperations();
     $this->message = Localization::getInstance();
 }
Exemplo n.º 13
0
 public static function setupSiteInterfaceLocalization()
 {
     // don't translate dashboard pages
     $c = Page::getCurrentPage();
     if ($c instanceof Page && Loader::helper('section', 'multilingual')->section('dashboard')) {
         return;
     }
     $ms = MultilingualSection::getCurrentSection();
     if (is_object($ms)) {
         $locale = $ms->getLocale();
     } else {
         $locale = DefaultLanguageHelper::getSessionDefaultLocale();
     }
     // change core language to translate e.g. core blocks/themes
     if (strlen($locale)) {
         Localization::changeLocale($locale);
     }
     // site translations
     if (is_dir(DIR_LANGUAGES_SITE_INTERFACE)) {
         if (file_exists(DIR_LANGUAGES_SITE_INTERFACE . '/' . $locale . '.mo')) {
             $loc = Localization::getInstance();
             $loc->addSiteInterfaceLanguage($locale);
         }
     }
     // add package translations
     if (strlen($locale)) {
         $ms = MultilingualSection::getByLocale($locale);
         if ($ms instanceof MultilingualSection) {
             $pl = PackageList::get();
             $installed = $pl->getPackages();
             foreach ($installed as $pkg) {
                 if ($pkg instanceof Package) {
                     $pkg->setupPackageLocalization($ms->getLocale());
                 }
             }
         }
     }
 }
 public function execute($action)
 {
     $msgs = Localization::getInstance();
     $forwards = $action->getForwards();
     // Recebe os valores enviados
     $roomCourse = $_POST["group"];
     $roomManager = $_POST['manager'];
     $userName = utf8_decode($_POST["name"]);
     $userEmail = $_POST["email"];
     $userPasswordPlataform = "mude";
     if (!empty($roomCourse) && !empty($roomManager) && !empty($userName) && !empty($userEmail)) {
         /**
          * Routine that checks which the browser used
          * If an error occurs during the login, the system should return to the previous page
          * If the browser used is Firefox, the system must go back two pages
          * If is Chrome should back 1 page
          * TODO Test with Internet Explorer
          */
         $useragent = $_SERVER['HTTP_USER_AGENT'];
         if (preg_match('|Firefox/([0-9\\.]+)|', $useragent, $matched)) {
             $browser_version = $matched[1];
             $browser = 'Firefox';
             $numReturnPages = 2;
         } else {
             $numReturnPages = 1;
         }
         /**
          * Via rest, it checks if this tool (in this case the Whiteboard)
          * have permission to use information from the Core
          */
         $host = $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"];
         $pass = md5(date("d/m/Y") . $host);
         $server = "http://code.inf.poa.ifrs.edu.br/core/index.php/rest";
         $action = str_replace("%40", "@", $userEmail);
         $rest = new RESTClient();
         $rest->initialize(array('server' => $server, 'http_user' => $host, 'http_pass' => $pass));
         $granted = $rest->get($action);
         if ($granted == 1) {
             // Caso o usuário esteja cadastrado na Plataform
             // CHECKING USER IN WHITEBOARD
             $user = $this->dao->login($userEmail, $userPasswordPlataform);
             if (count($user) <= 0) {
                 // Not in database, create new user
                 if (!empty($userEmail) && !empty($userName)) {
                     // Instantiates a new user;
                     $user = new User();
                     $user->setName($userName);
                     $user->setEmail($userEmail);
                     $user->setPassword($userPasswordPlataform);
                     $user->setRoomcreator(0);
                     $resultUser = $this->dao->saveNewUser($user);
                     $user = $this->dao->login($userEmail, $userPasswordPlataform);
                 }
             }
             if ($user->getName() != $userName) {
                 // Upadate user;
                 $resultUser = $this->dao->updateUserName($user->getUserId(), $userName);
             }
             // User contained in the database, loggin
             $_SESSION['id'] = $user->getUserId();
             $_SESSION['name'] = $user->getName();
             $_SESSION['roomCreator'] = $user->getRoomcreator();
             $_SESSION['email'] = $user->getEmail();
             $_SESSION['user'] = $user;
             // Verifies and creates, if necessary, the room of course
             $roomPlataform = $this->dao->getRoomByCourse($roomCourse);
             if (count($roomPlataform) <= 0) {
                 $roomName = "Turma: " . $roomCourse;
                 if ($user->getEmail() == $roomManager) {
                     $managerId = $user->getUserId();
                 } else {
                     $manager = $this->dao->login($roomManager, $userPasswordPlataform);
                     if (count($manager) <= 0) {
                         // Not in database, create new user coordinator
                         $manager = new User();
                         $manager->setName("Professor " . $roomCourse);
                         $manager->setEmail($roomManager);
                         $manager->setPassword($userPasswordPlataform);
                         $manager->setRoomcreator(1);
                         $resultManager = $this->dao->saveNewUser($manager);
                         $manager = $this->dao->login($manager->getEmail(), $userPasswordPlataform);
                     }
                     $managerId = $manager->getUserId();
                 }
                 // Instantiates a new room;
                 $roomPlataform = new Room();
                 $roomPlataform->setName($roomName);
                 $roomPlataform->setUserId($managerId);
                 $roomPlataform->setActive(0);
                 $roomPlataform->setActiveProduction(0);
                 $roomPlataform->setCourse($roomCourse);
                 $resultRoom = $this->dao->saveNewRoom($roomPlataform);
                 $roomPlataform = $this->dao->getRoomByCourse($roomCourse);
                 // Set manager permission of room
                 $permission = new Permission();
                 $permission->setUserId($managerId);
                 $permission->setRoomId($roomPlataform->getRoomId());
                 $resultPermission = $this->dao->savePermission($permission);
             }
             // Checks permissions
             $permissions = $this->dao->listPermissions($roomPlataform->getRoomId());
             $havePermission = false;
             foreach ($permissions as $permission) {
                 if ($permission->getUserId() == $user->getUserId()) {
                     $havePermission = true;
                 }
             }
             if (!$havePermission) {
                 $permission = new Permission();
                 $permission->setUserId($user->getUserId());
                 $permission->setRoomId($roomPlataform->getRoomId());
                 $resultPermission = $this->dao->savePermission($permission);
             }
             $roomPlataform = $this->dao->getRoomByCourse($roomCourse);
             $_SESSION['plataform'] = true;
             unset($_POST["group"]);
             unset($_POST['manager']);
             unset($_POST["name"]);
             unset($_POST["email"]);
             // If the room is active, will be given a join
             if ($roomPlataform->getActive() == 1) {
                 $_SESSION["idRoom"] = $roomPlataform->getRoomId();
                 $room = $this->dao->getRoom($roomPlataform->getRoomId());
                 // put the production in the session
                 $idProduction = $room->getActiveProduction();
                 $_SESSION['idProduction'] = $idProduction;
                 $history = new History();
                 $history->setUserId($_SESSION["id"]);
                 $history->setProductionId($idProduction);
                 $history->setDate(date('Y-m-d'));
                 $resultHistory = $this->dao->saveHistory($history);
                 // Retrieving the users in the room
                 $_REQUEST["users"] = $this->dao->getRoomUsers($_SESSION['idProduction']);
                 // Showing the page
                 $this->pageController->run($forwards['success']);
             } else {
                 if ($user->getUserId() == $roomPlataform->getUserId()) {
                     // If it is not active and the user is the owner of the room, will be given a start in the room
                     $production = new Production();
                     $production->setCreationDate(date('Y-m-d'));
                     $production->setUpdateDate(date('Y-m-d'));
                     $production->setRoomId($roomPlataform->getRoomId());
                     $resultProduction = $this->dao->createProduction($production);
                     if ($resultProduction) {
                         $_SESSION['idProduction'] = $production->getProductionId();
                     }
                     $resultUpdateRoom = $this->dao->updateRoomState($roomPlataform->getRoomId(), true, $_SESSION['idProduction']);
                     if ($resultUpdateRoom) {
                         $_SESSION["idRoom"] = $roomPlataform->getRoomId();
                     }
                     $resultRoom = $this->dao->getRoom($roomPlataform->getRoomId());
                     if ($resultRoom) {
                         $_SESSION["currentRoomManager"] = $resultRoom->getUserId();
                     }
                     $history = new History();
                     $history->setUserId($_SESSION["id"]);
                     $history->setProductionId($_SESSION['idProduction']);
                     $history->setDate(date('Y-m-d'));
                     $resultHistory = $this->dao->saveHistory($history);
                     // Retrieving the users in the room
                     $_REQUEST["users"] = $this->dao->getRoomUsers($_SESSION['idProduction']);
                     $this->pageController->run($forwards['success']);
                 } else {
                     // Otherwise, the room is closed and the user must wait until she opens
                     unset($_SESSION['id']);
                     unset($_SESSION['name']);
                     unset($_SESSION['roomCreator']);
                     unset($_SESSION['email']);
                     unset($_SESSION['user']);
                     // Closed room
                     echo "<script type='text/javascript'>";
                     echo "alert('" . $msgs->getText('error.plataform.closeRoom') . "');";
                     // Without permission			echo "history.go(-{$numReturnPages});";
                     echo "</script>";
                 }
             }
         } else {
             // Without permission
             echo "<script type='text/javascript'>";
             echo "alert('" . $msgs->getText('error.plataform.withoutPermission') . "');";
             echo "history.go(-{$numReturnPages});";
             echo "</script>";
         }
     } else {
         // Insufficient data
         echo "<script type='text/javascript'>";
         echo "alert('" . $msgs->getText('error.plataform.insufficientData') . "');";
         echo "history.go(-{$numReturnPages});";
         echo "</script>";
     }
 }
 public function execute($action)
 {
     $forwards = $action->getForwards();
     $msgs = Localization::getInstance();
     $message = $_POST['inviteFriendMessage'];
     $message = $message . "<br />" . $msgs->getText('inviteFriendForm.defaultMessage');
     $subject = $msgs->getText('inviteFriendForm.emailTitle');
     if (!empty($_POST['emailsSelecteds'])) {
         $listUsers = explode("-", $_POST['emailsSelecteds']);
         $code = md5($_POST[roomId]);
         $message = $message . "<br />" . $code;
         // Envio de email utilizando o PHPMailer
         unset($listUsers[0]);
         $mail = new PHPMailer();
         $mail->IsSMTP();
         $mail->IsHTML(true);
         //$mail->SMTPDebug= 2;
         $mail->Port = 25;
         $mail->Host = "nead.poa.ifrs.edu.br";
         //$mail->SMTPAuth = true;  // True caso use autentificação
         //$mail->Username = ''; // Usuário
         //$mail->Password = ''; // Senha
         //$mail->SMTPSecure = "ssl";
         $mail->Subject = $subject;
         $mail->From = "*****@*****.**";
         $mail->FromName = "WhiteBoard";
         foreach ($listUsers as $allowedUserEmail) {
             $mail->AddAddress($allowedUserEmail);
         }
         $mail->Body = $message;
         $mail->AltBody = $mail->Body;
         $enviado = $mail->Send();
         $mail->ClearAllRecipients();
         $mail->ClearAttachments();
         if ($enviado) {
             //echo "E-mail enviado com sucesso!";
         } else {
             echo "Não foi possível enviar o e-mail.<br /><br />";
             echo "<b>Informações do erro:</b> <br />" . $mail->ErrorInfo;
         }
     }
     $_SESSION['idRoomAux'] = $_POST[roomId];
     $this->pageController->run($forwards['success']);
 }