Please try again."; var $error_message; var $debug = 0; var $site_error_message; var $sql_query; var $row_count; var $configuration_data; var $ad_configuration_data; var $category_configuration; var $field_configuration_data; var $classified_user_id; var $stage; var $language_id; var $classified_variables; var $site_category = 0; var $page_result = 1; var $page_id; var $module_id; var $body; var $module_body; var $font_stuff; var $template; var $in_statement; var $count_images; var $images_captured; var $images_error; var $first_image_filled = 0; var $messages = array(); var $category_tree_array = array(); var $category_dropdown_name_array = array(); var $category_dropdown_id_array = array(); var $subcategory_array = array(); var $images_to_display = array(); var $image_file_types_icon = array(); var $image_file_types_extension = array(); var $category_questions = array(); var $category_explanation = array(); var $category_choices = array(); var $category_other_box = array(); var $category_display_order = array(); var $category_dropdown_array = array(); var $image_file_types = array(); var $site_name; var $message_category; var $multiple_languages; var $affiliate_id = 0; var $affiliate_page_type = 0; var $affiliate_group_id = 0; var $filter_id = 0; var $state_filter = ""; var $zip_filter = ""; var $zip_filter_distance = ""; var $max_latitude; var $min_latitude; var $max_longitude; var $min_longitude; var $postal_code_table = "geodesic_zip_codes"; var $sql_filter_in_statement; var $sql_state_filter_statement; var $sql_zip_filter_in_statement; var $uk_postcodes = array(); var $classauctions = 0; var $auction_configuration_data; var $popup_image_debug = 0; //######################################################################## function Site ($db,$message_category=0,$language_id=0,$classified_user_id=0,$classauctions=0) { if ($message_category) $this->message_category = $message_category; if ($language_id) { //check language existence $this->sql_query = "SELECT * FROM ".$this->pages_languages_table." where language_id = ".$language_id; // echo $this->sql_query." is the messages query
\n"; $result = $db->Execute($this->sql_query); if (!$result) { return false; } elseif ($result->RecordCount() == 1) { $this->language_id = $language_id; } else { $this->language_id = 1; } } else $this->language_id = 1; $this->classified_user_id = $classified_user_id; //get configuration data $this->get_configuration_data($db); if ($classauctions) { $this->classauctions = $classauctions; $this->get_auction_configuration_data($db); } $this->expire_groups_and_plans($db); } //end of function Site //######################################################################## function display_page ($db) { //if (($this->page_id < 135) || ($this->page_id > 154)) // if configuration_data isnt there yet well then lets get it. if(!$this->configuration_data) $this->get_configuration_data(); // if the user wants to use their own css this lets them if($this->configuration_data->USE_CSS) $css = $this->get_css($db); else $css = 0; if ($this->debug) echo "css retrieved
\n"; if ($this->page_id != 69) $this->get_template($db); if ($this->debug) echo "before template and extra page check for page_id = ".$this->page_id."
\n"; if (($this->template) || (($this->page_id >= 135) && ($this->page_id <= 154))) { if ($this->debug) echo "after template and extra page check for page_id = ".$this->page_id."
\n"; //$this->display_menu_bar(); //echo "hello 3
"; if (($this->page_id != 69) && (($this->page_id < 135) || ($this->page_id > 154))) $this->template = str_replace("<>",$this->body,$this->template); if ($this->debug) { if (($this->page_id != 69) && (($this->page_id < 135) || ($this->page_id > 154))) echo "mainbody was replaced
\n"; else echo "mainbody was NOT replaced
\n"; } //get any modules attached to this page //echo $this->affiliate_id." is the affiliate_id
\n"; //if ($this->affiliate_id == 0) $this->get_page_modules($db); $this->header_font_stuff = ""; if ($css) { $this->header_font_stuff .= "\n\n"; } $this->template = str_replace("<>",$this->header_font_stuff,$this->template); if($this->page_id == 1 || $this->page_id == 69 || $this->page_id == 70 || $this->page_id == 71) { // Get rid of excess tags on auction display page $this->template = eregi_replace("<<[a-z0-9_]*>>", "", $this->template); } echo $this->template; //echo "hello 4
"; return true; } else return false; } //end of function display_page //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_template($db) { //echo $this->affiliate_id." is the id
\n"; //echo $this->affiliate_group_id." is the group
\n"; if (($this->affiliate_id) && ($this->affiliate_group_id)) { $this->sql_query = "select * from ".$this->affiliate_templates_table." where group_id = ".$this->affiliate_group_id." and language_id = ".$this->language_id; $result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$result) { if ($this->debug) echo $this->sql_query."
\n"; echo "template failed 1
"; return false; } elseif ($result->RecordCount() ==1) { $show_page = $result->FetchNextObject(); //echo $this->affiliate_page_type." is affiliate_page_type
\n"; if ($this->affiliate_page_type > 1) $this->sql_query = "select template_code,location from ".$this->templates_table." where template_id = ".$show_page->SECONDARY_TEMPLATE_ID; else $this->sql_query = "select template_code,location from ".$this->templates_table." where template_id = ".$show_page->TEMPLATE_ID; $template_result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$template_result) { if ($this->debug) echo $this->sql_query."
\n"; echo "template failed 2
"; return false; } elseif ($template_result->RecordCount() ==1) { $show_template = $template_result->FetchNextObject(); $this->template = stripslashes($show_template->TEMPLATE_CODE); //get this affiliates personal html $affiliate_html = $this->get_user_data($db,$this->affiliate_id); if (strlen(trim($affiliate_html->AFFILIATE_HTML)) > 0) $this->template = str_replace("",stripslashes($affiliate_html->AFFILIATE_HTML),$this->template); else $this->template = str_replace("","",$this->template); return true; } else { echo "template failed 3
"; return false; } } else { echo "template configuration issue - check template assignment on this page 1
"; return false; } } if (($this->page_id == 3) && ($this->page_result == 1) && ($this->site_category)) { //see if there is a category home page template $this->sql_query = "select template_id from ".$this->categories_languages_table." where category_id = ".$this->site_category." and language_id = ".$this->language_id; $cat_temp_result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$cat_temp_result) { if ($this->debug) echo $this->sql_query."
\n"; echo "template failed 4
"; return false; } elseif ($cat_temp_result->RecordCount() ==1) { $show_category_template = $cat_temp_result->FetchNextObject(); if ($show_category_template->TEMPLATE_ID) { $this->sql_query = "select template_code,location from ".$this->templates_table." where template_id = ".$show_category_template->TEMPLATE_ID; $template_result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$template_result) { if ($this->debug) echo $this->sql_query."
\n"; echo "template failed 5
"; return false; } elseif ($template_result->RecordCount() ==1) { $show_template = $template_result->FetchNextObject(); $this->template = stripslashes($show_template->TEMPLATE_CODE); return; } else { echo "template failed 6
"; return false; } return true; } } else { echo "template configuration issue - check template assignment on this page 2
"; return false; } } if (($this->page_id == 3) && ($this->page_result > 1) && ($this->site_category)) { //see if there is a category secondary page template $this->sql_query = "select secondary_template_id from ".$this->categories_languages_table." where category_id = ".$this->site_category." and language_id = ".$this->language_id; $cat_temp_result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$cat_temp_result) { if ($this->debug) echo $this->sql_query."
\n"; echo "template failed 7
"; return false; } elseif ($cat_temp_result->RecordCount() ==1) { $show_category_template = $cat_temp_result->FetchNextObject(); if ($show_category_template->SECONDARY_TEMPLATE_ID) { $this->sql_query = "select template_code,location from ".$this->templates_table." where template_id = ".$show_category_template->SECONDARY_TEMPLATE_ID; $template_result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$template_result) { if ($this->debug) echo $this->sql_query."
\n"; echo "template failed 8
"; return false; } elseif ($template_result->RecordCount() ==1) { $show_template = $template_result->FetchNextObject(); $this->template = stripslashes($show_template->TEMPLATE_CODE); return; } else { echo "template failed 9
"; return false; } return true; } } else { echo "template configuration issue - check template assignment on this page 3
"; return false; } } if (($this->page_id == 1) && ($this->site_category)) { //see if there is a category home page template $this->sql_query = "select ad_display_template_id from ".$this->categories_languages_table." where category_id = ".$this->site_category." and language_id = ".$this->language_id; $cat_temp_result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$cat_temp_result) { if ($this->debug) echo $this->sql_query."
\n"; echo "template failed 10
"; return false; } elseif ($cat_temp_result->RecordCount() ==1) { $show_category_template = $cat_temp_result->FetchNextObject(); if ($show_category_template->AD_DISPLAY_TEMPLATE_ID) { $this->sql_query = "select template_code,location from ".$this->templates_table." where template_id = ".$show_category_template->AD_DISPLAY_TEMPLATE_ID; $template_result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$template_result) { if ($this->debug) echo $this->sql_query."
\n"; echo "template failed 11
"; return false; } elseif ($template_result->RecordCount() ==1) { $show_template = $template_result->FetchNextObject(); $this->template = stripslashes($show_template->TEMPLATE_CODE); return; } else { echo "template failed 12
"; return false; } return true; } } else { echo "template configuration issue - check template assignment on this page 4
"; return false; } } $this->sql_query = "select * from ".$this->pages_templates_table." where page_id = ".$this->page_id." and language_id = ".$this->language_id; $result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$result) { if ($this->debug) echo $this->sql_query."
\n"; echo "template failed 13
"; echo $db->ErrorMsg()." is the error
\n"; if ($this->debug) echo $this->sql_query."
\n"; return false; } elseif ($result->RecordCount() ==1) { $show_page = $result->FetchNextObject(); $this->sql_query = "select template_code,location from ".$this->templates_table." where template_id = ".$show_page->TEMPLATE_ID; $template_result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$template_result) { if ($this->debug) echo $this->sql_query."
\n"; echo "template failed 14
"; return false; } elseif ($template_result->RecordCount() ==1) { $show_template = $template_result->FetchNextObject(); $this->template = stripslashes($show_template->TEMPLATE_CODE); return; } else { echo "template failed 15
"; return false; } } else { echo "template configuration issue - check template assignment on this page 5
"; return false; } } // end of function get_template //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_page_modules($db) { // Flag if any HTML modules are used $html = false; $this->sql_query = "select * from ".$this->pages_modules_table." where page_id = ".$this->page_id." order by time asc"; $result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$result) { if ($this->debug) echo $this->sql_query."
\n"; return false; } elseif ($result->RecordCount() > 0) { while ($show = $result->FetchNextObject()) { $this->sql_query = "select * from ".$this->pages_table." where page_id = ".$show->MODULE_ID; $module_result = $db->Execute($this->sql_query); if ($this->debug) echo $this->sql_query."
\n"; if (!$module_result) { if ($this->debug) echo $this->sql_query."
\n"; //continue with next module...instead of erroring out. continue; } elseif ($module_result->RecordCount() == 1) { $show_module = $module_result->FetchNextObject(); if (strlen($show_module->MODULE_FILE_NAME) > 0) { include("classes/".$show_module->MODULE_FILE_NAME); $this->template = str_replace($show_module->MODULE_REPLACE_TAG,$this->body,$this->template); } // Check if HTML is in the module name if(strpos($show_module->NAME, "HTML") != false) { $html = true; } } } } // If we there were any HTML modules lets go over the modules again so that there are no embedded ones /*if($html) { $this->sql_query = "select * from ".$this->pages_table." where module = 1"; $module_result = $db->Execute($this->sql_query); $modules = $module_result->GetArray(); foreach($modules as $array => $key) { include("classes/".$key['module_file_name']); $this->template = str_replace($key['module_replace_tag'], $this->body, $this->template); } } */ return true; } // end of function get_page_modules //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_text($db,$current_page_id=0) { if ($current_page_id) $this->sql_query = "select text_id,text from ".$this->pages_text_languages_table." where page_id = ".$current_page_id." and language_id = ".$this->language_id; else $this->sql_query = "select text_id,text from ".$this->pages_text_languages_table." where page_id = ".$this->page_id." and language_id = ".$this->language_id; //echo $this->sql_query."
\n"; $result = $db->Execute($this->sql_query); if (!$result) { //echo "bad get_text query
\n"; return false; } elseif ($result->RecordCount() > 0) { //take the database message result and push the contents into an array while ($show = $result->FetchNextObject()) { $this->messages[$show->TEXT_ID] = $show->TEXT; //echo $show->TEXT_ID." - ".$show->TEXT."
\n"; } } } // end of function get_text //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_css($db,$current_page_id=0) { if ($current_page_id) $this->sql_query = "select * from ".$this->pages_fonts_table." where page_id = ".$current_page_id; else $this->sql_query = "SELECT * FROM ".$this->pages_fonts_table." where page_id = ".$this->page_id; $result = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$result) return false; elseif ($result->RecordCount() > 0) { while ($show = $result->FetchNextObject()) { $this->font_stuff .= ".".$show->ELEMENT." { "; $this->font_stuff .= "font-family: ".$show->FONT_FAMILY."; "; $this->font_stuff .= "font-size: ".$show->FONT_SIZE."; "; $this->font_stuff .= "font-style: ".$show->FONT_STYLE."; "; $this->font_stuff .= "font-weight: ".$show->FONT_WEIGHT."; "; if (strlen(trim($show->COLOR)) > 0) $this->font_stuff .= "color: ".$show->COLOR."; "; if (strlen(trim($show->TEXT_DECORATION)) > 0) $this->font_stuff .= "text-decoration: ".$show->TEXT_DECORATION."; "; if (strlen(trim($show->BACKGROUND_COLOR)) > 0) $this->font_stuff .= "background-color: ".$show->BACKGROUND_COLOR."; "; if (strlen(trim($show->BACKGROUND_IMAGE)) > 0) $this->font_stuff .= "background-image: url(".$show->BACKGROUND_IMAGE."); "; if (strlen(trim($show->TEXT_ALIGN)) > 0) $this->font_stuff .= "text-align: ".$show->TEXT_ALIGN."; "; if (strlen(trim($show->TEXT_VERTICAL_ALIGN)) > 0) $this->font_stuff .= "vertical-align: ".$show->TEXT_VERTICAL_ALIGN.";"; $this->font_stuff .= " } \n"; } } return true; } // end of function get_css //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function badwords ($msg,$mod) { $msg=wordwrap_msg($msg); $eachword = explode(" " , eregi_replace("
"," ",$msg)); // temp remove
$result = mysql_db_query($database, "SELECT * FROM badwords") or died("Query Error"); while ($db = mysql_fetch_array($result)) { for ($i=0; $i".$eachword[$i]."", $msg); // Badword } else { $msg = eregi_replace($eachword[$i], str_repeats("*", strlen($eachword[$i])), $msg); // Badword } } } } return $msg; } //######################################################################## function get_configuration_data($db) { $this->sql_query = "SELECT * FROM ".$this->site_configuration_table; $result = $db->Execute($this->sql_query); if (!$result) { return false; } else { $this->configuration_data = $result->FetchNextObject(); } return true; } //end of function get_configuration_data //######################################################################## //used within classauctions only function get_auction_configuration_data($db) { $this->sql_query = "SELECT * FROM ".$this->site_auction_configuration_table; $result = $db->Execute($this->sql_query); if (!$result) { return false; } else { $this->auction_configuration_data = $result->FetchNextObject(); } return true; } //########################################################################## function site_error($db) { $this->page_id = 59; $this->get_text($db); //check to see if debugging $this->body ="\n"; $this->body .="\n\t\n\n"; $this->body .="\n\t\n\n"; $this->body .="\n\t\n\n"; if ($this->debug) { $this->body .="\n\t\n\n"; } $this->body .="
\n\t".urldecode($this->messages[908])." \n\t
\n\t".urldecode($this->messages[908])." \n\t
\n\t".$this->site_error_message." \n\t
\n\tWith the following query:
".$this->sql_query." \n\t
\n"; $this->display_page($db); exit; } //end of function site_error //######################################################################### function show_state_dropdown ($db,$state,$name) { $this->sql_query = "SELECT * FROM ".$this->states_table." order by display_order, name"; $result = $db->Execute($this->sql_query); if (!$result) return false; else { $this->body .="\n\t"; } return true; }// end of function show_state_dropdown //######################################################################### function show_country_dropdown ($db,$country,$name) { $this->sql_query = "SELECT * FROM ".$this->countries_table." order by display_order, name"; $result = $db->Execute($this->sql_query); if (!$result) return false; else { $this->body .="\n\t"; } return true; }// end of function show_country_dropdown //######################################################################## function get_category_tree($db,$category) { $i = 0; $category_next = $category; $this->category_tree_array = 0; $this->category_tree_array = array(); do { $this->sql_query = "select parent_id from ".$this->categories_table." where category_id = ".$category_next; $category_result = $db->Execute($this->sql_query); if (!$category_result) { //$this->body .=$this->sql_query." is the query
\n"; $this->error_message = $this->messages[2052]; return false; } elseif ($category_result->RecordCount() == 1) { $show_category = $category_result->FetchNextObject(); $this->sql_query = "select category_name from ".$this->categories_languages_table." where category_id = ".$category_next." and language_id =".$this->language_id; $category_name_result = $db->Execute($this->sql_query); if (!$category_name_result) { //$this->body .=$this->sql_query." is the query
\n"; $this->error_message = $this->messages[2052]; return false; } elseif ($category_name_result->RecordCount() == 1) { $show_name = $category_name_result->FetchNextObject(); $this->category_tree_array[$i]["parent_id"] = $show_category->PARENT_ID; $this->category_tree_array[$i]["category_name"] = $show_name->CATEGORY_NAME; $this->category_tree_array[$i]["category_id"] = $category_next; $i++; $category_next = $show_category->PARENT_ID; } else { return false; } } else { return false; } } while ( $show_category->PARENT_ID != 0 ); return true; } // end of function get_category_tree($category) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_user_name($db,$some_user_id=0) { if ($some_user_id) { $this->sql_query = "select username from ".$this->userdata_table." where id = ".$some_user_id; $username_result = $db->Execute($this->sql_query); if (!$username_result) return false; elseif ($username_result->RecordCount() == 1) { $show_username = $username_result->FetchNextObject(); return $show_username->USERNAME; } else { //just display the user_id return $some_user_id; } } else { return false; } } //end of function get_user_name //######################################################################## function get_user_email($db,$some_user_id=0) { if ($some_user_id) { $this->sql_query = "select email from ".$this->userdata_table." where id = ".$some_user_id; $username_result = $db->Execute($this->sql_query); if (!$username_result) return false; elseif ($username_result->RecordCount() == 1) { $show_username = $username_result->FetchNextObject(); return $show_username->EMAIL; } else { //just display the user_id return $some_user_id; } } else { return false; } } //end of function get_user_email //######################################################################## function get_ad_title($db,$classified_id=0) { if ($classified_id) { $this->sql_query = "select title from ".$this->classifieds_table." where id = ".$classified_id; $ad_result = $db->Execute($this->sql_query); //$this->body .=$this->sql_query."
\n"; if (!$ad_result) { return false; } elseif ($ad_result->RecordCount() == 1) { $show_title = $ad_result->FetchNextObject(); return urldecode($show_title->TITLE); } else { //just display the user_id return $classified_id; } } else { return false; } } //end of function get_ad_title //######################################################################## function get_user_communication_level($db,$user_id=0) { if ($user_id) { $this->sql_query = "select communication_type from ".$this->userdata_table." where id = ".$user_id; $result = $db->Execute($this->sql_query); if (!$result) { return false; } elseif ($result->RecordCount() == 1) { $show_type = $result->FetchNextObject(); return $show_type->COMMUNICATION_TYPE; } else { //just display the user_id return false; } } else { return false; } } //end of function get_ad_title //######################################################################## function get_row_color($special=0) { if (($this->row_count % 2) == 0) { switch ($page_id) { case 2: //search page results if ($special) return "main_result_table_body_even_bold"; else return "main_result_table_body_even"; break; case 3: //search page results if ($special) return "browsing_result_table_body_even_bold"; else return "browsing_result_table_body_even"; break; } } else { switch ($page_id) { case 2: //search page results if ($special) return "main_result_table_body_odd_bold"; else return "main_result_table_body_odd"; break; case 3: //search page results if ($special) return "browsing_result_table_body_odd_bold"; else return "browsing_result_table_body_edd"; break; } } return $row_color; } //end of function get_row_color //################################################################################## function get_category_name($db,$category_id=0) { if ($category_id) { $this->sql_query = "select category_name,category_cache,cache_expire,description from ".$this->categories_languages_table." where category_id = ".$category_id." and language_id = ".$this->language_id; //echo $this->sql_query."
\n"; $result = $db->Execute($this->sql_query); if (!$result) { return false; } elseif ($result->RecordCount() == 1) { $show = $result->FetchNextObject(); return $show; } else { //just display the user_id return false; } } else { return "Main"; } } //end of function get_category_name //################################################################################## function get_category_configuration($db,$category_id=0) { if ($category_id) { $this->sql_query = "select * from ".$this->categories_table." where category_id = ".$category_id; $result = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$result) { return false; } elseif ($result->RecordCount() == 1) { $this->category_configuration = $result->FetchNextObject(); return true; } else { //just display the user_id return false; } } else { return false; } } //end of function get_category_configuration //################################################################################## function get_category_dropdown($db,$name,$category_id=0,$no_main=0,$css_control=0) { if (!$no_main) { array_push($this->category_dropdown_name_array, "All Categories"); array_push($this->category_dropdown_id_array,0); } $this->get_subcategories_for_dropdown($db,0,0); //build the select statement //array_reverse($this->category_dropdown_name_array); //array_reverse($this->category_dropdown_id_array); $this->body .="\n\t"; return true; } //end of function get_category_dropdown //################################################################################## function get_category_dropdown_PD($db,$name,$category_id=0,$no_main=0,$css_control=0) { if (!$no_main) { array_push($this->category_dropdown_name_array, "All Categories"); array_push($this->category_dropdown_id_array,0); } $this->get_subcategories_for_dropdown($db,0,0); //build the select statement //array_reverse($this->category_dropdown_name_array); //array_reverse($this->category_dropdown_id_array); echo "\n\t"; return true; } //end of function get_category_dropdown_PD //################################################################################## function get_subcategories_for_dropdown($db,$category_id=0) { if ((($this->stage + 1) <= $this->configuration_data->LEVELS_OF_CATEGORIES_DISPLAYED) || ($this->configuration_data->LEVELS_OF_CATEGORIES_DISPLAYED == 0)) { //$stage++; //$this->sql_query = "select ".$this->categories_table.".category_id as category_id,".$this->categories_table.".parent_id as parent_id,".$this->categories_languages_table.".category_name as category_name // from ".$this->categories_table.",".$this->categories_languages_table." // where ".$this->categories_table.".category_id =".$this->categories_languages_table.".category_id and // ".$this->categories_table.".parent_id = ".$category_id." order by display_order,category_name"; $this->sql_query = "select ".$this->categories_table.".category_id as category_id, ".$this->categories_table.".parent_id as parent_id,".$this->categories_languages_table.".category_name as category_name from ".$this->categories_table.",".$this->categories_languages_table." where ".$this->categories_table.".category_id = ".$this->categories_languages_table.".category_id and ".$this->categories_table.".parent_id = ".$category_id." and ".$this->categories_languages_table.".language_id = ".$this->language_id." order by ".$this->categories_table.".display_order,".$this->categories_languages_table.".category_name"; $category_result = $db->Execute($this->sql_query); //echo $this->sql_query." is the query
\n"; if (!$category_result) { //$this->body .=$this->sql_query." is the query
\n"; $this->error_message = $this->messages[2052]; return false; } elseif ($category_result->RecordCount() > 0) { $this->stage++; while ($show_category = $category_result->FetchNextObject()) { $pre_stage = ""; for ($i=1;$i<=$this->stage;$i++) { $pre_stage .= "   "; } if ($category_id != 0) { array_push($this->category_dropdown_name_array, $pre_stage.$show_category->CATEGORY_NAME); array_push($this->category_dropdown_id_array,$show_category->CATEGORY_ID); } else { array_push($this->category_dropdown_name_array, $show_category->CATEGORY_NAME); array_push($this->category_dropdown_id_array,$show_category->CATEGORY_ID); } $this->get_subcategories_for_dropdown($db,$show_category->CATEGORY_ID); } $this->stage--; } } return; } //end of function get_subcategories_for_dropdown //################################################################################## function get_category_questions($db,$category_id=0) { //get sell questions specific to this category while ($category_id != 0) { //get the questions for this category $this->sql_query = "SELECT * FROM ".$this->classified_sell_questions_table." WHERE category_id = ".$category_id." ORDER BY display_order"; //$this->sql_query = "SELECT * FROM ".$this->classified_sell_questions_table." WHERE category_id = ".$category_id." ORDER BY display_order desc"; //$this->body .=$this->sql_query." is the query
\n"; //echo $this->sql_query."
\n"; $result = $db->Execute($this->sql_query); if (!$result) { return false; } if ($result->RecordCount() > 0) { //$this->body .="hello from inside a positive results
\n"; while ($get_questions = $result->FetchNextObject()) { //get all the questions for this category and store them in the auction_questions variable //$this->body .=$get_questions["question_key"]." is the question key
\n"; $this->category_questions[$get_questions->QUESTION_ID] = $get_questions->NAME; $this->category_explanation[$get_questions->QUESTION_ID] = $get_questions->EXPLANATION; $this->category_choices[$get_questions->QUESTION_ID] = $get_questions->CHOICES; $this->category_other_box[$get_questions->QUESTION_ID] = $get_questions->OTHER_INPUT; $this->category_display_order[$get_questions->QUESTION_ID] = $get_questions->DISPLAY_ORDER; $this->category_url_icon[$get_questions->QUESTION_ID] = $get_questions->URL_ICON; //$this->body .=$get_questions->CHOICES." is the choices for ".$get_questions->QUESTION_ID."
\n\t"; } //end of while $get_questions = mysql_fetch_array($result) } //end of if ($result) //get this_cat_id parent category $this->sql_query = "SELECT parent_id FROM ".$this->categories_table." WHERE category_id = ".$category_id; //echo $this->sql_query."
\n"; $result = $db->Execute($this->sql_query); //$this->body .=$this->sql_query." is the query
\n"; if (!$result) { return false; } elseif ($result->RecordCount() == 1) { $show_category = $result->FetchNextObject(); $category_id = $show_category->PARENT_ID; } else { //$this->body .=$this->sql_query." is the query where count is not 1
\n"; return false; } } //end of if ($category_id != 0) } //end of function get_category_questions //################################################################################## function get_ad_configuration($db) { $this->sql_query = "select * from ".$this->ad_configuration_table; //echo $this->sql_query."
\n"; $result = $db->Execute($this->sql_query); if (!$result) { $this->error_message = $this->messages[57]; return false; } elseif ($result->RecordCount() == 1) { $this->ad_configuration_data = $result->FetchNextObject(); return true; } else { $this->html_disallowed_list = 0; return true; } } //function get_ad_configuration //######################################################################### function get_sql_in_statement($db,$category_id) { if ($category_id) { $this->sql_query = "SELECT in_statement FROM ".$this->categories_table." WHERE category_id = ".$category_id; //echo $this->sql_query."
\n"; $result = $db->Execute($this->sql_query); if (!$result) { return false; } elseif ($result->RecordCount() == 1) { $show_in_statement = $result->FetchNextObject(); $current_in_statement = $show_in_statement->IN_STATEMENT; if (strlen(trim($current_in_statement)) > 0) { $this->in_statement = $current_in_statement; return $current_in_statement; } else { $this->get_sql_in_array($db,$category_id); if (count($this->subcategory_array) > 0) { $this->in_statement = ""; $this->in_statement .= "in ("; while (list($key,$value) = each($this->subcategory_array)) { if ($key == 0) $this->in_statement .= $value; else $this->in_statement .= ",".$value; } $this->in_statement .= ")"; $this->sql_query = "update ".$this->categories_table." set in_statement =\"".$this->in_statement."\" WHERE category_id = ".$category_id; //echo $this->sql_query."
\n"; $result = $db->Execute($this->sql_query); if (!$result) { return false; } return true; } else { return false; } } } else { $this->get_sql_in_array($db,$category_id); if (count($this->subcategory_array) > 0) { $this->in_statement .= "in ("; while (list($key,$value) = each($this->subcategory_array)) { if ($key == 0) $this->in_statement .= $value; else $this->in_statement .= ",".$value; } $this->in_statement .= ")"; return $this->in_statement; } else { return false; } } } else { //category_id is missing return false; } } //end of get_sql_in_statement //#################################################################################### function get_sql_in_array($db,$category_id) { if ($category_id) { //get the count for this category $count = 0; $this->sql_query = "select category_id from ".$this->categories_table." where parent_id = ".$category_id; //$this->body .=$this->sql_query."
\n"; $result = $db->Execute($this->sql_query); if (!$result) { //$this->body .=$this->sql_query." is the query
\n"; $this->error_message = $this->messages[2524]; return false; } elseif ($result->RecordCount() > 0) { while ($show_category = $result->FetchNextObject()) { $this->get_sql_in_array($db,$show_category->CATEGORY_ID); } } array_push ($this->subcategory_array, $category_id); return true; } else { //category_id is missing return false; } } //end of get_sql_in_array //################################################################################## function get_user_data($db,$user_id=0) { if (!$user_id) { if ($this->classified_user_id) $user_id = $this->classified_user_id; } if ($user_id) { $this->sql_query = "select * from ".$this->userdata_table.",".$this->user_groups_price_plans_table." where ".$this->userdata_table.".id = ".$this->user_groups_price_plans_table.".id and ".$this->userdata_table.".id = ".$user_id; $user_data_result = $db->Execute($this->sql_query); //echo $this->sql_query." is the get_user_data query
\n"; if (!$user_data_result) { //$this->body .=$this->sql_query." is the state query
\n"; //echo $db->ErrorMsg()." is the error in get_user_data
\n"; //echo "bad get_user_data query
\n"; return false; } elseif ($user_data_result->RecordCount() == 1) { $show_user = $user_data_result->FetchNextObject(); return $show_user; } else { $this->error_message = $this->data_error_message; return false; } } else { //no user id return false; } } //end of function get_user_data //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_classified_data($db,$classified_id=0) { if ($classified_id) { $this->sql_query = "select * from ".$this->classifieds_table." where id = ".$classified_id; $result = $db->Execute($this->sql_query); if (!$result) { //$this->body .=$this->sql_query." is the query
\n"; return false; } elseif ($result->RecordCount() > 1 ) { //more than one auction matches //$this->body .=$this->sql_query." is the query
\n"; return false; } elseif ($result->RecordCount() <= 0) { //$this->body .=$this->sql_query." is the query
\n"; return false; } $show = $result->FetchNextObject(); return $show; } else { return false; } } //end of function get_classified_data //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function choose_language_form($db) { $this->sql_query = "select * from ".$this->pages_languages_table." where active = 1"; $result = $db->Execute($this->sql_query); if (!$result) { //$this->body .=$this->sql_query." is the state query
\n"; return false; } elseif ($result->RecordCount() > 0) { $this->page_id = 42; $this->get_text($db); //display the language choice form $this->body .="
\n"; $this->body .="\n"; $this->body .="\n\t\n\n"; $this->body .="\n\t\n\n"; $this->body .="\n\t\n\t"; $this->body .="\n\n"; $this->body .="\n\t\n\n"; $this->body .="
\n\t".urldecode($this->messages[327])."\n\t
\n\t".urldecode($this->messages[328])."\n\t
\n\t".urldecode($this->messages[329])." \n\t\n\t\n\t
\n\tmessages[330])."\"> \n\t
\n"; $this->body .="
\n"; $this->display_page($db); return true; } else { $this->error_message = $this->data_error_message; return false; } } //end of function choose_language_form //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function display_help_link($help_id=0,$type=0,$link_text=0,$question_id=0) { if ($question_id) { $help_link = ""; } elseif (($help_id) &&($link_text)) { $help_link = "language_id."');\">".urldecode($this->messages[$link_text]).""; } elseif ($help_id) { if ($type == 1) { $help_link = "language_id."');\">"; } else { $help_link = "language_id."');\">"; } } else { //no user id return false; } return $help_link; } //end of function display_help_link //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function display_ad_images ($db,$classified_id=0) { if ($classified_id) { $this->get_ad_configuration($db); $this->get_image_data($db,$classified_id); $this->count_images = count($this->images_to_display); if ($this->count_images >= $this->ad_configuration_data->PHOTO_COLUMNS) { $use_count = 0; switch ($this->ad_configuration_data->PHOTO_COLUMNS) { case 1: $width_tag = "100%"; break; case 2: $width_tag = "50%"; break; case 3: $width_tag = "33%"; break; case 4: $width_tag = "25%"; break; case 5: $width_tag = "20%"; break; case 6: $width_tag = "16%"; break; case 7: $width_tag = "14%"; break; case 8: $width_tag = "12%"; break; default: } } else { $use_count = 1; switch ($this->count_images) { case 1: $width_tag = "100%"; break; case 2: $width_tag = "50%"; break; case 3: $width_tag = "33%"; break; case 4: $width_tag = "25%"; break; case 5: $width_tag = "20%"; break; case 6: $width_tag = "16%"; break; case 7: $width_tag = "14%"; break; case 8: $width_tag = "12%"; break; default: } } if ((is_array($this->images_to_display)) && (count($this->images_to_display) > 0)) { ksort($this->images_to_display); reset($this->images_to_display); $image_table = ""; $value = current($this->images_to_display); do { $image_table .= ""; if ((($this->ad_configuration_data->PHOTO_COLUMNS > 1) && ($use_count == 0)) || (($use_count == 1) && ($this->count_images > 1))) { $value = next($this->images_to_display); if ($value) { $image_table .= ""; if ((($this->ad_configuration_data->PHOTO_COLUMNS > 2) && ($use_count == 0)) || (($use_count == 1) && ($this->count_images > 2))) { $value = next($this->images_to_display); if ($value) { $image_table .= ""; if ((($this->ad_configuration_data->PHOTO_COLUMNS > 3) && ($use_count == 0)) || (($use_count == 1) && ($this->count_images > 3))) { $value = next($this->images_to_display); if ($value) { $image_table .= ""; if ((($this->ad_configuration_data->PHOTO_COLUMNS > 4) && ($use_count == 0)) || (($use_count == 1) && ($this->count_images > 4))) { $value = next($this->images_to_display); if ($value) { $image_table .= ""; if ((($this->ad_configuration_data->PHOTO_COLUMNS > 5) && ($use_count == 0)) || (($use_count == 1) && ($this->count_images > 5))) { $value = next($this->images_to_display); if ($value) { $image_table .= ""; if ((($this->ad_configuration_data->PHOTO_COLUMNS > 6) && ($use_count == 0)) || (($use_count == 1) && ($this->count_images > 6))) { $value = next($this->images_to_display); if ($value) { $image_table .= ""; if ((($this->ad_configuration_data->PHOTO_COLUMNS > 7) && ($use_count == 0)) || (($use_count == 1) && ($this->count_images > 7))) { $value = next($this->images_to_display); if ($value) { $image_table .= ""; } } } } } } } } } } } } } } $image_table .= ""; } while ($value = next($this->images_to_display)); $image_table .= "
"; $image_table .= $this->display_image_tag($db, $value); $image_table .= ""; $image_table .= $this->display_image_tag($db, $value); $image_table .= ""; $image_table .= $this->display_image_tag($db, $value); $image_table .= ""; $image_table .= $this->display_image_tag($db, $value); $image_table .= ""; $image_table .= $this->display_image_tag($db, $value); $image_table .= ""; $image_table .= $this->display_image_tag($db, $value); $image_table .= ""; $image_table .= $this->display_image_tag($db, $value); $image_table .= ""; $image_table .= $this->display_image_tag($db, $value); $image_table .= "
\n"; } return $image_table; } else { //no auction id to check return false; } } //end of function display_ad_images //#################################################################################### function display_image_tag($db,$value) { //echo $value["image_text"]." is image text2
\n"; if ($value["type"] == 1) { //display the url if (strlen(trim($value["icon"])) > 0) { $tag = ""; $tag .= ""; } else { if ($value["image_width"] != $value["original_image_width"]) { if ($this->configuration_data->IMAGE_LINK_DESTINATION_TYPE) { $tag = ""; } else { $this->sql_query = "select * from ".$this->ad_configuration_table; //echo $db." is the db
\n"; $extra_result = $db->Execute($this->sql_query); //echo $this->sql_query." is the query
\n"; $show = $extra_result->FetchNextObject(); if ($this->ad_configuration_data->POPUP_IMAGE_TEMPLATE_ID) { if($this->popup_image_debug) { echo $this->ad_configuration_data->POPUP_IMAGE_EXTRA_WIDTH." is the extra width
\n"; echo $this->ad_configuration_data->POPUP_IMAGE_EXTRA_HEIGHT." is the extra height
\n"; echo $show->MAXIMUM_FULL_IMAGE_WIDTH." is the image width
\n"; echo $show->MAXIMUM_FULL_IMAGE_HEIGHT." is the image height
\n"; } $tag = "
MAXIMUM_FULL_IMAGE_WIDTH + $show->POPUP_IMAGE_EXTRA_WIDTH)."','".($show->MAXIMUM_FULL_IMAGE_HEIGHT + $show->POPUP_IMAGE_EXTRA_HEIGHT)."')\" class=browsing_image_links>"; } else { $tag = "MAXIMUM_FULL_IMAGE_WIDTH+40)."','".($show->MAXIMUM_FULL_IMAGE_HEIGHT+40)."')\" class=browsing_image_links>"; } } } if ($value["thumb_url"]) { $tag .= ""; } else { $tag .= ""; } } if ((strlen($value["image_text"]) > 0) && ($this->ad_configuration_data->MAXIMUM_IMAGE_DESCRIPTION)) { if (strlen($value["image_text"]) <= $this->ad_configuration_data->MAXIMUM_IMAGE_DESCRIPTION) $tag .= "
".$value["image_text"]; else { $small_string = substr($value["image_text"],0,$this->ad_configuration_data->MAXIMUM_IMAGE_DESCRIPTION); $position = strrpos($small_string," "); $smaller_string = substr($small_string,0,$position); $tag .= "
".$smaller_string."..."; } } if ($value["image_width"] != $value["original_image_width"]) $tag .= "
".urldecode($this->messages[339])."".urldecode($this->messages[12]).""; $tag .= "
"; } elseif ($value["type"] == 2) { //display the uploaded image if ($value["image_width"] != $value["original_image_width"]) { if ($this->configuration_data->IMAGE_LINK_DESTINATION_TYPE) $tag = ""; else $tag = ""; } $tag .= ""; if ((strlen($value["image_text"]) > 0) && ($this->ad_configuration_data->MAXIMUM_IMAGE_DESCRIPTION)) { if (strlen($value["image_text"]) <= $this->ad_configuration_data->MAXIMUM_IMAGE_DESCRIPTION) $tag .= "
".$value["image_text"]; else { $small_string = substr($value["image_text"],0,$this->ad_configuration_data->MAXIMUM_IMAGE_DESCRIPTION); $position = strrpos($small_string," "); $smaller_string = substr($small_string,0,$position); $tag .= "
".$smaller_string."..."; } } if ($value["image_width"] != $value["original_image_width"]) $tag .= "
".urldecode($this->messages[339]); $tag .= "
"; } return $tag; } //end of function display_image_tag //#################################################################################### function get_image_data($db,$classified_id=0,$large=0) { if ($classified_id) { if (($this->ad_configuration_data->NUMBER_OF_PHOTOS_IN_DETAIL) && (!$large)) $photo_limit = " order by display_order limit ".$this->ad_configuration_data->NUMBER_OF_PHOTOS_IN_DETAIL; else $photo_limit = ""; $this->sql_query = "select * from ".$this->images_urls_table." where classified_id = ".$classified_id.$photo_limit; //echo $this->sql_query."
\n"; $result = $db->Execute($this->sql_query); if (!$result) { return false; } elseif ($result->RecordCount() > 0) { while ($show_urls = $result->FetchNextObject()) { $this->images_to_display[$show_urls->DISPLAY_ORDER]["type"] = 1; $this->images_to_display[$show_urls->DISPLAY_ORDER]["id"] = $show_urls->IMAGE_ID; $this->images_to_display[$show_urls->DISPLAY_ORDER]["image_width"] = $show_urls->IMAGE_WIDTH; $this->images_to_display[$show_urls->DISPLAY_ORDER]["image_height"] = $show_urls->IMAGE_HEIGHT; $this->images_to_display[$show_urls->DISPLAY_ORDER]["original_image_width"] = $show_urls->ORIGINAL_IMAGE_WIDTH; $this->images_to_display[$show_urls->DISPLAY_ORDER]["original_image_height"] = $show_urls->ORIGINAL_IMAGE_HEIGHT; $this->images_to_display[$show_urls->DISPLAY_ORDER]["url"] = $show_urls->IMAGE_URL; $this->images_to_display[$show_urls->DISPLAY_ORDER]["classified_id"] = $show_urls->CLASSIFIED_ID; $this->images_to_display[$show_urls->DISPLAY_ORDER]["image_text"] = $show_urls->IMAGE_TEXT; $this->images_to_display[$show_urls->DISPLAY_ORDER]["thumb_url"] = $show_urls->THUMB_URL; $this->images_to_display[$show_urls->DISPLAY_ORDER]["icon"] = $show_urls->ICON; } } $this->sql_query = "select * from ".$this->images_table." where classified_id = ".$classified_id.$photo_limit; //echo $this->sql_query."
\n"; $result = $db->Execute($this->sql_query); if (!$result) { return false; } elseif ($result->RecordCount() > 0) { while ($show_uploaded = $result->FetchNextObject()) { $this->images_to_display[$show_uploaded->DISPLAY_ORDER]["type"] = 2; $this->images_to_display[$show_uploaded->DISPLAY_ORDER]["id"] = $show_uploaded->IMAGE_ID; $this->images_to_display[$show_uploaded->DISPLAY_ORDER]["image_width"] = $show_uploaded->IMAGE_WIDTH; $this->images_to_display[$show_uploaded->DISPLAY_ORDER]["image_height"] = $show_uploaded->IMAGE_HEIGHT; $this->images_to_display[$show_uploaded->DISPLAY_ORDER]["original_image_width"] = $show_uploaded->ORIGINAL_IMAGE_WIDTH; $this->images_to_display[$show_uploaded->DISPLAY_ORDER]["original_image_height"] = $show_uploaded->ORIGINAL_IMAGE_HEIGHT; $this->images_to_display[$show_uploaded->DISPLAY_ORDER]["image_file"] = $show_uploaded->IMAGE_FILE; $this->images_to_display[$show_uploaded->DISPLAY_ORDER]["classified_id"] = $show_uploaded->CLASSIFIED_ID; $this->images_to_display[$show_uploaded->DISPLAY_ORDER]["image_text"] = $show_urls->IMAGE_TEXT; $this->images_to_display[$show_uploaded->DISPLAY_ORDER]["thumb_file"] = $show_urls->THUMB_FILE; } } } else { return false; } } //end of function get_image_data //#################################################################################### function get_form_variables ($info) { //get the variables from the form and save them if (is_array($info)) { reset ($info); foreach ($info as $key => $value) //while (list($key,$value) = each($info)) { if ($value != "none") { if (!is_array($value)) $this->classified_variables[$key] = stripslashes($value); else { foreach ($value as $category_specific_key => $category_specific_value) { $this->classified_variables[$key][$category_specific_key] = stripslashes($category_specific_value); //echo $key." is the category_specific_key - ".$category_specific_value."
\n"; } } //echo $key." is the key and this is the value - ".$this->classified_variables[$key]."
\n"; } } } } //end of function get_form_variables ($info) //##################################################################### function classified_detail_check($db,$category_id=0) { if ($category_id) $this->get_category_configuration($db,$category_id); else $this->get_category_configuration($db,$this->terminal_category); $this->get_ad_configuration($db); //echo $this->category_configuration->USE_SITE_DEFAULT." is use site default
\n"; if (!$this->category_configuration->USE_SITE_DEFAULT) { //echo "using site settings
\n"; $this->field_configuration_data = $this->ad_configuration_data; $this->field_configuration_data->USE_OPTIONAL_FIELD_1 = $this->configuration_data->USE_OPTIONAL_FIELD_1; $this->field_configuration_data->USE_OPTIONAL_FIELD_2 = $this->configuration_data->USE_OPTIONAL_FIELD_2; $this->field_configuration_data->USE_OPTIONAL_FIELD_3 = $this->configuration_data->USE_OPTIONAL_FIELD_3; $this->field_configuration_data->USE_OPTIONAL_FIELD_4 = $this->configuration_data->USE_OPTIONAL_FIELD_4; $this->field_configuration_data->USE_OPTIONAL_FIELD_5 = $this->configuration_data->USE_OPTIONAL_FIELD_5; $this->field_configuration_data->USE_OPTIONAL_FIELD_6 = $this->configuration_data->USE_OPTIONAL_FIELD_6; $this->field_configuration_data->USE_OPTIONAL_FIELD_7 = $this->configuration_data->USE_OPTIONAL_FIELD_7; $this->field_configuration_data->USE_OPTIONAL_FIELD_8 = $this->configuration_data->USE_OPTIONAL_FIELD_8; $this->field_configuration_data->USE_OPTIONAL_FIELD_9 = $this->configuration_data->USE_OPTIONAL_FIELD_9; $this->field_configuration_data->USE_OPTIONAL_FIELD_10 = $this->configuration_data->USE_OPTIONAL_FIELD_10; $this->field_configuration_data->USE_OPTIONAL_FIELD_11 = $this->configuration_data->USE_OPTIONAL_FIELD_11; $this->field_configuration_data->USE_OPTIONAL_FIELD_12 = $this->configuration_data->USE_OPTIONAL_FIELD_12; $this->field_configuration_data->USE_OPTIONAL_FIELD_13 = $this->configuration_data->USE_OPTIONAL_FIELD_13; $this->field_configuration_data->USE_OPTIONAL_FIELD_14 = $this->configuration_data->USE_OPTIONAL_FIELD_14; $this->field_configuration_data->USE_OPTIONAL_FIELD_15 = $this->configuration_data->USE_OPTIONAL_FIELD_15; $this->field_configuration_data->USE_OPTIONAL_FIELD_16 = $this->configuration_data->USE_OPTIONAL_FIELD_16; $this->field_configuration_data->USE_OPTIONAL_FIELD_17 = $this->configuration_data->USE_OPTIONAL_FIELD_17; $this->field_configuration_data->USE_OPTIONAL_FIELD_18 = $this->configuration_data->USE_OPTIONAL_FIELD_18; $this->field_configuration_data->USE_OPTIONAL_FIELD_19 = $this->configuration_data->USE_OPTIONAL_FIELD_19; $this->field_configuration_data->USE_OPTIONAL_FIELD_20 = $this->configuration_data->USE_OPTIONAL_FIELD_20; } else { //echo "using category settings
\n"; $this->field_configuration_data = $this->category_configuration; } $this->error = 0; unset($this->error_variables); $this->error_variables = array(); //echo "about to check for badwords
\n"; $this->classified_variables["classified_title"] = strtr(stripslashes(urldecode($this->classified_variables["classified_title"])),"\"","'"); //$this->classified_variables["classified_title"] = stripslashes(urldecode($this->classified_variables["classified_title"])); if ($this->debug) echo $this->classified_variables["classified_title"]." after stripslashes
\n"; $this->classified_variables["classified_title"] = substr($this->classified_variables["classified_title"],0,$this->ad_configuration_data->TITLE_LENGTH); if ($this->debug) echo $this->classified_variables["classified_title"]." after maxlength
\n"; $this->classified_variables["classified_title"] = wordwrap($this->classified_variables["classified_title"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); if ($this->debug) echo $this->classified_variables["classified_title"]." after wordwrap
\n"; $this->classified_variables["classified_title"] = $this->replace_disallowed_html($db,$this->classified_variables["classified_title"],1); if ($this->debug) echo $this->classified_variables["classified_title"]." after disallowed
\n"; $this->classified_variables["classified_title"] = $this->check_for_badwords($this->classified_variables["classified_title"]); if ($this->debug) echo $this->classified_variables["classified_title"]." after check for badwords
\n"; if (strlen(trim($this->classified_variables["classified_title"])) ==0) { //error in classified_title - was not entered $this->error++; $this->error_variables["classified_title"] = "error"; } if ($this->field_configuration_data->USE_STATE_FIELD) { if (($this->classified_variables["state"] == "none") || (strlen(trim($this->classified_variables["state"])) == 0)) { //no state chosen $this->error++; $this->error_variables["state"] = "error"; } } if ($this->field_configuration_data->USE_COUNTRY_FIELD) { if (($this->classified_variables["country"] == "none") || (strlen(trim($this->classified_variables["country"])) == 0)) { //no country chosen //echo $this->classified_variables["country"]." is country check
\n"; //echo $this->messages[232]." is the error message
\n"; $this->error++; $this->error_variables["country"] = "error"; } } if ($this->field_configuration_data->USE_ZIP_FIELD) { $this->classified_variables["zip_code"] = stripslashes(urldecode($this->classified_variables["zip_code"])); $this->classified_variables["zip_code"] = wordwrap($this->classified_variables["zip_code"],$this->ad_configuration_data->ZIP_LENGTH, " \n",1); $this->classified_variables["zip_code"] = $this->replace_disallowed_html($db,$this->classified_variables["zip_code"],1); $this->classified_variables["zip_code"] = $this->check_for_badwords($this->classified_variables["zip_code"]); if ($this->configuration_data->REQUIRE_ZIP_FIELD) { if (strlen(trim($this->classified_variables["zip_code"])) == 0) { //error in classified_zip - was not entered $this->error++; $this->error_variables["zip_code"] = "error"; } else { //check that zip is regulation size if (strlen(trim($this->classified_variables["zip_code"])) > 15) { //zip not long enough $this->error++; $this->error_variables["zip_code"] = "error"; } } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_1) { if (($this->ad_configuration_data->OPTIONAL_1_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_1_other"])) > 0)) $this->classified_variables["optional_field_1"] = $this->classified_variables["optional_field_1_other"]; if ($this->ad_configuration_data->OPTIONAL_1_LENGTH > 0) $this->classified_variables["optional_field_1"] = substr($this->classified_variables["optional_field_1"],0,$this->ad_configuration_data->OPTIONAL_1_LENGTH); if (($this->ad_configuration_data->OPTIONAL_1_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_1_FIELD_TYPE)) { $this->classified_variables["optional_field_1"] = stripslashes(urldecode($this->classified_variables["optional_field_1"])); $this->classified_variables["optional_field_1"] = wordwrap($this->classified_variables["optional_field_1"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_1"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_1"],1); $this->classified_variables["optional_field_1"] = $this->check_for_badwords($this->classified_variables["optional_field_1"]); } if ($this->ad_configuration_data->OPTIONAL_1_NUMBER_ONLY) { $this->classified_variables["optional_field_1"] = str_replace(",","",$this->classified_variables["optional_field_1"]); if ((strlen(trim($this->classified_variables["optional_field_1"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_1"]))) { //echo "error in number only optional 1
\n"; $this->error++; $this->error_variables["optional_field_1"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_1) { if (strlen(trim($this->classified_variables["optional_field_1"])) == 0) { $this->error++; $this->error_variables["optional_field_1"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_2) { if (($this->ad_configuration_data->OPTIONAL_2_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_2_other"])) > 0)) $this->classified_variables["optional_field_2"] = $this->classified_variables["optional_field_2_other"]; if ($this->ad_configuration_data->OPTIONAL_2_LENGTH > 0) $this->classified_variables["optional_field_2"] = substr($this->classified_variables["optional_field_2"],0,$this->ad_configuration_data->OPTIONAL_2_LENGTH); if (($this->ad_configuration_data->OPTIONAL_2_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_2_FIELD_TYPE)) { $this->classified_variables["optional_field_2"] = stripslashes(urldecode($this->classified_variables["optional_field_2"])); $this->classified_variables["optional_field_2"] = wordwrap($this->classified_variables["optional_field_2"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_2"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_2"],1); $this->classified_variables["optional_field_2"] = $this->check_for_badwords($this->classified_variables["optional_field_2"]); } if ($this->ad_configuration_data->OPTIONAL_2_NUMBER_ONLY) { $this->classified_variables["optional_field_2"] = str_replace(",","",$this->classified_variables["optional_field_2"]); if ((strlen(trim($this->classified_variables["optional_field_2"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_2"]))) { //echo "error in number only optional 2
\n"; $this->error++; $this->error_variables["optional_field_2"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_2) { if (strlen(trim($this->classified_variables["optional_field_2"])) == 0) { $this->error++; $this->error_variables["optional_field_2"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_3) { if (($this->ad_configuration_data->OPTIONAL_3_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_3_other"])) > 0)) $this->classified_variables["optional_field_3"] = $this->classified_variables["optional_field_3_other"]; if ($this->ad_configuration_data->OPTIONAL_3_LENGTH > 0) $this->classified_variables["optional_field_3"] = substr($this->classified_variables["optional_field_3"],0,$this->ad_configuration_data->OPTIONAL_3_LENGTH); if (($this->ad_configuration_data->OPTIONAL_3_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_3_FIELD_TYPE)) { $this->classified_variables["optional_field_3"] = stripslashes(urldecode($this->classified_variables["optional_field_3"])); $this->classified_variables["optional_field_3"] = wordwrap($this->classified_variables["optional_field_3"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_3"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_3"],1); $this->classified_variables["optional_field_3"] = $this->check_for_badwords($this->classified_variables["optional_field_3"]); } if ($this->ad_configuration_data->OPTIONAL_3_NUMBER_ONLY) { $this->classified_variables["optional_field_3"] = str_replace(",","",$this->classified_variables["optional_field_3"]); if ((strlen(trim($this->classified_variables["optional_field_3"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_3"]))) { //echo "error in number only optional 3
\n"; $this->error++; $this->error_variables["optional_field_3"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_3) { if (strlen(trim($this->classified_variables["optional_field_3"])) == 0) { $this->error++; $this->error_variables["optional_field_3"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_4) { if (($this->ad_configuration_data->OPTIONAL_4_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_4_other"])) > 0)) $this->classified_variables["optional_field_4"] = $this->classified_variables["optional_field_4_other"]; if ($this->ad_configuration_data->OPTIONAL_4_LENGTH > 0) $this->classified_variables["optional_field_4"] = substr($this->classified_variables["optional_field_4"],0,$this->ad_configuration_data->OPTIONAL_4_LENGTH); if (($this->ad_configuration_data->OPTIONAL_4_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_4_FIELD_TYPE)) { $this->classified_variables["optional_field_4"] = stripslashes(urldecode($this->classified_variables["optional_field_4"])); $this->classified_variables["optional_field_4"] = wordwrap($this->classified_variables["optional_field_4"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_4"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_4"],1); $this->classified_variables["optional_field_4"] = $this->check_for_badwords($this->classified_variables["optional_field_4"]); } if ($this->ad_configuration_data->OPTIONAL_4_NUMBER_ONLY) { $this->classified_variables["optional_field_4"] = str_replace(",","",$this->classified_variables["optional_field_4"]); if ((strlen(trim($this->classified_variables["optional_field_4"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_4"]))) { //echo "error in number only optional 4
\n"; $this->error++; $this->error_variables["optional_field_4"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_4) { if (strlen(trim($this->classified_variables["optional_field_4"])) == 0) { $this->error++; $this->error_variables["optional_field_4"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_5) { if (($this->ad_configuration_data->OPTIONAL_5_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_5_other"])) > 0)) $this->classified_variables["optional_field_5"] = $this->classified_variables["optional_field_5_other"]; if ($this->ad_configuration_data->OPTIONAL_5_LENGTH > 0) $this->classified_variables["optional_field_5"] = substr($this->classified_variables["optional_field_5"],0,$this->ad_configuration_data->OPTIONAL_5_LENGTH); if (($this->ad_configuration_data->OPTIONAL_5_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_5_FIELD_TYPE)) { $this->classified_variables["optional_field_5"] = stripslashes(urldecode($this->classified_variables["optional_field_5"])); $this->classified_variables["optional_field_5"] = wordwrap($this->classified_variables["optional_field_5"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_5"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_5"],1); $this->classified_variables["optional_field_5"] = $this->check_for_badwords($this->classified_variables["optional_field_5"]); } if ($this->ad_configuration_data->OPTIONAL_5_NUMBER_ONLY) { $this->classified_variables["optional_field_5"] = str_replace(",","",$this->classified_variables["optional_field_5"]); if ((strlen(trim($this->classified_variables["optional_field_5"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_5"]))) { //echo "error in number only optional 5
\n"; $this->error++; $this->error_variables["optional_field_5"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_5) { if (strlen(trim($this->classified_variables["optional_field_5"])) == 0) { $this->error++; $this->error_variables["optional_field_5"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_6) { if (($this->ad_configuration_data->OPTIONAL_6_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_6_other"])) > 0)) $this->classified_variables["optional_field_6"] = $this->classified_variables["optional_field_6_other"]; if ($this->ad_configuration_data->OPTIONAL_6_LENGTH > 0) $this->classified_variables["optional_field_6"] = substr($this->classified_variables["optional_field_6"],0,$this->ad_configuration_data->OPTIONAL_6_LENGTH); if (($this->ad_configuration_data->OPTIONAL_6_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_6_FIELD_TYPE)) { $this->classified_variables["optional_field_6"] = stripslashes(urldecode($this->classified_variables["optional_field_6"])); $this->classified_variables["optional_field_6"] = wordwrap($this->classified_variables["optional_field_6"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_6"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_6"],1); $this->classified_variables["optional_field_6"] = $this->check_for_badwords($this->classified_variables["optional_field_6"]); } if ($this->ad_configuration_data->OPTIONAL_6_NUMBER_ONLY) { $this->classified_variables["optional_field_6"] = str_replace(",","",$this->classified_variables["optional_field_6"]); if ((strlen(trim($this->classified_variables["optional_field_6"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_6"]))) { //echo "error in number only optional 6
\n"; $this->error++; $this->error_variables["optional_field_6"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_6) { if (strlen(trim($this->classified_variables["optional_field_6"])) == 0) { $this->error++; $this->error_variables["optional_field_6"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_7) { if (($this->ad_configuration_data->OPTIONAL_7_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_7_other"])) > 0)) $this->classified_variables["optional_field_7"] = $this->classified_variables["optional_field_7_other"]; if ($this->ad_configuration_data->OPTIONAL_7_LENGTH > 0) $this->classified_variables["optional_field_7"] = substr($this->classified_variables["optional_field_7"],0,$this->ad_configuration_data->OPTIONAL_7_LENGTH); if (($this->ad_configuration_data->OPTIONAL_7_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_7_FIELD_TYPE)) { $this->classified_variables["optional_field_7"] = stripslashes(urldecode($this->classified_variables["optional_field_7"])); $this->classified_variables["optional_field_7"] = wordwrap($this->classified_variables["optional_field_7"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_7"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_7"],1); $this->classified_variables["optional_field_7"] = $this->check_for_badwords($this->classified_variables["optional_field_7"]); } if ($this->ad_configuration_data->OPTIONAL_7_NUMBER_ONLY) { $this->classified_variables["optional_field_7"] = str_replace(",","",$this->classified_variables["optional_field_7"]); if ((strlen(trim($this->classified_variables["optional_field_7"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_7"]))) { //echo "error in number only optional 7
\n"; $this->error++; $this->error_variables["optional_field_7"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_7) { if (strlen(trim($this->classified_variables["optional_field_7"])) == 0) { $this->error++; $this->error_variables["optional_field_7"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_8) { if (($this->ad_configuration_data->OPTIONAL_8_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_8_other"])) > 0)) $this->classified_variables["optional_field_8"] = $this->classified_variables["optional_field_8_other"]; if ($this->ad_configuration_data->OPTIONAL_8_LENGTH > 0) $this->classified_variables["optional_field_8"] = substr($this->classified_variables["optional_field_8"],0,$this->ad_configuration_data->OPTIONAL_8_LENGTH); if (($this->ad_configuration_data->OPTIONAL_8_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_8_FIELD_TYPE)) { $this->classified_variables["optional_field_8"] = stripslashes(urldecode($this->classified_variables["optional_field_8"])); $this->classified_variables["optional_field_8"] = wordwrap($this->classified_variables["optional_field_8"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_8"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_8"],1); $this->classified_variables["optional_field_8"] = $this->check_for_badwords($this->classified_variables["optional_field_8"]); } if ($this->ad_configuration_data->OPTIONAL_8_NUMBER_ONLY) { $this->classified_variables["optional_field_8"] = str_replace(",","",$this->classified_variables["optional_field_8"]); if ((strlen(trim($this->classified_variables["optional_field_8"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_8"]))) { //echo "error in number only optional 8
\n"; $this->error++; $this->error_variables["optional_field_8"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_8) { if (strlen(trim($this->classified_variables["optional_field_8"])) == 0) { $this->error++; $this->error_variables["optional_field_8"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_9) { if (($this->ad_configuration_data->OPTIONAL_9_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_9_other"])) > 0)) $this->classified_variables["optional_field_9"] = $this->classified_variables["optional_field_9_other"]; if ($this->ad_configuration_data->OPTIONAL_9_LENGTH > 0) $this->classified_variables["optional_field_9"] = substr($this->classified_variables["optional_field_9"],0,$this->ad_configuration_data->OPTIONAL_9_LENGTH); if (($this->ad_configuration_data->OPTIONAL_9_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_9_FIELD_TYPE)) { $this->classified_variables["optional_field_9"] = stripslashes(urldecode($this->classified_variables["optional_field_9"])); $this->classified_variables["optional_field_9"] = wordwrap($this->classified_variables["optional_field_9"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_9"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_9"],1); $this->classified_variables["optional_field_9"] = $this->check_for_badwords($this->classified_variables["optional_field_9"]); } if ($this->ad_configuration_data->OPTIONAL_9_NUMBER_ONLY) { $this->classified_variables["optional_field_9"] = str_replace(",","",$this->classified_variables["optional_field_9"]); if ((strlen(trim($this->classified_variables["optional_field_9"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_9"]))) { //echo "error in number only optional 9
\n"; $this->error++; $this->error_variables["optional_field_9"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_9) { if (strlen(trim($this->classified_variables["optional_field_9"])) == 0) { $this->error++; $this->error_variables["optional_field_9"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_10) { if (($this->ad_configuration_data->OPTIONAL_10_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_10_other"])) > 0)) $this->classified_variables["optional_field_10"] = $this->classified_variables["optional_field_10_other"]; if ($this->ad_configuration_data->OPTIONAL_10_LENGTH > 0) $this->classified_variables["optional_field_10"] = substr($this->classified_variables["optional_field_10"],0,$this->ad_configuration_data->OPTIONAL_10_LENGTH); if (($this->ad_configuration_data->OPTIONAL_10_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_10_FIELD_TYPE)) { $this->classified_variables["optional_field_10"] = stripslashes(urldecode($this->classified_variables["optional_field_10"])); $this->classified_variables["optional_field_10"] = wordwrap($this->classified_variables["optional_field_10"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_10"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_10"],1); $this->classified_variables["optional_field_10"] = $this->check_for_badwords($this->classified_variables["optional_field_10"]); } if ($this->ad_configuration_data->OPTIONAL_10_NUMBER_ONLY) { $this->classified_variables["optional_field_10"] = str_replace(",","",$this->classified_variables["optional_field_10"]); if ((strlen(trim($this->classified_variables["optional_field_10"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_10"]))) { //echo "error in number only optional 10
\n"; $this->error++; $this->error_variables["optional_field_10"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_10) { if (strlen(trim($this->classified_variables["optional_field_10"])) == 0) { $this->error++; $this->error_variables["optional_field_10"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_11) { if (($this->ad_configuration_data->OPTIONAL_11_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_11_other"])) > 0)) $this->classified_variables["optional_field_11"] = $this->classified_variables["optional_field_11_other"]; if ($this->configuration_data->OPTIONAL_11_LENGTH > 0) $this->classified_variables["optional_field_11"] = substr($this->classified_variables["optional_field_11"],0,$this->ad_configuration_data->OPTIONAL_11_LENGTH); if (($this->ad_configuration_data->OPTIONAL_11_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_11_FIELD_TYPE)) { $this->classified_variables["optional_field_11"] = stripslashes(urldecode($this->classified_variables["optional_field_11"])); $this->classified_variables["optional_field_11"] = wordwrap($this->classified_variables["optional_field_11"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_11"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_11"],1); $this->classified_variables["optional_field_11"] = $this->check_for_badwords($this->classified_variables["optional_field_11"]); } if ($this->ad_configuration_data->OPTIONAL_11_NUMBER_ONLY) { $this->classified_variables["optional_field_11"] = str_replace(",","",$this->classified_variables["optional_field_11"]); if ((strlen(trim($this->classified_variables["optional_field_11"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_11"]))) { //echo "error in number only optional 1
\n"; $this->error++; $this->error_variables["optional_field_11"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_11) { if (strlen(trim($this->classified_variables["optional_field_11"])) == 0) { $this->error++; $this->error_variables["optional_field_11"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_12) { if (($this->ad_configuration_data->OPTIONAL_12_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_12_other"])) > 0)) $this->classified_variables["optional_field_12"] = $this->classified_variables["optional_field_12_other"]; if ($this->configuration_data->OPTIONAL_12_LENGTH > 0) $this->classified_variables["optional_field_12"] = substr($this->classified_variables["optional_field_12"],0,$this->ad_configuration_data->OPTIONAL_12_LENGTH); if (($this->ad_configuration_data->OPTIONAL_12_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_12_FIELD_TYPE)) { $this->classified_variables["optional_field_12"] = stripslashes(urldecode($this->classified_variables["optional_field_12"])); $this->classified_variables["optional_field_12"] = wordwrap($this->classified_variables["optional_field_12"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_12"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_12"],1); $this->classified_variables["optional_field_12"] = $this->check_for_badwords($this->classified_variables["optional_field_12"]); } if ($this->ad_configuration_data->OPTIONAL_12_NUMBER_ONLY) { $this->classified_variables["optional_field_12"] = str_replace(",","",$this->classified_variables["optional_field_12"]); if ((strlen(trim($this->classified_variables["optional_field_12"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_12"]))) { //echo "error in number only optional 1
\n"; $this->error++; $this->error_variables["optional_field_12"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_12) { if (strlen(trim($this->classified_variables["optional_field_12"])) == 0) { $this->error++; $this->error_variables["optional_field_12"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_13) { if (($this->ad_configuration_data->OPTIONAL_13_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_13_other"])) > 0)) $this->classified_variables["optional_field_13"] = $this->classified_variables["optional_field_13_other"]; if ($this->configuration_data->OPTIONAL_13_LENGTH > 0) $this->classified_variables["optional_field_13"] = substr($this->classified_variables["optional_field_13"],0,$this->ad_configuration_data->OPTIONAL_13_LENGTH); if (($this->ad_configuration_data->OPTIONAL_13_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_13_FIELD_TYPE)) { $this->classified_variables["optional_field_13"] = stripslashes(urldecode($this->classified_variables["optional_field_13"])); $this->classified_variables["optional_field_13"] = wordwrap($this->classified_variables["optional_field_13"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_13"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_13"],1); $this->classified_variables["optional_field_13"] = $this->check_for_badwords($this->classified_variables["optional_field_13"]); } if ($this->ad_configuration_data->OPTIONAL_13_NUMBER_ONLY) { $this->classified_variables["optional_field_13"] = str_replace(",","",$this->classified_variables["optional_field_13"]); if ((strlen(trim($this->classified_variables["optional_field_13"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_13"]))) { //echo "error in number only optional 1
\n"; $this->error++; $this->error_variables["optional_field_13"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_13) { if (strlen(trim($this->classified_variables["optional_field_13"])) == 0) { $this->error++; $this->error_variables["optional_field_13"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_14) { if (($this->ad_configuration_data->OPTIONAL_14_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_14_other"])) > 0)) $this->classified_variables["optional_field_14"] = $this->classified_variables["optional_field_14_other"]; if ($this->configuration_data->OPTIONAL_14_LENGTH > 0) $this->classified_variables["optional_field_14"] = substr($this->classified_variables["optional_field_14"],0,$this->ad_configuration_data->OPTIONAL_14_LENGTH); if (($this->ad_configuration_data->OPTIONAL_14_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_14_FIELD_TYPE)) { $this->classified_variables["optional_field_14"] = stripslashes(urldecode($this->classified_variables["optional_field_14"])); $this->classified_variables["optional_field_14"] = wordwrap($this->classified_variables["optional_field_14"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_14"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_14"],1); $this->classified_variables["optional_field_14"] = $this->check_for_badwords($this->classified_variables["optional_field_14"]); } if ($this->ad_configuration_data->OPTIONAL_14_NUMBER_ONLY) { $this->classified_variables["optional_field_14"] = str_replace(",","",$this->classified_variables["optional_field_14"]); if ((strlen(trim($this->classified_variables["optional_field_14"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_14"]))) { //echo "error in number only optional 1
\n"; $this->error++; $this->error_variables["optional_field_14"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_14) { if (strlen(trim($this->classified_variables["optional_field_14"])) == 0) { $this->error++; $this->error_variables["optional_field_14"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_15) { if (($this->ad_configuration_data->OPTIONAL_15_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_15_other"])) > 0)) $this->classified_variables["optional_field_15"] = $this->classified_variables["optional_field_15_other"]; if ($this->configuration_data->OPTIONAL_15_LENGTH > 0) $this->classified_variables["optional_field_15"] = substr($this->classified_variables["optional_field_15"],0,$this->ad_configuration_data->OPTIONAL_15_LENGTH); if (($this->ad_configuration_data->OPTIONAL_15_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_15_FIELD_TYPE)) { $this->classified_variables["optional_field_15"] = stripslashes(urldecode($this->classified_variables["optional_field_15"])); $this->classified_variables["optional_field_15"] = wordwrap($this->classified_variables["optional_field_15"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_15"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_15"],1); $this->classified_variables["optional_field_15"] = $this->check_for_badwords($this->classified_variables["optional_field_15"]); } if ($this->ad_configuration_data->OPTIONAL_15_NUMBER_ONLY) { $this->classified_variables["optional_field_15"] = str_replace(",","",$this->classified_variables["optional_field_15"]); if ((strlen(trim($this->classified_variables["optional_field_15"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_15"]))) { //echo "error in number only optional 1
\n"; $this->error++; $this->error_variables["optional_field_15"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_15) { if (strlen(trim($this->classified_variables["optional_field_15"])) == 0) { $this->error++; $this->error_variables["optional_field_15"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_16) { if (($this->ad_configuration_data->OPTIONAL_16_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_16_other"])) > 0)) $this->classified_variables["optional_field_16"] = $this->classified_variables["optional_field_16_other"]; if ($this->configuration_data->OPTIONAL_16_LENGTH > 0) $this->classified_variables["optional_field_16"] = substr($this->classified_variables["optional_field_16"],0,$this->ad_configuration_data->OPTIONAL_16_LENGTH); if (($this->ad_configuration_data->OPTIONAL_16_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_16_FIELD_TYPE)) { $this->classified_variables["optional_field_16"] = stripslashes(urldecode($this->classified_variables["optional_field_16"])); $this->classified_variables["optional_field_16"] = wordwrap($this->classified_variables["optional_field_16"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_16"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_16"],1); $this->classified_variables["optional_field_16"] = $this->check_for_badwords($this->classified_variables["optional_field_16"]); } if ($this->ad_configuration_data->OPTIONAL_16_NUMBER_ONLY) { $this->classified_variables["optional_field_16"] = str_replace(",","",$this->classified_variables["optional_field_16"]); if ((strlen(trim($this->classified_variables["optional_field_16"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_16"]))) { //echo "error in number only optional 1
\n"; $this->error++; $this->error_variables["optional_field_16"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_16) { if (strlen(trim($this->classified_variables["optional_field_16"])) == 0) { $this->error++; $this->error_variables["optional_field_16"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_17) { if (($this->ad_configuration_data->OPTIONAL_17_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_17_other"])) > 0)) $this->classified_variables["optional_field_17"] = $this->classified_variables["optional_field_17_other"]; if ($this->configuration_data->OPTIONAL_17_LENGTH > 0) $this->classified_variables["optional_field_17"] = substr($this->classified_variables["optional_field_17"],0,$this->ad_configuration_data->OPTIONAL_17_LENGTH); if (($this->ad_configuration_data->OPTIONAL_17_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_17_FIELD_TYPE)) { $this->classified_variables["optional_field_17"] = stripslashes(urldecode($this->classified_variables["optional_field_17"])); $this->classified_variables["optional_field_17"] = wordwrap($this->classified_variables["optional_field_17"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_17"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_17"],1); $this->classified_variables["optional_field_17"] = $this->check_for_badwords($this->classified_variables["optional_field_17"]); } if ($this->ad_configuration_data->OPTIONAL_17_NUMBER_ONLY) { $this->classified_variables["optional_field_17"] = str_replace(",","",$this->classified_variables["optional_field_17"]); if ((strlen(trim($this->classified_variables["optional_field_17"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_17"]))) { //echo "error in number only optional 1
\n"; $this->error++; $this->error_variables["optional_field_17"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_17) { if (strlen(trim($this->classified_variables["optional_field_17"])) == 0) { $this->error++; $this->error_variables["optional_field_17"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_18) { if (($this->ad_configuration_data->OPTIONAL_18_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_18_other"])) > 0)) $this->classified_variables["optional_field_18"] = $this->classified_variables["optional_field_18_other"]; if ($this->configuration_data->OPTIONAL_18_LENGTH > 0) $this->classified_variables["optional_field_18"] = substr($this->classified_variables["optional_field_18"],0,$this->ad_configuration_data->OPTIONAL_18_LENGTH); if (($this->ad_configuration_data->OPTIONAL_18_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_18_FIELD_TYPE)) { $this->classified_variables["optional_field_18"] = stripslashes(urldecode($this->classified_variables["optional_field_18"])); $this->classified_variables["optional_field_18"] = wordwrap($this->classified_variables["optional_field_18"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_18"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_18"],1); $this->classified_variables["optional_field_18"] = $this->check_for_badwords($this->classified_variables["optional_field_18"]); } if ($this->ad_configuration_data->OPTIONAL_18_NUMBER_ONLY) { $this->classified_variables["optional_field_18"] = str_replace(",","",$this->classified_variables["optional_field_18"]); if ((strlen(trim($this->classified_variables["optional_field_18"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_18"]))) { //echo "error in number only optional 1
\n"; $this->error++; $this->error_variables["optional_field_18"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_18) { if (strlen(trim($this->classified_variables["optional_field_18"])) == 0) { $this->error++; $this->error_variables["optional_field_18"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_19) { if (($this->ad_configuration_data->OPTIONAL_19_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_19_other"])) > 0)) $this->classified_variables["optional_field_19"] = $this->classified_variables["optional_field_19_other"]; if ($this->configuration_data->OPTIONAL_19_LENGTH > 0) $this->classified_variables["optional_field_19"] = substr($this->classified_variables["optional_field_19"],0,$this->ad_configuration_data->OPTIONAL_19_LENGTH); if (($this->ad_configuration_data->OPTIONAL_19_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_19_FIELD_TYPE)) { $this->classified_variables["optional_field_19"] = stripslashes(urldecode($this->classified_variables["optional_field_19"])); $this->classified_variables["optional_field_19"] = wordwrap($this->classified_variables["optional_field_19"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_19"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_19"],1); $this->classified_variables["optional_field_19"] = $this->check_for_badwords($this->classified_variables["optional_field_19"]); } if ($this->ad_configuration_data->OPTIONAL_19_NUMBER_ONLY) { $this->classified_variables["optional_field_19"] = str_replace(",","",$this->classified_variables["optional_field_19"]); if ((strlen(trim($this->classified_variables["optional_field_19"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_19"]))) { //echo "error in number only optional 1
\n"; $this->error++; $this->error_variables["optional_field_19"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_19) { if (strlen(trim($this->classified_variables["optional_field_19"])) == 0) { $this->error++; $this->error_variables["optional_field_19"] = "error"; } } } if ($this->field_configuration_data->USE_OPTIONAL_FIELD_20) { if (($this->ad_configuration_data->OPTIONAL_20_OTHER_BOX) && (strlen(trim($this->classified_variables["optional_field_20_other"])) > 0)) $this->classified_variables["optional_field_20"] = $this->classified_variables["optional_field_20_other"]; if ($this->configuration_data->OPTIONAL_20_LENGTH > 0) $this->classified_variables["optional_field_20"] = substr($this->classified_variables["optional_field_20"],0,$this->ad_configuration_data->OPTIONAL_20_LENGTH); if (($this->ad_configuration_data->OPTIONAL_20_OTHER_BOX) || (!$this->ad_configuration_data->OPTIONAL_20_FIELD_TYPE)) { $this->classified_variables["optional_field_20"] = stripslashes(urldecode($this->classified_variables["optional_field_20"])); $this->classified_variables["optional_field_20"] = wordwrap($this->classified_variables["optional_field_20"],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); $this->classified_variables["optional_field_20"] = $this->replace_disallowed_html($db,$this->classified_variables["optional_field_20"],1); $this->classified_variables["optional_field_20"] = $this->check_for_badwords($this->classified_variables["optional_field_20"]); } if ($this->ad_configuration_data->OPTIONAL_20_NUMBER_ONLY) { $this->classified_variables["optional_field_20"] = str_replace(",","",$this->classified_variables["optional_field_20"]); if ((strlen(trim($this->classified_variables["optional_field_20"])) > 0) && (!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["optional_field_20"]))) { //echo "error in number only optional 1
\n"; $this->error++; $this->error_variables["optional_field_20"] = "error_number"; } } if ($this->configuration_data->REQUIRE_OPTIONAL_FIELD_20) { if (strlen(trim($this->classified_variables["optional_field_20"])) == 0) { $this->error++; $this->error_variables["optional_field_20"] = "error"; } } } if ($this->field_configuration_data->USE_URL_LINK_1) { if ($this->ad_configuration_data->URL_LINK_1_LENGTH > 0) $this->classified_variables["url_link_1"] = substr($this->classified_variables["url_link_1"],0,$this->ad_configuration_data->URL_LINK_1_LENGTH); $this->classified_variables["url_link_1"] = stripslashes(urldecode($this->classified_variables["url_link_1"])); $this->classified_variables["url_link_1"] = $this->replace_disallowed_html($db,$this->classified_variables["url_link_1"],1); $this->classified_variables["url_link_1"] = $this->check_for_badwords($this->classified_variables["url_link_1"]); if ($this->configuration_data->REQUIRE_URL_LINK_1) { if (strlen(trim($this->classified_variables["url_link_1"])) == 0) { $this->error++; $this->error_variables["url_link_1"] = "error"; } } } if ($this->field_configuration_data->USE_URL_LINK_2) { if ($this->ad_configuration_data->URL_LINK_2_LENGTH > 0) $this->classified_variables["url_link_2"] = substr($this->classified_variables["url_link_2"],0,$this->ad_configuration_data->URL_LINK_2_LENGTH); $this->classified_variables["url_link_2"] = stripslashes(urldecode($this->classified_variables["url_link_2"])); $this->classified_variables["url_link_2"] = $this->replace_disallowed_html($db,$this->classified_variables["url_link_2"],1); $this->classified_variables["url_link_2"] = $this->check_for_badwords($this->classified_variables["url_link_2"]); if ($this->configuration_data->REQUIRE_URL_LINK_2) { if (strlen(trim($this->classified_variables["url_link_2"])) == 0) { $this->error++; $this->error_variables["url_link_2"] = "error"; } } } if ($this->field_configuration_data->USE_URL_LINK_3) { if ($this->ad_configuration_data->URL_LINK_3_LENGTH > 0) $this->classified_variables["url_link_3"] = substr($this->classified_variables["url_link_3"],0,$this->ad_configuration_data->URL_LINK_3_LENGTH); $this->classified_variables["url_link_3"] = stripslashes(urldecode($this->classified_variables["url_link_3"])); $this->classified_variables["url_link_3"] = $this->replace_disallowed_html($db,$this->classified_variables["url_link_3"],1); $this->classified_variables["url_link_3"] = $this->check_for_badwords($this->classified_variables["url_link_3"]); if ($this->configuration_data->REQUIRE_URL_LINK_3) { if (strlen(trim($this->classified_variables["url_link_3"])) == 0) { $this->error++; $this->error_variables["url_link_3"] = "error"; } } } if ($this->field_configuration_data->USE_EMAIL_OPTION_FIELD) { if ((!eregi("^([a-z0-9]+)(([a-z0-9._-]+))*[@]([a-z0-9]+)([._-]([a-z0-9]+))*[.]([a-z0-9]){2,3}([a-z0-9])?$", $this->classified_variables[email_option])) || (strlen(trim($this->classified_variables[email_option])) == 0)) { $this->error_variables["email_option"] ="error1"; $this->error++; } } if ($this->field_configuration_data->USE_PRICE_FIELD) { if ($this->classified_user_id) { $this->sql_query = "select * from ".$this->user_groups_price_plans_table." where id = ".$this->classified_user_id; $plan_result = $db->Execute($this->sql_query); if (!$plan_result) { //echo $this->sql_query."
\n"; return false; } elseif ($plan_result->RecordCount() == 1) { $show_price_plan_id = $plan_result->FetchNextObject(); $this->sql_query = "select type_of_billing, charge_per_ad_type from ".$this->price_plans_table." where price_plan_id = ".$show_price_plan_id->PRICE_PLAN_ID; $price_plan_result = $db->Execute($this->sql_query); if (!$price_plan_result) { //echo $this->sql_query."
\n"; return false; } elseif ($price_plan_result->RecordCount() == 1) { $show_price_plan = $price_plan_result->FetchNextObject(); if (($show_price_plan->TYPE_OF_BILLING == 1) && ($show_price_plan->CHARGE_PER_AD_TYPE == 1)) { $this->classified_variables["price"] = trim(str_replace(",","",$this->classified_variables["price"])); //update price if ($this->session_id) { $this->sql_query = "update ".$this->sell_table." set price = \"".addslashes($this->classified_variables["price"])."\" where session = \"".$this->session_id."\""; $save_price_result = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$save_price_result) { //echo $this->sql_query."
\n"; } } if ((strlen($this->classified_variables["price"]) == 0) || ($this->classified_variables["price"] == 0)) { $this->error++; $this->error_variables["price"] = "error"; } } else { if (strlen($this->classified_variables["price"]) == 0) { $this->error++; $this->error_variables["price"] = "error"; } } } } } $this->classified_variables["price"] = trim(str_replace(",","",$this->classified_variables["price"])); $this->classified_variables["price"] = substr($this->classified_variables["price"],0,$this->ad_configuration_data->PRICE_LENGTH); if ((!ereg("^[0-9]{1,10}.?[0-9]{0,2}$", $this->classified_variables["price"]))) { //error in classified_zip - was not entered $this->error++; $this->error_variables["price"] = "error"; } } if ($this->field_configuration_data->USE_PHONE_1_OPTION_FIELD) { $this->classified_variables["phone_1_option"] = trim(str_replace(",","",$this->classified_variables["phone_1_option"])); $this->classified_variables["phone_1_option"] = substr($this->classified_variables["phone_1_option"],0,$this->ad_configuration_data->PHONE_1_LENGTH); } if ($this->field_configuration_data->USE_PHONE_2_OPTION_FIELD) { $this->classified_variables["phone_2_option"] = trim(str_replace(",","",$this->classified_variables["phone_2_option"])); $this->classified_variables["phone_2_option"] = substr($this->classified_variables["phone_2_option"],0,$this->ad_configuration_data->PHONE_2_LENGTH); } if ($this->field_configuration_data->USE_FAX_FIELD_OPTION) { $this->classified_variables["fax_option"] = trim(str_replace(",","",$this->classified_variables["fax_option"])); $this->classified_variables["fax_option"] = substr($this->classified_variables["fax_option"],0,$this->ad_configuration_data->FAX_LENGTH); } //echo $this->classified_variables["description"]." is description before anything
\n"; $this->classified_variables["description"] = stripslashes(urldecode($this->classified_variables["description"])); //$this->classified_variables["description"] = ereg_replace("\"", "'", $this->classified_variables["description"]); //echo $this->classified_variables["description"]." is description before max length
\n"; $this->classified_variables["description"] = substr($this->classified_variables["description"],0,$this->ad_configuration_data->MAXIMUM_DESCRIPTION_LENGTH); //echo $this->classified_variables["description"]." is description before wordwrap
\n"; //$this->classified_variables["description"] = wordwrap($this->classified_variables["description"],$this->configuration_data->MAX_WORD_WIDTH, "\n",1); //echo $this->classified_variables["description"]." is description before disallowed
\n"; $this->classified_variables["description"] = $this->replace_disallowed_html($db,$this->classified_variables["description"]); //echo $this->classified_variables["description"]." is description before badword
\n"; $this->classified_variables["description"] = $this->check_for_badwords($this->classified_variables["description"]); //$this->classified_variables["description"] = nl2br($this->classified_variables["description"]); //$this->classified_variables["description"] = ereg_replace("(\r\n|\n|\r)", "
", $this->classified_variables["description"]); //echo $this->classified_variables["description"]." after
\n"; if (strlen(trim($this->classified_variables["description"])) == 0) { $this->error++; $this->error_variables["description"] = "error"; } if ($this->field_configuration_data->USE_CITY_FIELD) { $this->classified_variables["city"] = $this->replace_disallowed_html($db,$this->classified_variables["city"],1); $this->classified_variables["city"] = $this->check_for_badwords($this->classified_variables["city"]); } //echo $this->error." is the error count
\n"; //reset($this->error_variables); //foreach ($this->error_variables as $key => $value) // echo $key." is the key to ".$value."
\n"; if ($this->error == 0) { //echo "details checked ok
\n"; return true; } else return false; } //end of function classified_detail_check() //############################################################################ function get_html_disallowed_array($db) { $this->sql_query = "select * from ".$this->html_allowed_table." where tag_status = 1"; $html_result = $db->Execute($this->sql_query); //$this->body .=$this->sql_query."
\n"; if (!$html_result) { return false; } elseif ($html_result->RecordCount() > 0) { $this->row_count = 0; while ($show_html = $html_result->FetchNextObject()) { //$this->body .=$show_html->TAG_NAME." is the tag name
\n"; if ($show_html->USE_SEARCH_STRING) { //$this->html_open_disallowed_list[$this->row_count] = str_replace("+++++",$show_html->TAG_NAME,$this->html_disallowed_string); //$this->html_closed_disallowed_list[$this->row_count] = str_replace("+++++",$show_html->TAG_NAME,$this->html_disallowed_string); $this->html_disallowed_list[$this->row_count] = str_replace("+++++",$show_html->TAG_NAME,$this->html_disallowed_string); //$this->body .=$this->html_disallowed_list[$this->row_count]." is html disallowed ".$this->row_count."
\n"; } //if ($show_html->REGULAR_EXPRESSION) // $this->html_disallowed_list[$this->row_count] = $show_html->REGULAR_EXPRESSION; else $this->html_disallowed_list[$this->row_count] = "'".$show_html->TAG_NAME."'i"; $this->html_disallowed_replacement[$this->row_count] = $show_html->REPLACE_WITH; //$this->body .=$this->html_disallowed_list[$this->row_count]." is html disallowed ".$this->row_count."
\n"; $this->row_count++; } return true; } else { $this->html_disallowed_list = 0; return true; } } //end of function get_html_disallowed_array //######################################################################### function replace_disallowed_html($db,$text,$remove_all=0) { $text = preg_replace ("/(<\/?)(\w+)([^>]*>)/e", "'\\1'.strtoupper('\\2').'\\3'", $text); if ($remove_all) $this->sql_query = "select * from ".$this->html_allowed_table; else $this->sql_query = "select * from ".$this->html_allowed_table." where tag_status = 1"; $html_result = $db->Execute($this->sql_query); //$this->body .=$this->sql_query."
\n"; if (!$html_result) { return false; } elseif ($html_result->RecordCount() > 0) { $this->row_count = 0; while ($show_html = $html_result->FetchNextObject()) { //$this->body .=$show_html->TAG_NAME." is the tag name
\n"; if (strlen(trim($show_html->REPLACE_WITH)) == 0) $replace = " "; else $replace = $show_html->REPLACE_WITH; if ($show_html->USE_SEARCH_STRING) { $expression = "/(<\/?)".$show_html->TAG_NAME."([^>]*>)/e"; $text = preg_replace ($expression, $replace, $text); } else { $expression = "'".$show_html->TAG_NAME."'"; $text = str_replace ($show_html->TAG_NAME, $replace, $text); } //$this->html_disallowed_replacement[$this->row_count] = $show_html->REPLACE_WITH; //$this->body .=$this->html_disallowed_list[$this->row_count]." is html disallowed ".$this->row_count."
\n"; //$this->row_count++; } return $text; } else { $this->html_disallowed_list = 0; return $text; } //$this->body .=$text." after upper
\n"; //$this->body .=$text." before cleaning
\n"; //$text = preg_replace ("/(<\/?)APPLET([^>]*>)/e", "appletsomething", $text); //$text = preg_replace ("/(<\/?)HTML([^>]*>)/e", "something", $text); //$text = preg_replace ("/(<\/?)TABLE([^>]*>)/e", "table", $text); //$this->body .=$text." after cleaning
\n"; return $text; } //function replace_disallowed_html //######################################################################### function get_badword_array($db) { $this->sql_query = "select * from ".$this->badwords_table; $result = $db->Execute($this->sql_query); if (!$result) { return false; } elseif ($result->RecordCount() > 0) { $this->row_count = 0; while ($show = $result->FetchNextObject()) { $this->badword_list[$this->row_count] = $show->BADWORD; $this->badword_replacement[$this->row_count] = $show->BADWORD_REPLACEMENT; $this->row_count++; } return true; } else { $this->badword_list = 0; return true; } } //end of function get_badword_array //######################################################################### function check_for_badwords($text) { if ($this->badword_list) { reset($this->badword_list); while (list($key,$badword) = each($this->badword_list)) { if(stristr($text, $badword)) { if(strtoupper($text)==strtoupper($badword)) $text = $this->badword_replacement[$key]; $text = eregi_replace("^$badword([^a-zA-Z])*", $this->badword_replacement[$key], $text); $text = eregi_replace("([^a-zA-Z])*$badword$", $this->badword_replacement[$key], $text); while(eregi("([^a-zA-Z ])*($badword)([^a-zA-Z ])*", $text)){ //$text = eregi_replace("([^a-zA-Z])*($badword)([^a-zA-Z])*", "\\1".$this->badword_replacement[$key]."\\3", $text); $text = eregi_replace("([^a-zA-Z])*($badword)([^a-zA-Z])*", $this->badword_replacement[$key], $text); } } } } return $text; } //end of function check_for_badwords //######################################################################### function extra_page($db,$page_id=0) { if ($page_id) { $this->sql_query = "select * from ".$this->extra_pages_table." where page_id = ".$page_id; $result = $db->Execute($this->sql_query); if (!$result) { return false; } elseif ($result->RecordCount() == 1) { $show = $result->FetchNextObject(); $this->body .=stripslashes(urldecode($show->PAGE_CONTENT)); return true; } else { return false; } } else { return false; } } //end of function check_for_badwords //######################################################################### function get_image_file_types_array($db) { $this->sql_query = "select * from ".$this->file_types_table." where accept = 1"; $type_result = $db->Execute($this->sql_query); if (!$type_result) { return false; } elseif ($type_result->RecordCount() > 0) { while ($show = $type_result->FetchNextObject()) { array_push($this->image_file_types,$show->MIME_TYPE); array_push($this->image_file_types_icon,$show->ICON_TO_USE); array_push($this->image_file_types_extension,$show->EXTENSION); } } return true; } //end of get_image_file_types_array //######################################################################### function image_accepted_type($type) { reset($this->image_file_types); foreach ($this->image_file_types as $key => $value) { if (strstr($type,$value)) { $image_accepted_type = 1; $this->current_file_type_icon = $this->image_file_types_icon[$key]; $this->current_file_type_extension = $this->image_file_types_extension[$key]; return true; } } return false; } //end of function image_accepted_type //######################################################################### function get_category_string($db,$category) { $category_tree = $this->get_category_tree($db,$category); reset ($this->category_tree_array); if ($category_tree) { //category tree $category_string = urldecode($this->messages[79])." > "; if (is_array($this->category_tree_array)) { $i = 0; //$categories = array_reverse($this->category_tree_array); $i = count($this->category_tree_array); while ($i > 0 ) { //display all the categories $i--; if ($i == 0) $category_string .= $this->category_tree_array[$i]["category_name"]; else $category_string .= $this->category_tree_array[$i]["category_name"]." > "; } } else { $this->body .=$category_tree; } } } //################################################################################## function check_extra_questions($db) { $num_questions = count($this->classified_variables["question_value"]); //$this->body .=$num_questions." is the num of questions remembered
\n"; if ($num_questions > 0 ) { while (list($key,$value) = each($this->classified_variables["question_value"])) { if (strlen(trim($value)) > 0) { if (strlen(trim($this->classified_variables["question_value_other"][$key])) > 0) { //check other value //wordrap $this->classified_variables["question_value_other"][$key] = wordwrap($this->classified_variables["question_value_other"][$key],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); //check the value for badwords $this->classified_variables["question_value_other"][$key] = $this->check_for_badwords($this->classified_variables["question_value_other"][$key]); //check the value for disallowed html $this->classified_variables["question_value_other"][$key] = $this->replace_disallowed_html($db,$this->classified_variables["question_value_other"][$key],1); } else { //check dropdown or input box value //wordrap $this->classified_variables["question_value"][$key] = wordwrap($this->classified_variables["question_value"][$key],$this->configuration_data->MAX_WORD_WIDTH, " \n",1); //check the value for badwords $this->classified_variables["question_value"][$key] = $this->check_for_badwords($this->classified_variables["question_value"][$key]); //check the value for disallowed html $this->classified_variables["question_value"][$key] = $this->replace_disallowed_html($db,$this->classified_variables["question_value"][$key],1); } } // end of if }//end of while }// end of if num_questions > 0 } //end of function check_extra_questions //################################################################################ function in_array_key($key, $array, $value = false) { if (is_array($array)) { while(list($k, $v) = each($array)) { if($key == $k) { if($value && $value == $v) return true; elseif($value && $value != $v) return false; else return true; } } } return false; } //end of function in_array_key //################################################################################# function expire_groups_and_plans($db) { $this->sql_query = "select * from ".$this->expirations_table." where expires < ".time(); $type_result = $db->Execute($this->sql_query); if (!$type_result) { return false; } elseif ($type_result->RecordCount() > 0) { while ($show = $type_result->FetchNextObject()) { if ($show->TYPE == 1) { $this->sql_query = "select group_expires_into from ".$this->groups_table." where group_id = ".$show->TYPE_ID; $expire_into_result = $db->Execute($this->sql_query); if (!$expire_into_result) { return false; } elseif ($expire_into_result->RecordCount() == 1) { $show_expire_into = $expire_into_result->FetchNextObject(); //expire group if ($show->TYPE_ID_EXPIRES_TO) { $this->sql_query = "update ".$this->user_groups_price_plans_table." set group_id = ".$show_expire_into->GROUP_EXPIRES_INTO." where group_id = ".$show->TYPE_ID; $update_group_result = $db->Execute($this->sql_query); if (!$update_group_result) { return false; } } } } elseif ($show->TYPE == 2) { //expire price plans $this->sql_query = "select * from ".$this->price_plans_table." where price_plan_id = ".$show->TYPE_ID; $price_plan_result = $db->Execute($this->sql_query); if (!$price_plan_result) { return false; } elseif ($price_plan_result->RecordCount() == 1) { if ($show->USER_ID) { //expires this specific users price plan $show_price_plan = $price_plan_result->FetchNextObject(); //check to see if ads expire with price plan if ($show_price_plan->AD_AND_SUBSCRIPTION_EXPIRATION == 1) { $this->sql_query = "update ".$this->classifieds_table." set live = 0 where seller = ".$show->USER_ID; $update_live_result = $db->Execute($this->sql_query); //$this->body .=$this->sql_query."
\n"; if (!$update_live_result) { return false; } } if ($show_price_plan->PRICE_PLAN_EXPIRES_INTO) { $this->sql_query = "update ".$this->user_groups_price_plans_table." set price_plan_id = ".$show_price_plan->PRICE_PLAN_EXPIRES_INTO." where id = ".$show->USER_ID; $update_price_plan_result = $db->Execute($this->sql_query); if (!$update_price_plan_result) { return false; } } } else { //expires this price plan for every user $show_price_plan = $price_plan_result->FetchNextObject(); if ($show_price_plan->AD_AND_SUBSCRIPTION_EXPIRATION == 1) { $this->sql_query = "select * ".$this->user_groups_price_plans_table." where price_plan_id = ".$show->TYPE_ID; $select_users_result = $db->Execute($this->sql_query); //$this->body .=$this->sql_query."
\n"; if (!$select_users_result) { return false; } elseif ($select_users_result->RecordCount() > 0) { while ($show_users = $select_users_result->FetchNextObject()) { $this->sql_query = "update ".$this->classifieds_table." set live = 0 where seller = ".$show_users->ID; $update_live_result = $db->Execute($this->sql_query); $this->body .=$this->sql_query."
\n"; if (!$update_live_result) { return false; } } } } if ($show_price_plan->PRICE_PLAN_EXPIRES_INTO) { $this->sql_query = "update ".$this->user_groups_price_plans_table." set price_plan_id = ".$show_price_plan->PRICE_PLAN_EXPIRES_INTO." where price_plan_id = ".$show->TYPE_ID; $update_price_plan_result = $db->Execute($this->sql_query); //$this->body .=$this->sql_query."
\n"; if (!$update_price_plan_result) { return false; } } } } } //delete the expiration $this->sql_query = "delete from ".$this->expirations_table." where expiration_id = ".$show->EXPIRATION_ID; $delete_result = $db->Execute($this->sql_query); //$this->body .=$this->sql_query."
\n"; if (!$delete_result) { return false; } } } return true; } //end of function expire_groups_and_plans //################################################################################# function get_state_name($db,$state_abbreviation=0) { if ($state_abbreviation) { $this->sql_query = "select name from ".$this->states_table." where abbreviation = \"".$state_abbreviation."\""; $name_result = $db->Execute($this->sql_query); if (!$name_result) { return false; } elseif ($name_result->RecordCount() == 1) { $show_name = $name_result->FetchNextObject(); return $show_name->NAME; } else { //just display the user_id return $state_abbreviation; } } else { return false; } } //end of function get_state_name //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_ad_count_for_category($db,$category_id=0) { if ($category_id) { //get the count for this category $count = 0; $this->sql_query = "select category_id from ".$this->categories_table." where parent_id = ".$category_id; $category_id_result = $db->Execute($this->sql_query); //$this->body .=$this->sql_query."
"; if (!$category_id_result) { //$this->body .=$this->sql_query." is the query
\n"; $this->error_message = $this->messages[2524]; return false; } elseif ($category_id_result->RecordCount() > 0) { while ($show_category = $category_id_result->FetchNextObject()) { $returned_count = $this->get_ad_count_for_category($db,$show_category->CATEGORY_ID); if ($returned_count) $count += $returned_count; //$this->body .=$count." is count returned for category ".$category_id."
\n"; } } $count += $this->get_ad_count_this_category($db,$category_id); return $count; } else { //category_id is missing return false; } } //end of function get_ad_count_for_category //################################################################################## function get_ad_count_this_category($db,$category_id=0) { if ($category_id) { //get the count for this category $count = 0; $this->sql_query = "select count(*) as total from ".$this->classifieds_table." where live = 1 and category = ".$category_id; $count_result = $db->Execute($this->sql_query); //$this->body .=$this->sql_query."
\n"; if (!$count_result) { //$this->body .=$this->sql_query." is the query
\n"; $this->error_message = $this->messages[2524]; return false; } elseif ($count_result->RecordCount() == 1) { $show = $count_result->FetchNextObject(); return $show->TOTAL; } else { return 0; } } else { //category_id is missing return false; } } //end of function get_ad_count_this_category //################################################################################## function update_category_count($db,$category_id=0) { if ($category_id) { $category_tree = $this->get_category_tree($db,$category_id); reset ($this->category_tree_array); if ($category_tree) { if (is_array($this->category_tree_array)) { $i = count($this->category_tree_array); while ($i > 0 ) { //display all the categories $i--; if ($this->category_tree_array[$i]["category_id"] != 0) { //$category_count = $this->get_ad_count_for_category($db,$this->category_tree_array[$i]["category_id"]); $this->sql_query = "select in_statement from ".$this->categories_table." where category_id = ".$this->category_tree_array[$i]["category_id"]; $in_category_result = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$in_category_result) { return false; } if ($in_category_result->RecordCount() == 1) { $show_in_statement = $in_category_result->FetchNextObject(); $this->sql_query = "select count(*) as total from ".$this->classifieds_table." where live = 1 and category ".$show_in_statement->IN_STATEMENT; $count_result = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$count_result) { //echo $this->sql_query." is the query
\n"; $this->error_message = $this->messages[2524]; return false; } elseif ($count_result->RecordCount() == 1) { $show = $count_result->FetchNextObject(); $this->sql_query = "update ".$this->categories_table." set category_count = ".$show->TOTAL." where category_id = ".$this->category_tree_array[$i]["category_id"]; $update_count_result = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$update_count_result) { return false; } } else { return false; } } else { return false; } } } } else { $category_tree_fields = $category_tree; } } } } //end of function update_category_count //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_category_count($db,$category_id=0) { //echo $category_id." is category id
"; if (($category_id) && (!$this->filter_id) && (!$this->state_filter) && (!$this->zip_filter_distance) && (!$this->zip_filter)) { $this->sql_query = "select category_count from ".$this->categories_table." where category_id = ".$category_id; $count_result = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$count_result) { return false; } elseif ($count_result->RecordCount() == 1) { $show = $count_result->FetchNextObject(); return $show->CATEGORY_COUNT; } else return false; } elseif ($category_id) { if ($this->filter_id) { $filter_in_statement = $this->get_sql_filter_in_statement($db); $sql_filter_in_statement = " and filter_id ".$filter_in_statement." "; } if ($this->state_filter) { //add state to end of sql_query $sql_state_filter_statement = " and location_state = \"".$this->state_filter."\" "; } if (($this->zip_filter_distance) && ($this->zip_filter)) { //add zip code in statement to end of sql_query if (strlen(trim($this->sql_zip_filter_in_statement)) == 0) { $zip_filter_in_statement = $this->get_sql_zip_filter_in_statement($db); $this->sql_zip_filter_in_statement = " and ".$zip_filter_in_statement." "; } } //get category in statement $this->sql_query = "select in_statement from ".$this->categories_table." where category_id = ".$category_id; $in_result = $db->Execute($this->sql_query); if (!$in_result) { return false; } elseif ($in_result->RecordCount() == 1) { $show_in_statement = $in_result->FetchNextObject(); $sql_category = " category ".$show_in_statement->IN_STATEMENT; } $this->sql_query = "select count(*) as category_count from ".$this->classifieds_table." where live = 1 and ".$sql_category.$sql_filter_in_statement.$sql_state_filter_statement.$sql_zip_filter_in_statement; $count_result = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$count_result) { return false; } elseif ($count_result->RecordCount() == 1) { $show_count = $count_result->FetchNextObject(); return $show_count->CATEGORY_COUNT; } else return false; } else return false; } //end of function get_category_count //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_sql_filter_in_statement($db) { if ($this->filter_id) { $this->sql_query = "SELECT in_statement FROM ".$this->filters_table." WHERE filter_id = ".$this->filter_id; //echo $this->sql_query."
\n"; $result = $db->Execute($this->sql_query); if (!$result) { return false; } elseif ($result->RecordCount() == 1) { $show_filter_in = $result->FetchNextObject(); return $show_filter_in->IN_STATEMENT; } } else { //category_id is missing return false; } } //end of get_sql_filter_in_statement //#################################################################################### function get_banner($db,$zone=0) { //category set already if ($zone) { $this->sql_query = "select * from ".$this->banners_table." where category_id = \"".$this->site_category."\" and zone = ".$zone; //$this->body .=$this->sql_query."
\n"; $banner_result = $db->Execute($this->sql_query); if (!$banner_result) { //$this->body .=$this->sql_query." is the query
\n"; return false; } elseif ($banner_result->RecordCount() == 0) { $this->get_category_tree($db,$this->site_category); $i = count($this->category_tree_array); while ($i >= 0 ) { //display all the categories $i--; $this->sql_query = "select * from ".$this->banners_table." where category_id = \"".$this->category_tree_array[$i]["category_id"]."\" and zone = ".$zone; //$this->body .=$this->sql_query." is the parent sql
\n"; $parent_banner_result = $db->Execute($this->sql_query); if (!$parent_banner_result) { //$this->body .=$this->sql_query." is the query
\n"; return false; } elseif ($parent_banner_result->RecordCount() == 1) { $show = $parent_banner_result->FetchNextObject(); if (strlen(trim($show->EXTERNAL_CODE_USE)) > 0) { return stripslashes($show->EXTERNAL_CODE_USE); } else { $tag = "BANNER_ID."> "; $this->update_banner_impression($db,$show->BANNER_ID); return $tag; } } elseif ($parent_banner_result->RecordCount() > 1) { srand(microtime()*1000000); $move_to = rand(1,$parent_banner_result->RecordCount()); $parent_banner_result->Move($move_to-1); $show = $parent_banner_result->FetchNextObject(); if (strlen(trim($show->EXTERNAL_CODE_USE)) > 0) { return stripslashes($show->EXTERNAL_CODE_USE); } else { $tag = "BANNER_ID."> "; $this->update_banner_impression($db,$show->BANNER_ID); return $tag; } } } } elseif ($banner_result->RecordCount() == 1) { $show = $banner_result->FetchNextObject(); if (strlen(trim($show->EXTERNAL_CODE_USE)) > 0) { return stripslashes($show->EXTERNAL_CODE_USE); } else { $tag = "BANNER_ID."> "; $this->update_banner_impression($db,$show->BANNER_ID); return $tag; } } elseif ($banner_result->RecordCount() > 1) { srand(microtime()*1000000); $move_to = rand(1,$banner_result->RecordCount()); $banner_result->Move($move_to-1); $show = $banner_result->FetchNextObject(); if (strlen(trim($show->EXTERNAL_CODE_USE)) > 0) { return stripslashes($show->EXTERNAL_CODE_USE); } else { $tag = "BANNER_ID."> "; $this->update_banner_impression($db,$show->BANNER_ID); return $tag; } } else { return false; } } } //end of function get_banner //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function update_banner_impression ($db,$banner_id=0) { if ($banner_id) { $this->sql_query = "select impressions from ".$this->banners_table." where banner_id = ".$banner_id; $banner_result = $db->Execute($this->sql_query); if (!$banner_result) { //$this->body .=$this->sql_query." is the query
\n"; return false; } elseif ($banner_result->RecordCount() == 1) { $show = $banner_result->FetchNextObject(); $impressions = $show->IMPRESSIONS + 1; $this->sql_query = "update ".$this->banners_table." set impressions = \"".$impressions."\" where banner_id = ".$banner_id; $update_result = $db->Execute($this->sql_query); if (!$update_result) { //$this->body .=$this->sql_query." is the query
\n"; return false; } } } } //end of function update_banner_impression //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function update_banner_click ($db,$banner_id=0) { if ($banner_id) { $this->sql_query = "select clicks,link_url from ".$this->banners_table." where banner_id = ".$banner_id; $banner_result = $db->Execute($this->sql_query); if (!$banner_result) { //$this->body .=$this->sql_query." is the query
\n"; return false; } elseif ($banner_result->RecordCount() == 1) { $show = $banner_result->FetchNextObject(); $clicks = $show->CLICKS + 1; $this->sql_query = "update ".$this->banners_table." set clicks = \"".$clicks."\" where banner_id = ".$banner_id; $update_result = $db->Execute($this->sql_query); if (!$update_result) { //$this->body .=$this->sql_query." is the query
\n"; return false; } return $show->LINK_URL; } } else return false; } //end of function update_banner_impression //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function send_communication($db,$to=0,$message_data=0) { $debug_comm = 0; if ($this->configuration_data->EMAIL_HEADER_BREAK) $separator = "\n"; else $separator = "\r\n"; if ($message_data) { if (($to) && ($to != "reply")) { if ((strlen(trim($message_data["message"])) > 0) && (strlen(trim($message_data["from"])) > 0) && (strlen(trim($message_data["subject"])) > 0) ) { $to_data = $this->get_user_data($db,$to); if ($to_data) { if (strlen(trim($message_data["subject"])) == 0) $message_data["subject"] == "no subject"; if (($to_data->COMMUNICATION_TYPE == 1) || ($to_data->COMMUNICATION_TYPE == 2)) { //send an email if (($this->classified_user_id) && (!$system)) { $from_data = $this->get_user_data($db,$this->classified_user_id); if ($from_data) { if ($from_data->COMMUNICATION_TYPE == 1) { $message_from = "Reply-to: ".$from_data->EMAIL.$separator."From: ".$from_data->EMAIL.$separator; $message_data["message"] .= "From: ".$from_data->USERNAME."\n".$from_data->EMAIL; } else { $message_from = "Reply-to: ".$this->configuration_data->SITE_EMAIL.$separator."From: ".$this->configuration_data->SITE_EMAIL.$separator; $message_data["message"] .= "From: ".$from_data->USERNAME."\n\n"; $message_data["message"] .= urldecode($this->messages[249])."\n\n"; $message_data["message"] .= "\n".$this->configuration_data->AUCTIONS_URL."?a=3&b=".$from_data->ID; if ($message_data["auction_id"]) $message_data["message"] .= "&c=".$message_data["auction_id"]; } } } else { if ($system) { $message_from = "From: ".$this->configuration_data->SITE_EMAIL.$separator."Reply-to: ".$this->configuration_data->SITE_EMAIL.$separator; } else { $email_address = str_replace("Reply-to: ","",$message_data["from"]); $email_address = str_replace("From: ","",$email_address); $message_from = "Reply-to: ".$message_data["from"].$separator.$message_data["from"].$separator; $message_data["message"] .= "\n\n".$message_data["from"]."\n\n"; } } //if ($to_data->COMMUNICATION_TYPE == 2) // $message_data["message"] .= "\n\n".urldecode($this->messages[248])."\n\n"; //send this email if (strlen(trim($message_data["classified_id"])) > 0) $regarding_ad = $message_data["classified_id"]; else $regarding_ad = 0; $additional = "-f".$this->configuration_data->SITE_EMAIL; $ip = $_SERVER['REMOTE_ADDR']; $host = @gethostbyaddr($ip); //$host = preg_replace("/^[^.]+./", "*.", $host); $message_data["message"] .= "\n".$_SERVER["REMOTE_ADDR"]." : ".$host; if ($this->configuration_data->EMAIL_CONFIGURATION_TYPE == 1) $message_data["message"] = str_replace("\n\n","\n",$message_data["message"]); if ($this->configuration_data->EMAIL_CONFIGURATION == 1) mail($to_data->EMAIL, $message_data["subject"], $message_data["message"], $message_from,$additional); elseif ($this->configuration_data->EMAIL_CONFIGURATION == 2) mail($to_data->EMAIL, $message_data["subject"], $message_data["message"], $message_from); else mail($to_data->EMAIL, $message_data["subject"], $message_data["message"]); if ($this->classified_user_id) { $this->sql_query = "insert into ".$this->user_communications_table." (message_to,message_from,regarding_ad,date_sent,message) values (".$to.",".$this->classified_user_id.",".$regarding_ad.",".time().",\"".urlencode($message_data["message"])."\")"; } else { $email_address = str_replace("Reply-to: ","",$message_data["from"]); $email_address = str_replace("From: ","",$email_address); $this->sql_query = "insert into ".$this->user_communications_table." (message_to,message_from_non_user,regarding_ad,date_sent,message) values (".$to.",\"".$email_address."\",".$regarding_ad.",".time().",\"".urlencode($message_data["message"])."\")"; } if ($debug_comm) echo $this->sql_query." has an error
\n"; $result = $db->Execute($this->sql_query); if (!$result) { if ($debug_comm) echo $this->sql_query." has an error
\n"; $this->error_message = $this->internal_error_message; return false; } } else { //send a private message if (strlen(trim($message_data["classified_id"])) > 0) $regarding_ad = $message_data["classified_id"]; else $regarding_ad = 0; $ip = $_SERVER['REMOTE_ADDR']; $host = @gethostbyaddr($ip); //$host = preg_replace("/^[^.]+./", "*.", $host); $message_data["message"] .= "\n".$_SERVER["REMOTE_ADDR"]." : ".$host; if ($this->classified_user_id) { $this->sql_query = "insert into ".$this->user_communications_table." (message_to,message_from,regarding_ad,date_sent,message) values (".$to.",".$this->classified_user_id.",".$regarding_ad.",".time().",\"".urlencode($message_data["message"])."\")"; } else { $email_address = str_replace("Reply-to: ","",$message_data["from"]); $email_address = str_replace("From: ","",$email_address); $this->sql_query = "insert into ".$this->user_communications_table." (message_to,message_from_non_user,regarding_ad,date_sent,message) values (".$to.",\"".$message_data["from"]."\",".$regarding_ad.",".time().",\"".urlencode($message_data["message"])."\")"; } if ($debug_comm) echo $this->sql_query."
\n"; $result = $db->Execute($this->sql_query); if (!$result) { if ($debug_comm) echo $this->sql_query."
\n"; return false; } } return true; } else { return false; } } else return false; } elseif (($message_data["replied_to_this_messages"]) && ($to == "reply")) { //send a reply using this data $this->sql_query = "select * from ".$this->user_communications_table." where message_id = ".$message_data["replied_to_this_messages"]; $result = $db->Execute($this->sql_query); if ($debug_comm) echo $this->sql_query."
\n"; if (!$result) { if ($debug_comm) echo $this->sql_query." - has an error
\n"; return false; } elseif ($result->RecordCount() == 1) { $show_message = $result->FetchNextObject(); if ($show_message->MESSAGE_FROM) { //this is a local user send them the reply $to_data = $this->get_user_data($db,$show_message->MESSAGE_FROM); $from_data = $this->get_user_data($db,$this->classified_user_id); $subject = $this->get_ad_title($db,$message_data["regarding_ad"]); if ($from_data->COMMUNICATION_TYPE == 1) { $message_from = "From: ".$from_data->EMAIL.$separator."Reply-to: ".$from_data->EMAIL.$separator; } else { $message_from = "From: ".$from_data->EMAIL.$separator."Reply-to: ".$from_data->EMAIL.$separator; $message_data["message"] .= "\n\n".urldecode($this->messages[249])."\n\n"; $message_data["message"] .= "\n".$this->configuration_data->CLASSIFIEDS_URL."?a=3&b=".$from_data->ID."&c=".$message_data["classified_id"]; } if (($to_data->COMMUNICATION_TYPE == 1) || ($to_data->COMMUNICATION_TYPE == 2)) { $additional = "-f".$this->configuration_data->SITE_EMAIL; $ip = $_SERVER['REMOTE_ADDR']; $host = @gethostbyaddr($ip); //$host = preg_replace("/^[^.]+./", "*.", $host); $message_data["message"] .= "\n".$_SERVER["REMOTE_ADDR"]." : ".$host; if ($this->configuration_data->EMAIL_CONFIGURATION_TYPE == 1) $message_data["message"] = str_replace("\n\n","\n",$message_data["message"]); if ($this->configuration_data->EMAIL_CONFIGURATION == 1) mail($to_data->EMAIL, $subject, $message_data["message"], $message_from,$additional); elseif ($this->configuration_data->EMAIL_CONFIGURATION == 2) mail($to_data->EMAIL, $subject, $message_data["message"], $message_from); else mail($to_data->EMAIL, $subject, $message_data["message"]); $this->sql_query = "insert into ".$this->user_communications_table." (message_to,message_from,regarding_ad,date_sent,message,replied_to_this_message) values (".$show_message->MESSAGE_FROM.",".$this->classified_user_id.",".$message_data["regarding_ad"].",".time().",\"".urlencode($message_data["message"])."\",".$message_data["regarding_ad"].")"; } else { $ip = $_SERVER['REMOTE_ADDR']; $host = @gethostbyaddr($ip); //$host = preg_replace("/^[^.]+./", "*.", $host); $message_data["message"] .= "\n".$_SERVER["REMOTE_ADDR"]." : ".$host; $this->sql_query = "insert into ".$this->user_communications_table." (message_to,message_from,regarding_ad,date_sent,message,replied_to_this_message) values (".$show_message->MESSAGE_FROM.",".$this->classified_user_id.",".$message_data["regarding_ad"].",".time().",\"".urlencode($message_data["message"])."\",".$message_data["regarding_ad"].")"; } $result = $db->Execute($this->sql_query); if ($debug_comm) echo $this->sql_query."
\n"; if (!$result) { if ($debug_comm) echo $this->sql_query." - has an error
\n"; return false; } } else { //this is a non registered user //check the validity of the email address $email_address = str_replace("Reply-to: ","",$show_message->MESSAGE_FROM_NON_USER); $email_address = str_replace("From: ","",$email_address); if (eregi("^([a-z0-9]+)(([a-z0-9._-]+))*[@]([a-z0-9]+)([._-]([a-z0-9]+))*[.]([a-z0-9]){2}([a-z0-9])?$", $email_address)) { //this is a valid email address //send the reply $from_data = $this->get_user_data($db,$this->classified_user_id); $subject = $this->get_ad_title($db,$message_data["regarding_ad"]); $message_data["classified_id"] = $message_data["regarding_ad"]; if ($from_data->COMMUNICATION_TYPE == 1) { $message_from = "From: ".$from_data->EMAIL.$separator."Reply-to: ".$from_data->EMAIL.$separator; } else { $message_from = "From: ".$this->configuration_data->SITE_EMAIL."Reply-to: ".$this->configuration_data->SITE_EMAIL.$separator; $message_data["message"] .= urldecode($this->messages[249])."\n\n"; $message_data["message"] .= "\n".$this->configuration_data->CLASSIFIEDS_URL."?a=3&b=".$from_data->ID."&c=".$message_data["classified_id"]; } $additional = "-f".$this->configuration_data->SITE_EMAIL; $ip = $_SERVER['REMOTE_ADDR']; $host = @gethostbyaddr($ip); //$host = preg_replace("/^[^.]+./", "*.", $host); $message_data["message"] .= "\n".$_SERVER["REMOTE_ADDR"]." : ".$host; if ($this->configuration_data->EMAIL_CONFIGURATION_TYPE == 1) $message_data["message"] = str_replace("\n\n","\n",$message_data["message"]); if ($this->configuration_data->EMAIL_CONFIGURATION == 1) mail($email_address, $subject, $message_data["message"], $message_from,$additional); elseif ($this->configuration_data->EMAIL_CONFIGURATION == 2) mail($email_address, $subject, $message_data["message"], $message_from); else mail($email_address, $subject, $message_data["message"]); } else { //this is an invalid email address if ($debug_comm) echo "invalid email address - ".$email_address." -
\n"; return false; } } if ($debug_comm) echo "sent successfully
\n"; return true; } else { if ($debug_comm) echo "error 1
\n"; return false; } } else { if ($debug_comm) echo "error 2
\n"; return false; } } else { //no communication info if ($debug_comm) echo "no message data passed in
\n"; return false; } } //end of function send_communication //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function display_thumbnail($db,$classified_id,$max_width=0,$max_height=0,$display_table_data=0,$affiliate=0) { if (!$display_table_data) { $this->body .="configuration_data->THUMBNAIL_MAX_WIDTH) $this->body .="width=".$this->configuration_data->THUMBNAIL_MAX_WIDTH; $this->body .=" class=thumbnail_td>"; } if (($this->configuration_data->POPUP_WHILE_BROWSING) && ($this->configuration_data->POPUP_WHILE_BROWSING_WIDTH) && ($this->configuration_data->POPUP_WHILE_BROWSING_HEIGHT)) { $this->body .= "body .= $this->configuration_data->AFFILIATE_URL."?aff=".$affiliate."&"; else $this->body .= $this->configuration_data->CLASSIFIEDS_FILE_NAME."?"; $this->body .= "a=2&b=".$classified_id."\" "; $this->body .= "onclick=\"window.open(this.href,'_blank','width=".$this->configuration_data->POPUP_WHILE_BROWSING_WIDTH.",height=".$this->configuration_data->POPUP_WHILE_BROWSING_HEIGHT.",scrollbars=1,location=0,menubar=0,resizable=1,status=0'); return false;\" class=".$css_class_tag.">"; } else { $this->body .="body .= $this->configuration_data->CLASSIFIEDS_FILE_NAME."?"; $this->body .= "a=2&b=".$classified_id.">"; } $this->sql_query = "select * from ".$this->images_urls_table." where classified_id = ".$classified_id." and display_order = 1"; $image_url_result = $db->Execute($this->sql_query); //echo $this->sql_query." is the query
\n"; if (!$image_url_result) { return false; } elseif ($image_url_result->RecordCount() == 1) { $show_image_url = $image_url_result->FetchNextObject(); if (($this->configuration_data->PHOTO_OR_ICON == 1) || (($max_width) && ($max_height))) { if ($max_width != 0) $current_max_width = $max_width; else $current_max_width = $this->configuration_data->THUMBNAIL_MAX_WIDTH; if ($max_height != 0) $current_max_height = $max_height; else $current_max_height = $this->configuration_data->THUMBNAIL_MAX_HEIGHT; if (($show_image_url->IMAGE_WIDTH > $current_max_width) && ($show_image_url->IMAGE_HEIGHT > $current_max_height)) { $imageprop = ($current_max_width * 100) / $show_image_url->IMAGE_WIDTH; $imagevsize = ($show_image_url->IMAGE_HEIGHT * $imageprop) / 100 ; $final_image_width = $current_max_width; $final_image_height = ceil($imagevsize); if ($final_image_height > $current_max_height) { $imageprop = ($current_max_height * 100) / $show_image_url->IMAGE_HEIGHT; $imagehsize = ($show_image_url->IMAGE_WIDTH * $imageprop) / 100 ; $final_image_height = $current_max_height; $final_image_width = ceil($imagehsize); } } elseif ($show_image_url->IMAGE_WIDTH > $current_max_width) { $imageprop = ($current_max_width * 100) / $show_image_url->IMAGE_WIDTH; $imagevsize = ($show_image_url->IMAGE_HEIGHT * $imageprop) / 100 ; $final_image_width = $current_max_width; $final_image_height = ceil($imagevsize); } elseif ($show_image_url->IMAGE_HEIGHT > $current_max_height) { $imageprop = ($current_max_height * 100) / $show_image_url->IMAGE_HEIGHT; $imagehsize = ($show_image_url->IMAGE_WIDTH * $imageprop) / 100 ; $final_image_height = $current_max_height; $final_image_width = ceil($imagehsize); } else { $final_image_width = $show_image_url->IMAGE_WIDTH; $final_image_height = $show_image_url->IMAGE_HEIGHT; } //echo $show_image_url->THUMB_URL." is thumb url
\n"; if (($show_image_url->THUMB_URL) && ($show_image_url->THUMB_URL != "0")) { $this->body .="THUMB_URL."\" width=\"".$final_image_width."\" height=\"".$final_image_height."\" border=0>"; } elseif ($show_image_url->IMAGE_URL) { $this->body .="IMAGE_URL."\" width=\"".$final_image_width."\" height=\"".$final_image_height."\" border=0>"; } else { //display the photo icon $this->body .=""; } } else { //echo $this->configuration_data->PHOTO_ICON_URL." is the photo icon 1
"; $this->body .=""; } } else { $this->sql_query = "select image_id,thumb,image_width,image_height from ".$this->images_table." where classified_id = ".$classified_id." and display_order = 1"; $image_db_result = $db->Execute($this->sql_query); //echo $this->sql_query." is the query
\n"; if (!$image_db_result) { return false; } elseif ($image_db_result->RecordCount() == 1) { $show_image_url = $image_db_result->FetchNextObject(); if ($this->configuration_data->PHOTO_OR_ICON == 1) { if ($max_width != 0) $current_max_width = $max_width; else $current_max_width = $this->configuration_data->THUMBNAIL_MAX_WIDTH; if ($max_height != 0) $current_max_height = $max_height; else $current_max_height = $this->configuration_data->THUMBNAIL_MAX_HEIGHT; if (($show_image_url->IMAGE_WIDTH > $current_max_width) && ($show_image_url->IMAGE_HEIGHT > $current_max_height)) { $imageprop = ($current_max_width * 100) / $show_image_url->IMAGE_WIDTH; $imagevsize = ($show_image_url->IMAGE_HEIGHT * $imageprop) / 100 ; $final_image_width = $current_max_width; $final_image_height = ceil($imagevsize); if ($final_image_height > $current_max_height) { $imageprop = ($current_max_height * 100) / $show_image_url->IMAGE_HEIGHT; $imagehsize = ($show_image_url->IMAGE_WIDTH * $imageprop) / 100 ; $final_image_height = $current_max_height; $final_image_width = ceil($imagehsize); } } elseif ($show_image_url->IMAGE_WIDTH > $current_max_width) { $imageprop = ($current_max_width * 100) / $show_image_url->IMAGE_WIDTH; $imagevsize = ($show_image_url->IMAGE_HEIGHT * $imageprop) / 100 ; $final_image_width = $current_max_width; $final_image_height = ceil($imagevsize); } elseif ($show_image_url->IMAGE_HEIGHT > $current_max_height) { $imageprop = ($current_max_height * 100) / $show_image_url->IMAGE_HEIGHT; $imagehsize = ($show_image_url->IMAGE_WIDTH * $imageprop) / 100 ; $final_image_height = $current_max_height; $final_image_width = ceil($imagehsize); } else { $final_image_width = $show_image_url->IMAGE_WIDTH; $final_image_height = $show_image_url->IMAGE_HEIGHT; } //$this->body .=$final_image_width." is the width
\n"; //$this->body .=$final_image_height." is the height
\n"; //$this->body .=$this->configuration_data->THUMBNAIL_MAX_WIDTH." is max width
\n"; //$this->body .=$this->configuration_data->THUMBNAIL_MAX_HEIGHT." is max height
\n"; if ($show_image_url->THUMB) { $this->body .= "IMAGE_ID."&size=1 width=".$final_image_width." height=".$final_image_height." border=0>"; } else { //$this->body .=$final_image_width." is the width
\n"; //$this->body .=$final_image_height." is the height
\n"; $this->body .= "IMAGE_ID." width=".$final_image_width." height=".$final_image_height." border=0>"; } } else { $this->body .=""; } } else { $this->body .="".$this->get_ad_title($db,$classified_id)." "; } } $this->body .="
"; if (!$display_table_data) $this->body .= ""; return true; } //end of function display_thumbnail //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function sell_success_email($db,$classified_id=0) { if (($classified_id) && ($this->configuration_data->SEND_SUCCESSFUL_PLACEMENT_EMAIL)) { $this->page_id = 51; $this->get_text($db); $ad_data = $this->get_classified_data($db,$classified_id); $user_data = $this->get_user_data($db,$ad_data->SELLER); if (($ad_data) && ($user_data)) { $subject = urldecode($this->messages[712]); $message = urldecode($this->messages[713])." ".$user_data->FIRSTNAME.",\n"; $message .= urldecode($this->messages[714])."\n\n"; if (!$this->configuration_data->ADMIN_APPROVES_ALL_ADS) $message .= $this->configuration_data->CLASSIFIEDS_URL."?a=2&b=".$classified_id; if ($this->configuration_data->EMAIL_HEADER_BREAK) $separator = "\n"; else $separator = "\r\n"; $from = "From: ".$this->configuration_data->SITE_EMAIL.$separator."Reply-to: ".$this->configuration_data->SITE_EMAIL.$separator; $additional = "-f".$this->configuration_data->SITE_EMAIL; if ($this->configuration_data->EMAIL_CONFIGURATION_TYPE == 1) $message = str_replace("\n\n","\n",$message); if ($this->configuration_data->EMAIL_CONFIGURATION == 1) mail($user_data->EMAIL, $subject, $message, $from,$additional); elseif ($this->configuration_data->EMAIL_CONFIGURATION == 2) mail($user_data->EMAIL, $subject, $message, $from); else mail($user_data->EMAIL, $subject, $message); //mail($user_data->EMAIL,$subject,$message,$from); return true; } else { return false; } } else { return false; } } //end of function sell_success_email //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_payment_types_accepted($db) { //expire user credits $this->sql_query = "select * from ".$this->payment_types_table." where accepted = 1"; $payment_type_results = $db->Execute($this->sql_query); if (!$payment_type_results) { return false; } elseif ($payment_type_results->RecordCount() > 0) { return $payment_type_results; } else { return false; } } //end of function get_payment_types_accepted //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_tax($db,$user_data=0) { if (($this->subtotal) && ($this->configuration_data->CHARGE_TAX_BY) && ($user_data)) { if ($this->configuration_data->CHARGE_TAX_BY == 1) { //charge by state/province if ($user_data->STATE != "none") { $this->sql_query = "select * from ".$this->states_table." where abbreviation = ".$user_data->STATE; $get_tax_results = $db->Execute($this->sql_query); if (!$get_tax_results) { return false; } elseif ($get_tax_results->RecordCount() == 0) { $tax = $this->subtotal * $this->configuration_data->DEFAULT_TAX_RATE; return $tax; } elseif ($get_tax_results->RecordCount() == 1) { $show_tax = $get_tax_results->FetchNextObject(); $tax = $show_tax->TAX_RATE * $this->subtotal; return $tax; } } else { $tax = $this->subtotal * $this->configuration_data->DEFAULT_TAX_RATE; return $tax; } } elseif ($this->configuration_data->CHARGE_TAX_BY == 2) { //charge by country if ($user_data->COUNTRY != "none") { $this->sql_query = "select * from ".$this->countries_table." where abbreviation = ".$user_data->COUNTRY; $get_tax_results = $db->Execute($this->sql_query); if (!$get_tax_results) { return false; } elseif ($get_tax_results->RecordCount() == 0) { $tax = $this->subtotal * $this->configuration_data->DEFAULT_TAX_RATE; return $tax; } elseif ($get_tax_results->RecordCount() == 1) { $show_tax = $get_tax_results->FetchNextObject(); $tax = $show_tax->TAX_RATE * $this->subtotal; return $tax; } } else { $tax = $this->subtotal * $this->configuration_data->DEFAULT_TAX_RATE; return $tax; } } else return 0; } else { return 0; } } //end of function get_tax //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function expire_subscriptions($db) { //echo $this->configuration_data->SUBSCRIPTION_EXPIRE_PERIOD_NOTICE." sub exp notice
\n"; if ( $this->configuration_data->SUBSCRIPTION_EXPIRE_PERIOD_NOTICE) { $old_page_id = $this->page_id; $this->page_id = 87; $this->get_text($db); $this->page_id = $old_page_id; $notice_time = (time() + (86400 * $this->configuration_data->SUBSCRIPTION_EXPIRE_PERIOD_NOTICE)); $this->sql_query = "select * from ".$this->user_subscriptions_table." where subscription_expire < ".$notice_time." and notice_sent = 0"; //echo $this->sql_query."
"; $subscription_notice_results = $db->Execute($this->sql_query); if (!$subscription_notice_results) { return false; } elseif ($subscription_notice_results->RecordCount()) { while ($show = $subscription_notice_results->FetchNextObject()) { $user_data = $this->get_user_data($db,$show->USER_ID); $message_data["subject"] = urldecode($this->messages[1435]); $message_data["message"] = $user_data->USERNAME."\n\n"; $message_data["message"] .= urldecode($this->messages[1436])."\n\n"; $message_data["message"] .= date("M d, Y H:i", $show->SUBSCRIPTION_EXPIRE)."\n\n"; $message_data["message"] .= $this->configuration_data->CLASSIFIEDS_URL."\n\n"; if ($this->configuration_data->EMAIL_HEADER_BREAK) $separator = "\n"; else $separator = "\r\n"; $message_data["from"] = "From: ".$this->configuration_data->SITE_EMAIL.$separator."Reply-to: ".$this->configuration_data->SITE_EMAIL.$separator; if ($this->configuration_data->EMAIL_CONFIGURATION_TYPE == 1) $message_data["message"] = str_replace("\n\n","\n",$message_data["message"]); $additional = "-f".$this->configuration_data->SITE_EMAIL; if ($this->configuration_data->EMAIL_CONFIGURATION == 1) mail($user_data->EMAIL, $message_data["subject"], $message_data["message"], $message_data["from"],$additional); elseif ($this->configuration_data->EMAIL_CONFIGURATION == 2) mail($user_data->EMAIL, $message_data["subject"], $message_data["message"], $message_data["from"]); else mail($user_data->EMAIL, $message_data["subject"], $message_data["message"]); //@mail($user_data->EMAIL,urldecode($this->messages[558]),$message,$message_from); $this->sql_query = "update ".$this->user_subscriptions_table." set notice_sent = 1 where subscription_id = ".$show->SUBSCRIPTION_ID; //echo $this->sql_query."
"; $update_result = $db->Execute($this->sql_query); if (!$update_result) { return false; } } } } $this->sql_query = "select * from ".$this->user_subscriptions_table." where subscription_expire < ".time(); $expire_subscriptions_results = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$expire_subscriptions_results) { return false; } else { //check to see if ads are expired also while ($show_user = $expire_subscriptions_results->FetchNextObject()) { $this->sql_query = "select price_plan_id from ".$this->user_groups_price_plans_table." where id = ".$show_user->USER_ID; $user_price_plan_results = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$user_price_plan_results) { return false; } elseif ($user_price_plan_results->RecordCount() == 1) { $show_price_plan = $user_price_plan_results->FetchNextObject(); $this->sql_query = "select ad_and_subscription_expiration from ".$this->price_plans_table." where price_plan_id = ".$show_price_plan->PRICE_PLAN_ID; //echo $this->sql_query."
\n"; $user_expire_ads_result = $db->Execute($this->sql_query); if (!$user_expire_ads_result) { return false; } elseif ($user_expire_ads_result->RecordCount() == 1) { $show_expired_ads_also = $user_expire_ads_result->FetchNextObject(); if ($show_expired_ads_also->AD_AND_SUBSCRIPTION_EXPIRATION) { //expire the ads also $this->sql_query = "update ".$this->classifieds_table." set live = 0, ends = ".time()." where seller = ".$show_user->USER_ID; $expire_ads_also_result = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$expire_ads_also_result) { return false; } } } else return false; } else return false; } } $this->sql_query = "delete from ".$this->user_subscriptions_table." where subscription_expire < ".time(); $expire_subscriptions_results = $db->Execute($this->sql_query); //echo $this->sql_query."
\n"; if (!$expire_subscriptions_results) { return false; } else { return true; } }// end of function expire_subscriptions //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function LoadRTE($sFieldName, $sHTMLContent, $iWidth, $iHeight, $bButtons, $secure = 0) { $this->body .= "\n\t"; include_once 'AplosRTE/rte.php'; // Generate URL for AplosRTE if($secure) { if($this->configuration_data->CLASSIFIEDS_SSL_URL && $this->configuration_data->USE_SSL_IN_SELL_PROCESS) { $parsed_url = parse_url($this->configuration_data->CLASSIFIEDS_SSL_URL); $url = $parsed_url['scheme']."://".$parsed_url['host'].$parsed_url['path']; $url = str_replace(basename($url), "", $url); $url .= 'classes/AplosRTE/'; } else { $url = 'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/'.'classes/AplosRTE/'; } } else { $url = 'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/'.'classes/AplosRTE/'; } $editor = new rteEditor( $rtePath = $url, //full URL to AplosRTE dir - use trailing slash $this->body, $imageGallery = true, $rteTheme = '' ); // default,blue,green,silver $this->body .= $editor->initRTE( $fieldname = $sFieldName, //fieldname $content = $sHTMLContent, //default content $rteWidth = $iWidth, $rteheight = $iHeight, $showEditor = true, //show toolbar $readonly = false, //textarea readonly '' ); // CSS style for textarea if not Gecko or IE $this->body .= "\n"; return true; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_sql_zip_filter_in_statement($db) { if (($this->zip_filter) && ($this->zip_filter_distance)) { if ($this->configuration_data->USE_ZIP_DISTANCE_CALCULATOR == 2) { if ($this->debug) { echo "using the uk zip codes
\n"; echo $db_host." is db_host
\n"; echo $db_username." is db_username
\n"; echo $db_password." is db_password
\n"; echo $database." is database
\n"; echo $this->zip_filter." is zip filter
"; echo $this->zip_filter_distance." is zip filter distance
"; } $postcode_list = array(); $postcode = trim($options['postcode_from']); $this->sql_query = "SELECT postcode, x, y FROM cgi_postcodes WHERE postcode = ' " . trim($this->zip_filter) . "'"; if ($this->debug) echo $this->sql_query."
\n"; $postcode_data_result = $db->Execute($this->sql_query); $result = mysql_query($sql); if($postcode_data_result->RecordCount() <> 1) { return false; } while ($row = $postcode_data_result->FetchNextObject()) { $user_x = $row->X; $user_y = $row->Y; } //$_radius = $this->zip_filter_distance + 5; $_radius = $this->zip_filter_distance; $_radius = $_radius / 0.621; $_radius = sprintf("%.0f", $_radius * 1000); $_radius = $_radius / 2; $_lowerx = $user_x - $_radius; $_lowery = $user_y - $_radius; $_upperx = $user_x + $_radius; $_uppery = $user_y + $_radius; $this->sql_query = "SELECT x, y, postcode FROM cgi_postcodes WHERE (x >= $_lowerx and y >= $_lowery) AND (x <= $_upperx and y <= $_uppery)"; if ($this->debug) echo $this->sql_query."
\n"; $postcode_result = $db->Execute($this->sql_query); if((!$postcode_result) || ($postcode_result->RecordCount() == 0)) { if ($this->debug) echo $this->sql_query."
\n"; return false; } $zip_in_statement .= "location_zip in ("; $zip_count = 0; while ($row = $postcode_result->FetchNextObject()) { $distance = sqrt((($row->X -$user_x) * ($row->X -$user_x)) + (($row->Y - $user_y) * ($row->Y - $user_y))); $km = sprintf("%.2f", $distance / 1000); $miles = sprintf("%.2f", $km * 0.621); $this->uk_postcodes[urlencode($row->POSTCODE)] = $miles; if ($this->debug) echo $row->POSTCODE." has a distance of: ".$miles."
"; if ($zip_count == 0) { $zip_in_statement .= "'".urlencode($row->POSTCODE)."'"; } else { $zip_in_statement .= ",'".urlencode($row->POSTCODE)."'"; } $zip_count++; } $zip_in_statement .= ")"; if ($this->debug) echo $zip_in_statement." is zip in statement within site_class
\n"; return $zip_in_statement; } elseif ($this->configuration_data->USE_ZIP_DISTANCE_CALCULATOR == 1) { //get the longitude and latitude of the zip code entered $this->sql_query = "select * from ".$this->postal_code_table." where zipcode = ".$this->zip_filter." limit 1"; //echo $this->sql_query."
\n"; $zip_result = $db->Execute($this->sql_query); if (!$zip_result) { return false; } elseif ($zip_result->RecordCount() == 1) { //zip code data found...continue $show_zip_data = $zip_result->FetchNextObject(); //get the minimum and maximum longitude and latitude $this->RadiusAssistant($show_zip_data->LATITUDE, $show_zip_data->LONGITUDE, $this->zip_filter_distance); $this->search_zip_latitude = $show_zip_data->LATITUDE; $this->search_zip_longitude = $show_zip_data->LONGITUDE; //get the zip codes within distance using min and max longitude and latitude $this->sql_query = "select distinct(zipcode) from ".$this->postal_code_table." where ((latitude >= ".$this->min_latitude." and latitude <= ".$this->max_latitude.") and (longitude >= ".$this->min_longitude." and longitude <= ".$this->max_longitude."))"; //echo $this->sql_query."
\n"; $range_zip_result = $db->Execute($this->sql_query); if (!$range_zip_result) { return false; } elseif ($range_zip_result->RecordCount() > 0) { $zip_in_statement .= "location_zip in ("; $zip_count = 0; while ($show_zip_in = $range_zip_result->FetchNextObject()) { if ($zip_count == 0) $zip_in_statement .= $show_zip_in->ZIPCODE; else $zip_in_statement .= ",".$show_zip_in->ZIPCODE; $zip_count++; } $zip_in_statement .= ")"; } else { //no results $zip_in_statement .= "location_zip in ()"; } return $zip_in_statement; } else { //category_id is missing return false; } } } else { //category_id is missing return false; } } //end of get_sql_zip_filter_in_statement //#################################################################################### function RadiusAssistant($Latitude, $Longitude, $Miles) { $EQUATOR_LAT_MILE = 69.172; $this->max_latitude = $Latitude + $Miles / $EQUATOR_LAT_MILE; $this->min_latitude = $Latitude - ($this->max_latitude - $Latitude); $this->max_longitude = $Longitude + $Miles / (cos($this->min_latitude * M_PI / 180) * $EQUATOR_LAT_MILE); $this->min_longitude = $Longitude - ($this->max_longitude - $Longitude); } //end of function RadiusAssistant //################################################################################## function calculate_distance_from_zip($dblLat2,$dblLong2) { $EARTH_RADIUS_MILES = 3963; $dist = 0; //convert degrees to radians $current_latitude = $this->search_zip_latitude * M_PI / 180; $current_longitude = $this->search_zip_longitude * M_PI / 180; $dblLat2 = $dblLat2 * M_PI / 180; $dblLong2 = $dblLong2 * M_PI / 180; if ($current_latitude != $dblLat2 || $current_longitude != $dblLong2) { //the two points are not the same $dist = sin($current_latitude) * sin($dblLat2) + cos($current_latitude) * cos($dblLat2) * cos($dblLong2 - $current_longitude); $dist = $EARTH_RADIUS_MILES * (-1 * atan($dist / sqrt(1 - $dist * $dist)) + M_PI / 2); } return $dist; } //end of function Calculate_distance_from_zip //################################################################################## function check_category_new_ad_icon_use($db,$category_id=0,$category_cache_instead=0) { //echo $this->configuration_data->CATEGORY_NEW_AD_IMAGE." is CATEGORY_NEW_AD_IMAGE
\n"; //echo $this->configuration_data->CATEGORY_NEW_AD_LIMIT." is CATEGORY_NEW_AD_LIMIT
\n"; if ((strlen(trim($this->configuration_data->CATEGORY_NEW_AD_IMAGE)) > 0) && ($this->configuration_data->CATEGORY_NEW_AD_LIMIT) && ($category_id)) { $date_limit = (time() - ($this->configuration_data->CATEGORY_NEW_AD_LIMIT * 3600)); $in_statement = $this->get_sql_in_statement($db,$category_id); $this->sql_query = "select count(id) as count from ".$this->classifieds_table." where category ".$in_statement." and live = 1 and date > ".$date_limit; //echo $this->sql_query."
\n"; $new_ad_result = $db->Execute($this->sql_query); if (!$new_ad_result) { return false; } elseif ($new_ad_result->RecordCount() == 1) { $show_count = $new_ad_result->FetchNextObject(); if ($show_count->COUNT > 0) { if ($category_cache_instead) $this->category_cache .= "configuration_data->CATEGORY_NEW_AD_IMAGE."\" border=0>"; else $this->body .= "configuration_data->CATEGORY_NEW_AD_IMAGE."\" border=0>"; } } } } //end of function check_category_new_ad_icon_use //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function check_user_subscription($db) { $this->function_name = "check_user_subscription"; $this->sql_query = "select * from ".$this->user_subscriptions_table." where subscription_expire > ".time()." and user_id = ".$this->auction_user_id; $get_subscriptions_results = $db->Execute($this->sql_query); if($this->configuration_data->DEBUG_SELL) { $this->debug_display($db, $this->filename, $this->function_name, "user_subscriptions_table", "get data from user subscriptions table by subscription expire and user id"); } if (!$get_subscriptions_results) { return false; } elseif ($get_subscriptions_results->RecordCount() == 0) { return false; } elseif ($get_subscriptions_results->RecordCount() > 0) { return true; } } // end of function check_user_subscription //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function update_balance_approval($db,$transaction_id=0,$cc_transaction_id=0) { if ($transaction_id) { $this->sql_query = "update ".$this->balance_transactions." set approved = 1, cc_transaction_id = ".$cc_transaction_id." where transaction_id = ".$transaction_id; $update_balance_transaction_result = $db->Execute($this->sql_query); if (!$update_balance_transaction_result) return false; else return true; } else return false; } //end of function update_balance_approval //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function get_price_plan_from_group($db,$group_id=0) { if ($group_id) { $this->sql_query = "select * from ".$this->groups_table." where group_id = ".$group_id; $group_price_plan_result = $db->Execute($this->sql_query); //echo $this->sql_query." is the query
\n"; //$this->body .=$this->sql_query." is get_price_plan query
\n"; if (!$group_price_plan_result) { $this->error_message = $this->internal_error_message; $this->site_error($this->sql_query,$db->ErrorMsg()); return false; } elseif ($group_price_plan_result->RecordCount() == 1) { $show_group_price_plan = $group_price_plan_result->FetchNextObject(); $this->sql_query = "select * from ".$this->price_plans_table." where price_plan_id = ".$show_group_price_plan->PRICE_PLAN_ID; $price_plan_result = $db->Execute($this->sql_query); //echo $this->sql_query." is the query
\n"; //$this->body .=$this->sql_query." is get_price_plan query
\n"; if (!$price_plan_result) { $this->error_message = $this->internal_error_message; $this->site_error($this->sql_query,$db->ErrorMsg()); return false; } elseif ($price_plan_result->RecordCount() == 1) { $show_price_plan = $price_plan_result->FetchNextObject(); return $show_price_plan; } else { return false; } } else { //just display the user_id return false; } } else { $this->error_message = $this->internal_error_message; return false; } } //end of function get_price_plan_from_group //######################################################################## function get_auctions_price_plan_from_group($db,$group_id=0) { if ($group_id) { $this->sql_query = "select * from ".$this->groups_table." where group_id = ".$group_id; $group_price_plan_result = $db->Execute($this->sql_query); //echo $this->sql_query." is the query
\n"; //$this->body .=$this->sql_query." is get_price_plan query
\n"; if (!$group_price_plan_result) { $this->error_message = $this->internal_error_message; $this->site_error($this->sql_query,$db->ErrorMsg()); return false; } elseif ($group_price_plan_result->RecordCount() == 1) { $show_group_price_plan = $group_price_plan_result->FetchNextObject(); $this->sql_query = "select * from ".$this->auctions_price_plans_table." where price_plan_id = ".$show_group_price_plan->AUCTION_PRICE_PLAN_ID; $price_plan_result = $db->Execute($this->sql_query); //echo $this->sql_query." is the query
\n"; //$this->body .=$this->sql_query." is get_price_plan query
\n"; if (!$price_plan_result) { $this->error_message = $this->internal_error_message; $this->site_error($this->sql_query,$db->ErrorMsg()); return false; } elseif ($price_plan_result->RecordCount() == 1) { $show_price_plan = $price_plan_result->FetchNextObject(); return $show_price_plan; } else { return false; } } else { //just display the user_id return false; } } else { $this->error_message = $this->internal_error_message; return false; } } //end of function get_auctions_price_plan_from_group //######################################################################## } //end of class Site ?> ================ Non Persistent ================could not connect to database