Skip to content
This repository has been archived by the owner on Aug 13, 2022. It is now read-only.

Commit

Permalink
added safety checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Guite committed Oct 24, 2018
1 parent 1c5b792 commit 5b8746a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -138,6 +138,9 @@ New features:
- Added missing support for query and request arguments to controller content type (#307).
- Use title as fallback for description in finder.

Bugfixes:
- Addition of (minor) safety check for Slideshare, Vimeo and YouTube content types.

### Version 5.0.1

Bugfixes:
Expand Down
Expand Up @@ -87,7 +87,7 @@ public function displayView()
$this->data['slideUrl'] = '';
$this->data['details'] = '';

if ('' != $this->data['url']) {
if (isset($this->data['url']) && '' != $this->data['url']) {
$content = $this->cacheHelper->fetch('https://www.slideshare.net/api/oembed/2?url=' . $this->data['url'] . '&format=json');
if (false !== $content) {
$this->data['details'] = @json_decode($content, true);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Zikula/ContentModule/ContentType/VimeoType.php
Expand Up @@ -95,7 +95,7 @@ public function displayView()
$this->data['videoId'] = '';
$this->data['details'] = '';
$r = '/vimeo.com\/([-a-zA-Z0-9_]+)/';
if (preg_match($r, $this->data['url'], $matches)) {
if (isset($this->data['url']) && '' != $this->data['url'] && preg_match($r, $this->data['url'], $matches)) {
$this->data['videoId'] = $matches[1];
$content = $this->cacheHelper->fetch('https://vimeo.com/api/v2/video/' . $this->data['videoId'] . '.php');
if (false !== $content) {
Expand Down
Expand Up @@ -97,7 +97,7 @@ public function displayView()
{
$this->data['videoId'] = '';
$r = '/\?v=([-a-zA-Z0-9_]+)(&|$)/';
if (preg_match($r, $this->data['url'], $matches)) {
if (isset($this->data['url']) && '' != $this->data['url'] && preg_match($r, $this->data['url'], $matches)) {
$this->data['videoId'] = $matches[1];
// @todo fetch additional data if needed - requires an API key though
// https://developers.google.com/youtube/v3/docs/
Expand Down

0 comments on commit 5b8746a

Please sign in to comment.