Connect($db_hostname,$db_username,$db_password,$db_name); $conn->fmtDate = "Y-m-d"; $conn->fmtTimeStamp = "H:i:s"; return $conn; } // // provide a search box for querying the database records // class SearchTable { var $conn; var $Url_ID; var $Adm_ID; var $Cmy_ID; var $array_search; var $searchword; var $searchprice; var $searchpricemin; var $searchpricemax; var $searchzipcode; var $searchzipcodeexact; var $searchname; var $searcheventid; var $searcheventdate; var $searchfreeitems; var $searchnewitems; // // Constructor // - takes in a list of category ids specifying // the current categories to search upon. // function SearchTable($list,$word,$price,$pricemin,$pricemax,$zipcode,$zipcodeexact,$name,$eventid,$eventdate,$freeitems,$newitems,$check) { global $urlid; global $admid; global $cmyid; $this->array_search = $list; $this->conn = &MyConn(); $this->Url_ID = $urlid; $this->Adm_ID = $admid; $this->Cmy_ID = $cmyid; $this->searchword = $word; $this->searchprice = $price; $this->searchpricemin = $pricemin; $this->searchpricemax = $pricemax; $this->searchzipcode = $zipcode; $this->searchzipcodeexact = $zipcodeexact; $this->searchname = $name; $this->searcheventid = $eventid; $this->searcheventdate = $eventdate; $this->searchfreeitems = $freeitems; $this->searchnewitems = $newitems; $this->searchall = $check; } // // builds the form and search box specifically for the current page // function getTable($page) { global $cpage; global $sitecolor; $table = ""; $sql = "select * from url where Url_ID = '" . $this->Url_ID . "'"; $rs = $this->conn->Execute($sql); if (!$rs->EOF) { $Url_SearchOption1 = $rs->fields("Url_SearchOption1"); $Url_SearchOption2 = $rs->fields("Url_SearchOption2"); $Url_SearchOption3 = $rs->fields("Url_SearchOption3"); $Url_SearchOption4 = $rs->fields("Url_SearchOption4"); $Url_SearchOption5 = $rs->fields("Url_SearchOption5"); $Url_SearchOption6 = $rs->fields("Url_SearchOption6"); $Url_SearchOption7 = $rs->fields("Url_SearchOption7"); $Url_SearchOption8 = $rs->fields("Url_SearchOption8"); $Url_SearchOption9 = $rs->fields("Url_SearchOption9"); $Url_SearchOption10 = $rs->fields("Url_SearchOption10"); } if ($Url_SearchOption1 == 'Y' || $Url_SearchOption2 == 'Y' || $Url_SearchOption3 == 'Y' || $Url_SearchOption4 == 'Y' || $Url_SearchOption5 == 'Y' || $Url_SearchOption6 == 'Y' || $Url_SearchOption7 == 'Y' || $Url_SearchOption8 == 'Y' || $Url_SearchOption9 == 'Y' || $Url_SearchOption10 == 'Y') { /* Implement Search */ if ($page == "main") { $table = "
\n"; $table .= "\n"; } else { $table = "\n"; $table .= "\n"; } $table .= "\n"; for ($i = 0; $i < sizeof($this->array_search); $i++) { $table .= "\n"; } $table .= "
\n"; $table .= "\n"; if ($Url_SearchOption1 == 'Y') { $table .= "\n"; } if ($Url_SearchOption2 == 'Y') { $table .= "\n"; } if ($Url_SearchOption3 == 'Y') { $table .= "\n"; } if ($Url_SearchOption4 == 'Y') { $table .= "\n"; if ($this->searchzipcodeexact == 'Y') $table .= "\n"; else $table .= "\n"; } if ($Url_SearchOption5 == 'Y') { $table .= "\n"; } if ($Url_SearchOption7 == 'Y') { $table .= "\n"; } if ($Url_SearchOption8 == 'Y') { $table .= "\n"; } if ($Url_SearchOption6 == 'Y') { if ($this->searchfreeitems == 'Yes') $table .= "\n"; else $table .= "\n"; } if ($Url_SearchOption9 == 'Y') { if ($this->searchnewitems == 'Yes') $table .= "\n"; else $table .= "\n"; } if ($this->searchall != 1) $table .= "\n"; else $table .= "\n"; if ($this->searchall == 1) $table .= "\n"; else $table .= "\n"; $table .= "\n"; $table .= "
QUICK SEARCH

Brand, subject, title:
searchword . "\">
Price:
searchprice . "\">
Price Range:
searchpricemin . "\"> - searchpricemax . "\">
Zip Code:
searchzipcode . "\">
 Exact Zip Code
 Exact Zip Code
Name / Business:
searchname . "\">
Event ID:
searcheventid . "\">
Event Date:
searcheventdate . "\">
(YYYY-MM-DD)
 Free Items
 Free Items
 New Items
 New Items
 this category
 this category
 entire site
 entire site

