Skip to content
Snippets Groups Projects
Commit ed4e1885 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #76 from greezybacon/issue/video-embedding


Allow embedding videos via <iframes>

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents eab9f7f2 8d01fcac
No related branches found
No related tags found
No related merge requests found
...@@ -134,7 +134,10 @@ class Format { ...@@ -134,7 +134,10 @@ class Format {
function html($html, $config=array('balance'=>1)) { function html($html, $config=array('balance'=>1)) {
require_once(INCLUDE_DIR.'htmLawed.php'); require_once(INCLUDE_DIR.'htmLawed.php');
return htmLawed($html, $config); $spec = false;
if (isset($config['spec']))
$spec = $config['spec'];
return htmLawed($html, $config, $spec);
} }
function html2text($html, $width=74, $tidy=true) { function html2text($html, $width=74, $tidy=true) {
...@@ -215,6 +218,8 @@ class Format { ...@@ -215,6 +218,8 @@ class Format {
'deny_attribute' => 'id', 'deny_attribute' => 'id',
'schemes' => 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; *:file, http, https; src: cid, http, https, data', 'schemes' => 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; *:file, http, https; src: cid, http, https, data',
'hook_tag' => function($e, $a=0) { return Format::__html_cleanup($e, $a); }, 'hook_tag' => function($e, $a=0) { return Format::__html_cleanup($e, $a); },
'elements' => '*+iframe',
'spec' => 'iframe=-*,height,width,type,src(match="`^(https?:)?//(www\.)?(youtube|dailymotion|vimeo)\.com/`i"),frameborder;',
); );
return Format::html($html, $config); return Format::html($html, $config);
......
...@@ -97,7 +97,7 @@ if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) { ...@@ -97,7 +97,7 @@ if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) {
?> ?>
<table class="thread-entry <?php echo $threadType[$entry['thread_type']]; ?>" cellspacing="0" cellpadding="1" width="800" border="0"> <table class="thread-entry <?php echo $threadType[$entry['thread_type']]; ?>" cellspacing="0" cellpadding="1" width="800" border="0">
<tr><th><?php echo Format::db_datetime($entry['created']); ?> &nbsp;&nbsp;<span class="textra"></span><span><?php echo $poster; ?></span></th></tr> <tr><th><?php echo Format::db_datetime($entry['created']); ?> &nbsp;&nbsp;<span class="textra"></span><span><?php echo $poster; ?></span></th></tr>
<tr><td class="thread-body"><?php echo Format::viewableImages(Format::display($entry['body'])); ?></td></tr> <tr><td class="thread-body"><div><?php echo Format::viewableImages(Format::display($entry['body'])); ?></div></td></tr>
<?php <?php
if($entry['attachments'] if($entry['attachments']
&& ($tentry=$ticket->getThreadEntry($entry['id'])) && ($tentry=$ticket->getThreadEntry($entry['id']))
......
...@@ -383,8 +383,8 @@ if(!$cfg->showNotesInline()) { ?> ...@@ -383,8 +383,8 @@ if(!$cfg->showNotesInline()) { ?>
<th width="auto" class="tmeta"><?php echo Format::htmlchars($entry['poster']); ?></th> <th width="auto" class="tmeta"><?php echo Format::htmlchars($entry['poster']); ?></th>
</tr> </tr>
<tr><td colspan="4" class="thread-body" id="thread-id-<?php <tr><td colspan="4" class="thread-body" id="thread-id-<?php
echo $entry['id']; ?>"><?php echo $entry['id']; ?>"><div><?php
echo Format::viewableImages(Format::display($entry['body'])); ?></td></tr> echo Format::viewableImages(Format::display($entry['body'])); ?></div></td></tr>
<?php <?php
if($entry['attachments'] if($entry['attachments']
&& ($tentry=$ticket->getThreadEntry($entry['id'])) && ($tentry=$ticket->getThreadEntry($entry['id']))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment