*/ // name of the language file that needs to be included use \ChamiloSession as Session; $language_file = "index"; require_once '../inc/global.inc.php'; require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php'; if (empty($_user['user_id'])) { api_not_allowed(true); } //api_protect_course_script(); //not a course script, so no protection if (empty($_SESSION['origin_url'])) { $origin_url = $_SERVER['HTTP_REFERER']; Session::write('origin_url',$origin_url); } /* Process the form and redirect to origin */ if (!empty($_POST['submit_email']) && !empty($_POST['email_title']) && !empty($_POST['email_text'])) { $text = Security::remove_XSS($_POST['email_text'])."\n\n---\n".get_lang('EmailSentFromDokeos')." ".api_get_path(WEB_PATH); $email_administrator=Security::remove_XSS($_POST['dest']); $user_id=api_get_user_id(); $title=Security::remove_XSS($_POST['email_title']); $content=Security::remove_XSS($_POST['email_text']); if (!empty($_user['mail'])) { api_mail('',$email_administrator,$title,$text,api_get_person_name($_user['firstname'],$_user['lastname']), $_user['mail']); UserManager::send_message_in_outbox ($email_administrator,$user_id,$title, $content); } else { api_mail('',$email_administrator,$title,$text,get_lang('Anonymous')); } $orig = $_SESSION['origin_url']; Session::erase('origin_url'); header('location:'.$orig); } /* Header */ Display::display_header(get_lang('SendEmail')); ?>