Skip to content

Commit

Permalink
VLC Player #11
Browse files Browse the repository at this point in the history
  • Loading branch information
jreklund committed Sep 20, 2017
1 parent 5ae77f8 commit 6b5fbba
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/util.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function fillObject($obj, $row, $include = array(), $exclude = array()) {
$allowed = false;
}
if($allowed)
$obj->{$key} = stripslashes($value);
$obj->{$key} = $value;
}
return $obj;
}
Expand Down
3 changes: 2 additions & 1 deletion tpl/default/javascripts/php4dvd.validate.min.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions tpl/default/javascripts/src/jquery.validate.php4dvd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
jQuery.validator.addMethod("vlcPlayer", function(value, element) {
// Copyright (c) 2010-2013 Diego Perini, MIT licensed
// https://gist.github.com/dperini/729294
// see also https://mathiasbynens.be/demo/url-regex
// modified to allow protocol-relative URLs
// modified to allow windows and linux paths
return this.optional( element )
|| /^(?:(?:(?:https?):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value )
|| /^[a-z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$/i.test( value )
|| /^(\/[\w^ ]+)+\/?([\w.])+[^.]$/i.test( value );
}, "Please enter a valid URL.");
4 changes: 3 additions & 1 deletion tpl/default/movies/javascript/update.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
$.validator.messages["digits"] = "<i class='fa fa-times-circle-o' aria-hidden='true'></i> {$smarty.const.VALIDATOR_DIGITS|htmlentities:3:'UTF-8'}";
$.validator.messages["email"] = "<i class='fa fa-times-circle-o' aria-hidden='true'></i> {$smarty.const.VALIDATOR_EMAIL|htmlentities:3:'UTF-8'}";
$.validator.messages["url"] = "<i class='fa fa-times-circle-o' aria-hidden='true'></i> {$smarty.const.VALIDATOR_URL|htmlentities:3:'UTF-8'}";
$.validator.messages["vlcPlayer"] = "<i class='fa fa-times-circle-o' aria-hidden='true'></i> {$smarty.const.VALIDATOR_URL|htmlentities:3:'UTF-8'}";
$.validator.messages["date"] = "<i class='fa fa-times-circle-o' aria-hidden='true'></i> {$smarty.const.VALIDATOR_DATE|htmlentities:3:'UTF-8'}";
$.validator.messages["accept"] = "<i class='fa fa-times-circle-o' aria-hidden='true'></i> {$smarty.const.VALIDATOR_ACCEPT_JPG|htmlentities:3:'UTF-8'}";
$("#imdbsearchform").validate();
Expand All @@ -23,7 +24,8 @@
success: function(e){ e.parents(".has-feedback").removeClass("has-error"),e.parent("div").remove() },
rules: {
photo: { required: false, accept: "image/jpg,image/jpeg", },
cover: { required: false, accept: "image/jpg,image/jpeg", }
cover: { required: false, accept: "image/jpg,image/jpeg", },
trailer: { vlcPlayer: true }
}
});
$("#updateform").valid();
Expand Down
8 changes: 7 additions & 1 deletion tpl/default/movies/movie/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
<span class="hidden-sm">{$smarty.const.VISIT_IMDB}</span></a>
</li>
{/if}
{if $movie->trailer}
{if 0 !== $movie->trailer|strpos:"http://"}
<li>
<a href="vlc://file:///{$movie->trailer}" rel="noreferrer noopener" title="{$movie->name|htmlentities:3:'UTF-8'} ({$movie->year|htmlentities:3:'UTF-8'})">
<i class="fa fa-youtube-play fa-fw" title="{$smarty.const.VIEW_TRAILER|htmlentities:3:'UTF-8'}" aria-hidden="true"></i>
<span class="hidden-sm">{$smarty.const.VIEW_TRAILER|htmlentities:3:'UTF-8'}</span></a>
</li>
{elseif $movie->trailer}
<li>
<a href="{$movie->trailer}" class="popup-trailer" target="_blank" rel="noreferrer noopener" title="{$movie->name|htmlentities:3:'UTF-8'} ({$movie->year|htmlentities:3:'UTF-8'})">
<i class="fa fa-youtube-play fa-fw" title="{$smarty.const.VIEW_TRAILER|htmlentities:3:'UTF-8'}" aria-hidden="true"></i>
Expand Down
2 changes: 1 addition & 1 deletion tpl/default/movies/update.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ <h3 class="box-title">{$smarty.const.MOVIE_INFORMATION|htmlentities:3:'UTF-8'}</
<div class="form-group has-feedback">
<label for="trailer" class="{$colWidthSmall} control-label">{$smarty.const.TRAILER_URL|htmlentities:3:'UTF-8'} {if isset($movie)}<a href="http://www.youtube.com/results?search_query={$movie->name|htmlentities:3:'UTF-8'|urlencode}+{$movie->year|htmlentities:3:'UTF-8'}+trailer" target="_blank" rel="noreferrer noopener"><i class="fa fa-search" title="{$smarty.const.SEARCH_FOR_TRAILER|htmlentities:3:'UTF-8'} - YouTube" aria-hidden="true"></i></a>{/if}</label>
<div class="{$colWidthLarge}">
<input type="text" name="trailer" id="trailer" class="form-control url" value="{if isset($movie)}{$movie->trailer|htmlentities:3:'UTF-8'}{/if}" placeholder="{$smarty.const.TRAILER_URL|htmlentities:3:'UTF-8'}">
<input type="text" name="trailer" id="trailer" class="form-control" value="{if isset($movie)}{$movie->trailer|htmlentities:3:'UTF-8'}{/if}" placeholder="{$smarty.const.TRAILER_URL|htmlentities:3:'UTF-8'}">
</div>
</div>
<div class="form-group has-feedback">
Expand Down

0 comments on commit 6b5fbba

Please sign in to comment.