| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605 |
- <?php
- function pip()
- {
- global $config;
- // Set our defaults
- $controller = $config['default_controller'];
- $action = 'index';
- $url = '';
-
- // Get request url and script url
- $request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
- $script_url = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : '';
-
- //Dirty job :)
- if (!stristr($request_url,'/?')) {
- $request_url = str_replace('?','/?',$request_url);
- }
- // Get our url path and trim the / of the left and the right
- if ($request_url != $script_url) $url = trim(preg_replace('/'. str_replace('/', '\/', str_replace('index.php', '', $script_url)) .'/', '', $request_url, 1), '/');
- //die('debug: '.$url);
- // Split the url into segments
- $segments = explode('/', $url);
- // Do our default checks
- if(isset($segments[0]) && $segments[0] != '') $controller = $segments[0];
- if(isset($segments[1]) && $segments[1] != '') $action = $segments[1];
- $routed = segmentRouter($segments,$controller,$action);
- $controller = $routed['controller'];
- $action = $routed['action'];
- $segments = $routed['segments'];
- // Get our controller file
- $path = APP_DIR . 'controllers/' . $controller . '.php';
-
- if (file_exists($path)) {
- //require_once('application/controllers/'.$controller.'.php');
- //die('okokok: '.$path);
- require_once($path);
- }
- else {
- $controller = $config['error_controller'];
- require_once(APP_DIR . 'controllers/' . $controller . '.php');
- }
- // Check the action exists
- if (!method_exists($controller, $action)) {
- $controller = $config['error_controller'];
- require_once(APP_DIR . 'controllers/' . $controller . '.php');
- $action = 'index';
- }
-
- // Create object and call method
- $obj = new $controller;
- die(call_user_func_array(array($obj, $action), array_slice($segments, 2)));
- }
- function segmentRouter($segments,$controller,$action) {
- if (stristr($segments[0], '?')) {
- $segments[0] = 'main';
- }
- //Check for controller
- $_SESSION['maptype'] = '';
- switch ($segments[0]) {
- case 'rockhome-irodak':
- $controller = 'offices';
- if ($segments[1]=='search') {
- $action = 'search';
- }
- elseif ($segments[1]=='reorder') {
- $action = 'reorder';
- }
- elseif ($segments[1]=='rate') {
- $action = 'rate';
- }
- elseif ($segments[1]=='properties') {
- $action = 'properties';
- }
- elseif ($segments[1]=='sendcontact') {
- $action = 'sendcontact';
- }
- elseif ($segments[1]=='pdfexport') {
- $action = 'pdfexport';
- }
- elseif ($segments[1]=='getrawlist') {
- $action = 'getrawlist';
- }
- elseif ($segments[1]=='') {
- $action = 'index';
- }
- else {
- $action = 'show';
- $_SESSION['maptype'] = 'initPropMap';
- $segments[2] = $segments[1];
- }
- break;
- case 'main':
- $controller = 'main';
- $action = 'index';
- $segments[2] = $segments[2];
- break;
- case 'exporter':
- $controller = 'main';
- $action = 'exporter';
- break;
- case 'aktivexp':
- $controller = 'main';
- $action = 'aktivexp';
- break;
- case 'openai':
- $controller = 'main';
- $action = 'sendrequest';
- break;
- case 'elado':
- if ($segments[3]=='') {
- $controller = 'property';
- $action = 'search';
- $roman = array(
- "budapest-i",
- "budapest-ii",
- "budapest-iii",
- "budapest-iv",
- "budapest-v",
- "budapest-vi",
- "budapest-vii",
- "budapest-viii",
- "budapest-ix",
- "budapest-x",
- "budapest-xi",
- "budapest-xii",
- "budapest-xiii",
- "budapest-xiv",
- "budapest-xv",
- "budapest-xvi",
- "budapest-xvii",
- "budapest-xviii",
- "budapest-xix",
- "budapest-xx",
- "budapest-xxi",
- "budapest-xxii",
- "budapest-xxiii");
-
- $arab = array(
- "Budapest 01",
- "Budapest 02",
- "Budapest 03",
- "Budapest 04",
- "Budapest 05",
- "Budapest 06",
- "Budapest 07",
- "Budapest 08",
- "Budapest 09",
- "Budapest 10",
- "Budapest 11",
- "Budapest 12",
- "Budapest 13",
- "Budapest 14",
- "Budapest 15",
- "Budapest 16",
- "Budapest 17",
- "Budapest 18",
- "Budapest 19",
- "Budapest 20",
- "Budapest 21",
- "Budapest 22",
- "Budapest 23"
- );
- $city = $segments[2];
- $city = str_replace($roman,$arab,$city);
- $city = str_replace("-kerulet","",$city);
- $_REQUEST['city'] = $city;
- $_REQUEST['ertekesites'] = $segments[0];
- if ($segments[1]=='lakas') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - tarsashazi';
- }
- elseif ($segments[1]=='csaladihaz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - csaladihaz';
- }
- elseif ($segments[1]=='epuletresz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - epuletresz';
- }
- elseif ($segments[1]=='hazresz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - hazresz';
- }
- elseif ($segments[1]=='ikerhaz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - ikerhaz';
- }
- elseif ($segments[1]=='teljesepulet') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - teljesepulet';
- }
- else {
- $_REQUEST['jelleg'] = $segments[1];
- }
- $segments[2] = 'filter';
- $_REQUEST['from'] = '/';
- }
- elseif (stristr($segments[2],'?')) {
- $controller = 'property';
- $action = 'search';
- $_REQUEST['city'] = '';
- $segments[2] = 'filter';
- }
- else {
- $controller = 'property';
- $action = 'show';
- $segments[2] = $segments[3];
- }
- break;
- case 'berletijog':
- if ($segments[3]=='') {
- $controller = 'property';
- $action = 'search';
- $roman = array(
- "budapest-i",
- "budapest-ii",
- "budapest-iii",
- "budapest-iv",
- "budapest-v",
- "budapest-vi",
- "budapest-vii",
- "budapest-viii",
- "budapest-ix",
- "budapest-x",
- "budapest-xi",
- "budapest-xii",
- "budapest-xiii",
- "budapest-xiv",
- "budapest-xv",
- "budapest-xvi",
- "budapest-xvii",
- "budapest-xviii",
- "budapest-xix",
- "budapest-xx",
- "budapest-xxi",
- "budapest-xxii",
- "budapest-xxiii");
-
- $arab = array(
- "Budapest 01",
- "Budapest 02",
- "Budapest 03",
- "Budapest 04",
- "Budapest 05",
- "Budapest 06",
- "Budapest 07",
- "Budapest 08",
- "Budapest 09",
- "Budapest 10",
- "Budapest 11",
- "Budapest 12",
- "Budapest 13",
- "Budapest 14",
- "Budapest 15",
- "Budapest 16",
- "Budapest 17",
- "Budapest 18",
- "Budapest 19",
- "Budapest 20",
- "Budapest 21",
- "Budapest 22",
- "Budapest 23"
- );
- $city = $segments[2];
- $city = str_replace($roman,$arab,$city);
- $city = str_replace("-kerulet","",$city);
- $_REQUEST['city'] = $city;
- $_REQUEST['ertekesites'] = $segments[0];
- if ($segments[1]=='lakas') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - tarsashazi';
- }
- elseif ($segments[1]=='csaladihaz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - csaladihaz';
- }
- elseif ($segments[1]=='epuletresz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - epuletresz';
- }
- elseif ($segments[1]=='hazresz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - hazresz';
- }
- elseif ($segments[1]=='ikerhaz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - ikerhaz';
- }
- elseif ($segments[1]=='teljesepulet') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - teljesepulet';
- }
- else {
- $_REQUEST['jelleg'] = $segments[1];
- }
- $segments[2] = 'filter';
- $_REQUEST['from'] = '/';
- }
- elseif (stristr($segments[2],'?')) {
- $controller = 'property';
- $action = 'search';
- $_REQUEST['city'] = '';
- $segments[2] = 'filter';
- }
- else {
- $controller = 'property';
- $action = 'show';
- $segments[2] = $segments[3];
- }
- break;
- case 'kiado':
- if ($segments[3]=='') {
- $controller = 'property';
- $action = 'search';
- $roman = array(
- "budapest-i",
- "budapest-ii",
- "budapest-iii",
- "budapest-iv",
- "budapest-v",
- "budapest-vi",
- "budapest-vii",
- "budapest-viii",
- "budapest-ix",
- "budapest-x",
- "budapest-xi",
- "budapest-xii",
- "budapest-xiii",
- "budapest-xiv",
- "budapest-xv",
- "budapest-xvi",
- "budapest-xvii",
- "budapest-xviii",
- "budapest-xix",
- "budapest-xx",
- "budapest-xxi",
- "budapest-xxii",
- "budapest-xxiii");
-
- $arab = array(
- "Budapest 01",
- "Budapest 02",
- "Budapest 03",
- "Budapest 04",
- "Budapest 05",
- "Budapest 06",
- "Budapest 07",
- "Budapest 08",
- "Budapest 09",
- "Budapest 10",
- "Budapest 11",
- "Budapest 12",
- "Budapest 13",
- "Budapest 14",
- "Budapest 15",
- "Budapest 16",
- "Budapest 17",
- "Budapest 18",
- "Budapest 19",
- "Budapest 20",
- "Budapest 21",
- "Budapest 22",
- "Budapest 23"
- );
- $city = $segments[2];
- $city = str_replace($roman,$arab,$city);
- $city = str_replace("-kerulet","",$city);
- $_REQUEST['city'] = $city;
- $_REQUEST['ertekesites'] = $segments[0];
- if ($segments[1]=='lakas') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - tarsashazi';
- }
- elseif ($segments[1]=='csaladihaz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - csaladihaz';
- }
- elseif ($segments[1]=='epuletresz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - epuletresz';
- }
- elseif ($segments[1]=='hazresz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - hazresz';
- }
- elseif ($segments[1]=='ikerhaz') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - ikerhaz';
- }
- elseif ($segments[1]=='teljesepulet') {
- $_REQUEST['jelleg'] = 'Lakóingatlan - teljesepulet';
- }
- else {
- $_REQUEST['jelleg'] = $segments[1];
- }
- $segments[2] = 'filter';
- $_REQUEST['from'] = '/';
- }
- elseif (stristr($segments[2],'?')) {
- $controller = 'property';
- $action = 'search';
- $_REQUEST['city'] = '';
- $segments[2] = 'filter';
- }
- else {
- $controller = 'property';
- $action = 'show';
- $segments[2] = $segments[3];
- }
- break;
- case 'arcsokkentett-ingatlanok':
- ///property/search/filter/?statusz=arcsokkent&from=/property/search/filter/
- $controller = 'property';
- $action = 'search';
- $segments[2] = 'filter';
- $_REQUEST['statusz'] = 'arcsokkent';
- $_REQUEST['city'] = '';
- $_REQUEST['from'] = '/property/search/filter/';
- break;
- case 'elado-otthonok':
- ///property/search/filter/?statusz=off&ertekesites=elado&kilatas=undefined&ovezet=undefined&ferohely_garazs_min=undefined&ferohely_garazs_max=undefined&name=undefined&from=/property/search/filter/
- $controller = 'property';
- $action = 'search';
- $segments[2] = 'filter';
- $_REQUEST['statusz'] = 'off';
- $_REQUEST['ertekesites'] = 'elado';
- $_REQUEST['from'] = '/property/search/filter/';
- break;
- ///property/search/filter/?statusz=off&ertekesites=kiado&altipus=undefined&jogi_statusz=undefined&kilatas=undefined&futes=undefined&ovezet=undefined&tajolas=undefined&allapot=undefined&kornyek=undefined&telek_min=undefined&telek_max=undefined&epites_eve_min=undefined&epites_eve_max=undefined&ferohely_garazs_min=undefined&ferohely_garazs_max=undefined&name=undefined&from=/property/search/filter/
- case 'kiado-otthonok':
- $controller = 'property';
- $action = 'search';
- $segments[2] = 'filter';
- $_REQUEST['statusz'] = 'off';
- $_REQUEST['ertekesites'] = 'kiado';
- $_REQUEST['from'] = '/property/search/filter/';
- break;
- ///property/search/filter/?statusz=legujabb&from=/property/search/filter/
- case 'legujabb-ajanlataink':
- $controller = 'property';
- $action = 'search';
- $segments[2] = 'filter';
- $_REQUEST['statusz'] = 'legujabb';
- $_REQUEST['from'] = '/property/search/filter/';
- break;
- ///property/search/filter/?jelleg=kereskedelmi&altipus=undefined&kilatas=undefined&ovezet=undefined&tajolas=undefined&kornyek=undefined&telek_min=undefined&telek_max=undefined&ferohely_garazs_min=undefined&ferohely_garazs_max=undefined&name=undefined&from=/property/search/filter/
- case 'uzleti-ingatlanok':
- $controller = 'property';
- $action = 'search';
- $segments[2] = 'filter';
- break;
- case 'admin':
- //donothing
- break;
- case 'blog':
- //donothing
- break;
-
- case 'rockhome-tanacsadok':
- $controller = 'agents';
- if ($segments[1]=='search') {
- $action = 'search';
- }
- elseif ($segments[1]=='reorder') {
- $action = 'reorder';
- }
- elseif ($segments[1]=='rate') {
- $action = 'rate';
- }
- elseif ($segments[1]=='office') {
- $action = 'office';
- }
- elseif ($segments[1]=='iroda') {
- $action = 'office';
- }
- elseif ($segments[1]=='properties') {
- $action = 'properties';
- }
- elseif ($segments[1]=='sendcontact') {
- $action = 'sendcontact';
- }
- elseif ($segments[1]=='pdfexport') {
- $action = 'pdfexport';
- }
- elseif ($segments[1]=='vcard') {
- $action = 'vcard';
- }
- else {
- $action = 'show';
- $segments[2] = $segments[1];
- }
- break;
- case 'profile':
- //donothing
- break;
- case 'auth':
- //donothing
- break;
- case 'contact':
- //donothing
- break;
- case 'error':
- //donothing
- break;
- case 'pricefill':
- //donothing
- break;
- case 'packages':
- $controller = 'pages';
- $action = 'packages';
- $segments[2] = $segments[1];
- break;
- case 'data-management-information':
- $controller = 'pages';
- $action = 'gdpr';
- break;
- case 'terms-and-conditions':
- $controller = 'pages';
- $action = 'terms';
- break;
- case 'privacy-policy':
- $controller = 'pages';
- $action = 'privacy';
- break;
- case 'refund-policy':
- $controller = 'pages';
- $action = 'refound';
- break;
- case 'order':
- $controller = 'pages';
- $action = 'order';
- break;
- case 'payment':
- $controller = 'pages';
- $action = 'status';
- $segments[2] = $segments[1];
- break;
- case 'api':
- $controller = 'api';
- $action = $segments[1];
- break;
- case '':
- break;
- default:
- $controller = 'pages';
- $action = 'show';
- $segments[2] = $segments[0].'_'.$segments[1];
- break;
- }
- if (substr($segments[0],0,1)=='x' || substr($segments[0],0,1)=='U' || substr($segments[0],0,1)=='H' || substr($segments[0],0,1)=='G' || substr($segments[0],0,1)=='T' || substr($segments[0],0,2)=='NY') {
- $controller = 'single';
- $action = 'show';
- $segments[2] = $segments[0];
- $_REQUEST['code'] = $segments[0];
- }
- if ($segments[0]=='single' && $segments[1]=='sendcontact') {
- $controller = 'single';
- $action = 'sendcontact';
- }
- $result['controller'] = $controller;
- $result['action'] = $action;
- $result['segments'] = $segments;
- return $result;
- }
- ?>
|