function add($s) { if (empty($_POST)) { if (isset($_COOKIE['contacts'])) { $errors['val']['contacts'] = $_COOKIE['contacts']; } else { $errors = NULL; } $block_html = Html::pageHouseAdd($errors); $s->assign("block_html",$block_html); $s->assign("YANDEX_KEY",YANDEX_KEY); $s->assign("LAT_CENTER_REGION",LAT_CENTER_REGION); $s->assign("LON_CENTER_REGION",LON_CENTER_REGION); $s->display("house_add.tpl"); } else { $errors = House::checkForm($_REQUEST,''); require_once './libs/securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { $errors['captcha']['is_error'] = 1; } if (!isset($errors['is_error'])&&!isset($errors['captcha']['is_error'])) { $house_id = House::addStatic($_POST); setcookie('contacts',stripslashes($_POST['contacts'])); $_SESSION['last_house_id'] = $house_id; if ($house_id > 0) header("Location: /house.html?action=view&id=".$house_id); exit(); } else { //echo "Error:".print_r($errors); $block_html = Html::pageHouseAdd($errors); $s->assign("YANDEX_KEY",YANDEX_KEY); if (isset($_SESSION['admin'])) $s->assign("is_admin",$_SESSION['admin']); $s->assign("block_html",$block_html); $s->display("house_add.tpl"); } } }