📄 account.php
字号:
switch($customFieldData[0]) { case 1: //Standard input $adCatDef .=<<<ENDPRINT <tr> <td>$customTitle: <input type="text" name="newOptional{$i}"></td> </tr>ENDPRINT; break; case 2: //Textarea input $adCatDef .=<<<ENDPRINT <tr> <td>$customTitle:<br><textarea name="newOptional{$i}"></textarea></td> </tr>ENDPRINT; break; case 3: //Select $options = ""; for($ii=1;$ii<=$customFieldData[1];$ii++) { $displayOption = stripslashes($customFieldData[$ii + 2]); if($ii == $value) { $options .= "<option value=\"$ii\" selected>$displayOption</option>"; } else { $options .= "<option value=\"$ii\">$displayOption</option>"; } } $adCatDef .=<<<ENDPRINT <tr> <td>$customTitle: <select name="newOptional{$i}">$options</select></td> </tr>ENDPRINT; break; case 4: //Radio buttons $buttons = ""; for($ii=1;$ii<=$customFieldData[1];$ii++) { $displayOption = stripslashes($customFieldData[$ii + 2]); if($ii == $value) { $buttons .= "<input type=\"radio\" name=\"newOptional{$i}\" value=\"$ii\" checked>$displayOption "; } else { $buttons .= "<input type=\"radio\" name=\"newOptional{$i}\" value=\"$ii\">$displayOption "; } } $adCatDef .=<<<ENDPRINT <tr> <td>$customTitle: $buttons</td> </tr>ENDPRINT; break; case 5: //Checkbox $checkBoxes = ""; $check = explode(",",$value); for($ii=1;$ii<=$customFieldData[1];$ii++) { $displayOption = stripslashes($customFieldData[$ii + 2]); if(in_array($ii,$check)) { $checkBoxes .= "<input name=\"newOptional{$type}[]\" type=\"checkbox\" value=\"$ii\" checked>$displayOption</input> "; } else { $checkBoxes .= "<input name=\"newOptional{$type}[]\" type=\"checkbox\" value=\"$ii\">$displayOption</input> "; } } $adCatDef .=<<<ENDPRINT <tr> <td>$customTitle: $checkBoxes</td> </tr>ENDPRINT; break; } } if($adCatDef != "") { $adDef .=<<<ENDITEM <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td class="alttd"><b>{$Languages['account']['adsscreencatopt']}:</b></td> </tr> $adCatDef </table> </td> </tr>ENDITEM; } if(($typeUse & 256) != 0) { if($SystemOptions['fee_images'] != "0.00") { $imgMsg = sprintf($Languages['account']['addimagefee'],formatPrice($SystemOptions['fee_images'])); } $adDef .=<<<ENDITEM <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td colspan="2" class="alttd"><b>{$Languages['account']['adsscreenimages']}:</b> $imgMsg</td> </tr>ENDITEM; for($i=1; $i<=$SystemOptions['num_images']; $i++) { $adDef .=<<<ENDITEM <tr> <td> {$Languages['account']['addupload']}: <input type="file" name="newImage{$i}"> </td> </tr>ENDITEM; } $adDef .=<<<ENDITEM </table> </td> </tr>ENDITEM; } if($SystemOptions['allow_featured'] == 1) { if($SystemOptions['fee_featured'] != "0.00") { $msg = sprintf($Languages['account']['addadditionalfee'],formatPrice($SystemOptions['fee_featured'])); $featured = "{$Languages['account']['adsscreendispfea']}: <select name=\"newFeatured\"><option value=\"1\">{$Languages['account']['yes']}</option><option value=\"0\" selected>{$Languages['account']['no']}</option></select> $msg<br>"; } else { $featured = "{$Languages['account']['adsscreendispfea']}: <select name=\"newFeatured\"><option value=\"1\">{$Languages['account']['yes']}</option><option value=\"0\" selected>{$Languages['account']['no']}</option></select><br>"; } $showOptions = "true"; } if($SystemOptions['allow_bold'] == 1) { if($SystemOptions['fee_bold'] != "0.00") { $msg = sprintf($Languages['account']['addadditionalfee'],formatPrice($SystemOptions['fee_bold'])); $bold = "{$Languages['account']['adsscreendispbold']}: <select name=\"newBold\"><option value=\"2\">{$Languages['account']['yes']}</option><option value=\"0\" selected>{$Languages['account']['no']}</option></select> Additional $msg<br>"; } else { $bold = "{$Languages['account']['adsscreendispbold']}: <select name=\"newBold\"><option value=\"2\">{$Languages['account']['yes']}</option><option value=\"0\" selected>{$Languages['account']['no']}</option></select><br>"; } $showOptions = "true"; } if($SystemOptions['allow_italic'] == 1) { if($SystemOptions['fee_italic'] != "0.00") { $msg = sprintf($Languages['account']['addadditionalfee'],formatPrice($SystemOptions['fee_italic'])); $italic = "{$Languages['account']['adsscreendispitalic']}: <select name=\"newItalic\"><option value=\"4\">{$Languages['account']['yes']}</option><option value=\"0\" selected>{$Languages['account']['no']}</option></select> Additional $msg<br>"; } else { $italic = "{$Languages['account']['adsscreendispitalic']}: <select name=\"newItalic\"><option value=\"4\">{$Languages['account']['yes']}</option><option value=\"0\" selected>{$Languages['account']['no']}</option></select><br>"; } $showOptions = "true"; } if($SystemOptions['allow_color'] == 1) { $back = 1; for($i=8;$i<=64;$i=$i*2) { $optionColors .= "<option value=\"$i\" class=\"background_{$back}\">{$Languages['account']['color']} $back</option>"; $back++; } if($SystemOptions['fee_color'] != "0.00") { $msg = sprintf($Languages['account']['addadditionalfee'],formatPrice($SystemOptions['fee_color'])); $colors = "{$Languages['account']['adsscreendispbg']}: <div id=\"listings\"><select name=\"newColor\"><option value=\"\"></option>$optionColors></select></div> Additional $msg<br>"; } else { $colors = "{$Languages['account']['adsscreendispbg']}: <div id=\"listings\"><select name=\"newColor\"><option value=\"\"></option>$optionColors</select></div><br>"; } $showOptions = "true"; } if($showOptions == "true") { $adDef .=<<<ENDITEM <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td colspan="2" class="alttd"><b>{$Languages['account']['adsscreendispopt']}:</b></td> </tr> <tr> <td> $featured $bold $italic $colors </td> </tr> </table> </td> </tr>ENDITEM; } $result = query("SELECT category_ad_types,category_ad_prices FROM {$class_prefix}categories WHERE category_id=$adCategory",$class_link); list($catTypes,$catPrices) = mysql_fetch_row($result); $catPriceArray = explode(",",$catPrices); $catTypesArray = explode(",",$catTypes); $count = 0; while(list(,$val) = each($catTypesArray)) { if($val == $adType) { $catPrice = $catPriceArray[$count]; } $count++; } for($i=1;$i<=4;$i++) { if($SystemOptions['time_'.$i] != "2147483647") { $timeParts = explode("|",$SystemOptions['time_'.$i.'_multiplier']); if($timeParts[0] == "1") { $price = formatPrice($catPrice * $timeParts[1]); } else { $price = formatPrice($catPrice + $timeParts[1]); } if($SystemOptions['time_'.$i] != "0") { $timeOptions .= "<option value=\"$i\">{$SystemOptions['time_'.$i]} {$Languages['account']['adddays']} $price</option>"; } else { $timeOptions .= "<option value=\"$i\">{$Languages['account']['addunldays']} $price</option>"; } } } $adDef .=<<<ENDITEM <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td colspan="2" class="alttd"><b>{$Languages['account']['addnumdays']}:</b></td> </tr> <tr> <td> {$Languages['account']['addnumdaysintro']}<br> <select name="newTime">$timeOptions</select> </td> </tr> </table> </td> </tr>ENDITEM; //Check to see if we have any coupons $today = date("Y-m-d"); $result = query("SELECT COUNT(coupon_id) FROM {$class_prefix}coupons WHERE coupon_expires > '$today' OR coupon_expires = '0000-00-00'",$class_link); list($coupons) = mysql_fetch_row($result); if($coupons != 0) { $adDef .=<<<ENDITEM <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td colspan="2" class="alttd"><b>{$Languages['account']['addcoupon']}:</b></td> </tr> <tr> <td> {$Languages['account']['addcouponintro']}<br> <input type="text" name="couponCode"> </td> </tr> </table> </td> </tr>ENDITEM; } $displayJava =<<<ENDDATA<script language="JavaScript1.2" type="text/javascript">function checkAdd(form) { if(trim(form.newTitle.value) == "") { alert("{$Languages['account']['adderror10']}"); return false; }$adJava return true; }</script>ENDDATA; $displayData =<<<ENDDATA $displayJava <table width="100%" border="0" cellspacing="1" cellpadding="3"> <form name="addForm" method="post" action="account.php" enctype="multipart/form-data" onSubmit="return checkAdd(this);"> <input type="hidden" name="action" value="add"> <input type="hidden" name="adCategory" value="$adCategory"> <input type="hidden" name="adType" value="$adType"> <input type="hidden" name="step" value="3"> <table width="100%" border="0" cellspacing="1" cellpadding="3"> $adDef $couponDef <tr> <td align="center"><input type="submit" value="{$Languages['account']['process']}"></td> </tr> </form> </table>ENDDATA; break; case "3": //Post ad data, pay if needed //Preset the status to 9, so we can do group payment if needed. $adStatus = 9; //Protect the data $adType = intval(protect($adType)); $adCategory = intval(protect($adCategory)); $newTitle = protect(stripHtml($newTitle)); $newCondition = intval(protect($newCondition)); $newPrice = protect(stripHtml($newPrice)); $newDesc = protect(stripHtml($newDesc)); $newCity = protect(stripHtml($newCity)); $newState = protect(stripHtml($newState)); $newPostal = protect(stripHtml($newPostal)); $newCountry = protect(stripHtml($newCountry)); for($i=1;$i<=10;$i++) { if(!is_array(${"newTypeOptional".$i})) { ${"newTypeOptional".$i} = protect(stripHtml(${"newTypeOptional".$i})); } else { $tmpVal = ""; while(list($key,$val) = each(${"newTypeOptional".$i})) { $tmpVal .= "$val,"; } ${"newTypeOptional".$i} = $tmpVal; } } for($i=1;$i<=5;$i++) { if(!is_array(${"newOptional".$i})) { ${"newOptional".$i} = protect(stripHtml(${"newOptional".$i})); } else { $tmpVal = ""; while(list($key,$val) = each(${"newOptional".$i})) { $tmpVal .= "$val,"; } ${"newOptional".$i} = $tmpVal; } } $newFeatured = intval(protect($newFeatured)); $newBold = intval(protect($newBold)); $newItalic = intval(protect($newItalic)); $newColor = intval(protect($newColor)); $newOptions = $newFeatured + $newBold + $newItalic + $newColor; //Set dates $beginDate = date("Y-m-d"); $numDays = $SystemOptions['time_'.$newTime]; if($numDays == "0") { $numDays = 3650; } $endDate = date("Y-m-d",strtotime("+$numDays days")); //Store the data $result = query("INSERT INTO {$class_prefix}ads (ad_id,ad_status,ad_user_id,ad_category,ad_date_begin,ad_date_end,ad_type,ad_title,ad_description,ad_image1,ad_image2,ad_image3,ad_image4,ad_image5,ad_options,ad_optional_1,ad_optional_2,ad_optional_3,ad_optional_4,ad_optional_5,ad_type_optional1,ad_type_optional2,ad_type_optional3,ad_type_optional4,ad_type_optional5,ad_type_optional6,ad_type_optional7,ad_type_optional8,ad_type_optional9,ad_type_optional10,ad_price,ad_condition,ad_views,ad_city,ad_state,ad_postal,ad_country) VALUES (NULL,$adStatus,$userID,$adCategory,'$beginDate','$endDate',$adType,'$newTitle','$newDesc','','','','','',$newOptions,'$newOptional1','$newOptional2','$newOptional3','$newOptional4','$newOptional5','$newTypeOptional1','$newTypeOptional2','$newTypeOptional3','$newTypeOptional4','$newTypeOptional5','$newTypeOptional6','$newTypeOptional7','$newTypeOptional8','$newTypeOptional9','$newTypeOptional10','$newPrice',$newCondition,0,'$newCity','$newState','$newPostal','$newCountry')",$class_link); $adID = mysql_insert_id($class_link); //Process images for($i=1; $i<=$SystemOptions['num_images']; $i++) { if(is_uploaded_file($_FILES['newImage'.$i]['tmp_name'])) { $imgName = processImage($_FILES['newImage'.$i]); $result = query("UPDATE {$class_prefix}ads SET ad_image{$i}='$imgName' WHERE ad_id=$adID",$class_link); ${"adImage".$i} = $imgName; } } //Set price, update users record $adFee = "0.00"; //Get category price $result = query("SELECT category_ad_types,category_ad_prices FROM {$class_prefix}categories WHERE category_id=$adCategory",$class_link); list($catTypes,$catPrices) = mysql_fetch_row($result); $catPriceArray = explode(",",$catPrices); $catTypesArray = explode(",",$catTypes); $count = 0; while(list(,$val) = each($catTypesArray)) { if($val == $adType) { $catPrice = $catPriceArray[$count]; } $count++; } //Update price with time frame info $timeData = explode("|",$SystemOptions['time_'.$newTime.'_multiplier']); if($timeData[0] == "1") { $adFee = sprintf("%01.2f",$catPrice * $timeData[1]); } else { $adFee = sprintf("%01.2f",$catPrice + $timeData[1]); } //Check options if(($newOptions & 1) != 0) { $adFee = sprintf("%01.2f",$adFee + $SystemOptions['fee_featured']); } if(($newOptions & 2) != 0) { $adFee = sprintf("%01.2f",$adFee + $SystemOptions['fee_bold']); } if(($newOptions & 4) != 0) { $adFee = sprintf("%01.2f",$adFee + $SystemOptions['fee_italic']); } if(($newOptions & 8) != 0) { $adFee = sprintf("%01.2f",$adFee + $SystemOptions['fee_color']); } if(($newOptions & 16) != 0) { $adFee = sprintf("%01.2f",$adFee + $SystemOptions['fee_color']); } if(($newOptions & 32) != 0) { $adFee = sprintf("%01.2f",$adFee + $SystemOptions['fee_color']); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -