mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 04:20:49 +08:00
add back to top
This commit is contained in:
@@ -789,13 +789,14 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
||||
}
|
||||
|
||||
//update exam progress
|
||||
$examRep = new \App\Repositories\ExamRepository();
|
||||
$updateExamProgressResult = $examRep->updateProgressBulk();
|
||||
$log = 'update exam progress';
|
||||
do_log($log . ", result: " . json_encode($updateExamProgressResult));
|
||||
if ($printProgress) {
|
||||
printProgress($log);
|
||||
}
|
||||
//move to cronjob from v1.7
|
||||
// $examRep = new \App\Repositories\ExamRepository();
|
||||
// $updateExamProgressResult = $examRep->updateProgressBulk();
|
||||
// $log = 'update exam progress';
|
||||
// do_log($log . ", result: " . json_encode($updateExamProgressResult));
|
||||
// if ($printProgress) {
|
||||
// printProgress($log);
|
||||
// }
|
||||
|
||||
// delete torrents that have been dead for a long time
|
||||
if ($deldeadtorrent_torrent > 0){
|
||||
|
||||
@@ -352,7 +352,8 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab =
|
||||
|
||||
// $s = preg_replace("/\[em([1-9][0-9]*)\]/ie", "(\\1 < 192 ? '<img src=\"pic/smilies/\\1.gif\" alt=\"[em\\1]\" />' : '[em\\1]')", $s);
|
||||
$s = preg_replace_callback("/\[em([1-9][0-9]*)\]/i", function ($matches) {
|
||||
return $matches[1] < 192 ? '<img src="pic/smilies/' . $matches[1] . '.gif" alt="[em' . $matches[1] . ']" />' : '[em' . $matches[1] . ']';
|
||||
$smile = get_smile($matches[1]);
|
||||
return $smile ? '<img src="'.$smile.'" alt="[em' . $matches[1] . ']" />' : '[em' . $matches[1] . ']';
|
||||
}, $s);
|
||||
reset($tempCode);
|
||||
$j = $i = 0;
|
||||
@@ -2707,6 +2708,15 @@ function stdfoot() {
|
||||
foreach (\Nexus\Nexus::getAppendFooters() as $value) {
|
||||
print($value);
|
||||
}
|
||||
$backToTop = <<<TOTOP
|
||||
<script type="application/javascript" src="/vendor/jquery-goup-1.1.3/jquery.goup.min.js"></script>
|
||||
<script>
|
||||
jQuery(document).ready(function(){
|
||||
jQuery.goup();
|
||||
});
|
||||
</script>
|
||||
TOTOP;
|
||||
print($backToTop);
|
||||
print("</body></html>");
|
||||
|
||||
//echo replacePngTags(ob_get_clean());
|
||||
@@ -3208,6 +3218,8 @@ if ($smalldescription_main == 'no' || $CURUSER['showsmalldescr'] == 'no')
|
||||
$displaysmalldescr = false;
|
||||
else $displaysmalldescr = true;
|
||||
//while ($row = mysql_fetch_assoc($res))
|
||||
$lastcom_tooltip = [];
|
||||
$torrent_tooltip = [];
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$id = $row["id"];
|
||||
@@ -3368,8 +3380,6 @@ foreach ($rows as $row)
|
||||
//comments
|
||||
|
||||
$nl = "<br />";
|
||||
$lastcom_tooltip = [];
|
||||
$torrent_tooltip = [];
|
||||
if (!$row["comments"]) {
|
||||
print("<a href=\"comment.php?action=add&pid=".$id."&type=torrent\" title=\"".$lang_functions['title_add_comments']."\">" . $row["comments"] . "</a>");
|
||||
} else {
|
||||
@@ -3688,7 +3698,7 @@ function create_tooltip_container($id_content_arr, $width = 400)
|
||||
{
|
||||
if(count($id_content_arr))
|
||||
{
|
||||
$result = "<div id=\"tooltipPool\" style=\"display: none\">";
|
||||
$result = "<div style=\"display: none\">";
|
||||
foreach($id_content_arr as $id_content_arr_each)
|
||||
{
|
||||
$result .= "<div id=\"" . $id_content_arr_each['id'] . "\">" . $id_content_arr_each['content'] . "</div>";
|
||||
@@ -3703,12 +3713,13 @@ function getimdb($imdb_id, $cache_stamp, $mode = 'minor')
|
||||
global $lang_functions;
|
||||
global $showextinfo;
|
||||
$thenumbers = $imdb_id;
|
||||
$movie = new imdb ($thenumbers);
|
||||
$imdb = new Nexus\Imdb\Imdb();
|
||||
$movie = $imdb->getMovie($imdb_id);
|
||||
$movieid = $thenumbers;
|
||||
$movie->setid ($movieid);
|
||||
// $movie->setid ($movieid);
|
||||
|
||||
$target = array('Title', 'Credits', 'Plot');
|
||||
switch ($movie->cachestate($target))
|
||||
switch ($imdb->getCacheStatus($imdb_id))
|
||||
{
|
||||
case "0": //cache is not ready
|
||||
{
|
||||
@@ -3772,7 +3783,7 @@ function getimdb($imdb_id, $cache_stamp, $mode = 'minor')
|
||||
}
|
||||
case 'median':
|
||||
{
|
||||
if (($photo_url = $movie->photo_localurl() ) != FALSE)
|
||||
if (($photo_url = $movie->photo() ) != FALSE)
|
||||
$smallth = "<img src=\"".$photo_url. "\" width=\"105\" alt=\"poster\" />";
|
||||
else $smallth = "";
|
||||
$runtime = $movie->runtime ();
|
||||
@@ -5355,4 +5366,19 @@ function insert_torrent_tags($torrentId, $tagIdArr, $sync = false)
|
||||
sql_query($insertTagsSql);
|
||||
}
|
||||
|
||||
function get_smile($num)
|
||||
{
|
||||
static $all;
|
||||
if (is_null($all)) {
|
||||
$all = [];
|
||||
$prefix = getFullDirectory('public');
|
||||
foreach (glob(getFullDirectory('public/pic/smilies') . '/*') as $value) {
|
||||
$subPath = substr($value, strlen($prefix));
|
||||
$basename = basename($subPath);
|
||||
$all[strstr($basename, '.', true)] = $subPath;
|
||||
}
|
||||
}
|
||||
return $all[$num] ?? null;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -276,36 +276,37 @@ function nexus_config($key, $default = null)
|
||||
*
|
||||
* @date 2021/1/11
|
||||
* @param null $name
|
||||
* @return array|mixed|string
|
||||
* @param null $default
|
||||
* @return mixed
|
||||
*/
|
||||
function get_setting($name = null)
|
||||
function get_setting($name = null, $default = null): mixed
|
||||
{
|
||||
static $settings;
|
||||
if (is_null($settings)) {
|
||||
$settings = \Nexus\Database\NexusDB::remember("nexus_settings_in_nexus", 10, function () {
|
||||
//get all settings from database
|
||||
$sql = "select name, value from settings";
|
||||
$result = sql_query($sql);
|
||||
$final = [];
|
||||
while ($row = mysql_fetch_assoc($result)) {
|
||||
$value = $row['value'];
|
||||
if (!is_null($value)) {
|
||||
$arr = json_decode($value, true);
|
||||
if (is_array($arr)) {
|
||||
$value = $arr;
|
||||
}
|
||||
}
|
||||
arr_set($final, $row['name'], $value);
|
||||
}
|
||||
return $final;
|
||||
return \App\Models\Setting::getFromDb();
|
||||
});
|
||||
}
|
||||
if (is_null($name)) {
|
||||
return $settings;
|
||||
}
|
||||
return arr_get($settings, $name);
|
||||
return arr_get($settings, $name, $default);
|
||||
}
|
||||
|
||||
function get_setting_from_db($name = null, $default = null)
|
||||
{
|
||||
static $final;
|
||||
if (is_null($final)) {
|
||||
$final = \App\Models\Setting::getFromDb();
|
||||
}
|
||||
if (is_null($name)) {
|
||||
return $final;
|
||||
}
|
||||
return arr_get($final, $name, $default);
|
||||
}
|
||||
|
||||
|
||||
function nexus_env($key = null, $default = null)
|
||||
{
|
||||
static $env;
|
||||
|
||||
Reference in New Issue
Block a user