📄 classified.php
字号:
<?php//////////////////////////// COPYRIGHT NOTICE ////////////////////////////////////// This script is part of BosClassifieds, a software application by BosDev, Inc //// Use of any kind of part or all of this script or modification of this //// script requires a license from BosDev, Inc. Use or modification of //// this script without a license constitutes Software Piracy and will //// result in legal action from BosDev, Inc. All rights reserved. //// http://www.bosdev.com sales@bosdev.com //// //// BosClassifieds Copyright 2004, BosDev, Inc. //////////////////////////////////////////////////////////////////////////////////////Connect to database & get functions loadedinclude("connect.php");include("functions.php");//Set globalsglobal $SystemOptions,$cat_id;$result = query("SELECT * FROM {$class_prefix}system",$class_link);$SystemOptions = mysql_fetch_array($result);//Check for spider-friendly URLif(isset($_SERVER['PATH_INFO']) && $SystemOptions['spider'] == 1) { $parts = explode('/', substr($_SERVER['PATH_INFO'],1)); for($i=0; $i < count($parts); $i++){ if($i % 2 == 0){ $$parts[$i] = $parts[$i+1];} } }//Set languageinclude("{$insPath}languages/{$SystemOptions['language']}.php");//Include integration fileinclude("{$insPath}integration/{$SystemOptions['integration']}.php");//Load ad types$adTypes = array();$result = query("SELECT type_id,type_title FROM {$class_prefix}ad_types",$class_link);while(list($typeID,$typeTitle) = mysql_fetch_row($result)) { $adTypes[$typeID] = stripslashes($typeTitle); }//Get ad data$listing = intval(protect($listing));$result = query("SELECT a.ad_status,a.ad_user_id,a.ad_category,a.ad_date_begin,a.ad_date_end,a.ad_type,a.ad_title,a.ad_description,ad_image1,a.ad_image2,a.ad_image3,a.ad_image4,a.ad_image5,a.ad_options,a.ad_optional_1,a.ad_optional_2,a.ad_optional_3,a.ad_optional_4,a.ad_optional_5,a.ad_type_optional1,a.ad_type_optional2,a.ad_type_optional3,a.ad_type_optional4,a.ad_type_optional5,a.ad_type_optional6,a.ad_type_optional7,a.ad_type_optional8,a.ad_type_optional9,a.ad_type_optional10,a.ad_price,a.ad_condition,a.ad_views,a.ad_city,a.ad_state,a.ad_postal,a.ad_country,t.type_required,t.type_use,t.option1,t.def_option1,t.option2,t.def_option2,t.option3,t.def_option3,t.option4,t.def_option4,t.option5,t.def_option5,t.option6,t.def_option6,t.option7,t.def_option7,t.option8,t.def_option8,t.option9,t.def_option9,t.option10,t.def_option10,c.category_optional_1,c.category_optional_1_def,c.category_optional_2,c.category_optional_2_def,c.category_optional_3,c.category_optional_3_def,c.category_optional_4,c.category_optional_4_def,c.category_optional_5,c.category_optional_5_def FROM {$class_prefix}ads a LEFT JOIN {$class_prefix}ad_types t ON a.ad_type=t.type_id LEFT JOIN {$class_prefix}categories c ON a.ad_category=c.category_id WHERE a.ad_id=$listing",$class_link);list($adStatus,$adUser,$adCategory,$adBegin,$adEnd,$adType,$adTitle,$adDescription,$adImage1,$adImage2,$adImage3,$adImage4,$adImage5,$adOptions,$adOptional1,$adOptional2,$adOptional3,$adOptional4,$adOptional5,$adTypeOptional1,$adTypeOptional2,$adTypeOptional3,$adTypeOptional4,$adTypeOptional5,$adTypeOptional6,$adTypeOptional7,$adTypeOptional8,$adTypeOptional9,$adTypeOptional10,$adPrice,$adCondition,$adViews,$adCity,$adState,$adPostal,$adCountry,$typeRequired,$typeUse,$typeOption1,$typeOption1Def,$typeOption2,$typeOption2Def,$typeOption3,$typeOption3Def,$typeOption4,$typeOption4Def,$typeOption5,$typeOption5Def,$typeOption6,$typeOption6Def,$typeOption7,$typeOption7Def,$typeOption8,$typeOption8Def,$typeOption9,$typeOption9Def,$typeOption10,$typeOption10Def,$catOption1,$catOption1Def,$catOption2,$catOption2Def,$catOption3,$catOption3Def,$catOption4,$catOption4Def,$catOption5,$catOption5Def) = mysql_fetch_row($result);//Make sure the ad isn't deleted (search engines)if($adTitle == "") { echo<<<ENDREDIR <META HTTP-EQUIV="refresh" CONTENT=0;URL="{$insUrl}index.php">ENDREDIR; die(); }//Add viewer to statisticsrecordUser("a",$listing);$adViews++;$userInfo = getUserInfo($adUser);$adTitle = toHtml($adTitle);$adPrice = toHtml($adPrice);$adDescription = toHtml($adDescription);$adOptional1 = toHtml($adOptional1);$adOptional2 = toHtml($adOptional2);$adOptional3 = toHtml($adOptional3);$adOptional4 = toHtml($adOptional4);$adOptional5 = toHtml($adOptional5);$adTypeOptional1 = toHtml($adTypeOptional1);$adTypeOptional2 = toHtml($adTypeOptional2);$adTypeOptional3 = toHtml($adTypeOptional3);$adTypeOptional4 = toHtml($adTypeOptional4);$adTypeOptional5 = toHtml($adTypeOptional5);$adTypeOptional6 = toHtml($adTypeOptional6);$adTypeOptional7 = toHtml($adTypeOptional7);$adTypeOptional8 = toHtml($adTypeOptional8);$adTypeOptional9 = toHtml($adTypeOptional9);$adTypeOptional10 = toHtml($adTypeOptional10);$adCity = toHtml($adCity);$adState = toHtml($adState);$adPostal = toHtml($adPostal);$adCountry = toHtml($adCountry);$catOption1 = stripslashes($catOption1);$catOption1Def = stripslashes($catOption1Def);$catOption2 = stripslashes($catOption2);$catOption2Def = stripslashes($catOption2Def);$catOption3 = stripslashes($catOption3);$catOption3Def = stripslashes($catOption3Def);$catOption4 = stripslashes($catOption4);$catOption4Def = stripslashes($catOption4Def);$catOption5 = stripslashes($catOption5);$catOption5Def = stripslashes($catOption5Def);$typeOption1 = stripslashes($typeOption1);$typeOption1Def = stripslashes($typeOption1Def);$typeOption2 = stripslashes($typeOption2);$typeOption2Def = stripslashes($typeOption2Def);$typeOption3 = stripslashes($typeOption3);$typeOption3Def = stripslashes($typeOption3Def);$typeOption4 = stripslashes($typeOption4);$typeOption4Def = stripslashes($typeOption4Def);$typeOption5 = stripslashes($typeOption5);$typeOption5Def = stripslashes($typeOption5Def);$typeOption6 = stripslashes($typeOption6);$typeOption6Def = stripslashes($typeOption6Def);$typeOption7 = stripslashes($typeOption7);$typeOption7Def = stripslashes($typeOption7Def);$typeOption8 = stripslashes($typeOption8);$typeOption8Def = stripslashes($typeOption8Def);$typeOption9 = stripslashes($typeOption9);$typeOption9Def = stripslashes($typeOption9Def);$typeOption10 = stripslashes($typeOption10);$typeOption10Def = stripslashes($typeOption10Def);if($adStatus == 3) { $adClosed = "<span style=\"text-decoration:line-through;\">"; $adClosedE = "</span>"; }$adDefHead =<<<ENDITEM<tr> <td class="headtd">{$adClosed}{$adTypes[$adType]}: $adTitle{$adClosedE}</td> <td class="headtd" align="right">#{$listing}</td></tr>ENDITEM;$adDef .=<<<ENDITEM <b>{$Languages['classified']['posted']}:</b> {$userInfo['name']} <a class="small" href="{$insUrl}search.php?user=$adUser">[{$Languages['classified']['byposter']}]</a><br>ENDITEM;if(($typeUse & 2) != 0 && $adCondition != "") { $adDef .=<<<ENDITEM <b>{$Languages['classified']['condition']}:</b> {$Languages['global']['condition'][$adCondition]}<br>ENDITEM; }if(($typeUse & 4) != 0 && $adPrice != "") { $adDef .=<<<ENDITEM <b>{$Languages['classified']['price']}:</b> $adPrice<br>ENDITEM; }if(($typeUse & 8) != 0 && $adDescription != "") { $adDefExt .=<<<ENDITEM <tr> <td colspan="2"> <b>{$Languages['classified']['desc']}:</b><br> $adDescription </td> </tr>ENDITEM; }if(($typeUse & 16) != 0 && $adCity != "") { $adDef .=<<<ENDITEM <b>{$Languages['classified']['city']}:</b> $adCity <a class="small" href="{$insUrl}search.php?city=$adCity">[{$Languages['classified']['bycity']}]</a><br>ENDITEM; }if(($typeUse & 32) != 0 && $adState != "") { $adDef .=<<<ENDITEM <b>{$Languages['classified']['state']}:</b> $adState <a class="small" href="{$insUrl}search.php?state=$adState">[{$Languages['classified']['bystate']}]</a><br>ENDITEM; }if(($typeUse & 64) != 0 && $adPostal != "") { $adDef .=<<<ENDITEM <b>{$Languages['classified']['postal']}:</b> $adPostal <a class="small" href="{$insUrl}search.php?postal=$adPostal">[{$Languages['classified']['bypostal']}]</a><br>ENDITEM; }if(($typeUse & 128) != 0 && $adCountry != "") { $adDef .=<<<ENDITEM <b>{$Languages['classified']['country']}:</b> $adCountry <a class="small" href="{$insUrl}search.php?country=$adCountry">[{$Languages['classified']['bycountry']}]</a><br>ENDITEM; }//Loop through custom ad type fields$type = 1;for($i=512;$i<=262144;$i=$i*2) { if(($typeUse & $i) != 0 && ${"adTypeOptional".$type} != "") { $customTitle = ${"typeOption".$type}; unset($value); $value = stripslashes(${"adTypeOptional".$type}); $customFieldData = explode("|",${"typeOption".$type."Def"}); switch($customFieldData[0]) { case 1: //Standard input $adDef .=<<<ENDPRINT <b>$customTitle:</b> $value<br>ENDPRINT; break; case 2: //Textarea input $adDefExt .=<<<ENDPRINT <tr> <td colspan="2"><b>$customTitle:</b><br>$value</td> </tr>ENDPRINT; break; case 3: //Select $adDef .=<<<ENDPRINT <b>$customTitle:</b> {$customFieldData[$value + 2]}<br>ENDPRINT; break; case 4: //Radio buttons $adDef .=<<<ENDPRINT <b>$customTitle:</b> {$customFieldData[$value + 2]}<br>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 .= "$displayOption, "; } } $checkBoxes = substr($checkBoxes,0,-2); $adDef .=<<<ENDPRINT <b>$customTitle:</b> $checkBoxes<br>ENDPRINT; break; } } $type++; }//Loop through category fieldsfor($i=1;$i<=5;$i++) { if(${"catOption".$i} != "") { $customTitle = ${"catOption".$i}; unset($value); $value = ${"adOptional".$i}; $customFieldData = explode("|",${"catOption".$i."Def"}); switch($customFieldData[0]) { case 1: //Standard input $adDef .=<<<ENDPRINT <b>$customTitle:</b> $value<br>ENDPRINT; break; case 2: //Textarea input $adDefExt .=<<<ENDPRINT <tr> <td colspan="2"><b>$customTitle:</b><br>$value</td> </tr>ENDPRINT; break; case 3: //Select $adDef .=<<<ENDPRINT <b>$customTitle:</b> {$customFieldData[$value + 2]}<br>ENDPRINT; break; case 4: //Radio buttons $adDef .=<<<ENDPRINT <b>$customTitle:</b> {$customFieldData[$value + 2]}<br>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 .= "$displayOption, "; } } $checkBoxes = substr($checkBoxes,0,-2); $adDef .=<<<ENDPRINT <b>$customTitle:</b> $checkBoxes<br>ENDPRINT; break; } } }if(($typeUse & 256) != 0) { if($adImage1 != "") { $imgs++; $imgThumb1 = getThumb($adImage1); $imgSmall1 = str_replace(".jpg","_small.jpg",$adImage1); } if($adImage2 != "") { $imgs++; $imgThumb2 = getThumb($adImage2); $imgSmall2 = str_replace(".jpg","_small.jpg",$adImage2); } if($adImage3 != "") { $imgs++; $imgThumb3 = getThumb($adImage3); $imgSmall3 = str_replace(".jpg","_small.jpg",$adImage3); } if($adImage4 != "") { $imgs++; $imgThumb4 = getThumb($adImage4); $imgSmall4 = str_replace(".jpg","_small.jpg",$adImage4); } if($adImage5 != "") { $imgs++; $imgThumb5 = getThumb($adImage5); $imgSmall5 = str_replace(".jpg","_small.jpg",$adImage5); } if($imgs != 0) { $imageLayout =<<<ENDIMG <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td width="100%" align="center" valign="center"> <a href="{$insUrl}images/listings/$adImage1" target="_blank" name="imageLarge"><img src="{$insUrl}images/listings/$imgSmall1" name="mainPicture" border="0"></a><br> <span style="font-size:7pt; font-weight:normal;">{$Languages['classified']['fullsize']}</span> </td> <td align="center" valign="center">ENDIMG; if($adImage1 != "" && $imgs != 1) { $imageLayout .= "<a href=\"javascript:update('$imgSmall1','$adImage1');\"><img src=\"{$insUrl}images/listings/$imgThumb1\" border=\"0\"></a><br><br>"; } if($adImage2 != "") { $imageLayout .= "<a href=\"javascript:update('$imgSmall2','$adImage2');\"><img src=\"{$insUrl}images/listings/$imgThumb2\" border=\"0\"></a><br><br>"; } if($adImage3 != "") { $imageLayout .= "<a href=\"javascript:update('$imgSmall3','$adImage3');\"><img src=\"{$insUrl}images/listings/$imgThumb3\" border=\"0\"></a><br><br>"; } if($adImage4 != "") { $imageLayout .= "<a href=\"javascript:update('$imgSmall4','$adImage4');\"><img src=\"{$insUrl}images/listings/$imgThumb4\" border=\"0\"></a><br><br>"; } if($adImage5 != "") { $imageLayout .= "<a href=\"javascript:update('$imgSmall5','$adImage5');\"><img src=\"{$insUrl}images/listings/$imgThumb5\" border=\"0\"></a><br><br>"; } $imageLayout .=<<<ENDIMG </td> </tr> </table>ENDIMG; } }if(authenticateUser()) { $userInfo = getUserInfo(); if($userInfo['admin'] != "0") { $adminOptions =<<<ENDOPTIONS <tr> <td colspan="2" align="right"> <a href="{$insUrl}admin/index.php?action=adsEdit&adID=$listing">[{$Languages['classified']['adminedit']}]</a> | <a href="{$insUrl}admin/index.php?action=adsDelete&adID=$listing">[{$Languages['classified']['admindelete']}]</a> </td> </tr>ENDOPTIONS; } }if($adStatus == 1) { $listingOptions =<<<ENDOPTIONS <div align="right"><a href="{$insUrl}account.php?action=ask&listing=$listing">[{$Languages['classified']['ask']}]</a> | <a href="{$insUrl}account.php?action=report&listing=$listing">[{$Languages['classified']['adminreport']}]</a></div><br>ENDOPTIONS; }//Display header$cat_id=$adCategory;$title_extra = "$adTitle | ";include("header.php");echo<<<ENDDATA<script language="JavaScript"><!--function update(small,full){ document['mainPicture'].src='{$insUrl}images/listings/' + small; document.all('imageLarge').href='{$insUrl}images/listings/' + full; return; }//--></script><br><div id="adBox"><table width="{$SystemOptions['page_width']}" border="0" cellspacing="0" cellpadding="3">$adDefHead$adminOptions <tr> <td valign="top" width="50%"> $adDef </td> <td valign="top" width="50%"> $listingOptions $imageLayout </td> </tr>$adDefExt <tr> <td colspan="2" align="right">$adViews {$Languages['classified']['numviews']}</td> </tr></table></div>ENDDATA;include("footer.php");?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -