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
+2 -2
View File
@@ -1,6 +1,6 @@
<?php <?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.11'); defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.12');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-05-23'); defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-05-25');
defined('IN_TRACKER') || define('IN_TRACKER', true); defined('IN_TRACKER') || define('IN_TRACKER', true);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP"); defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org"); defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
+9
View File
@@ -893,6 +893,11 @@ function doInsert(ibTag, ibClsTag, isSingle)
return isClose; return isClose;
} }
function clearContent()
{
document.<?php echo $form?>.<?php echo $text?>.value = '';
}
function winop() function winop()
{ {
windop = window.open("moresmilies.php?form=<?php echo $form?>&text=<?php echo $text?>","mywin","height=500,width=500,resizable=no,scrollbars=yes"); 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) { function check_code ($imagehash, $imagestring, $where = 'signup.php',$maxattemptlog=false,$head=true) {
global $lang_functions; global $lang_functions;
global $iv;
if ($iv !== 'yes') {
return true;
}
$query = sprintf("SELECT * FROM regimages WHERE imagehash='%s' AND imagestring='%s'", $query = sprintf("SELECT * FROM regimages WHERE imagehash='%s' AND imagestring='%s'",
mysql_real_escape_string($imagehash), mysql_real_escape_string($imagehash),
mysql_real_escape_string($imagestring)); mysql_real_escape_string($imagestring));
+6
View File
@@ -68,3 +68,9 @@ function removeUserLeechWarn($params)
return $rep->removeLeechWarn($CURUSER['id'], $params['uid']); return $rep->removeLeechWarn($CURUSER['id'], $params['uid']);
} }
function getOffer($params)
{
$offer = \App\Models\Offer::query()->findOrFail($params['id']);
return $offer->toArray();
}
+22
View File
@@ -149,6 +149,28 @@ stdhead($lang_upload['head_upload']);
$offer .= "<option value=\"" . $offerrow["id"] . "\">" . htmlspecialchars($offerrow["name"]) . "</option>"; $offer .= "<option value=\"" . $offerrow["id"] . "\">" . htmlspecialchars($offerrow["name"]) . "</option>";
$offer .= "</select>"; $offer .= "</select>";
tr($lang_upload['row_your_offer']. (!$uploadfreely && !$allowspecial ? "<font color=red>*</font>" : ""), $offer.$lang_upload['text_please_select_offer'] , 1); 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 //===end
+4 -5
View File
@@ -6,11 +6,10 @@ $q = $_REQUEST['q'] ?? '';
if (!empty($q)) { if (!empty($q)) {
$query->where('username', 'like', "%{$q}%"); $query->where('username', 'like', "%{$q}%");
} }
$total = $query->toBase()->getCountForPagination(); $total = (clone $query)->count();
$page = $_REQUEST['page'] ?? 1; $perPage = 50;
$perPage = 20; list($paginationTop, $paginationBottom, $limit, $offset) = pager($perPage, $total, "?");
$rows = $query->forPage($page, $perPage)->orderBy('id', 'desc')->get()->toArray(); $rows = (clone $query)->offset($offset)->take($perPage)->orderBy('id', 'desc')->get()->toArray();
list($paginationTop, $paginationBottom, $limit) = pager($perPage, $total, "?");
$header = [ $header = [
'id' => 'ID', 'id' => 'ID',
'uid' => 'UID', 'uid' => 'UID',