upload auto fill offer

This commit is contained in:
xiaomlove
2022-05-25 02:15:41 +08:00
parent 4ccfa9fc3a
commit 69f02de4eb
8 changed files with 46 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.11');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-05-23');
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.12');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-05-25');
defined('IN_TRACKER') || define('IN_TRACKER', true);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

View File

@@ -893,6 +893,11 @@ function doInsert(ibTag, ibClsTag, isSingle)
return isClose;
}
function clearContent()
{
document.<?php echo $form?>.<?php echo $text?>.value = '';
}
function winop()
{
windop = window.open("moresmilies.php?form=<?php echo $form?>&text=<?php echo $text?>","mywin","height=500,width=500,resizable=no,scrollbars=yes");
@@ -1682,6 +1687,10 @@ function image_code () {
function check_code ($imagehash, $imagestring, $where = 'signup.php',$maxattemptlog=false,$head=true) {
global $lang_functions;
global $iv;
if ($iv !== 'yes') {
return true;
}
$query = sprintf("SELECT * FROM regimages WHERE imagehash='%s' AND imagestring='%s'",
mysql_real_escape_string($imagehash),
mysql_real_escape_string($imagestring));

View File

@@ -296,7 +296,7 @@ $lang_functions = array
'text_please_download_something_within' => "请在",
'text_inactive_account_be_deleted' => "内做些下载。没有流量的用户会被删除账号。",
'text_attendance' => '[签到得魔力]',
'text_attended' => '[签到已得%u, 补签卡:%d]',
'text_attended' => '[签到已得%u, 补签卡: %d]',
'imdb_cache_dir_can_not_create' => 'imdb 缓存目录无法创建',
'imdb_cache_dir_is_not_writeable' => 'imdb 缓存目录不可写',
'imdb_photo_dir_can_not_create' => 'imdb 图片目录无法创建',

View File

@@ -298,7 +298,7 @@ $lang_functions = array
'text_please_download_something_within' => "請在",
'text_inactive_account_be_deleted' => "內做些下載。沒有流量的用戶會被移除賬號。",
'text_attendance' => '[簽到得魔力]',
'text_attended' => '[簽到已得%u, 補簽卡:%d]',
'text_attended' => '[簽到已得%u, 補簽卡: %d]',
'text_pt_gen_douban_url_note' => "(來自 <strong><a href=\"https://www.douban.com/\">douban</a></strong> 的鏈接。如電影 <b>Transformers</b> 的鏈接是<b> https://movie.douban.com/subject/1794171/</b>)",
'row_pt_gen_imdb_url' => "PT-Gen imdb 鏈接",
'text_pt_gen_imdb_url_note' => "(來自 <strong><a href=\"https://www.imdb.com//\">imdb</a></strong> 的鏈接。如電影 <b>Transformers</b> 的鏈接是<b> https://www.imdb.com/title/tt0418279/</b>)",

View File

@@ -298,7 +298,7 @@ $lang_functions = array
'text_please_download_something_within' => "Please download something within ",
'text_inactive_account_be_deleted' => ". Inactive accounts (with no transfer amount) will be deleted.",
'text_attendance' => '[Attend get bouns]',
'text_attended' => '[Attend got bouns %u, card:%d]',
'text_attended' => '[Attend got bouns %u, card: %d]',
'row_pt_gen_douban_url' => "PT-Gen douban link",
'text_pt_gen_douban_url_note' => "(URL taken from <strong><a href=\"https://www.douban.com/\">douban</a></strong>. e.g.&nbsp;for movie <b>Transformers</b> the URL is <b> https://movie.douban.com/subject/1794171//</b>)",
'row_pt_gen_imdb_url' => "PT-Gen imdb link",

View File

@@ -68,3 +68,9 @@ function removeUserLeechWarn($params)
return $rep->removeLeechWarn($CURUSER['id'], $params['uid']);
}
function getOffer($params)
{
$offer = \App\Models\Offer::query()->findOrFail($params['id']);
return $offer->toArray();
}

View File

@@ -149,6 +149,28 @@ stdhead($lang_upload['head_upload']);
$offer .= "<option value=\"" . $offerrow["id"] . "\">" . htmlspecialchars($offerrow["name"]) . "</option>";
$offer .= "</select>";
tr($lang_upload['row_your_offer']. (!$uploadfreely && !$allowspecial ? "<font color=red>*</font>" : ""), $offer.$lang_upload['text_please_select_offer'] , 1);
$getOfferJs = <<<JS
jQuery('select[name="offer"]').on("change", function () {
let id = this.value
if (id == 0) {
return
}
let params = {action: "getOffer", params: {id: id}}
jQuery.post("ajax.php", params, function (response) {
console.log(response)
if (response.ret != 0) {
alert(response.msg)
return
}
jQuery("#name").val(response.data.name)
clearContent()
doInsert(response.data.descr, '', false)
jQuery("#browsecat").val(response.data.category)
}, 'json')
})
JS;
\Nexus\Nexus::js($getOfferJs, 'footer', false);
}
//===end

View File

@@ -6,11 +6,10 @@ $q = $_REQUEST['q'] ?? '';
if (!empty($q)) {
$query->where('username', 'like', "%{$q}%");
}
$total = $query->toBase()->getCountForPagination();
$page = $_REQUEST['page'] ?? 1;
$perPage = 20;
$rows = $query->forPage($page, $perPage)->orderBy('id', 'desc')->get()->toArray();
list($paginationTop, $paginationBottom, $limit) = pager($perPage, $total, "?");
$total = (clone $query)->count();
$perPage = 50;
list($paginationTop, $paginationBottom, $limit, $offset) = pager($perPage, $total, "?");
$rows = (clone $query)->offset($offset)->take($perPage)->orderBy('id', 'desc')->get()->toArray();
$header = [
'id' => 'ID',
'uid' => 'UID',