\n"; $table .= "
\n"; /* Implement Search */ } return $table; } } // // provides the main index listings for the entire classifieds. // these categories are the Parent classified indexes. // class Category { var $conn; var $Adm_ID; var $Cmy_ID; var $array_cat; var $Cmy_Path; var $Cmy_URL; // // Constructor // - retrieves all the main categories and binds them to an array // function Category() { global $admid; global $cmyid; $this->array_cat = array(); $this->conn = &MyConn(); $this->Adm_ID = $admid; $this->Cmy_ID = $cmyid; $transdate = $this->conn->DBDate(time()); $transtime = $this->conn->DBTimeStamp(time()); $sql = "select * from company where Cmy_ID = " . $this->Cmy_ID; $rs = $this->conn->Execute($sql); if (!$rs->EOF) { $this->Cmy_Path = $rs->fields("Cmy_Upload_URL"); $this->Cmy_URL = $rs->fields("Cmy_URL"); } $sql = "select * from category where Cat_Visible= 'Y' and Cat_Parent_ID = 0 and Cmy_ID = " . $this->Cmy_ID . " order by Cat_Name asc"; $rs = $this->conn->Execute($sql); while (!$rs->EOF) { array_push($this->array_cat, array( $rs->fields("Cat_Name"), $rs->fields("Cat_Img"), $rs->fields("Cat_Index_Tmp"), $rs->fields("Cat_Con_Tmp"), $rs->fields("Cat_ID"), $rs->fields("Cat_Folder_Type"), $rs->fields("Cat_Upload_URL"), $rs->fields("Cat_Display_Type"), $rs->fields("Cat_Code"), 0, 0)); $rs->MoveNext(); } $sql = "select category.Cat_ID, count(*) from category, content where category.Cat_ID = content.Cat_ID AND Cat_Visible= 'Y' and Cat_Parent_ID = 0 and category.Cmy_ID = " . $this->Cmy_ID . " and Con_Status = 'Visible' and (Con_Release_Date < '" . $transdate . "' OR (Con_Release_Date = '" . $transdate . "' and Con_Release_Time <= '" . $transtime . "')) and (Con_Expiry_Date > '" . $transdate . "' OR (Con_Expiry_Date = '" . $transdate . "' and Con_Expiry_Time <= '" . $transtime . "')) group by category.Cat_ID order by Cat_Name asc"; $rs = $this->conn->Execute($sql); while (!$rs->EOF) { for ($i = 0; $i < sizeof($this->array_cat); $i++) { if ($this->array_cat[$i][4] == $rs->fields("Cat_ID")) { $this->array_cat[$i][9] = $rs->fields("count(*)"); } } $rs->MoveNext(); } $sql = "select category.Cat_ID, count(*) from category, category_content where category.Cat_ID = category_content.Cat_Sub_ID AND Cat_Visible= 'Y' and Cat_Parent_ID = 0 and category.Cmy_ID = " . $this->Cmy_ID . " group by category_content.Cat_Sub_ID order by Cat_Name asc"; $rs = $this->conn->Execute($sql); while (!$rs->EOF) { for ($i = 0; $i < sizeof($this->array_cat); $i++) { if ($this->array_cat[$i][4] == $rs->fields("Cat_ID")) { $this->array_cat[$i][10] = $rs->fields("count(*)"); } } $rs->MoveNext(); } } // // helper function that returns a newly created anchor/link // function getLink($index,$picview,$path) { if ($this->array_cat[$index][9] || $this->array_cat[$index][10]) { if ($this->array_cat[$index][9]) $anchor = ""; else $anchor = ""; if ($picview) $anchor .= ""; else { $anchor .= $this->array_cat[$index][0] . ""; if ($this->array_cat[$index][9]) $anchor .= " (" . $this->array_cat[$index][9] . ")"; } } else { if ($picview) $anchor = ""; else $anchor = "" . $this->array_cat[$index][0] . ""; } return $anchor; } // // function that returns a newly created url // function getURL($catcode) { $anchor = ""; for ($i = 0; $i < sizeof($this->array_cat); $i++) { if (strcasecmp($this->array_cat[$i][8],$catcode) == 0) { $anchor = $this->array_cat[$i][2] . "?cid=" . $this->array_cat[$i][4]; } } return $anchor; } // // function that returns number of content // function getNumOfContent($catcode) { $num = 0; for ($i = 0; $i < sizeof($this->array_cat); $i++) { if (strcasecmp($this->array_cat[$i][8],$catcode) == 0) { $num = $this->array_cat[$i][9]; } } return $num; } // // function that returns a newly created anchor/link // function getAnchor($catcode,$picview = -1) { $anchor = ""; for ($i = 0; $i < sizeof($this->array_cat); $i++) { if (strcasecmp($this->array_cat[$i][8],$catcode) == 0) { if ($this->array_cat[$i][5] == "C") $path = $this->Cmy_URL . $this->array_cat[$i][6]; else $path = $this->Cmy_URL . $this->Cmy_Path; if ($picview != -1) $anchor = $this->getLink($i,$picview,$path); else $anchor = $this->getLink($i,$this->array_cat[$i][7],$path); } } return $anchor; } // // returns a table of the category indexes as anchors/links // parameter accepts 1 for picture link, 0 for text link. // function listings($picview = -1) { $listings = "\n"; for ($i = 0; $i < sizeof($this->array_cat); $i++) { if ($this->array_cat[$i][5] == "C") $path = $this->Cmy_URL . $this->array_cat[$i][6]; else $path = $this->Cmy_URL . $this->Cmy_Path; if ($picview != -1) $listings .= "\n"; else $listings .= "\n"; } $listings .= "
" . $this->getLink($i,$picview,$path) . "
" . $this->getLink($i,$this->array_cat[$i][7],$path) . "
\n"; return $listings; } // // returns a searchbox // function searchBox() { global $HTTP_POST_VARS; $list = array(); for ($i = 0; $i < sizeof($this->array_cat); $i++) { array_push($list,$this->array_cat[$i][4]); } $searchTable = new SearchTable($list,$HTTP_POST_VARS['searchword'],$HTTP_POST_VARS['searchprice'],$HTTP_POST_VARS['searchpricemin'],$HTTP_POST_VARS['searchpricemax'],$HTTP_POST_VARS['searchzipcode'],$HTTP_POST_VARS['searchzipcodeexact'],$HTTP_POST_VARS['searchname'],$HTTP_POST_VARS['searcheventid'],$HTTP_POST_VARS['searcheventdate'],$HTTP_POST_VARS['searchfreeitems'],$HTTP_POST_VARS['searchnewitems'],$HTTP_POST_VARS['searchall']); return $searchTable->getTable("main"); } } // // retrieves the bio data // class Bio { var $conn; var $Adm_ID; var $Cmy_ID; var $array_bio; var $Cmy_URL; var $Cmy_Upload_URL; // // Constructor // - retrieves the entire company data and binds to an array // function Bio() { global $admid; global $cmyid; $this->array_bio = array(); $this->conn = &MyConn(); $this->Adm_ID = $admid; $this->Cmy_ID = $cmyid; $sql = "select * from bio where Cmy_ID = '" . $this->Cmy_ID . "' order by Bio_LastName asc, Bio_FirstName asc"; $rs = &$this->conn->Execute($sql); while (!($rs->EOF)) { $this->array_bio[$rs->fields("Adm_ID")] = array($rs->fields("Bio_FirstName"),$rs->fields("Bio_LastName"),$rs->fields("Bio_Info"),$rs->fields("Bio_Phone1"),$rs->fields("Bio_Phone2"),$rs->fields("Bio_Fax"),$rs->fields("Bio_Pic"),$rs->fields("Bio_Website"),$rs->fields("Bio_Email")); $rs->MoveNext(); } $sql = "select * from company where Cmy_ID = " . $this->Cmy_ID; $rs = $this->conn->Execute($sql); $this->Cmy_URL = $rs->fields("Cmy_URL"); $this->Cmy_Upload_URL = $rs->fields("Cmy_Upload_URL"); } function setAdm_ID($admin) { $this->Adm_ID = $admin; } function getAdm_ID() { return $this->Adm_ID; } function FirstName() { return $this->array_bio[$this->Adm_ID][0]; } // returns first name function LastName() { return $this->array_bio[$this->Adm_ID][1]; } // returns last name function Info() { return $this->array_bio[$this->Adm_ID][2]; } // returns description function Phone1() { return $this->array_bio[$this->Adm_ID][3]; } // returns phone 1 function Phone2() { return $this->array_bio[$this->Adm_ID][4]; } // returns phone 2 function Fax() { return $this->array_bio[$this->Adm_ID][5]; } // returns fax function Website() { return $this->array_bio[$this->Adm_ID][7]; } // returns website function Email() { return $this->array_bio[$this->Adm_ID][8]; } // returns email function Pic() { if ($this->array_bio[$this->Adm_ID][6]) { return $this->Cmy_URL . $this->Cmy_Upload_URL . $this->array_bio[$this->Adm_ID][6]; } else { return ""; } } } // // retrieves the company data // class Company { var $conn; var $Adm_ID; var $Cmy_ID; var $array_cmy; // // Constructor // - retrieves the entire company data and binds to an array // function Company() { global $admid; global $cmyid; $this->array_cmy = array(); $this->conn = &MyConn(); $this->Adm_ID = $admid; $this->Cmy_ID = $cmyid; $sql = "select * from company where Cmy_ID = " . $this->Cmy_ID; $rs = $this->conn->Execute($sql); $this->array_cmy["Cmy_Name"] = $rs->fields("Cmy_Name"); $this->array_cmy["Cmy_Website"] = $rs->fields("Cmy_Website"); $this->array_cmy["Cmy_AddrLine1"] = $rs->fields("Cmy_AddrLine1"); $this->array_cmy["Cmy_AddrLine2"] = $rs->fields("Cmy_AddrLine2"); $this->array_cmy["Cmy_City"] = $rs->fields("Cmy_City"); $this->array_cmy["Cmy_Prov_State"] = $rs->fields("Cmy_Prov_State"); $this->array_cmy["Cmy_Country"] = $rs->fields("Cmy_Country"); $this->array_cmy["Cmy_Postal_Zip"] = $rs->fields("Cmy_Postal_Zip"); $this->array_cmy["Cmy_Phone1"] = $rs->fields("Cmy_Phone1"); $this->array_cmy["Cmy_Phone2"] = $rs->fields("Cmy_Phone2"); $this->array_cmy["Cmy_Fax"] = $rs->fields("Cmy_Fax"); $this->array_cmy["Cmy_Dir"] = $rs->fields("Cmy_Dir"); $this->array_cmy["Cmy_URL"] = $rs->fields("Cmy_URL"); $this->array_cmy["Cmy_Temp_Dir"] = $rs->fields("Cmy_Temp_Dir"); $this->array_cmy["Cmy_Temp_URL"] = $rs->fields("Cmy_Temp_URL"); $this->array_cmy["Cmy_Con_Dir"] = $rs->fields("Cmy_Con_Dir"); $this->array_cmy["Cmy_Con_URL"] = $rs->fields("Cmy_Con_URL"); $this->array_cmy["Cmy_Upload_Dir"] = $rs->fields("Cmy_Upload_Dir"); $this->array_cmy["Cmy_Upload_URL"] = $rs->fields("Cmy_Upload_URL"); $this->array_cmy["Cmy_Logo"] = $rs->fields("Cmy_Logo"); $this->array_cmy["Cmy_Descr"] = $rs->fields("Cmy_Descr"); $this->array_cmy["Cmy_CName1"] = $rs->fields("Cmy_CName1"); $this->array_cmy["Cmy_CName2"] = $rs->fields("Cmy_CName2"); $this->array_cmy["Cmy_CPosition1"] = $rs->fields("Cmy_CPosition1"); $this->array_cmy["Cmy_CPosition2"] = $rs->fields("Cmy_CPosition2"); $this->array_cmy["Cmy_CContact1"] = $rs->fields("Cmy_CContact1"); $this->array_cmy["Cmy_CContact2"] = $rs->fields("Cmy_CContact2"); $this->array_cmy["Cmy_Email"] = $rs->fields("Cmy_Email"); $this->array_cmy["Cmy_CEmail1"] = $rs->fields("Cmy_CEmail1"); $this->array_cmy["Cmy_CEmail2"] = $rs->fields("Cmy_CEmail2"); } // // returns the image link for company logo // function getLogo() { if ($this->array_cmy["Cmy_Logo"]) return $this->array_cmy["Cmy_URL"] . $this->array_cmy["Cmy_Upload_URL"] . $this->array_cmy["Cmy_Logo"]; else return ""; } // // returns the custom description from company // function getDescription() { return $this->array_cmy["Cmy_Descr"]; } // // returns the contact info specified on the company page // function getContact() { $contact = "\n"; $contact .= "\n"; $contact .= "\n"; $contact .= "\n"; $contact .= "\n"; $contact .= "\n"; $contact .= "
Name" . $this->array_cmy["Cmy_Name"] . "
Phone Number" . $this->array_cmy["Cmy_Phone1"] . "
Fax Number" . $this->array_cmy["Cmy_Fax"] . "
Emailarray_cmy["Cmy_Email"] . ">" . $this->array_cmy["Cmy_Email"] . "
Address" . $this->array_cmy["Cmy_AddrLine1"] . "
"; if ($this->array_cmy["Cmy_AddrLine2"]) $contact .= $this->array_cmy["Cmy_AddrLine2"] . "
"; $contact .= $this->array_cmy["Cmy_City"] . ", " .$this->array_cmy["Cmy_Prov_State"] . " " . $this->array_cmy["Cmy_Postal_Zip"] . " " . $this->array_cmy["Cmy_Country"] . "
\n"; return $contact; } // // returns the people associated to the company // function getPeople($num) { $contact = "\n"; $contact .= "\n"; $contact .= "\n"; $contact .= "\n"; $contact .= "\n"; $contact .= "
Position" . $this->array_cmy["Cmy_CPosition" . $num] . "
Name" . $this->array_cmy["Cmy_CName" . $num] . "
Emailarray_cmy["Cmy_CEmail" . $num] . ">" . $this->array_cmy["Cmy_CEmail" . $num] . "
Contact" . $this->array_cmy["Cmy_CContact" . $num] . "
\n"; return $contact; } } // // retrieves the subcategories of the selected main category // class SubCategory { var $conn; var $Adm_ID; var $Cmy_ID; var $Cat_ID; var $array_subcat; var $Cat_Name; var $Cat_Con_Tmp; var $Cmy_Path; var $Cmy_URL; // // Constructor // - retrieves all the subcategories of the selected main category // function SubCategory() { global $admid; global $cmyid; global $HTTP_GET_VARS; $this->array_subcat = array(); $this->conn = &MyConn(); $this->Adm_ID = $admid; $this->Cmy_ID = $cmyid; $this->Cat_ID = $HTTP_GET_VARS['cid']; $transdate = $this->conn->DBDate(time()); $transtime = $this->conn->DBTimeStamp(time()); $sql = "select * from company where Cmy_ID = " . $this->Cmy_ID; $rs = $this->conn->Execute($sql); if (!$rs->EOF) { $this->Cmy_Path = $rs->fields("Cmy_Upload_URL"); $this->Cmy_URL = $rs->fields("Cmy_URL"); } /* Grab SubCategory Data */ $sql = "select * from category where Cat_Visible = 'Y' and Cat_ID = " . $this->Cat_ID; $rs = $this->conn->Execute($sql); if (!$rs->EOF) { $this->Cat_Name = $rs->fields("Cat_Name"); $this->Cat_Con_Tmp = $rs->fields("Cat_Con_Tmp"); } /* Grab SubCategory Data */ $sql = "select * from category where Cat_Visible = 'Y' and Cat_Parent_ID = " . $this->Cat_ID . " OR Cat_ID = " . $this->Cat_ID . " order by Cat_Name asc"; $rs = $this->conn->Execute($sql); while (!$rs->EOF) { if ($rs->fields("Cat_ID") != $this->Cat_ID) { array_push($this->array_subcat, array( $rs->fields("Cat_Name"), $rs->fields("Cat_Img"), $rs->fields("Cat_Index_Tmp"), $this->Cat_Con_Tmp, $rs->fields("Cat_ID"), $rs->fields("Cat_Folder_Type"), $rs->fields("Cat_Upload_URL"), $rs->fields("Cat_Display_Type"), $rs->fields("Cat_Code"), 0)); } $rs->MoveNext(); } $sql = "select category.Cat_ID, count(*) from category, content where category.Cat_ID = content.Cat_ID AND (Cat_Parent_ID = " . $this->Cat_ID . " OR category.Cat_ID = " . $this->Cat_ID . ") and Cat_Visible = 'Y' and Con_Status = 'Visible' and (Con_Release_Date < '" . $transdate . "' OR (Con_Release_Date = '" . $transdate . "' and Con_Release_Time <= '" . $transtime . "')) and (Con_Expiry_Date > '" . $transdate . "' OR (Con_Expiry_Date = '" . $transdate . "' and Con_Expiry_Time <= '" . $transtime . "')) group by category.Cat_ID order by Cat_Name asc"; $rs = $this->conn->Execute($sql); while (!$rs->EOF) { for ($i = 0; $i < sizeof($this->array_subcat); $i++) { if ($this->array_subcat[$i][4] == $rs->fields("Cat_ID")) { $this->array_subcat[$i][9] = $rs->fields("count(*)"); } } $rs->MoveNext(); } } // // helper function that builds the anchors/links // function getLink($index,$picview,$path) { $anchor = " "; if ($picview) $anchor .= ""; else { $anchor .= $this->array_subcat[$index][0] . ""; if ($this->array_subcat[$index][9]) $anchor .= " (" . $this->array_subcat[$index][9] . ")"; } return $anchor; } // // function that returns a newly created url // function getURL($catcode) { $anchor = ""; for ($i = 0; $i < sizeof($this->array_subcat); $i++) { if (strcasecmp($this->array_subcat[$i][8],$catcode) == 0) { $anchor = $this->array_subcat[$i][2] . "?cid=" . $this->array_subcat[$i][4]; } } return $anchor; } // // function that returns number of content // function getNumOfContent($catcode) { $num = 0; for ($i = 0; $i < sizeof($this->array_subcat); $i++) { if (strcasecmp($this->array_subcat[$i][8],$catcode) == 0) { $num = $this->array_subcat[$i][9]; } } return $num; } // // function that returns a newly created anchor/link // function getAnchor($catcode,$picview = -1) { $anchor = ""; for ($i = 0; $i < sizeof($this->array_subcat); $i++) { if (strcasecmp($this->array_subcat[$i][8],$catcode) == 0) { if ($this->array_subcat[$i][5] == "C") $path = $this->Cmy_URL . $this->array_subcat[$i][6]; else $path = $this->Cmy_URL . $this->Cmy_Path; if ($picview != -1) $anchor = $this->getLink($i,$picview,$path); else $anchor = $this->getLink($i,$this->array_subcat[$i][7],$path); } } return $anchor; } // // returns the listings of subcategories // function listings($picview = -1) { global $cpage; $listings = "
array_subcat) . ")\" action=" . $cpage . " name=classified method=post>\n"; $listings .= "\n"; $listings .= "\n"; $listings .= "\n"; $listings .= "\n"; for ($i = 0; $i < sizeof($this->array_subcat); $i++) { if ($this->array_cat[$i][5] == "C") $path = $this->Cmy_URL . $this->array_cat[$i][6]; else $path = $this->Cmy_URL . $this->Cmy_Path; if ($picview != -1) $listings .= "\n"; else $listings .= "\n"; } $listings .= "
\n"; $listings .= "NOTE: Click on any box or multiple boxes to view classifieds. "; $listings .= "To view all ads in the category, please check 'Select All' and press 'Search' key."; $listings .= "

