diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php
index 488adcda..2b2d3339 100644
--- a/app/Console/Commands/Test.php
+++ b/app/Console/Commands/Test.php
@@ -36,6 +36,7 @@ use Illuminate\Support\Facades\Storage;
use JeroenG\Explorer\Domain\Syntax\Matching;
use JeroenG\Explorer\Infrastructure\Scout\ElasticEngine;
use Nexus\Database\NexusDB;
+use Nexus\Imdb\Imdb;
use Rhilip\Bencode\Bencode;
class Test extends Command
@@ -118,14 +119,17 @@ class Test extends Command
// $r = $searchRep->deleteBookmark(1);
// $r = $searchRep->addBookmark(1);
- $rep = new AttendanceRepository();
- $uid = 1;
- $attendance = $rep->getAttendance($uid);
+// $rep = new AttendanceRepository();
+// $uid = 1;
+// $attendance = $rep->getAttendance($uid);
// $r = $rep->migrateAttendanceLogs($uid);
// $r = $rep->getContinuousDays($attendance);
- $r = $rep->getContinuousPoints(11);
- dd($r);
+// $r = $rep->getContinuousPoints(11);
+ $url = 'https://www.imdb.com/title/tt4574334/?ref_=vp_vi_tt';
+ $imdb = new Imdb();
+ $rating = $imdb->getRating($url);
+ dd($rating);
}
diff --git a/app/Models/Language.php b/app/Models/Language.php
index 8b0deb76..9d2b29b5 100644
--- a/app/Models/Language.php
+++ b/app/Models/Language.php
@@ -4,9 +4,19 @@ namespace App\Models;
class Language extends NexusModel
{
+ const DEFAULT_ENABLED = ['en', 'chs', 'cht'];
+
protected $table = 'language';
protected $fillable = [
'lang_name', 'site_lang_folder',
];
+
+ public static function listEnabled($withoutCache = false)
+ {
+ if ($withoutCache) {
+ return Setting::getFromDb('main.site_language_enabled', self::DEFAULT_ENABLED);
+ }
+ return Setting::get('main.site_language_enabled', self::DEFAULT_ENABLED);
+ }
}
diff --git a/app/Models/Torrent.php b/app/Models/Torrent.php
index 24d73f41..a78c329b 100644
--- a/app/Models/Torrent.php
+++ b/app/Models/Torrent.php
@@ -25,7 +25,8 @@ class Torrent extends NexusModel
const BANNED_NO = 'no';
protected $casts = [
- 'added' => 'datetime'
+ 'added' => 'datetime',
+ 'pt_gen' => 'array',
];
public static $commentFields = [
diff --git a/classes/class_cache_redis.php b/classes/class_cache_redis.php
index dc0d3b27..7f93c4e5 100644
--- a/classes/class_cache_redis.php
+++ b/classes/class_cache_redis.php
@@ -288,14 +288,12 @@ class class_cache_redis {
if (!$this->getIsEnabled()) {
return 0;
}
+ $this->redis->del($Key);
if ($AllLang){
$langfolder_array = $this->getLanguageFolderArray();
foreach($langfolder_array as $lf)
$this->redis->del($lf."_".$Key);
}
- else {
- $this->redis->del($Key);
- }
}
function getCacheReadTimes() {
diff --git a/include/constants.php b/include/constants.php
index 4bef625e..6816791b 100644
--- a/include/constants.php
+++ b/include/constants.php
@@ -1,6 +1,6 @@
',
$lang_functions['spoiler_expand_collapse'], $title, $contentClass, $content
);
- $js = <<%s', $align, $text));
+}
+
function format_urls($text, $newWindow = false) {
// return preg_replace("/((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/[^()\[\]<>\s]+)/ei", "formatUrl('\\1', ".($newWindow==true ? 1 : 0).", '', 'faqlink')", $text);
return preg_replace_callback("/((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/[^()\[\]<>\s]+)/i", function ($matches) use ($newWindow) {
@@ -340,12 +335,12 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab =
if ($enableimage) {
// $s = preg_replace("/\[img\]([^\<\r\n\"']+?)\[\/img\]/ei", "formatImg('\\1',".$imageresizer.",".$image_max_width.",".$image_max_height.")", $s, $imagenum, $imgReplaceCount);
$s = preg_replace_callback("/\[img\]([^\<\r\n\"']+?)\[\/img\]/i", function ($matches) use ($imageresizer, $image_max_width, $image_max_height) {
- return formatImg($matches[1],".$imageresizer.",".$image_max_width.",".$image_max_height.");
+ return formatImg($matches[1],$imageresizer,$image_max_width,$image_max_height);
}, $s, $imagenum, $imgReplaceCount);
// $s = preg_replace("/\[img=([^\<\r\n\"']+?)\]/ei", "formatImg('\\1',".$imageresizer.",".$image_max_width.",".$image_max_height.")", $s, ($imagenum != -1 ? max($imagenum-$imgReplaceCount, 0) : -1));
$s = preg_replace_callback("/\[img=([^\<\r\n\"']+?)\]/i", function ($matches) use ($imageresizer, $image_max_width, $image_max_height) {
- return formatImg($matches[1],".$imageresizer.",".$image_max_width.",".$image_max_height.");
+ return formatImg($matches[1],$imageresizer,$image_max_width,$image_max_height);
}, $s, ($imagenum != -1 ? max($imagenum-$imgReplaceCount, 0) : -1));
} else {
$s = preg_replace("/\[img\]([^\<\r\n\"']+?)\[\/img\]/i", '', $s, -1);
@@ -380,12 +375,6 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab =
return formatYoutube($matches[4], $matches[2], $matches[3]);
}, $s);
}
- //[spoiler=What happens to the hero?]The hero dies at the end![/spoiler]
- if (str_contains($s, '[spoiler')) {
- $s = preg_replace_callback("/\[spoiler(=(.*))?\](.*)\[\/spoiler\]/isU", function ($matches) {
- return formatSpoiler($matches[3], $matches[2], nexus()->getScript() != 'preview');
- }, $s);
- }
// [url=http://www.example.com]Text[/url]
if ($adid) {
@@ -406,6 +395,22 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab =
return formatUrl($matches[1], ".($newtab==true ? 1 : 0).", '', 'faqlink');
}, $s);
+ // [left]Left text[/left]
+ $s = preg_replace_callback("/\[left\](.*)\[\/left\]/isU", function ($matches) {
+ return formatTextAlign($matches[1], 'left');
+ }, $s);
+
+ // [center]Center text[/center]
+ $s = preg_replace_callback("/\[center\](.*)\[\/center\]/isU", function ($matches) {
+ return formatTextAlign($matches[1], 'center');
+ }, $s);
+
+ // [right]Right text[/right]
+ $s = preg_replace_callback("/\[right\](.*)\[\/right\]/isU", function ($matches) {
+ return formatTextAlign($matches[1], 'right');
+ }, $s);
+
+
$s = format_urls($s, $newtab);
// Quotes
if (strpos($s,"[quote") !== false && strpos($s,"[/quote]") !== false) { //format_quote is kind of slow. Better check if [quote] exists beforehand
@@ -417,6 +422,14 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab =
$smile = get_smile($matches[1]);
return $smile ? '
' : '[em' . $matches[1] . ']';
}, $s);
+
+ //[spoiler=What happens to the hero?]The hero dies at the end![/spoiler]
+ if (str_contains($s, '[spoiler')) {
+ $s = preg_replace_callback("/\[spoiler(=(.*))?\](.*)\[\/spoiler\]/isU", function ($matches) {
+ return formatSpoiler($matches[3], $matches[2], nexus()->getScript() != 'preview');
+ }, $s);
+ }
+
reset($tempCode);
$j = $i = 0;
while(count($tempCode) || $j > 5) {
@@ -1139,8 +1152,15 @@ function get_external_tr($imdb_url = "")
{
global $lang_functions;
global $showextinfo;
+ if ($showextinfo['imdb'] != 'yes') {
+ return '';
+ }
+ $ptGen = new Nexus\PTGen\PTGen();
$imdbNumber = parse_imdb_id($imdb_url);
- ($showextinfo['imdb'] == 'yes' ? tr($lang_functions['row_imdb_url'], "
".$lang_functions['text_imdb_url_note']."", 1) : "");
+ $y = $ptGen->buildInput("url", $imdbNumber ? "http://www.imdb.com/title/tt".parse_imdb_id($imdb_url) : "", $lang_functions['text_imdb_url_note'], $lang_functions['pt_gen_get_description']);
+ return tr($lang_functions['row_imdb_url'], $y, 1);
+
+// ($showextinfo['imdb'] == 'yes' ? tr($lang_functions['row_imdb_url'], "
".$lang_functions['text_imdb_url_note']."", 1) : "");
}
function get_torrent_extinfo_identifier($torrentid)
@@ -2431,19 +2451,19 @@ if ($CURUSER){
}
?>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -2770,15 +2790,16 @@ function stdfoot() {
foreach (\Nexus\Nexus::getAppendFooters() as $value) {
print($value);
}
- $backToTop = <<
+ $js = <<
+
-TOTOP;
- print($backToTop);
+JS;
+ print($js);
print("