Пример #1
0
 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&amp;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();
     }
 }
Пример #2
0
 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&amp;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();
     }
 }
Пример #3
0
 public static function str2url($str)
 {
     $str = mb_convert_encoding($str, 'ISO-8859-5', "UTF-8");
     // переводим в транслит
     $str = SitemapCronBase::rus2translit($str);
     // в нижний регистр
     $str = strtolower($str);
     // заменям все ненужное нам на "-"
     $str = preg_replace('~[^-a-z0-9_]+~u', '-', $str);
     // удаляем начальные и конечные '-'
     $str = trim($str, "-");
     $str = mb_convert_encoding($str, 'UTF-8');
     return $str;
 }
Пример #4
0
 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 .= '&amp;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 . '&amp;body=' . SitemapCronBase::str2url($body);
                     //if($page > 1){
                     //$link .= '&amp;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] . '&amp;body=' . SitemapCronBase::str2url($body);
                         //if($page > 1){
                         //$link .= '&amp;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 .= '&amp;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&amp;body=' . SitemapCronBase::str2url($body);
                     $link = $base_url . $link;
                     //if($page > 1){
                     //$link .= '&amp;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 . '&amp;body=' . SitemapCronBase::str2url($body);
                         $link = $base_url . $link;
                         //if($page > 1){
                         //$link .= '&amp;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] . '&amp;body=' . SitemapCronBase::str2url($body);
                             //if($page > 1){
                             //$link .= '&amp;p0='.$page;
                             //}
                             $this->addUrl($link, 'daily', '0.9', $this->date);
                         }
                         //}
                     }
                 }
             }
         }
     }
 }
Пример #5
0
 * $all_sitemaps = array(
 *      'subdomain_name' => array( 'filename1' => 'ClassName1' , 'filename2' => 'ClassName2' ,) ,
 *      ...
 *      'subdomain_name' => array( 'filename1' => 'ClassName1' , 'filename2' => 'ClassName2' ,) ,
 * );
 */
$all_sitemaps = array('realestate' => array('categories' => 'CategoriesMap'), 'vehicles' => array('makemodel' => 'MakeModelMap'), "jobs" => array("titlecity" => "TitleCityMap"));
$all_sitemaps_str = '';
echo "\n";
foreach ($all_sitemaps as $subdomain => $f_sitemaps) {
    $list = array();
    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();
        foreach ($sm_runner->getXmlFilesList() as $l_one_map) {
            $list[] = "http://" . $subdomain . "." . $sm_runner->getDomainName() . "/" . rawurlencode(preg_replace('%^.+/%u', '', $l_one_map)) . "\n";
        }
        $sm_runner->reset();
        unset($sm_runner);
    }
    SitemapCronBase::createSitemapIndex($subdomain, $list);
}
function PrintText($p_sTxt)
{
    $x = memory_get_usage(TRUE) / 1024;
    $x = number_format($x, 2);
    echo date("d/m/y : H:i:s", time()) . " [Mem: {$x} KB] {$p_sTxt} \n";
}
Пример #6
0
 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 .= '&amp;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 .= '&amp;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 .= '&amp;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 .= '&amp;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 .= '&amp;p0='.$page;
                     //}
                     $this->addUrl($link, 'daily', '0.9', $this->date);
                     //}
                 }
             }
         }
     }
 }