array_subcat) . " <= 1) { form.elements['subcat[]'].checked = form.elements['checkall'].checked; } else { for(i=0; i < form.elements['subcat[]'].length; i++) form.elements['subcat[]'][i].checked = form.elements['checkall'].checked; } \"> Select All     

" . $this->getLink($i,$picview,$path) . "
" . $this->getLink($i,$this->array_cat[$i][7],$path) . "
\n"; $listings .= "
\n"; return $listings; } // // returns the parent category's name // function getName() { return $this->Cat_Name; } // // returns the search box // function searchBox() { global $HTTP_POST_VARS; $list = array(); for ($i = 0; $i < sizeof($this->array_subcat); $i++) { array_push($list,$this->array_subcat[$i][4]); } $searchTable = new SearchTable($list,$HTTP_POST_VARS['searchword'],$HTTP_POST_VARS['searchprice'],$HTTP_POST_VARS['searchpricemin'],$HTTP_POST_VARS['searchpricemax'],$HTTP_POST_VARS['searchzipcode'],$HTTP_POST_VARS['searchzipcodeexact'],$HTTP_POST_VARS['searchname'],$HTTP_POST_VARS['searcheventid'],$HTTP_POST_VARS['searcheventdate'],$HTTP_POST_VARS['searchfreeitems'],$HTTP_POST_VARS['searchnewitems'],$HTTP_POST_VARS['searchall']); return $searchTable->getTable(""); } } // // contains the actual listings of selected classified category // class Classified { var $conn; var $Adm_ID; var $Cmy_ID; var $Cat_Name; var $array_class; var $Cmy_Path; var $Cmy_URL; // // returns the field name // function getFieldName($field) { return $this->array_contentfield[strtolower($field)][0]; } // // returns the field index // function getFieldIndex($field) { return $this->array_contentfield[strtolower($field)][1]; } // // Constructor // - builds and retrieves the selected classifieds // function Classified() { global $admid; global $cmyid; global $HTTP_GET_VARS; global $HTTP_POST_VARS; $this->array_class = array(); $this->array_class_image = array(); $this->array_contentfield = array(); $this->array_sortfield = array(); $this->conn = &MyConn(); $this->Adm_ID = $admid; $this->Cmy_ID = $cmyid; $transdate = $this->conn->DBDate(time()); $transtime = $this->conn->DBTimeStamp(time()); $sql = "select * from company where Cmy_ID = " . $this->Cmy_ID; $rs = $this->conn->Execute($sql); if (!$rs->EOF) { $this->Cmy_Path = $rs->fields("Cmy_Upload_URL"); $this->Cmy_URL = $rs->fields("Cmy_URL"); } // select visible content $this->array_contentfield[strtolower("Con_ID")] = array("Con_ID",0); $this->array_contentfield[strtolower("Cat_ID")] = array("Cat_ID",1); $this->array_contentfield[strtolower("Adm_ID")] = array("Adm_ID",2); $this->array_contentfield[strtolower("Con_Title")] = array("Con_Title",3); $this->array_contentfield[strtolower("Con_Create_Date")] = array("Con_Create_Date",4); $this->array_contentfield[strtolower("Con_Modify_Date")] = array("Con_Modify_Date",5); $this->array_contentfield[strtolower("Con_Create_Time")] = array("Con_Create_Time",6); $this->array_contentfield[strtolower("Con_Modify_Time")] = array("Con_Modify_Time",7); $this->array_contentfield[strtolower("Con_Release_Date")] = array("Con_Release_Date",8); $this->array_contentfield[strtolower("Con_Release_Time")] = array("Con_Release_Time",9); $this->array_contentfield[strtolower("Con_Expiry_Date")] = array("Con_Expiry_Date",10); $this->array_contentfield[strtolower("Con_Expiry_Time")] = array("Con_Expiry_Time",11); $this->array_contentfield[strtolower("Con_Status")] = array("Con_Status",12); $this->array_contentfield[strtolower("Con_Type")] = array("Con_Type",13); $this->array_contentfield[strtolower("Con_URL")] = array("Con_URL",14); $this->array_contentfield[strtolower("Con_Upload")] = array("Con_Upload",15); $this->array_contentfield[strtolower("Con_Summary")] = array("Con_Summary",16); $this->array_contentfield[strtolower("Con_Content")] = array("Con_Content",17); $sql = "select * from content_field where FCon_Active = 'Y' AND Cmy_ID = " . $this->Cmy_ID; $rs = &$this->conn->Execute($sql); while (!$rs->EOF) { if ($rs->fields("FCon_Field_Name") == "Con_XText1") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText1",18); if ($rs->fields("FCon_Field_Name") == "Con_XText2") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText2",19); if ($rs->fields("FCon_Field_Name") == "Con_XText3") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText3",20); if ($rs->fields("FCon_Field_Name") == "Con_XText4") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText4",21); if ($rs->fields("FCon_Field_Name") == "Con_XText5") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText5",22); if ($rs->fields("FCon_Field_Name") == "Con_XText6") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText6",23); if ($rs->fields("FCon_Field_Name") == "Con_XText7") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText7",24); if ($rs->fields("FCon_Field_Name") == "Con_XText8") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText8",25); if ($rs->fields("FCon_Field_Name") == "Con_XText9") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText9",26); if ($rs->fields("FCon_Field_Name") == "Con_XText10") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText10",27); if ($rs->fields("FCon_Field_Name") == "Con_XText11") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText11",28); if ($rs->fields("FCon_Field_Name") == "Con_XText12") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText12",29); if ($rs->fields("FCon_Field_Name") == "Con_XText13") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText13",30); if ($rs->fields("FCon_Field_Name") == "Con_XText14") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText14",31); if ($rs->fields("FCon_Field_Name") == "Con_XText15") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText15",32); if ($rs->fields("FCon_Field_Name") == "Con_XText16") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText16",33); if ($rs->fields("FCon_Field_Name") == "Con_XText17") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText17",34); if ($rs->fields("FCon_Field_Name") == "Con_XText18") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText18",35); if ($rs->fields("FCon_Field_Name") == "Con_XText19") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText19",36); if ($rs->fields("FCon_Field_Name") == "Con_XText20") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText20",37); if ($rs->fields("FCon_Field_Name") == "Con_XText21") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText21",38); if ($rs->fields("FCon_Field_Name") == "Con_XText22") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText22",39); if ($rs->fields("FCon_Field_Name") == "Con_XText23") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText23",40); if ($rs->fields("FCon_Field_Name") == "Con_XText24") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText24",41); if ($rs->fields("FCon_Field_Name") == "Con_XText25") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XText25",42); if ($rs->fields("FCon_Field_Name") == "Con_XBox1") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XBox1",43); if ($rs->fields("FCon_Field_Name") == "Con_XBox2") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XBox2",44); if ($rs->fields("FCon_Field_Name") == "Con_XBox3") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XBox3",45); if ($rs->fields("FCon_Field_Name") == "Con_XBox4") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XBox4",46); if ($rs->fields("FCon_Field_Name") == "Con_XBox5") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XBox5",47); if ($rs->fields("FCon_Field_Name") == "Con_XNum1") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XNum1",48); if ($rs->fields("FCon_Field_Name") == "Con_XNum2") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XNum2",49); if ($rs->fields("FCon_Field_Name") == "Con_XNum3") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XNum3",50); if ($rs->fields("FCon_Field_Name") == "Con_XNum4") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XNum4",51); if ($rs->fields("FCon_Field_Name") == "Con_XNum5") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XNum5",52); if ($rs->fields("FCon_Field_Name") == "Con_XInt1") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XInt1",53); if ($rs->fields("FCon_Field_Name") == "Con_XInt2") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XInt2",54); if ($rs->fields("FCon_Field_Name") == "Con_XInt3") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XInt3",55); if ($rs->fields("FCon_Field_Name") == "Con_XInt4") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XInt4",56); if ($rs->fields("FCon_Field_Name") == "Con_XInt5") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XInt5",57); if ($rs->fields("FCon_Field_Name") == "Con_XDate1") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XDate1",58); if ($rs->fields("FCon_Field_Name") == "Con_XDate2") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XDate2",59); if ($rs->fields("FCon_Field_Name") == "Con_XDate3") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XDate3",60); if ($rs->fields("FCon_Field_Name") == "Con_XDate4") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XDate4",61); if ($rs->fields("FCon_Field_Name") == "Con_XDate5") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XDate5",62); if ($rs->fields("FCon_Field_Name") == "Con_XTime1") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XTime1",63); if ($rs->fields("FCon_Field_Name") == "Con_XTime2") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XTime2",64); if ($rs->fields("FCon_Field_Name") == "Con_XTime3") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XTime3",65); if ($rs->fields("FCon_Field_Name") == "Con_XTime4") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XTime4",66); if ($rs->fields("FCon_Field_Name") == "Con_XTime5") $this->array_contentfield[strtolower($rs->fields("FCon_Display_Name"))] = array("Con_XTime5",67); $rs->MoveNext(); } $this->array_contentfield["Cmy_ID"] = array("Cmy_ID",68); $this->array_contentfield["Con_GlobalID"] = array("Con_GlobalID",69); // Build Sort Array (Need to be automatic in the future.) if ($HTTP_POST_VARS['searchzipcode']) array_push($this->array_sortfield, array("Con_XText8","asc")); array_push($this->array_sortfield, array("Con_Title","asc")); array_push($this->array_sortfield, array("Con_Content","asc")); // form submitted from an anchor via get method if ($HTTP_GET_VARS['cid']) $sql = "select * from category where Cat_Visible = 'Y' and Cat_ID = " . $HTTP_GET_VARS['cid'] . " order by Cat_Name asc"; // form submitted from search via post method if ($HTTP_POST_VARS['searchcat']) { if ($HTTP_POST_VARS['searchall']) $sql = "select * from category where Cat_Visible = 'Y' and Cmy_ID = " . $this->Cmy_ID . " order by Cat_Name asc"; else $selections = $HTTP_POST_VARS['searchcat']; } // form submitted from checkboxes via post method if ($HTTP_POST_VARS['subcat']) $selections = $HTTP_POST_VARS['subcat']; // if multiple category listings then build sql statement if (sizeof($selections) > 0) { $sql = "select * from category where Cat_Visible = 'Y' and Cat_ID = " . $selections[0]; for ($i = 1; $i < sizeof($selections); $i++) $sql .= " OR Cat_ID = " . $selections[$i]; $sql .= " order by Cat_Name asc"; } if ($sql) { $rs = &$this->conn->Execute($sql); while (!$rs->EOF) { array_push($this->array_class, array($rs->fields("Cat_ID"), $rs->fields("Cat_Code"), $rs->fields("Cat_Name"), $rs->fields("Cat_Visible"), $rs->fields("Cat_Img"), $rs->fields("Cat_Display_Type"), $rs->fields("Cat_Index_Tmp"), $rs->fields("Cat_Con_Tmp"), $rs->fields("Cat_Folder_Type"), $rs->fields("Cat_Con_Dir"), $rs->fields("Cat_Con_URL"), $rs->fields("Cat_Upload_Dir"), $rs->fields("Cat_Upload_URL"), array())); $rs->MoveNext(); } } // retrieve the content $presql1 = "select * from content,category where content.Cat_ID = category.Cat_ID"; $presql2 = "select CImg_ID, content_image.Con_ID, Img_File, Caption from content_image,content,category where content_image.Con_ID = content.Con_ID and content.Cat_ID = category.Cat_ID"; $sql = " AND (category.Cat_ID = " . $this->array_class[0][0]; for ($i = 1; $i < sizeof($this->array_class); $i++) $sql .= " OR category.Cat_ID = " . $this->array_class[$i][0]; $sql .= ")"; $sql .= " and Cat_Visible = 'Y' and Con_Status = 'Visible'"; if ($HTTP_POST_VARS['func'] != "search") $sql .= " and (Con_Release_Date < '" . $transdate . "' OR (Con_Release_Date = '" . $transdate . "' and Con_Release_Time <= '" . $transtime . "')) and (Con_Expiry_Date > '" . $transdate . "' OR (Con_Expiry_Date = '" . $transdate . "' and Con_Expiry_Time <= '" . $transtime . "'))"; if ($HTTP_POST_VARS['searchword']) $sql .= " and (Con_Content like '%" . $HTTP_POST_VARS['searchword'] . "%' OR Con_Title like '%" . $HTTP_POST_VARS['searchword'] . "%')"; if ($HTTP_POST_VARS['searchprice']) { $sql .= " and " . "Con_XNum1" . " LIKE '" . $HTTP_POST_VARS['searchprice'] . "'"; } else { if ($HTTP_POST_VARS['searchpricemin']) $sql .= " and " . "Con_XNum1" . " >= '" . $HTTP_POST_VARS['searchpricemin'] . "'"; if ($HTTP_POST_VARS['searchpricemax']) $sql .= " and ". "Con_XNum1" . " <= '" . $HTTP_POST_VARS['searchpricemax'] . "'"; } if ($HTTP_POST_VARS['searchzipcode']) { if ($HTTP_POST_VARS['searchzipcodeexact']) $sql .= " and " . "Con_XText8" . " = '" . $HTTP_POST_VARS['searchzipcode'] . "'"; else $sql .= " and (" . "Con_XText8" . " like '" . substr($HTTP_POST_VARS['searchzipcode'],0,3) . "%' OR Con_XText8 = '')"; } if ($HTTP_POST_VARS['searchname']) $sql .= " and " . "Con_XText1" . " like '%" . $HTTP_POST_VARS['searchname'] . "%'"; if ($HTTP_POST_VARS['searcheventid']) $sql .= " and " . "Con_XText19" . " = '" . $HTTP_POST_VARS['searcheventid'] . "'"; if ($HTTP_POST_VARS['searcheventdate']) $sql .= " and ((Con_XDate1 <= '" . $HTTP_POST_VARS['searcheventdate'] . "' and Con_XDate2 >= '" . $HTTP_POST_VARS['searcheventdate'] . "') OR (Con_XDate1 <= '" . $HTTP_POST_VARS['searcheventdate'] . "' and Con_XDate2 = '0000-00-00') OR (Con_XDate1 = '0000-00-00' and Con_XDate2 >= '" . $HTTP_POST_VARS['searcheventdate'] . "'))"; if ($HTTP_POST_VARS['searchfreeitems']) $sql .= " and " . "Con_XText18" . " = '" . $HTTP_POST_VARS['searchfreeitems'] . "'"; /* New Item */ if ($HTTP_POST_VARS['searchnewitems']) { $today = getdate(); $year = $today['year']; $mth = $today['mon']; $mday = $today['mday']; $newdate = date("Y-m-d",mktime(0,0,0,$mth,$mday-NEW_ADS_DAYS,$year)); $sql .= " and Con_Release_Date >= '" . $newdate . "'"; } /* New Item */ $sql .= " order by Cat_Name asc"; for ($i = 0; $i < sizeof($this->array_sortfield); $i++) { if ($this->array_sortfield[$i][0]) $sql .= ", " . $this->array_sortfield[$i][0] . " " . $this->array_sortfield[$i][1]; } $rs = $this->conn->Execute($presql1 . $sql); $counter = 0; while (!$rs->EOF) { if ($rs->fields("Cat_ID") == $this->array_class[$counter][0]) { array_push($this->array_class[$counter][13], array($rs->fields("Con_ID"), $rs->fields("Cat_ID"), $rs->fields("Adm_ID"), $rs->fields("Con_Title"), $rs->fields("Con_Create_Date"), $rs->fields("Con_Modify_Date"), $rs->fields("Con_Create_Time"), $rs->fields("Con_Modify_Time"), $rs->fields("Con_Release_Date"), $rs->fields("Con_Release_Time"), $rs->fields("Con_Expiry_Date"), $rs->fields("Con_Expiry_Time"), $rs->fields("Con_Status"), $rs->fields("Con_Type"), $rs->fields("Con_URL"), $rs->fields("Con_Upload"), $rs->fields("Con_Summary"), $rs->fields("Con_Content"), $rs->fields("Con_XText1"), $rs->fields("Con_XText2"), $rs->fields("Con_XText3"), $rs->fields("Con_XText4"), $rs->fields("Con_XText5"), $rs->fields("Con_XText6"), $rs->fields("Con_XText7"), $rs->fields("Con_XText8"), $rs->fields("Con_XText9"), $rs->fields("Con_XText10"), $rs->fields("Con_XText11"), $rs->fields("Con_XText12"), $rs->fields("Con_XText13"), $rs->fields("Con_XText14"), $rs->fields("Con_XText15"), $rs->fields("Con_XText16"), $rs->fields("Con_XText17"), $rs->fields("Con_XText18"), $rs->fields("Con_XText19"), $rs->fields("Con_XText20"), $rs->fields("Con_XText21"), $rs->fields("Con_XText22"), $rs->fields("Con_XText23"), $rs->fields("Con_XText24"), $rs->fields("Con_XText25"), $rs->fields("Con_XBox1"), $rs->fields("Con_XBox2"), $rs->fields("Con_XBox3"), $rs->fields("Con_XBox4"), $rs->fields("Con_XBox5"), $rs->fields("Con_XNum1"), $rs->fields("Con_XNum2"), $rs->fields("Con_XNum3"), $rs->fields("Con_XNum4"), $rs->fields("Con_XNum5"), $rs->fields("Con_XInt1"), $rs->fields("Con_XInt2"), $rs->fields("Con_XInt3"), $rs->fields("Con_XInt4"), $rs->fields("Con_XInt5"), $rs->fields("Con_XDate1"), $rs->fields("Con_XDate2"), $rs->fields("Con_XDate3"), $rs->fields("Con_XDate4"), $rs->fields("Con_XDate5"), $rs->fields("Con_XTime1"), $rs->fields("Con_XTime2"), $rs->fields("Con_XTime3"), $rs->fields("Con_XTime4"), $rs->fields("Con_XTime5"), $rs->fields("Cmy_ID"), $rs->fields("Con_GlobalID"))); $rs->MoveNext(); } else { $counter++; } } $rs = $this->conn->Execute($presql2 . $sql); while (!$rs->EOF) { if (!array_key_exists($rs->fields("Con_ID"),$this->array_class_image)) { $this->array_class_image[$rs->fields("Con_ID")] = array(); } array_push($this->array_class_image[$rs->fields("Con_ID")],array($rs->fields("CImg_ID"),$rs->fields("Img_File"),$rs->fields("Caption"))); $rs->MoveNext(); } // retrieve the name of the section / parent category if ($HTTP_GET_VARS['pid'] || $HTTP_GET_VARS['cid']) { if ($HTTP_GET_VARS['cid']) $sql = "select * from category where Cat_Visible = 'Y' and Cat_ID = " . $HTTP_GET_VARS['cid'] . " order by Cat_Name asc"; if ($HTTP_GET_VARS['pid']) $sql = "select * from category where Cat_Visible = 'Y' and Cat_ID = " . $HTTP_GET_VARS['pid'] . " order by Cat_Name asc"; $rs = $this->conn->Execute($sql); $this->Cat_Name = $rs->fields("Cat_Name"); } else { $this->Cat_Name = "Search Results"; } } // // returns the listings of the actual classifieds // function listings() { global $sitecolor; global $HTTP_SESSION_VARS; $check = false; $listings = "\n"; for ($i = 0; $i < sizeof($this->array_class); $i++) { if (sizeof($this->array_class[$i][13]) > 0) { $check = true; if ($this->array_class[$i][8] == "C") $imagepath = $this->Cmy_URL . $this->array_class[$i][12]; else $imagepath = $this->Cmy_URL . $this->Cmy_Path; $listings .= "\n"; for ($j = 0; $j < sizeof($this->array_class[$i][13]); $j++) { if ($bgcolor == "#FFFFEE") $bgcolor = "#FFFFFF"; else $bgcolor = "#FFFFEE"; /* $Con_ID = $this->array_class[$i][13][$j][$this->getFieldIndex("Con_ID")]; $title = $this->array_class[$i][13][$j][$this->getFieldIndex("Con_Title")]; $expirationdate = $this->array_class[$i][13][$j][$this->getFieldIndex("Con_Expiry_Date")]; $model = $this->array_class[$i][13][$j][$this->getFieldIndex("Make, model, color, size, other descriptions")]; $price = $this->array_class[$i][13][$j][$this->getFieldIndex("Price of item:")]; $units = $this->array_class[$i][13][$j][$this->getFieldIndex("Unit price information and other pricing details")]; $content = $this->array_class[$i][13][$j][$this->getFieldIndex("Con_Content")]; $name = $this->array_class[$i][13][$j][$this->getFieldIndex("Your Name, Event or Business")]; $venue = $this->array_class[$i][13][$j][$this->getFieldIndex("Address (physical location)")]; $city = $this->array_class[$i][13][$j][$this->getFieldIndex("City & State")]; $zipcode = $this->array_class[$i][13][$j][$this->getFieldIndex("Zip Code")]; $areacode = $this->array_class[$i][13][$j][$this->getFieldIndex("Area Code")]; $phone = $this->array_class[$i][13][$j][$this->getFieldIndex("Phone (daytime)")]; $website = $this->array_class[$i][13][$j][$this->getFieldIndex("Website (if you have one)")]; $videowebsite = $this->array_class[$i][13][$j][$this->getFieldIndex("Video Website Link")]; $email = $this->array_class[$i][13][$j][$this->getFieldIndex("E-mail address")]; */ $Con_ID = $this->array_class[$i][13][$j][0]; $title = $this->array_class[$i][13][$j][3]; $expirationdate = $this->array_class[$i][13][$j][10]; $eventstartdate = $this->array_class[$i][13][$j][58]; $eventenddate = $this->array_class[$i][13][$j][59]; $eventstarttime = $this->array_class[$i][13][$j][63]; $eventendtime = $this->array_class[$i][13][$j][64]; $score = $this->array_class[$i][13][$j][30]; $model = $this->array_class[$i][13][$j][24]; $price = $this->array_class[$i][13][$j][48]; $source = $this->array_class[$i][13][$j][26]; $units = $this->array_class[$i][13][$j][27]; $content = $this->array_class[$i][13][$j][17]; $name = $this->array_class[$i][13][$j][18]; $venue = $this->array_class[$i][13][$j][19]; $city = $this->array_class[$i][13][$j][20]; $zipcode = $this->array_class[$i][13][$j][25]; $areacode = $this->array_class[$i][13][$j][28]; $phone = $this->array_class[$i][13][$j][22]; $website = $this->array_class[$i][13][$j][23]; $videowebsite = $this->array_class[$i][13][$j][29]; $contact = $this->array_class[$i][13][$j][32]; $email = $this->array_class[$i][13][$j][21]; $displaycontact = $this->array_class[$i][13][$j][33]; $displayemail = $this->array_class[$i][13][$j][34]; $Con_GlobalID = $this->array_class[$i][13][$j][69]; $eventid = $this->array_class[$i][13][$j][36]; $headline = $this->array_class[$i][13][$j][37]; $headlinesummary = $this->array_class[$i][13][$j][16]; $listings .= ""; } } } if (sizeof($this->array_class) == 0 || !$check) $listings .= ""; $listings .= "

