Exemplo n.º 1
0
function get_h1()
{
    global $zag_radel;
    global $dbname;
    // ищем в table ACTION сам action и если он есть то выхватываем имя раздела
    //$_res=findpole_universal_full($_GET['action'],"content","action",1,"return");
    $_res = ___findpole('select content.h1_' . $_GET['lang'] . ' from content where action="' . $_GET['action'] . '"', 'h1_' . $_GET['lang']);
    //echo "----_res-----".$_res."<br>";
    if (!$_res) {
        if (isset($_GET['grupa']) and intval($_GET['grupa']) > 0) {
            // строим запрос
            $_sql = 'SELECT * FROM catalog_tree where id=' . $_GET['grupa'];
            // выполняем запрос + при необходимости выводим сам запрос
            $result = mysql::query_one($_sql, 0);
            if ($result) {
                $_res = $result->h1;
            } else {
                $_res = 'Такого товара нет!';
            }
            //echo "----_res-----".$_res."<br>";
        } else {
            if (isset($_GET['goods']) and $_GET['action'] == "catalog" and intval($_GET['goods']) > 0) {
                // строим запрос
                $_sql = 'SELECT * FROM catalog where id=' . intval($_GET['goods']) . ' and status=1';
                // выполняем запрос + при необходимости выводим сам запрос
                $result = mysql::query_one($_sql, 0);
                if ($result) {
                    $_res = $result->name;
                } else {
                    $_res = 'Такого товара нет!';
                }
            } else {
                if (isset($_GET['action'])) {
                    if ($_GET['action'] == 'news') {
                        if (!isset($_GET['url'])) {
                            if (TYPE_NEWS == 0 or !isset($_GET['type'])) {
                                // нашли поля
                                $_arr = ___findarray('select h1, title from ceo where id=1');
                            } else {
                                // нашли поля
                                switch ($_GET['type']) {
                                    case 1:
                                        $_idd = 6;
                                        break;
                                    case 2:
                                        $_idd = 7;
                                        break;
                                    default:
                                        $_idd = 1;
                                        break;
                                }
                                // нашли поля
                                $_arr = ___findarray('select h1, title from ceo where id=' . $_idd);
                            }
                            if ($_arr['h1'] != '') {
                                $_res = $_arr['h1'];
                            } else {
                                $_res = $_arr['title'];
                            }
                        } else {
                            $_res = ___findpole('select zag from news where url="' . $_GET['url'] . '"', 'zag');
                        }
                    } else {
                        if ($_GET['action'] == 'gallery') {
                            if (!isset($_GET['url'])) {
                                $_arr = ___findarray('select h1, title from ceo where id=2');
                                if ($_arr['h1'] != '') {
                                    $_res = $_arr['h1'];
                                } else {
                                    $_res = $_arr['title'];
                                }
                                if (isset($_GET['id'])) {
                                    $_res .= ', ' . ___findpole('select pole from gallery_grupa where id=' . $_GET['id'], 'pole');
                                }
                            } else {
                                $_res = ___findpole('select pole from gallery_grupa where url="' . $_GET['url'] . '"', 'pole');
                            }
                        } else {
                            if ($_GET['action'] == 'search') {
                                $_arr = ___findarray('select h1, title from ceo where id=13');
                                if ($_arr['h1'] != '') {
                                    $_res = $_arr['h1'];
                                } else {
                                    $_res = $_arr['title'];
                                }
                            } else {
                                if ($_GET['action'] == 'voting') {
                                    $_arr = ___findarray('select h1, title from ceo where id=12');
                                    if ($_arr['h1'] != '') {
                                        $_res = $_arr['h1'];
                                        if (isset($_GET['arhiv'])) {
                                            $_res = 'Архив голосований';
                                        }
                                    } else {
                                        $_res = $_arr['title'];
                                    }
                                } else {
                                    if ($_GET['action'] == 'catalog') {
                                        $_arr = ___findarray('select h1, title from ceo where id=3');
                                        if ($_arr['h1'] != '') {
                                            $_res = $_arr['h1'];
                                        } else {
                                            $_res = $_arr['title'];
                                        }
                                    } else {
                                        if ($_GET['action'] == 'brand') {
                                            $_arr = ___findarray('select h1, title from ceo where id=9');
                                            if ($_arr['h1'] != '') {
                                                $_res = $_arr['h1'];
                                            } else {
                                                $_res = $_arr['title'];
                                            }
                                        } else {
                                            if ($_GET['action'] == 'basket') {
                                                $_arr = ___findarray('select h1, title from ceo where id=10');
                                                if ($_arr['h1'] != '') {
                                                    $_res = $_arr['h1'];
                                                } else {
                                                    $_res = $_arr['title'];
                                                }
                                            } else {
                                                if ($_GET['action'] == 'mycabinet') {
                                                    $_arr = ___findarray('select h1, title from ceo where id=11');
                                                    if ($_arr['h1'] != '') {
                                                        $_res = $_arr['h1'];
                                                    } else {
                                                        $_res = $_arr['title'];
                                                    }
                                                } else {
                                                    if ($_GET['action'] == 'filter') {
                                                        // имя текущего раздела
                                                        $_res = filter::get_name_curent_filter();
                                                    } else {
                                                        if ($_GET['action'] == 'registration') {
                                                            $_arr = ___findarray('select h1, title from ceo where id=8');
                                                            if ($_arr['h1'] != '') {
                                                                $_res = $_arr['h1'];
                                                            } else {
                                                                $_res = $_arr['title'];
                                                            }
                                                        } else {
                                                            /*
                                                             * костыль для 3 новостей
                                                             */
                                                            if (isset($_GET['type']) and $_GET['type'] == 1) {
                                                                $_res = $zag_radel['news1'];
                                                            } else {
                                                                if (isset($_GET['type']) and $_GET['type'] == 2) {
                                                                    $_res = $zag_radel['news2'];
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                } else {
                    $_res = $zag_radel['main'];
                }
            }
        }
    }
    return $_res;
}