include("config/config.php"); include("../../include/adodb/adodb.inc.php"); include("../../include/phpmailer/class.phpmailer.php"); include("include/globalfunctions.php"); // // establish a connection to the database // function MyConn() { $db_hostname = "localhost"; $db_username = "classifieds"; $db_password = "cl4ss"; $db_name = "morningtimez"; $db_driver = "mysqlt"; $conn = &ADONewConnection($db_driver); $conn->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"; /* 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 .= "" . $this->getLink($i,$picview,$path) . " |
" . $this->getLink($i,$this->array_cat[$i][7],$path) . " |
Name | " . $this->array_cmy["Cmy_Name"] . " |
Phone Number | " . $this->array_cmy["Cmy_Phone1"] . " |
Fax Number | " . $this->array_cmy["Cmy_Fax"] . " |
array_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"] . " |
Position | " . $this->array_cmy["Cmy_CPosition" . $num] . " |
Name | " . $this->array_cmy["Cmy_CName" . $num] . " |
array_cmy["Cmy_CEmail" . $num] . ">" . $this->array_cmy["Cmy_CEmail" . $num] . " | |
Contact | " . $this->array_cmy["Cmy_CContact" . $num] . " |
" . $this->array_class[$i][2] . " | |||
";
if ($videowebsite) $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 .= "
"; } $listings .= "
"; $k++; } */ /* Generate Images for Listing Purposes*/ $listings .= " | |||
No Classifieds Found |