" . $this->array_class[$i][2] . "
"; if ($videowebsite) $listings .= "   "; if ($title) $listings .= "" . $title . ""; if ($Con_GlobalID) $listings .= " #" . $Con_GlobalID; $listings .= "
"; if ($eventid) $listings .= "Event ID: #" . $eventid . " "; /* Today's Date */ $today = getdate(); $year = $today['year']; $mth = $today['mon']; $mday = $today['mday']; $todaydate = date("Y-m-d",mktime(0,0,0,$mth,$mday,$year)); /* Today's Date */ if ($todaydate > $eventenddate) { if ($score) $listings .= "Score/Result: " . $score . "

"; } else { $eventstartstr = ""; if ($eventstartdate != "0000-00-00") { $eventstartstr .= " " . $eventstartdate; if ($eventstarttime != "00:00:00") { $tmp = split(":",$eventstarttime); if ($tmp[0] >= 12) { if ($tmp[0] != 12) $tmp[0] = ($tmp[0]-12); $eventstartstr .= " - " . $tmp[0] . ":" . $tmp[1] . " PM"; } else { if ($tmp[0] == "00") $tmp[0] = 12; else { if ($tmp[0] < "10") $tmp[0] = substr($tmp[0],1,1); } $eventstartstr .= " - " . $tmp[0] . ":" . $tmp[1] . " AM"; } } } else $eventstartstr .= " N/A"; $eventendstr = ""; if ($eventenddate != "0000-00-00") { $eventendstr .= " " . $eventenddate; if ($eventendtime != "00:00:00") { $tmp = split(":",$eventendtime); if ($tmp[0] >= 12) { if ($tmp[0] != 12) $tmp[0] = ($tmp[0]-12); $eventendstr .= " - " . $tmp[0] . ":" . $tmp[1] . " PM"; } else { if ($tmp[0] == "00") $tmp[0] = 12; else { if ($tmp[0] < "10") $tmp[0] = substr($tmp[0],1,1); } $eventendstr .= " - " . $tmp[0] . ":" . $tmp[1] . " AM"; } } } else $eventendstr .= " N/A"; if ($eventstartdate != "" || $eventenddate != "") $listings .= "Date and Time "; if ($eventstartstr) $listings .= "Start:" . $eventstartstr; if ($eventstartstr && $eventendstr) $listings .= "   "; if ($eventendstr) $listings .= "End:" . $eventendstr; if ($eventstartstr || $eventendstr) $listings .= "

