function do_xml()
{
    $_str = $_str_temp = '';
    // коннектимся
    f_mysql_connect();
    // выбираем
    $result = mysql_db_query($GLOBALS["dbname"], "SELECT * FROM news where status=1 order by id desc limit " . ___findpole("select zna from config where id=9", 'zna'));
    // формируем все новости
    $name_file = '/rss/all.xml';
    for ($i = 0; $i < mysql_numrows($result); $i++) {
        $find = mysql_fetch_array($result);
        // елементы для замены
        $mass_element_for_parsing = array("%zag%", "%link%", "%text%", "%date%");
        // заменяеміе значения
        $mass_result_for_parsing = array($find['zag'], MAIN_PATH . "/news/idnews/" . $find['id'] . '/type/' . $find['type'], strip_tags(htmlspecialchars(substr($find['text'], 0, 150))), $find['date']);
        // парсим данные
        $_str_temp = parsing_tpl($name_file, $mass_element_for_parsing, $mass_result_for_parsing, $_str_temp);
    }
    // основной шаблон
    $name_file = '/rss/template.xml';
    // елементы для замены
    $mass_element_for_parsing = array("%zag%", "%www%", "%tegs%");
    // заменяеміе значения
    $mass_result_for_parsing = array(iconv('CP1251', 'UTF-8', 'Новости'), iconv('CP1251', 'UTF-8', ADRESS_SITE), iconv('CP1251', 'UTF-8', $_str_temp));
    // парсим данные
    $_str = parsing_tpl($name_file, $mass_element_for_parsing, $mass_result_for_parsing, $_str);
    write_keh(HOST . '/rss/ru.xml', $_str);
}
function if_content($action)
{
    f_mysql_connect();
    $_str = "where action='" . $action . "' and status=1";
    //echo $_str;
    $result = f_mysql_select("content", $_str);
    if (mysql_numrows($result) > 0) {
        // есть
        $_res = 1;
    } else {
        // нет
        $_res = 0;
    }
    return $_res;
}
Exemple #3
0
 case 'redaktirovat_dannye_o_pasionate':
     // записываем в базу
     multy_update_form('pansionat', $_POST['id_pansionat']);
     // сохраняем картинки
     multy_update_photo('pansionat', 'pansionat', __COUNT_PHOTO_PANSIONAT, $_POST['id_pansionat']);
     // елементы для замены
     $mass_element_for_parsing = array('%soobshhenie_posle_redaktirovanija_pansionata%');
     // заменяеміе значения
     $mass_result_for_parsing = array(get_content('soobshhenie_posle_redaktirovanija_pansionata'));
     // имя файла с путем
     $name_file = "/tpl/forms/pansionat_edit_write.tpl.html";
     // парсим данные
     $_str = parsing_tpl($name_file, $mass_element_for_parsing, $mass_result_for_parsing, $_str);
     break;
 case 'nomer':
     f_mysql_connect();
     // записываем в базу
     multy_insert_form('pansionat_costs');
     // сохраняем картинки
     multy_upload_photo('pansionat_costs', 'nomera', __COUNT_PHOTO_PANSIONAT);
     // елементы для замены
     $mass_element_for_parsing = array('%soobshhenie_posle_dobavlenija_nomera%');
     // заменяеміе значения
     $mass_result_for_parsing = array(get_content('soobshhenie_posle_dobavlenija_nomera'));
     // имя файла с путем
     $name_file = "/tpl/forms/nomer_write.tpl.html";
     // парсим данные
     $_str = parsing_tpl($name_file, $mass_element_for_parsing, $mass_result_for_parsing, $_str);
     break;
 case 'redaktirovat_dannye_o_nomere':
     // записываем в базу
