Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

ofaj
jmontoyaa 9 years ago
commit ccd665ef79
  1. 19
      main/inc/lib/api.lib.php
  2. 5
      main/inc/lib/document.lib.php
  3. 9
      main/inc/lib/message.lib.php
  4. 6
      main/inc/lib/notification.lib.php
  5. 7
      src/Chamilo/CoreBundle/Component/HTMLPurifier/Filter/AllowIframes.php

@ -7857,8 +7857,8 @@ function api_create_protected_dir($name, $parentDirectory)
* @param string sender e-mail
* @param array extra headers in form $headers = array($name => $value) to allow parsing
* @param array data file (path and filename)
* @param array data to attach a file (optional)
* @param bool True for attaching a embedded file inside content html (optional)
* @param array Additional parameters
* @return returns true if mail was sent
* @see class.phpmailer.php
*/
@ -7979,7 +7979,22 @@ function api_mail_html(
// Attachment ...
if (!empty($data_file)) {
$mail->AddAttachment($data_file['path'], $data_file['filename']);
$o = 0;
foreach ($data_file as $file_attach) {
if (!empty($file_attach['path']) && !empty($file_attach['filename'])) {
$mail->AddAttachment($file_attach['path'], $file_attach['filename']);
}
$o++;
}
} elseif (is_array($_FILES)) {
$data_file = $_FILES;
$o = 0;
foreach ($data_file as $file_attach) {
if (!empty($file_attach['tmp_name']) && !empty($file_attach['name'])) {
$mail->AddAttachment($file_attach['tmp_name'], $file_attach['name']);
}
$o++;
}
}
// Only valid addresses are accepted.

@ -2815,6 +2815,11 @@ class DocumentManager
if ($upload_ok) {
// File got on the server without problems, now process it
if ($title) {
$titleAndExt = explode('.', $files[$fileKey]['name']);
$ext = end($titleAndExt);
$files[$fileKey]['name'] = $title.'.'.$ext;
}
$new_path = handle_uploaded_document(
$course_info,
$files[$fileKey],

@ -362,6 +362,12 @@ class MessageManager
// Load user settings.
$notification = new Notification();
$sender_info = api_get_user_info($user_sender_id);
// add file attachment additional attributes
foreach ($file_attachments as $index => $file_attach) {
$file_attachments[$index]['path'] = $file_attach['tmp_name'];
$file_attachments[$index]['filename'] = $file_attach['name'];
}
if (empty($group_id)) {
$type = Notification::NOTIFICATION_TYPE_MESSAGE;
@ -373,7 +379,8 @@ class MessageManager
array($receiver_user_id),
$subject,
$content,
$sender_info
$sender_info,
$file_attachments
);
} else {
$usergroup = new UserGroup();

@ -227,7 +227,8 @@ class Notification extends Model
$user_list,
$title,
$content,
$senderInfo = array()
$senderInfo = array(),
$attachments = array()
) {
$this->type = intval($type);
$content = $this->formatContent($content, $senderInfo);
@ -307,7 +308,8 @@ class Notification extends Model
Security::filter_terms($content),
$this->adminName,
$this->adminEmail,
$extraHeaders
$extraHeaders,
$attachments
);
}
$sendDate = api_get_utc_datetime();

@ -54,11 +54,16 @@ class AllowIframes extends HTMLPurifier_Filter
protected function postFilterCallback($matches)
{
// Domain Whitelist
$hostName = array();
preg_match('#https?://(.*)#i', api_get_path(WEB_PATH), $hostName);
$youTubeMatch = preg_match('#src="(https:)?//www.youtube(-nocookie)?.com/#i', $matches[1]);
$vimeoMatch = preg_match('#://player.vimeo.com/#i', $matches[1]);
$googleMapsMatch = preg_match('#src="https://maps.google.com/#i', $matches[1]);
$slideShare = preg_match('#src="(https?:)?//www.slideshare.net/#', $matches[1]);
$platformDomain = preg_match('#src="https?://(.+\.)?' . $hostName[1] . '#i', $matches[1]);
if ($youTubeMatch || $vimeoMatch || $googleMapsMatch) {
if ($youTubeMatch || $vimeoMatch || $googleMapsMatch || $slideShare || $platformDomain) {
$extra = ' frameborder="0"';
if ($youTubeMatch) {
$extra .= ' allowfullscreen';

Loading…
Cancel
Save