mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 04:20:49 +08:00
upload preivew + es command
This commit is contained in:
@@ -70,7 +70,7 @@ foreach ($settings as $name => $value) {
|
||||
$SITENAME = $BASIC['SITENAME'];
|
||||
$BASEURL = $BASIC['BASEURL'] ?: ($_SERVER['HTTP_HOST'] ?? '');
|
||||
$announce_urls = array();
|
||||
$announce_urls[] = $BASIC['announce_url'] ?: ($BASEURL . '/announce.php');
|
||||
$announce_urls[] = $BASIC['announce_url'] ?: ($BASEURL . '/api/announce');
|
||||
|
||||
$SITE_ONLINE = $MAIN['site_online'];
|
||||
$max_torrent_size = $MAIN['max_torrent_size'];
|
||||
|
||||
@@ -636,13 +636,22 @@ function get_elapsed_time($ts,$shortunit = false)
|
||||
return "< 1".($shortunit ? $lang_functions['text_short_min'] : $lang_functions['text_min']);
|
||||
}
|
||||
|
||||
function textbbcode($form,$text,$content="",$hastitle=false, $col_num = 130)
|
||||
function textbbcode($form,$text,$content="",$hastitle=false, $col_num = 130, $withPreview = false)
|
||||
{
|
||||
global $lang_functions;
|
||||
global $subject, $BASEURL, $CURUSER, $enableattach_attachment;
|
||||
$editTbodyId = "$form-$text-edit";
|
||||
$previewTbodyId = "$form-$text-preview";
|
||||
$btnEditId = "$form-$text-btn-edit";
|
||||
$btnPreviewId = "$form-$text-btn-preview";
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
let textareaId = "<?php echo $text?>"
|
||||
let editTbodyId = "<?php echo $editTbodyId?>"
|
||||
let previewTbodyId = "<?php echo $previewTbodyId?>"
|
||||
let btnEditId = "<?php echo $btnEditId?>"
|
||||
let btnPreviewId = "<?php echo $btnPreviewId?>"
|
||||
//<![CDATA[
|
||||
var b_open = 0;
|
||||
var i_open = 0;
|
||||
@@ -841,9 +850,25 @@ function simpletag(thetag)
|
||||
cstat();
|
||||
}
|
||||
}
|
||||
|
||||
function textBBCodePreview() {
|
||||
let poststr = encodeURIComponent( document.getElementById(textareaId).value );
|
||||
let result=ajax.posts('preview.php','body='+poststr);
|
||||
jQuery('#' + editTbodyId).hide()
|
||||
jQuery('#' + previewTbodyId).html(result).show()
|
||||
jQuery('#' + btnPreviewId).hide()
|
||||
jQuery('#' + btnEditId).show()
|
||||
}
|
||||
function textBBCodeEdit() {
|
||||
jQuery('#' + editTbodyId).show()
|
||||
jQuery('#' + previewTbodyId).hide()
|
||||
jQuery('#' + btnPreviewId).show()
|
||||
jQuery('#' + btnEditId).hide()
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
<table width="100%" cellspacing="0" cellpadding="5" border="0">
|
||||
<tbody id="<?php echo $editTbodyId?>">
|
||||
<tr><td align="left" colspan="2">
|
||||
<table cellspacing="1" cellpadding="2" border="0">
|
||||
<tr>
|
||||
@@ -944,16 +969,16 @@ if ($enableattach_attachment == 'yes'){
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2" valign="middle">
|
||||
<iframe src="<?php echo get_protocol_prefix() . $BASEURL?>/attachment.php" width="100%" height="24" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>
|
||||
<iframe src="<?php echo getSchemeAndHttpHost()?>/attachment.php" width="100%" height="24" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
print("<tr>");
|
||||
print("<td align=\"left\"><textarea class=\"bbcode\" cols=\"100\" style=\"width: 650px;\" name=\"".$text."\" id=\"".$text."\" rows=\"20\" onkeydown=\"ctrlenter(event,'compose','qr')\">".$content."</textarea>");
|
||||
print("<td align=\"left\"><textarea class=\"bbcode\" cols=\"100\" style=\"width: 100%;\" name=\"".$text."\" id=\"".$text."\" rows=\"20\" onkeydown=\"ctrlenter(event,'compose','qr')\">".$content."</textarea>");
|
||||
?>
|
||||
</td>
|
||||
<td align="center" width="99%">
|
||||
<td align="center" width="">
|
||||
<table cellspacing="1" cellpadding="3">
|
||||
<tr>
|
||||
<?php
|
||||
@@ -970,7 +995,17 @@ foreach ($quickSmilies as $smily) {
|
||||
</tr></table>
|
||||
<br />
|
||||
<a href="javascript:winop();"><?php echo $lang_functions['text_more_smilies'] ?></a>
|
||||
</td></tr></table>
|
||||
</td></tr></tobdy>
|
||||
<?php if($withPreview) {?>
|
||||
<tbody id="<?php echo $previewTbodyId?>"></tbody>
|
||||
<tbody>
|
||||
<tr><td colspan="2" style="text-align: center;border: none">
|
||||
<input id="<?php echo $btnPreviewId ?>" type="button" class="btn" value="<?php echo $lang_functions['submit_preview']?>" onclick="javascript:textBBCodePreview()">
|
||||
<input id="<?php echo $btnEditId ?>" type="button" class="btn" style="display: none" value="<?php echo $lang_functions['submit_edit']?>" onclick="javascript:textBBCodeEdit()">
|
||||
</td></tr>
|
||||
</tbody>
|
||||
<?php }?>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -1009,7 +1044,7 @@ function begin_compose($title = "",$type="new", $body="", $hassubject=true, $sub
|
||||
print("<table class=\"main\" width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n");
|
||||
if ($hassubject)
|
||||
print("<tr><td class=\"rowhead\">".$lang_functions['row_subject']."</td>" .
|
||||
"<td class=\"rowfollow\" align=\"left\"><input type=\"text\" style=\"width: 650px;\" name=\"subject\" maxlength=\"".$maxsubjectlength."\" value=\"".htmlspecialchars($subject)."\" /></td></tr>\n");
|
||||
"<td class=\"rowfollow\" align=\"left\"><input type=\"text\" style=\"width: 99%;\" name=\"subject\" maxlength=\"".$maxsubjectlength."\" value=\"".htmlspecialchars($subject)."\" /></td></tr>\n");
|
||||
print("<tr><td class=\"rowhead\" valign=\"top\">".$lang_functions['row_body']."</td><td class=\"rowfollow\" align=\"left\"><span style=\"display: none;\" id=\"previewouter\"></span><div id=\"editorouter\">");
|
||||
textbbcode("compose","body", $body, false);
|
||||
print("</div></td></tr>");
|
||||
@@ -1042,7 +1077,7 @@ function get_external_tr($imdb_url = "")
|
||||
global $lang_functions;
|
||||
global $showextinfo;
|
||||
$imdbNumber = parse_imdb_id($imdb_url);
|
||||
($showextinfo['imdb'] == 'yes' ? tr($lang_functions['row_imdb_url'], "<input type=\"text\" style=\"width: 650px;\" name=\"url\" value=\"".($imdbNumber ? "http://www.imdb.com/title/tt".parse_imdb_id($imdb_url) : "")."\" /><br /><font class=\"medium\">".$lang_functions['text_imdb_url_note']."</font>", 1) : "");
|
||||
($showextinfo['imdb'] == 'yes' ? tr($lang_functions['row_imdb_url'], "<input type=\"text\" style=\"width: 100%;\" name=\"url\" value=\"".($imdbNumber ? "http://www.imdb.com/title/tt".parse_imdb_id($imdb_url) : "")."\" /><br /><font class=\"medium\">".$lang_functions['text_imdb_url_note']."</font>", 1) : "");
|
||||
}
|
||||
|
||||
function get_torrent_extinfo_identifier($torrentid)
|
||||
|
||||
@@ -341,10 +341,19 @@ function request_local_api($api)
|
||||
{
|
||||
$start = microtime(true);
|
||||
$ch = curl_init();
|
||||
$headers = [
|
||||
'Request-Id: ' . nexus()->getRequestId(),
|
||||
'Platform: tracker',
|
||||
'Scheme: ' . (isHttps() ? 'https' : 'http'),
|
||||
'SERVER_PORT: ' . ($_SERVER['SERVER_PORT'] ?? ''),
|
||||
'Host: ' . ($_SERVER['HTTP_HOST'] ?? ''),
|
||||
'REMOTE_ADDR: ' . ($_SERVER['REMOTE_ADDR'] ?? ''),
|
||||
'X-Forwarded-For: ' . ($_SERVER['HTTP_X_FORWARDED_FOR'] ?? ''),
|
||||
];
|
||||
$options = [
|
||||
CURLOPT_URL => sprintf('%s?%s', trim($api, '/'), $_SERVER['QUERY_STRING']),
|
||||
CURLOPT_USERAGENT => $_SERVER["HTTP_USER_AGENT"],
|
||||
CURLOPT_HTTPHEADER => ['REQUEST_ID: ' . nexus()->getRequestId(), 'Platform: tracker'],
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_TIMEOUT => 60,
|
||||
|
||||
@@ -282,7 +282,7 @@ function get_setting($name = null)
|
||||
{
|
||||
static $settings;
|
||||
if (is_null($settings)) {
|
||||
$settings = \Nexus\Database\NexusDB::remember("nexus_settings_in_nexus" . __METHOD__, 10, function () {
|
||||
$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);
|
||||
@@ -443,7 +443,12 @@ function arr_set(&$array, $key, $value)
|
||||
|
||||
function isHttps()
|
||||
{
|
||||
$result = !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) !== 'off');
|
||||
if (RUNNING_IN_OCTANE) {
|
||||
$https = request()->server('HTTPS');
|
||||
$result = !empty($https) && (strtolower($https) !== 'off');
|
||||
} else {
|
||||
$result = !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) !== 'off');
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -456,7 +461,12 @@ function getSchemeAndHttpHost()
|
||||
}
|
||||
$isHttps = isHttps();
|
||||
$protocol = $isHttps ? 'https' : 'http';
|
||||
$result = "$protocol://" . $_SERVER['HTTP_HOST'];
|
||||
if (RUNNING_IN_OCTANE) {
|
||||
$host = request()->server('HTTP_HOST', '');
|
||||
} else {
|
||||
$host = $_SERVER['HTTP_HOST'] ?? '';
|
||||
}
|
||||
$result = "$protocol://" . $host;
|
||||
return $result;
|
||||
|
||||
}
|
||||
@@ -619,10 +629,10 @@ function nexus_trans($key, $replace = [], $locale = null)
|
||||
|
||||
function isRunningInConsole(): bool
|
||||
{
|
||||
return php_sapi_name() == 'cli';
|
||||
return !RUNNING_IN_OCTANE && php_sapi_name() == 'cli';
|
||||
}
|
||||
|
||||
function get_tracker_schema_and_host(): array
|
||||
function get_tracker_schema_and_host($combine = false): array|string
|
||||
{
|
||||
global $https_announce_urls, $announce_urls;
|
||||
$httpsAnnounceUrls = array_filter($https_announce_urls);
|
||||
@@ -644,15 +654,18 @@ function get_tracker_schema_and_host(): array
|
||||
$log .= ", https_announce_urls empty, use announce_urls[0]";
|
||||
$base_announce_url = $announce_urls[0];
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$ssl_torrent = "http://";
|
||||
$base_announce_url = $announce_urls[0];
|
||||
}
|
||||
do_log($log);
|
||||
if ($combine) {
|
||||
return $ssl_torrent . $base_announce_url;
|
||||
}
|
||||
return compact('ssl_torrent', 'base_announce_url');
|
||||
}
|
||||
|
||||
|
||||
function get_hr_ratio($uped, $downed)
|
||||
{
|
||||
if ($downed > 0) {
|
||||
|
||||
Reference in New Issue
Block a user