"; } if ($model) $listings .= "" . $model . ""; if ($price && $price != "0.00") { if ($model) $listings .= " "; $listings .= "Price:  $" . FormatPrice($price) . ""; if ($units) $listings .= " / " . $units . ""; } if ($model || ($price && $price != "0.00")) $listings .= "

"; if ($headline) { $listings .= "" . $headline . "

"; } if ($headlinesummary) { $listings .= "" . str_replace(" ","  ",nl2br($headlinesummary)) . "

"; } if ($content) { /* Generate Images for Listing Purposes*/ $k = 0; while ($k < sizeof($this->array_class_image[$Con_ID])) { $imageholder = ""; $imageholder .= ""; $imageholder .= ""; $imageholder .= "
"; $imageholder .= "array_class_image[$Con_ID][$k][1] . "\" border=0>"; $imageholder .= "
"; //$content = str_replace("**" . str_replace("Con_" . $Con_ID . "_","",$this->array_class_image[$Con_ID][$k][1]) . "**",$imageholder,$content); /* Suppress Image */ if (strcasecmp($HTTP_SESSION_VARS['WEBSITE_SYSTEMID'] . ".",substr($Con_GlobalID,0,strlen($HTTP_SESSION_VARS['WEBSITE_SYSTEMID'])+1)) != 0) { $content = str_replace("**" . $this->array_class_image[$Con_ID][$k][1] . "**\r\n","",$content); $content = str_replace("**" . $this->array_class_image[$Con_ID][$k][1] . "**","",$content); } /* Suppress Image */ $content = str_replace("**" . $this->array_class_image[$Con_ID][$k][1] . "**",$imageholder,$content); $k++; } /* Generate Images for Listing Purposes*/ $listings .= str_replace(" ","  ",nl2br($content)) . "

