Skip to content

Commit ce660af

Browse files
Back office : Fix TMDB age restriction import
--------- Co-authored-by: MacWarrior <[email protected]>
1 parent 893c7e9 commit ce660af

File tree

6 files changed

+18
-6
lines changed

6 files changed

+18
-6
lines changed

upload/admin_area/styles/cb_2014/theme/js/pages/edit_video/edit_video.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function saveInfoTmdb(tmdb_video_id, type) {
132132
hideSpinner();
133133
$('.page-content').prepend(result['msg']);
134134
} else {
135-
location.reload();
135+
window.location.href = window.location.href;
136136
}
137137
},
138138
});

upload/admin_area/styles/cb_2014/theme/js/pages/edit_video/edit_video.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

upload/changelog/552.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version":"5.5.2",
3-
"revision":"168",
3+
"revision":"169",
44
"status":"stable",
55
"detail":[
66
{
@@ -63,6 +63,7 @@
6363
,"Fix settings saving issues"
6464
,"Fix missing config warning"
6565
,"Fix TMDB tags import"
66+
,"Fix TMDB age restriction import"
6667
]
6768
},
6869
{

upload/includes/classes/tmdb.class.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,18 @@ public function movieCurrentLanguageAgeRestriction($movie_id)
8383
{
8484
$results = $this->requestAPI('movie/' . $movie_id . '/release_dates')['response']['results'];
8585
$restriction = array_search(strtoupper($this->language), array_column($results, 'iso_3166_1'));
86+
if (empty($restriction) && $this->language == 'en') {
87+
$restriction = array_search('US', array_column($results, 'iso_3166_1'));
88+
}
8689
if ($restriction !== false) {
87-
return (!empty($results[$restriction]['release_dates'][0]['certification']) ? $results[$restriction]['release_dates'][0]['certification'] : 0);
90+
foreach ($results[$restriction]['release_dates'] as $certification) {
91+
if (!empty($certification['certification'])) {
92+
if ($certification['certification'] == 'R') {
93+
return 17;
94+
}
95+
return $certification['certification'];
96+
}
97+
}
8898
}
8999
return 0;
90100
}
@@ -310,6 +320,7 @@ public function importDataFromTmdb(int $videoid, int $tmdb_id, $type = 'movie')
310320
$credentials = $this->seriesCurrentLanguageAgeRestriction($tmdb_id);
311321
break;
312322
}
323+
$credentials = preg_replace('/\D/', '',$credentials);
313324
$video_info['age_restriction'] = $credentials;
314325
if (!$credentials && config('enable_tmdb_mature_content') == 'yes' && $details['adult']) {
315326
$video_info['age_restriction'] = config('tmdb_mature_content_age');

upload/styles/cb_28/theme/js/pages/edit_video/edit_video.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function saveInfoTmdb(tmdb_video_id, type, videoid) {
147147
hideSpinner();
148148
$('.page-content').prepend(result['msg']);
149149
} else {
150-
location.reload();
150+
window.location.href = window.location.href;
151151
}
152152
},
153153
});

0 commit comments

Comments
 (0)