private function getInput()
 {
     // Fetch input values;
     // Case: administration page;
     if (array_key_exists('page', $_REQUEST) && $_REQUEST['page'] != '') {
         $page = $_REQUEST['page'];
         if ($page == 'admin') {
             $this->admin_page = true;
         }
     }
     if ($this->admin_page) {
         if (RealEstateAgency_Util::isDefinedNonEmptyRequest('login')) {
             // login in progress;
             $this->login_in_progress = true;
             if (RealEstateAgency_Util::isDefinedNonEmptyRequest('nick')) {
                 $this->nick = $_POST['nick'];
             }
             if (RealEstateAgency_Util::isDefinedNonEmptyRequest('key')) {
                 $this->keyword = $_POST['key'];
             }
         }
     }
     if (RealEstateAgency_Util::isButton('disconnect') || tools_get_input('disconnect')) {
         $this->disconnect = true;
     }
     if ($this->login_in_progress) {
         if (array_key_exists('cookie_enabled', $_COOKIE) && $_COOKIE['cookie_enabled'] != '') {
             $this->cookie_enabled = true;
         } else {
             $this->cookie_enabled = false;
         }
     }
 }
 public function execute($page)
 {
     $globalData = $this->getGlobalData();
     $view = $this->getGlobalData()->getView();
     if (RealEstateAgency_Const::TYPE_FLAT == $page) {
     } else {
         if (RealEstateAgency_Const::TYPE_ROOM == $page) {
         } else {
             if (RealEstateAgency_Const::TYPE_HOUSE == $page) {
             } else {
                 if (RealEstateAgency_Const::TYPE_COTTAGE == $page) {
                 } else {
                     if (RealEstateAgency_Const::TYPE_COMMERCIAL == $page) {
                     } else {
                         if (RealEstateAgency_Const::TYPE_LAND == $page) {
                         } else {
                             return;
                         }
                     }
                 }
             }
         }
     }
     $rent1 = tools_get_input('rent');
     $rent2 = tools_get_input('op_type');
     $operation_type = 0;
     if ($rent2 == 1 || $rent1 == 1) {
         $operation_type = 1;
     }
     $view->page = $page;
     $search_period = $globalData->getViewVariable('search_period', 'search');
     $search_price_1 = $globalData->getViewVariable('search_price_1', 'search');
     $search_price_2 = $globalData->getViewVariable('search_price_2', 'search');
     $search_rooms = $globalData->getViewVariable('search_rooms', 'search');
     $search_city_district = $globalData->getViewVariable('search_city_district', 'search');
     $search_position = tools_get_input('search_position');
     $list = new RealEstateAgency_Object_RealEstateObjectList();
     $list->setGlobalData($this->getGlobalData());
     $list->setSearch($page);
     $filter = new RealEstateAgency_Object_SearchFilter();
     $filter->setOperationType($operation_type);
     $filter->setPeriod($search_period);
     $filter->setPriceFrom($search_price_1);
     $filter->setPriceTo($search_price_2);
     $filter->setRooms($search_rooms);
     $filter->setCityDistrict($search_city_district);
     $filter->setPosition($search_position);
     $filter->setLimit(RealEstateAgency_Const::OBJECTS_ON_PAGE);
     $filter->prepare();
     $list->loadBy($filter);
     $view->op_type = $filter->getOperationType();
     // $view->search_period = $filter->getPeriod();
     $view->search_price_1 = $filter->getPriceFrom();
     $view->search_price_2 = $filter->getPriceTo();
     $view->search_rooms = $filter->getRooms();
     $view->search_city_district = $filter->getCityDistrict();
     $view->search_position = $filter->getPosition();
     $globalData->setViewVariable('search_period', $filter->getPeriod(), 'search');
     $globalData->setViewVariable('search_price_1', $filter->getPriceFrom(), 'search');
     $globalData->setViewVariable('search_price_2', $filter->getPriceTo(), 'search');
     $globalData->setViewVariable('search_rooms', $filter->getRooms(), 'search');
     $globalData->setViewVariable('search_city_district', $filter->getCityDistrict(), 'search');
     $view->list_of_settlements = $list;
 }
 private function getInput()
 {
     $this->object_action = tools_get_input('object_action');
     $this->location_id = tools_get_input('location_id');
     $this->location_text = tools_get_input('location_text');
     $op_type = tools_get_input('op_type');
     if (1 == $op_type) {
         $op_type = 1;
     } else {
         $op_type = 0;
     }
     $this->operation_type = $op_type;
     if (tools_get_input('do_not_save')) {
         $this->do_not_save = true;
     }
     $this->action = 'secondpage';
     if ($this->location_id == NULL && $this->location_text == NULL) {
         $this->action = 'firstpage';
     }
     if (tools_is_button('just_save')) {
         $this->action = 'submit';
     }
 }
 private static function execute_really($globalData)
 {
     $login_necessary = false;
     Zend_Loader::loadClass('Zend_View');
     $view = new Zend_View();
     $view->setScriptPath(RealEstateAgency_Const::PATH_TEMPLATE);
     $globalData->initialize();
     $globalData->setView($view);
     require_once 'RealEstateAgency/Controller/Login.php';
     $loginObject = new RealEstateAgency_Controller_Login();
     $loginObject->setGlobalData($globalData);
     $loginObject->execute();
     $logged = $loginObject->isLogged();
     $isAdmin = $loginObject->isAdmin();
     $globalData->setLoginObject($loginObject);
     $object_counters = new RealEstateAgency_Object_Counters();
     if (!tools_get_input("remote")) {
         $object_counters->loadCounters($globalData);
         // load data and put it in the View.
     }
     $defaultPage = false;
     if (RealEstateAgency_Util::isDefinedNonEmptyRequest('page')) {
         $page = $_REQUEST['page'];
         if ($page == 'admin') {
             // Login/Logoff page;
             echo $view->render('admin.php');
         } else {
             if (RealEstateAgency_Const::TYPE_FLAT == $page || RealEstateAgency_Const::TYPE_ROOM == $page || RealEstateAgency_Const::TYPE_HOUSE == $page || RealEstateAgency_Const::TYPE_COTTAGE == $page || RealEstateAgency_Const::TYPE_COMMERCIAL == $page || RealEstateAgency_Const::TYPE_LAND == $page) {
                 // Flats/Rooms/Houses/Commercial page;
                 require_once 'RealEstateAgency/Controller/ForSearch.php';
                 $object = new RealEstateAgency_Controller_ForSearch();
                 $globalData->setPageName('search');
                 $object->setGlobalData($globalData);
                 $object->execute($page);
                 echo $view->render('search.php');
             } else {
                 if ($page == 'image') {
                     $view->object_id = tools_get_input('object_id');
                     echo $view->render('images.php');
                 } else {
                     if ($page == 'delete') {
                         if ($logged) {
                             $view->object_id = tools_get_input('object_id');
                             $view->really = tools_get_input('really');
                             $view->global_data = $globalData;
                             echo $view->render('delete.php');
                         } else {
                             $login_necessary = true;
                         }
                     } else {
                         if ($page == 'update') {
                             // Update real estate object;
                             if ($logged) {
                                 require_once 'RealEstateAgency/Controller/ForUpdate.php';
                                 $object = new RealEstateAgency_Controller_ForUpdate();
                                 $globalData->setPageName('update');
                                 $object->setGlobalData($globalData);
                                 $object->execute();
                                 echo $view->render('update.php');
                             } else {
                                 $login_necessary = true;
                             }
                         } else {
                             if ($page == 'area') {
                                 // Area;
                                 if ($isAdmin) {
                                     require_once 'RealEstateAgency/Controller/ForArea.php';
                                     $object = new RealEstateAgency_Controller_ForArea();
                                     $globalData->setPageName('area');
                                     $object->setGlobalData($globalData);
                                     $object->execute();
                                     echo $view->render('area.php');
                                 } else {
                                     $login_necessary = true;
                                 }
                             } else {
                                 if ($page == 'district') {
                                     // District;
                                     if ($isAdmin) {
                                         require_once 'RealEstateAgency/Controller/ForDistrict.php';
                                         $object = new RealEstateAgency_Controller_ForDistrict();
                                         $globalData->setPageName('district');
                                         $object->setGlobalData($globalData);
                                         $object->execute();
                                         echo $view->render('district.php');
                                     } else {
                                         $login_necessary = true;
                                     }
                                 } else {
                                     if ($page == 'settl') {
                                         // Settlement;
                                         if ($isAdmin) {
                                             require_once 'RealEstateAgency/Controller/ForSettlement.php';
                                             $object = new RealEstateAgency_Controller_ForSettlement();
                                             $globalData->setPageName('settl');
                                             $object->setGlobalData($globalData);
                                             $object->execute();
                                             echo $view->render('settl.php');
                                         } else {
                                             $login_necessary = true;
                                         }
                                     } else {
                                         if ($page == 'settl_part') {
                                             // Settlement part;
                                             if ($isAdmin) {
                                                 require_once 'RealEstateAgency/Controller/ForSettlementPart.php';
                                                 $object = new RealEstateAgency_Controller_ForSettlementPart();
                                                 $globalData->setPageName('settl_part');
                                                 $object->setGlobalData($globalData);
                                                 $object->execute();
                                                 echo $view->render('settl_part.php');
                                             } else {
                                                 $login_necessary = true;
                                             }
                                         } else {
                                             if ($page == 'object') {
                                                 // New real estate object;
                                                 if ($logged) {
                                                     require_once 'RealEstateAgency/Controller/ForObject.php';
                                                     $object = new RealEstateAgency_Controller_ForObject();
                                                     $globalData->setPageName('object_city');
                                                     $object->setGlobalData($globalData);
                                                     $object->execute();
                                                     echo $view->render('object_city.php');
                                                 } else {
                                                     $login_necessary = true;
                                                 }
                                             } else {
                                                 // Default;
                                                 $defaultPage = true;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         // Default;
         $defaultPage = true;
     }
     if ($login_necessary) {
         $defaultPage = true;
     }
     if ($defaultPage) {
         require_once 'RealEstateAgency/Controller/ForSearch.php';
         $object = new RealEstateAgency_Controller_ForSearch();
         $globalData->setPageName('search');
         $object->setGlobalData($globalData);
         $object->execute('flat');
         echo $view->render('search.php');
     }
 }
 /**
  * Read data from the web page;
  */
 public function readWebFormForUpdate()
 {
     $this->setObjectType(tools_get_input('r_e_type'));
     $this->setPrice(tools_get_input('price'));
     $this->setRooms(tools_get_input('rooms'));
     $this->setRoomsType(tools_get_input('rooms_type'));
     $this->setSettlementAreaID(tools_get_input('city_district'));
     $this->setSettlementSubPartName(tools_get_input('city_sub_district'));
     // version 1.4
     $this->setStreet(tools_get_input('street'));
     $this->setHouseNumber(tools_get_input('house_num'));
     $this->setSquareAll(tools_get_input('sq_all'));
     $this->setSquareLive(tools_get_input('sq_live'));
     $this->setSquareKitchen(tools_get_input('sq_kitchen'));
     $this->setSquareLand(tools_get_input('sq_land'));
     $this->setFloor(tools_get_input('floor'));
     $this->setFloors(tools_get_input('floors'));
     $this->setDescription(tools_get_input('description'));
     $this->setRentPeriod(tools_get_input('rent_period'));
     // version 1.5
 }
 private function getInput()
 {
     $this->action = 'showpage';
     $this->objectID = tools_get_input('object_id');
     $op_type = tools_get_input('op_type');
     if ($op_type == 1) {
         $op_type = 1;
     } else {
         $op_type = 0;
     }
     $this->operation_type = $op_type;
     if (tools_is_button('just_save')) {
         $this->action = 'submit';
     }
 }
<?php

if (!tools_get_input("remote")) {
    ?>

<table class="upper_table">

<tr>

<td>
	<img width="147" height="180" src="./title_1_7.jpg" alt="..."/>
</td>

<td>
	<p class="description_space">
	&nbsp;
	</p>
	<div class="description_text">
		<ul>
			<li>
			Real Estate Agency <span class="agency">...</span>
			</li>
			<li>
			Address:
			</li>
			<li>
			Phone:
			</li>
		<ul>
		<p style="color:#707070;text-align:center;">
...<br />
<?php

require_once 'RealEstateAgency/Const.php';
require_once 'RealEstateAgency/Util.php';
$dir = RealEstateAgency_Const::UPLOAD_IMAGES_DIR;
$name = tools_get_input('name');
$name = basename($name);
$ext = tools_get_ext($name);
$correct = true;
$mime = '';
if ('gif' == $ext) {
    $mime = 'image/gif';
} else {
    if ('png' == $ext) {
        $mime = 'image/png';
    } else {
        if ('jpg' == $ext) {
            $mime = 'image/pjpeg';
        } else {
            if ('jpeg' == $ext) {
                $mime = 'image/pjpeg';
            } else {
                $correct = false;
            }
        }
    }
}
$name = str_replace('/', '_', $name);
$name = str_replace('\\', '_', $name);
$filename = $dir . $name;
if (!tools_is_allowable_ext($ext)) {