"; } $listings .= ""; $listings .= "
"; $listings .= ""; if ($name) $listings .= "    " . $name; if ($phone) { if ($areacode) $listings .= " " . $areacode . "/" . $phone . ""; else $listings .= " " . $phone . ""; } if ($name || $phone) $listings .= "
"; $addressblock = ""; if ($venue) $addressblock .= $venue; if ($city) { if ($addressblock) $addressblock .= ", "; $addressblock .= $city; } if ($zipcode) { if ($addressblock) $addressblock .= " "; $addressblock .= $zipcode; } if ($addressblock) $listings .= "        " . $addressblock . "
"; if ($website) $listings .= "            Website:  " . $website . "
"; if (($contact && $displaycontact != "No") || ($email && $displayemail != "No") || $source) $listings .= "            "; if ($contact && $displaycontact != "No") $listings .= "Contact:  " . $contact . "   "; if ($email && $displayemail != "No") $listings .= "Email:  " . $email . "   "; if ($source) $listings .= "Source:  " . $source; $listings .= "
"; $listings .= "
"; /* Generate Images for Listing Purposes*/ /* $k = 0; while ($k < sizeof($this->array_class_image[$Con_ID])) { $listings .= ""; $listings .= ""; $listings .= "
"; $listings .= "array_class_image[$Con_ID][$k][1] . "\" border=0>
"; $listings .= "" . $this->array_class_image[$Con_ID][$k][2] . ""; $listings .= "

