Пример #1
0
function fallBackForm(&$data)
{
    global $smarty, $db;
    $smarty->assign($data);
    $_POST = $data;
    foreach (array('postcode', 'gridref', 'county_id', 'placename', 'all_checked') as $key) {
        if (isset($_POST[$key])) {
            $smarty->assign('elementused', $key);
        }
    }
    $smarty->reassignPostedDate("submitted_start");
    $smarty->reassignPostedDate("submitted_end");
    $smarty->reassignPostedDate("taken_start");
    $smarty->reassignPostedDate("taken_end");
    if (!empty($_POST['searchtext']) && preg_match('/^=/', $_POST['searchtext'])) {
        $smarty->assign('searchtext', preg_replace('/^=/', '', $_POST['searchtext']));
        $smarty->assign('ind_exact_checked', 'checked="checked"');
    } else {
        $smarty->assign('searchtext', $_POST['searchtext']);
    }
    if (!empty($_POST['exact_ind'])) {
        $smarty->assign('exact_ind_checked', 'checked="checked"');
    }
    if (!empty($_POST['all_ind'])) {
        $smarty->assign('all_checked', 'checked="checked"');
    }
    if (!empty($_POST['user_invert_ind'])) {
        $smarty->assign('user_invert_checked', 'checked="checked"');
    }
    if (!empty($_POST['reverse_order_ind'])) {
        $smarty->assign('reverse_order_checked', 'checked="checked"');
    }
    if (empty($db)) {
        $db = NewADOConnection($GLOBALS['DSN']);
        if (empty($db)) {
            die('Database connection failed');
        }
    }
    advanced_form($smarty, $db);
}
Пример #2
0
    // -------------------------------
    require_once 'geograph/searchcriteria.class.php';
    require_once 'geograph/searchengine.class.php';
    require_once 'geograph/searchenginebuilder.class.php';
    require_once 'geograph/searchenginediscuss.class.php';
    if (!empty($_GET['u'])) {
        $_GET['user_id'] = $_GET['u'];
    }
    $engine = new SearchEngineDiscuss('#');
    $engine->buildAdvancedQuery($_GET);
    //should never fail?? - but display form 'in case'
    $db = NewADOConnection($GLOBALS['DSN']);
    if (empty($db)) {
        die('Database connection failed');
    }
    advanced_form($smarty, $db);
} else {
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        // -------------------------------
        //  Build advacned query
        // -------------------------------
        require_once 'geograph/searchcriteria.class.php';
        require_once 'geograph/searchengine.class.php';
        require_once 'geograph/searchenginebuilder.class.php';
        require_once 'geograph/searchenginediscuss.class.php';
        if ($_POST['refine']) {
            //we could use the selected item but then have to check for numberic placenames
            $_POST['placename'] = $_POST['old-placename'];
        } else {
            $engine = new SearchEngineDiscuss('#');
            $engine->buildAdvancedQuery($_POST);