public function fillUrls() { $big_cities = array("Москва", "Санкт-Петербург", "Новосибирск", "Екатеринбург", "КРАСНОДАР", "Омск", "Владивосток", "Тюмень", "Иркутск", "Барнаул", "Пермь", "Челябинск", "Ростов-на-Дону", "Казань", "Красноярск", "Уфа", "Томск", "Новокузнецк", "Самара"); $base_url = "http://auto." . $this->base_domain . "/search/"; $date = date("Y-m-d", time()); $sql = "SELECT vpv_value\n\t\t\t\tFROM np_vehicles_pv\n\t\t\t\tWHERE vpv_prop_name='l_make' AND vpv_value<>''"; $this->db->executeSQL($sql, $result, $cnt); $p_makes = array(); foreach ($result as $row) { $p_makes[] = $row['vpv_value']; } $sql = "SELECT l_make\n\t\t\t\tFROM vehicles where l_isActive=1\n\t\t\t\t\t and l_make IN (\"" . implode('","', $p_makes) . "\")\n\t\t\t\tgroup by l_make having count(l_id) >= 5"; $this->db->executeSQL($sql, $result, $cnt); foreach ($big_cities as $city) { foreach ($result as $row) { $link = sprintf("?a=%s&mk=%s", SitemapCronBase::str2url($city), SitemapCronBase::str2url($row['l_make'])); $link = $base_url . $link; $this->addUrl($link, 'always', '0.9', $date); } $str_ = $this->renderXml(); $path = NETUPPATH . "/sitemaps/sitemap-makes-" . $city . ".xml"; $enc_path = NETUPPATH . "/sitemaps/sitemap-makes-" . rawurlencode($city) . ".xml"; file_put_contents($path, $str_); $this->addFileToList($enc_path); $this->urls = array(); } }
public function fillUrls() { $base_url = "http://auto." . $this->base_domain . "/search/"; $sql = "SELECT vpv_value\n FROM np_vehicles_pv\n\t\t\t\tWHERE vpv_prop_name='l_make' AND vpv_value<>''"; $this->db->executeSQL($sql, $result, $cnt); $p_makes = array(); foreach ($result as $row) { $p_makes[] = $row['vpv_value']; } $sql = "SELECT vpv_value\n FROM np_vehicles_pv\n\t\t\t\tWHERE vpv_prop_name='l_model' AND vpv_value<>''"; $this->db->executeSQL($sql, $result, $cnt); $p_models = array(); foreach ($result as $row) { $p_models[] = $row['vpv_value']; } $sql = "SELECT l_make, l_model \n FROM vehicles where l_isActive=1\n and l_make IN (\"" . implode('","', $p_makes) . "\") and l_model IN (\"" . implode('","', $p_models) . "\")\t\t\t\t\n group by l_make, l_model having count(l_id) >= 5"; $this->db->executeSQL($sql, $result, $cnt); $data = array(); foreach ($result as $row) { $data[$row['l_make']][] = $row['l_model']; } unset($result); $date = date("Y-m-d", time()); foreach ($data as $make => $models) { $make = str_replace("/", " ", $make); $link = sprintf('?mk=%s', SitemapCronBase::str2url($make)); $link = $base_url . $link; $this->addUrl($link, 'always', '0.9', $date); foreach ($models as $model) { $model = str_replace("/", " ", $model); $link = sprintf("?mk=%s&md=%s", SitemapCronBase::str2url($make), SitemapCronBase::str2url($model)); $link = $base_url . $link; $this->addUrl($link, 'always', '0.9', $date); } $str_ = $this->renderXml(); $path = NETUPPATH . "/sitemaps/sitemap-" . $make . ".xml"; $enc_path = NETUPPATH . "/sitemaps/sitemap-" . rawurlencode($make) . ".xml"; file_put_contents($path, $str_); $this->addFileToList($enc_path); $this->urls = array(); } }
private function find_most_popular($city, $make, $translitted_city, $translitted_make) { $subdomain = $translitted_city != 'www' ? $translitted_city . '.' : ''; $fields_to_find = array('l_model', 'l_subcategory', 'l_i_year', 'l_trtype'); $found_fields = array(); foreach ($fields_to_find as $one_field) { $found_fields[$one_field] = array(); $result = $this->make_search($city, $make, $one_field); if (!empty($result)) { $matches = $result['matches']; $ids = array(); foreach ($matches as $match) { if ($match["attrs"]["@count"] > 5) { $ids[$match['id']] = $match["attrs"]["@count"]; } } if (!empty($ids)) { $sql = "SELECT {$one_field}, l_id FROM `vehicles` WHERE l_id IN (" . implode(",", array_keys($ids)) . ")"; $res = $cnt = FALSE; $this->db->executeSQL($sql, $res, $cnt); if ($res) { // order rows as the IDs were given foreach (array_keys($ids) as $oneID) { foreach ($res as $oneRow) { if ($oneRow['l_id'] == $oneID) { if (!empty($oneRow[$one_field])) { $found_fields[$one_field][$oneRow[$one_field]] = $ids[$oneID]; } break; } } } } } } } //make + body foreach ($found_fields['l_subcategory'] as $body => $num) { if (in_array($body, array_keys($this->m_aCategories))) { $base_url = "http://" . $subdomain . $this->base_domain . "/auto/search/" . $this->m_aCategories[$body] . "/"; } else { continue; } //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $translitted_make; $link = $base_url . $link . '?body=' . SitemapCronBase::str2url($body); //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); //} } //make + year + body foreach ($found_fields['l_i_year'] as $year => $num) { $bodies = $this->find_body_by_field($city, $make, array(array('field' => 'l_i_year', 'value' => $year, 'type' => 'int'))); if ($bodies !== FALSE) { $matches = $bodies['matches']; $ids = array(); foreach ($matches as $match) { $ids[$match['id']] = $match["attrs"]["@count"]; } $sql = "SELECT l_subcategory, l_id FROM `vehicles` WHERE l_id IN (" . implode(",", array_keys($ids)) . ")"; $res = $cnt = FALSE; $this->db->executeSQL($sql, $res, $cnt); if ($res) { // order rows as the IDs were given $found = FALSE; $bodies = array(); foreach (array_keys($ids) as $oneID) { foreach ($res as $oneRow) { if ($oneRow['l_id'] == $oneID) { $bodies[$oneRow['l_subcategory']] = $ids[$oneRow['l_id']]; } } } foreach ($bodies as $body => $num) { if (in_array($body, array_keys($this->m_aCategories))) { $base_url = "http://" . $subdomain . $this->base_domain . "/auto/search/" . $this->m_aCategories[$body] . "/"; } else { continue; } //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $translitted_make; $link = $base_url . $link . '?year=' . $year . '-' . $year . '&body=' . SitemapCronBase::str2url($body); //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); //} } } } } //make + transmission + body foreach ($found_fields['l_trtype'] as $trtype => $num) { $bodies = $this->find_body_by_field($city, $make, array(array('field' => 'ltrtype', 'value' => $trtype, 'type' => 'string'))); if ($bodies !== FALSE) { $matches = $bodies['matches']; $ids = array(); foreach ($matches as $match) { $ids[$match['id']] = $match["attrs"]["@count"]; } $sql = "SELECT l_subcategory, l_id FROM `vehicles` WHERE l_id IN (" . implode(",", array_keys($ids)) . ")"; $res = $cnt = FALSE; $this->db->executeSQL($sql, $res, $cnt); if ($res) { // order rows as the IDs were given $found = FALSE; $bodies = array(); foreach (array_keys($ids) as $oneID) { foreach ($res as $oneRow) { if ($oneRow['l_id'] == $oneID) { $bodies[$oneRow['l_subcategory']] = $ids[$oneRow['l_id']]; } } } foreach ($bodies as $body => $num) { if (in_array($body, array_keys($this->m_aCategories))) { $base_url = "http://" . $subdomain . $this->base_domain . "/auto/search/" . $this->m_aCategories[$body] . "/"; } else { continue; } //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $translitted_make; if (in_array($trtype, array_keys($this->m_aTrTypes))) { $link = $base_url . $link . '?kpp=' . $this->m_aTrTypes[$trtype] . '&body=' . SitemapCronBase::str2url($body); //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); } //} } } } } //make + model + body foreach ($found_fields['l_model'] as $model => $num) { $bodies = $this->find_body_by_field($city, $make, array(array('field' => 'lmodel', 'value' => $model, 'type' => 'string'))); if ($bodies !== FALSE) { $matches = $bodies['matches']; $ids = array(); foreach ($matches as $match) { $ids[$match['id']] = $match["attrs"]["@count"]; } $sql = "SELECT l_subcategory, l_id FROM `vehicles` WHERE l_id IN (" . implode(",", array_keys($ids)) . ")"; $res = $cnt = FALSE; $this->db->executeSQL($sql, $res, $cnt); if ($res) { // order rows as the IDs were given $found = FALSE; $bodies = array(); foreach (array_keys($ids) as $oneID) { foreach ($res as $oneRow) { if ($oneRow['l_id'] == $oneID) { $bodies[$oneRow['l_subcategory']] = $ids[$oneRow['l_id']]; } } } $ind = 0; foreach ($bodies as $body => $num) { $ind++; if (in_array($body, array_keys($this->m_aCategories))) { $base_url = "http://" . $subdomain . $this->base_domain . "/auto/search/" . $this->m_aCategories[$body] . "/"; } else { continue; } if ($ind == 1) { $link = $translitted_make . '/' . SitemapCronBase::str2url($model); $link = $base_url . $link; $this->addUrl($link, 'daily', '0.9', $this->date); } //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $translitted_make . '/' . SitemapCronBase::str2url($model) . '?body=' . SitemapCronBase::str2url($body); $link = $base_url . $link; //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); //} } } } } //make + model + body + new only foreach ($found_fields['l_model'] as $model => $num) { $bodies = $this->find_body_by_field($city, $make, array(array('field' => 'lmodel', 'value' => $model, 'type' => 'string'), array('field' => 'l_isDealer', 'value' => 1, 'type' => 'int'))); if ($bodies !== FALSE) { $matches = $bodies['matches']; $ids = array(); foreach ($matches as $match) { $ids[$match['id']] = $match["attrs"]["@count"]; } $sql = "SELECT l_subcategory, l_id FROM `vehicles` WHERE l_id IN (" . implode(",", array_keys($ids)) . ")"; $res = $cnt = FALSE; $this->db->executeSQL($sql, $res, $cnt); if ($res) { // order rows as the IDs were given $found = FALSE; $bodies = array(); foreach (array_keys($ids) as $oneID) { foreach ($res as $oneRow) { if ($oneRow['l_id'] == $oneID) { $bodies[$oneRow['l_subcategory']] = $ids[$oneRow['l_id']]; } } } foreach ($bodies as $body => $num) { if (in_array($body, array_keys($this->m_aCategories))) { $base_url = "http://" . $subdomain . $this->base_domain . "/auto/search/" . $this->m_aCategories[$body] . "/"; } else { continue; } //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $translitted_make . '/' . SitemapCronBase::str2url($model) . '?new=1&body=' . SitemapCronBase::str2url($body); $link = $base_url . $link; //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); //} } } } } //take only 5 most popular models to prevent tooo many searches $found_fields['l_model'] = array_slice($found_fields['l_model'], 0, 5, TRUE); $found_fields['l_i_year'] = array_slice($found_fields['l_i_year'], 0, 5, TRUE); $found_fields['l_trtype'] = array_slice($found_fields['l_trtype'], 0, 5, TRUE); //make + model + year + body foreach ($found_fields['l_model'] as $model => $num1) { foreach ($found_fields['l_i_year'] as $year => $num2) { $bodies = $this->find_body_by_field($city, $make, array(array('field' => 'lmodel', 'value' => $model, 'type' => 'string'), array('field' => 'l_i_year', 'value' => $year, 'type' => 'int'))); if ($bodies !== FALSE) { $matches = $bodies['matches']; $ids = array(); foreach ($matches as $match) { $ids[$match['id']] = $match["attrs"]["@count"]; } $sql = "SELECT l_subcategory, l_id FROM `vehicles` WHERE l_id IN (" . implode(",", array_keys($ids)) . ")"; $res = $cnt = FALSE; $this->db->executeSQL($sql, $res, $cnt); if ($res) { // order rows as the IDs were given $found = FALSE; $bodies = array(); foreach (array_keys($ids) as $oneID) { foreach ($res as $oneRow) { if ($oneRow['l_id'] == $oneID) { $bodies[$oneRow['l_subcategory']] = $ids[$oneRow['l_id']]; } } } foreach ($bodies as $body => $num) { if (in_array($body, array_keys($this->m_aCategories))) { $base_url = "http://" . $subdomain . $this->base_domain . "/auto/search/" . $this->m_aCategories[$body] . "/"; } else { continue; } //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $translitted_make . '/' . SitemapCronBase::str2url($model) . '?year=' . $year . '-' . $year . '&body=' . SitemapCronBase::str2url($body); $link = $base_url . $link; //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); //} } } } } } //make + model + transmission + body foreach ($found_fields['l_model'] as $model => $num1) { foreach ($found_fields['l_trtype'] as $trtype => $num2) { $bodies = $this->find_body_by_field($city, $make, array(array('field' => 'lmodel', 'value' => $model, 'type' => 'string'), array('field' => 'ltrtype', 'value' => $trtype, 'type' => 'string'))); if ($bodies !== FALSE) { $matches = $bodies['matches']; $ids = array(); foreach ($matches as $match) { $ids[$match['id']] = $match["attrs"]["@count"]; } $sql = "SELECT l_subcategory, l_id FROM `vehicles` WHERE l_id IN (" . implode(",", array_keys($ids)) . ")"; $res = $cnt = FALSE; $this->db->executeSQL($sql, $res, $cnt); if ($res) { // order rows as the IDs were given $found = FALSE; $bodies = array(); foreach (array_keys($ids) as $oneID) { foreach ($res as $oneRow) { if ($oneRow['l_id'] == $oneID) { $bodies[$oneRow['l_subcategory']] = $ids[$oneRow['l_id']]; } } } foreach ($bodies as $body => $num) { if (in_array($body, array_keys($this->m_aCategories))) { $base_url = "http://" . $subdomain . $this->base_domain . "/auto/search/" . $this->m_aCategories[$body] . "/"; } else { continue; } //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $translitted_make . '/' . SitemapCronBase::str2url($model); if (in_array($trtype, array_keys($this->m_aTrTypes))) { $link = $base_url . $link . '?kpp=' . $this->m_aTrTypes[$trtype] . '&body=' . SitemapCronBase::str2url($body); //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); } //} } } } } } }
* all_sitemaps array pattern : * $all_sitemaps = array( * 'subdomain_name' => array( 'filename1' => 'ClassName1' , 'filename2' => 'ClassName2' ,) , * ... * 'subdomain_name' => array( 'filename1' => 'ClassName1' , 'filename2' => 'ClassName2' ,) , * ); */ $all_sitemaps = array('auto' => array('sitemapindex' => 'siteMapIndexAuto')); $big_cities = array("Москва", "Санкт-Петербург", "Новосибирск", "Екатеринбург", "КРАСНОДАР", "Омск", "Владивосток", "Тюмень", "Иркутск", "Барнаул", "Пермь", "Челябинск", "Ростов-на-Дону", "Казань", "Уфа", "Красноярск", "Нижний Новгород", "Самара", "Томск", "Хабаровск", "Новокузнецк", "Волгоград", "Киров", "Саратов", "Кемерово", "Чита", "Калининград", "Сургут", "Воронеж", "Улан-Удэ", "Оренбург", "Курган", "Мурманск", "Ульяновск", "Благовещенск", "Ижевск", "Ярославль", "Астрахань", "Ставрополь", "Уссурийск", "Нижневартовск", "Сочи", "Абакан", "Нижний Тагил", "Тольятти", "Новороссийск", "Набережные Челны", "Тверь", "Курск", "Петропавловск-камчатский", "Белгород", "Чебоксары", "Бийск", "Владимир", "Комсомольск-на-Амуре", "Магнитогорск", "Пенза", "Тамбов", "Якутск", "Находка", "Смоленск", "Липецк", "Рязань", "Вологда", "Братск", "Кострома", "Петрозаводск", "Стерлитамак", "Иваново", "Брянск", "Махачкала", "Ангарск", "Каменск-Уральский", "Великий Новгород", "Калуга", "Псков", "Орел", "Саранск", "Нальчик", "Йошкар-Ола", "Ханты-Мансийск", "Анапа", "Горно-Алтайск", "Владикавказ", "Прокопьевск", "Сыктывкар", "Архангельск", "Череповец", "Армавир", "Ноябрьск", "Таганрог", "Березовский", "Первоуральск", "Тула", "Белово", "Нефтеюганск", "Южно-Сахалинск", "Рубцовск", "Пятигорск", "Рыбинск"); $all_sitemaps_str = ''; echo "\n"; foreach ($all_sitemaps as $subdomain => &$f_sitemaps) { if ($subdomain == 'auto') { foreach ($big_cities as $city) { $list = array(); $translitted_city = SitemapCronBase::str2url($city); $translitted_city = str_replace('moskva', 'www', str_replace('sankt-peterburg', 'spb', $translitted_city)); $_subdomain = $translitted_city != 'www' ? $translitted_city . '.' : ''; foreach ($f_sitemaps as $file_name_ => $class_name_) { sleep(2); PrintText("Creating {$subdomain} Sitemap: ' {$file_name_} ( {$class_name_}.class )"); require_once RUNNING_PATH . "/" . $subdomain . "/" . $file_name_ . ".php"; $sm_runner = new $class_name_($db_conf); $sm_runner->fillUrls($city); foreach ($sm_runner->getXmlFilesList() as $l_one_map) { $list[] = "http://" . $_subdomain . $sm_runner->getDomainName() . "/" . preg_replace('%^.+/%u', '', $l_one_map) . "\n"; } $sm_runner->reset(); unset($sm_runner); } SitemapCronBase::createSitemapIndex($subdomain, $list, $translitted_city);
private function find_most_popular($city, $one_deal_type, $deal_type_string, $one_translitted_category, $translitted_city) { $subdomain = $translitted_city != 'www' ? $translitted_city . '.' : ''; $fields_to_find = array('empty' => 'empty', 'l_roomsint' => 'l_rooms', 'lfoundneigh' => 'l_found_neigh', 'lfoundmetro' => 'l_found_metro'); $found_fields = array(); foreach ($fields_to_find as $one_field => $one_field_db) { $found_fields[$one_field] = array(); $result = $this->make_search($city, $one_deal_type, $one_translitted_category, $one_field); if (!empty($result)) { $matches = $result['matches']; $ids = array(); if ($one_field == 'empty') { $found_fields[$one_field] = $result['total_found']; } else { foreach ($matches as $match) { if ($match["attrs"]["@count"] > 5) { $ids[$match['id']] = $match["attrs"]["@count"]; } } if (!empty($ids)) { $sql = "SELECT {$one_field_db}, l_id FROM `realestate` WHERE l_id IN (" . implode(",", array_keys($ids)) . ")"; $result = array(); $cnt = 0; $this->db->executeSQL($sql, $res, $cnt); if ($res) { // order rows as the IDs were given foreach (array_keys($ids) as $oneID) { foreach ($res as $oneRow) { if ($oneRow['l_id'] == $oneID) { if (!empty($oneRow[$one_field_db])) { $found_fields[$one_field][$oneRow[$one_field_db]] = $ids[$oneID]; } break; } } } } } } } } //category if (isset($found_fields['empty']) && $found_fields['empty'] > 0) { $base_url = "http://" . $subdomain . $this->base_domain . "/realty/" . $deal_type_string . "/" . $one_translitted_category . "/"; //$num = $found_fields['empty']; //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $base_url; //if($page > 1){ //$link .= '?p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); //} } //kvartira + rooms if ($one_translitted_category == 'kvartira') { $l_roomsint = array(); $four_and_more = 0; foreach ($found_fields['l_roomsint'] as $rooms => $num) { if ($rooms > 3) { $four_and_more += $num; } else { if ($rooms > 0) { $l_roomsint[(int) $rooms] = $num; } } } if ($four_and_more > 0) { $l_roomsint[4] = $four_and_more; } $found_fields['l_roomsint'] = $l_roomsint; foreach ($found_fields['l_roomsint'] as $rooms => $num) { $base_url = "http://" . $subdomain . $this->base_domain . "/realty/" . $deal_type_string . "/" . $one_translitted_category . "/"; //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ if ($rooms > 3) { $rooms = 4; } $link = $base_url . '?rooms=' . $rooms; //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); //} } } //kvartira new if ($one_translitted_category == 'kvartira' && $deal_type_string == 'sale') { if ($new_flats_count = $this->find_count_by_field($city, $one_translitted_category, array(array('field' => 'l_deal_type', 'value' => $one_deal_type, 'type' => 'int'), array('field' => 'l_isNew', 'value' => 1, 'type' => 'int')))) { PrintText("Found " . $new_flats_count . " new flats in " . $translitted_city); $base_url = "http://" . $subdomain . $this->base_domain . "/realty/" . $deal_type_string . "/" . $one_translitted_category . "/"; //$num = $new_flats_count; //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $base_url . '?new=1'; //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); //} } } //zagorodnaya-nedvizhimost by asset types if (in_array($one_translitted_category, array_keys($this->m_aCategoriesDetailsOnSite))) { foreach ($this->m_aCategoriesDetailsOnSite[$one_translitted_category] as $asset_type) { if ($asset_type_count = $this->find_count_by_field($city, NULL, array(array('field' => 'l_deal_type', 'value' => $one_deal_type, 'type' => 'int'), array('field' => 'lassettype', 'value' => $asset_type, 'type' => 'string')))) { PrintText("Found " . $asset_type_count . " assets from type: " . $asset_type); $base_url = "http://" . $subdomain . $this->base_domain . "/realty/" . $deal_type_string . "/" . $one_translitted_category . "/"; //$num = $asset_type_count; //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $base_url . '?' . SitemapCronBase::str2url($asset_type) . '=1'; //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); //} } } } //kvartira by metro stations if ($one_translitted_category == 'kvartira') { if ($metros = $this->metro_stations($city)) { foreach ($metros as $metro) { if ($flats_count = $this->find_count_by_field($city, $one_translitted_category, array(array('field' => 'l_deal_type', 'value' => $one_deal_type, 'type' => 'int'), array('field' => 'lfoundmetro', 'value' => $metro['Name'], 'type' => 'string')))) { PrintText("Found " . $flats_count . " assets near " . $metro['Name']); $base_url = "http://" . $subdomain . $this->base_domain . "/realty/" . $deal_type_string . "/" . $one_translitted_category . "/"; //$num = $flats_count; //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $base_url . '?metros=' . $metro['ID']; //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); //} } } } } //kvartira by neighborhood if ($one_translitted_category == 'kvartira') { if ($neighs = $this->neighs($city)) { foreach ($neighs as $neigh) { if ($flats_count = $this->find_count_by_field($city, $one_translitted_category, array(array('field' => 'l_deal_type', 'value' => $one_deal_type, 'type' => 'int'), array('field' => 'lfoundneigh', 'value' => $neigh['Name'], 'type' => 'string')))) { PrintText("Found " . $flats_count . " assets near " . $neigh['Name']); $base_url = "http://" . $subdomain . $this->base_domain . "/realty/" . $deal_type_string . "/" . $one_translitted_category . "/"; //$num = $flats_count; //$pages = ($num / $this->listings_on_page) + 1; //$pages = ($pages < $this->max_pages) ? $pages : $this->max_pages - 1; //for($page = 1; $page <= $pages; $page++){ $link = $base_url . '?neighborhoods=' . $neigh['ID']; //if($page > 1){ //$link .= '&p0='.$page; //} $this->addUrl($link, 'daily', '0.9', $this->date); //} } } } } }