"; $k++; } */ /* Generate Images for Listing Purposes*/ $listings .= "
No Classifieds Found
\n"; return $listings; } // // returns the category name // function getName() { return $this->Cat_Name; } // // function that returns number of content // function getNumOfContent() { $num = 0; for ($i = 0; $i < sizeof($this->array_class); $i++) { $num += sizeof($this->array_class[$i][13]); } return $num; } // // returns the search box // function searchBox() { global $HTTP_POST_VARS; $list = array(); for ($i = 0; $i < sizeof($this->array_class); $i++) { array_push($list,$this->array_class[$i][0]); } $searchTable = new SearchTable($list,$HTTP_POST_VARS['searchword'],$HTTP_POST_VARS['searchprice'],$HTTP_POST_VARS['searchpricemin'],$HTTP_POST_VARS['searchpricemax'],$HTTP_POST_VARS['searchzipcode'],$HTTP_POST_VARS['searchzipcodeexact'],$HTTP_POST_VARS['searchname'],$HTTP_POST_VARS['searcheventid'],$HTTP_POST_VARS['searcheventdate'],$HTTP_POST_VARS['searchfreeitems'],$HTTP_POST_VARS['searchnewitems'],$HTTP_POST_VARS['searchall']); return $searchTable->getTable(""); } } ?>