function get_last_add_id($tablename, $condition, $namefield)
{
    f_mysql_connect();
    //echo $condition." order by $namefield desc limit 1";
    $result = f_mysql_select($tablename, $condition . " order by {$namefield} desc limit 1");
    $find = mysql_fetch_array($result);
    $_res = $find[$namefield];
    //	echo "<br>_res-".$_res."<br>";
    return $_res;
}
function show_title()
{
    global $action;
    f_mysql_connect();
    if (isset($_GET['action'])) {
        /*
         * специфические разделы для выбора ключей
         */
        if ($_GET['action'] == "news") {
            if (isset($_GET['url'])) {
                // нашли поля
                $_arr = ___findarray('select zag,text from news where url="' . $_GET['url'] . '"');
                $_title = $_arr['zag'] . ' — ' . NAME_FIRMS . ' - Новости';
                $_description = get_stoka($_arr['text'], 50, ' ');
                $_keywords = get_stoka($_arr['zag'], 50, ', ') . _KEYWORDS;
            } else {
                if (TYPE_NEWS == 0 or !isset($_GET['type'])) {
                    // нашли поля
                    $_arr = ___findarray('select title,description,keywords from ceo where id=1');
                    $_title = NAME_FIRMS . ' - ' . $_arr['title'];
                    $_description = $_arr['description'];
                    $_keywords = $_arr['keywords'];
                } else {
                    // нашли поля
                    switch ($_GET['type']) {
                        case 1:
                            $_idd = 6;
                            break;
                        case 2:
                            $_idd = 7;
                            break;
                        default:
                            $_idd = 1;
                            break;
                    }
                    //ищем
                    $_arr = ___findarray('select title,description,keywords from ceo where id=' . $_idd);
                    $_title = NAME_FIRMS . ' - ' . $_arr['title'];
                    $_description = $_arr['description'];
                    $_keywords = $_arr['keywords'];
                }
            }
        } else {
            if ($_GET['action'] == "gallery" or $_GET['action'] == "arhiv") {
                $_arr = ___findarray('select title,description,keywords from ceo where id=2');
                if (isset($_GET['id'])) {
                    // нашли поля
                    $_arr1 = ___findarray('select pole from gallery_grupa where id="' . $_GET['id'] . '"');
                    $_title = $_arr['title'] . ' - ' . $_arr1['pole'] . ' — ' . NAME_FIRMS;
                    if ($_arr1['text'] == '') {
                        $_description = _DESCRIPTION;
                    } else {
                        $_description = get_stoka($_arr1['text'], 50, ' ');
                    }
                    $_keywords = get_stoka($_arr1['pole'], 50, ', ') . _KEYWORDS;
                } else {
                    // нашли поля
                    $_arr = ___findarray('select title,description,keywords from ceo where id=2');
                    $_title = $_arr['title'] . ' - ' . NAME_FIRMS;
                    $_description = $_arr['description'];
                    $_keywords = $_arr['keywords'];
                }
                // раздел каталог
            } else {
                if ($_GET['action'] == "catalog") {
                    // нашли поля
                    $_arr = ___findarray('select title,description,keywords from ceo where id=3');
                    $_title = $_arr['title'];
                    $_description = $_arr['description'];
                    $_keywords = $_arr['keywords'];
                    // если есть Группа
                    if (isset($_GET['grupa'])) {
                        // строим запрос
                        $_sql = 'SELECT * FROM catalog_tree where id=' . $_GET['grupa'];
                        // выполняем запрос + при необходимости выводим сам запрос
                        $result = mysql::query_one($_sql, 0);
                        /*
                         * определяем переменные
                         */
                        $_title .= " - " . $result->title;
                        $_description .= ", " . $result->description;
                        $_keywords .= ", " . $result->keywords;
                        /*
                         * определяем переменные
                         */
                        $_title .= " - " . NAME_FIRMS;
                        $_description .= ", " . NAME_FIRMS;
                        $_keywords .= ", " . NAME_FIRMS;
                    } else {
                        if (isset($_GET['goods'])) {
                            // строим запрос
                            $_sql = 'SELECT name, text_short FROM catalog where id=' . intval($_GET['goods']) . ' and status=1';
                            // выполняем запрос + при необходимости выводим сам запрос
                            $result = mysql::query_one($_sql, 0);
                            /*
                             * определяем переменные
                             */
                            $_title .= " - " . get_stoka($result->name, 50, ' ') . " - " . NAME_FIRMS;
                            $_description .= ", " . get_stoka($result->description, 150, ' ') . ", " . NAME_FIRMS;
                            $_keywords .= ", " . get_stoka($result->keywords, 150, ' ') . ", " . NAME_FIRMS;
                        }
                    }
                    // раздел каталог
                } else {
                    if ($_GET['action'] == "brand") {
                        // нашли поля
                        $_arr = ___findarray('select title,description,keywords from ceo where id=9');
                        $_title = $_arr['title'];
                        $_description = $_arr['description'];
                        $_keywords = $_arr['keywords'];
                        // конкретный бренд
                        if (isset($_GET['id'])) {
                            // строим запрос
                            $_sql = 'SELECT * FROM brand where id=' . $_GET['id'];
                            // выполняем запрос + при необходимости выводим сам запрос
                            $result = mysql::query_one($_sql, 0);
                            /*
                             * определяем переменные
                             */
                            $_title .= " - " . $result->pole;
                            $_description .= ", " . $result->pole;
                            $_keywords .= ", " . $result->pole;
                            /*
                             * определяем переменные
                             */
                            $_title .= " - " . NAME_FIRMS;
                            $_description .= ", " . NAME_FIRMS;
                            $_keywords .= ", " . NAME_FIRMS;
                        }
                        // раздел каталог
                    } else {
                        if ($_GET['action'] == "basket") {
                            // нашли поля
                            $_arr = ___findarray('select title,description,keywords from ceo where id=10');
                            $_title = $_arr['title'];
                            $_description = $_arr['description'];
                            $_keywords = $_arr['keywords'];
                            /*
                             * определяем переменные
                             */
                            $_title .= " - " . NAME_FIRMS;
                            $_description .= ", " . NAME_FIRMS;
                            $_keywords .= ", " . NAME_FIRMS;
                            // раздел каталог
                        } else {
                            if ($_GET['action'] == "mycabinet") {
                                // нашли поля
                                $_arr = ___findarray('select title,description,keywords from ceo where id=11');
                                $_title = $_arr['title'];
                                $_description = $_arr['description'];
                                $_keywords = $_arr['keywords'];
                                /*
                                 * определяем переменные
                                 */
                                $_title .= " - " . NAME_FIRMS;
                                $_description .= ", " . NAME_FIRMS;
                                $_keywords .= ", " . NAME_FIRMS;
                                // раздел каталог
                            } else {
                                if ($_GET['action'] == "filter") {
                                    // имя текущего раздела
                                    $_res = filter::get_name_curent_filter();
                                    $_title = $_res;
                                    $_description = $_res;
                                    $_keywords = $_res;
                                    // конкретный бренд
                                    if (isset($_GET['id'])) {
                                        /*
                                         * определяем переменные
                                         */
                                        $_title .= " - " . NAME_FIRMS;
                                        $_description .= ", " . NAME_FIRMS;
                                        $_keywords .= ", " . NAME_FIRMS;
                                    }
                                } else {
                                    if ($_GET['action'] == "search") {
                                        // нашли поля
                                        $_arr = ___findarray('select title,description,keywords from ceo where id=13');
                                        $_title = NAME_FIRMS . ' - ' . $_arr['title'];
                                        $_description = $_arr['description'];
                                        $_keywords = $_arr['keywords'];
                                    } else {
                                        if ($_GET['action'] == "voting") {
                                            // нашли поля
                                            $_arr = ___findarray('select title,description,keywords from ceo where id=12');
                                            $_title = NAME_FIRMS . ' - ' . $_arr['title'];
                                            if (isset($_GET['arhiv'])) {
                                                $_title .= ' - Архив голосований';
                                            }
                                            $_description = $_arr['description'];
                                            $_keywords = $_arr['keywords'];
                                        } else {
                                            if ($_GET['action'] == "registration") {
                                                // нашли поля
                                                $_arr = ___findarray('select title,description,keywords from ceo where id=8');
                                                $_title = NAME_FIRMS . ' - ' . $_arr['title'];
                                                $_description = $_arr['description'];
                                                $_keywords = $_arr['keywords'];
                                            } else {
                                                $_str = "where action='" . $_GET['action'] . "' and status=1";
                                                //echo "<br>".$_str."<br>";
                                                $result = f_mysql_select("content", $_str);
                                                if (mysql_numrows($result) > 0) {
                                                    $find = mysql_fetch_array($result);
                                                    /*
                                                     * определяем переменные
                                                     */
                                                    $_title = mysql::query_findpole('select title_' . $_GET['lang'] . ' from content where action="' . $_GET['action'] . '"', 'title_' . $_GET['lang']) . ' - ' . NAME_FIRMS;
                                                    $_description = mysql::query_findpole('select description_' . $_GET['lang'] . ' from content where action="' . $_GET['action' . '"'], 'description_' . $_GET['lang']);
                                                    $_keywords = mysql::query_findpole('select keywords_' . $_GET['lang'] . ' from content where action="' . $_GET['action'] . '"', 'keywords_' . $_GET['lang']);
                                                    /*$_title=$find['title'].' - '.NAME_FIRMS;
                                                    		$_description=$find['description'];
                                                    		$_keywords=$find['keywords'];	*/
                                                } else {
                                                    /*$_title=_TITLE.' - '.NAME_FIRMS;
                                                    		$_description=_DESCRIPTION;
                                                    		$_keywords=_KEYWORDS;*/
                                                    $_title = mysql::query_findpole('select title_' . $_GET['lang'] . ' from content where action=' . $_GET['action'], 'title_' . $_GET['lang']) . ' - ' . NAME_FIRMS;
                                                    $_description = mysql::query_findpole('select description_' . $_GET['lang'] . ' from content where action=' . $_GET['action'], 'description_' . $_GET['lang']);
                                                    $_keywords = mysql::query_findpole('select keywords_' . $_GET['lang'] . ' from content where action=' . $_GET['action'], 'keywords_' . $_GET['lang']);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (!isset($_GET['action']) or $_title == '') {
        //$result=f_mysql_select("title","where id=1");
        //$find=mysql_fetch_array($result);
        /*
         * определяем переменные
         */
        $_title = _TITLE . ' - ' . NAME_FIRMS;
        $_description = _DESCRIPTION;
        $_keywords = _KEYWORDS;
    }
    // массив значений
    $_res = array($_title, $_description, $_keywords);
    //print_r($_res);
    return $_res;
}
function ___findarray($_sql)
{
    f_mysql_connect();
    $result = mysql_db_query($GLOBALS["dbname"], $_sql);
    //echo $_sql."<br>";
    if (mysql_numrows($result) > 0) {
        $find = mysql_fetch_array($result);
        return $find;
    } else {
        return false;
    }
}