pip.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. <?php
  2. function pip()
  3. {
  4. global $config;
  5. // Set our defaults
  6. $controller = $config['default_controller'];
  7. $action = 'index';
  8. $url = '';
  9. // Get request url and script url
  10. $request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
  11. $script_url = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : '';
  12. //Dirty job :)
  13. if (!stristr($request_url,'/?')) {
  14. $request_url = str_replace('?','/?',$request_url);
  15. }
  16. // Get our url path and trim the / of the left and the right
  17. if ($request_url != $script_url) $url = trim(preg_replace('/'. str_replace('/', '\/', str_replace('index.php', '', $script_url)) .'/', '', $request_url, 1), '/');
  18. //die('debug: '.$url);
  19. // Split the url into segments
  20. $segments = explode('/', $url);
  21. // Do our default checks
  22. if(isset($segments[0]) && $segments[0] != '') $controller = $segments[0];
  23. if(isset($segments[1]) && $segments[1] != '') $action = $segments[1];
  24. $routed = segmentRouter($segments,$controller,$action);
  25. $controller = $routed['controller'];
  26. $action = $routed['action'];
  27. $segments = $routed['segments'];
  28. // Get our controller file
  29. $path = APP_DIR . 'controllers/' . $controller . '.php';
  30. if (file_exists($path)) {
  31. //require_once('application/controllers/'.$controller.'.php');
  32. //die('okokok: '.$path);
  33. require_once($path);
  34. }
  35. else {
  36. $controller = $config['error_controller'];
  37. require_once(APP_DIR . 'controllers/' . $controller . '.php');
  38. }
  39. // Check the action exists
  40. if (!method_exists($controller, $action)) {
  41. $controller = $config['error_controller'];
  42. require_once(APP_DIR . 'controllers/' . $controller . '.php');
  43. $action = 'index';
  44. }
  45. // Create object and call method
  46. $obj = new $controller;
  47. die(call_user_func_array(array($obj, $action), array_slice($segments, 2)));
  48. }
  49. function segmentRouter($segments,$controller,$action) {
  50. if (stristr($segments[0], '?')) {
  51. $segments[0] = 'main';
  52. }
  53. //Check for controller
  54. $_SESSION['maptype'] = '';
  55. switch ($segments[0]) {
  56. case 'rockhome-irodak':
  57. $controller = 'offices';
  58. if ($segments[1]=='search') {
  59. $action = 'search';
  60. }
  61. elseif ($segments[1]=='reorder') {
  62. $action = 'reorder';
  63. }
  64. elseif ($segments[1]=='rate') {
  65. $action = 'rate';
  66. }
  67. elseif ($segments[1]=='properties') {
  68. $action = 'properties';
  69. }
  70. elseif ($segments[1]=='sendcontact') {
  71. $action = 'sendcontact';
  72. }
  73. elseif ($segments[1]=='pdfexport') {
  74. $action = 'pdfexport';
  75. }
  76. elseif ($segments[1]=='getrawlist') {
  77. $action = 'getrawlist';
  78. }
  79. elseif ($segments[1]=='') {
  80. $action = 'index';
  81. }
  82. else {
  83. $action = 'show';
  84. $_SESSION['maptype'] = 'initPropMap';
  85. $segments[2] = $segments[1];
  86. }
  87. break;
  88. case 'main':
  89. $controller = 'main';
  90. $action = 'index';
  91. $segments[2] = $segments[2];
  92. break;
  93. case 'exporter':
  94. $controller = 'main';
  95. $action = 'exporter';
  96. break;
  97. case 'aktivexp':
  98. $controller = 'main';
  99. $action = 'aktivexp';
  100. break;
  101. case 'openai':
  102. $controller = 'main';
  103. $action = 'sendrequest';
  104. break;
  105. case 'elado':
  106. if ($segments[3]=='') {
  107. $controller = 'property';
  108. $action = 'search';
  109. $roman = array(
  110. "budapest-i",
  111. "budapest-ii",
  112. "budapest-iii",
  113. "budapest-iv",
  114. "budapest-v",
  115. "budapest-vi",
  116. "budapest-vii",
  117. "budapest-viii",
  118. "budapest-ix",
  119. "budapest-x",
  120. "budapest-xi",
  121. "budapest-xii",
  122. "budapest-xiii",
  123. "budapest-xiv",
  124. "budapest-xv",
  125. "budapest-xvi",
  126. "budapest-xvii",
  127. "budapest-xviii",
  128. "budapest-xix",
  129. "budapest-xx",
  130. "budapest-xxi",
  131. "budapest-xxii",
  132. "budapest-xxiii");
  133. $arab = array(
  134. "Budapest 01",
  135. "Budapest 02",
  136. "Budapest 03",
  137. "Budapest 04",
  138. "Budapest 05",
  139. "Budapest 06",
  140. "Budapest 07",
  141. "Budapest 08",
  142. "Budapest 09",
  143. "Budapest 10",
  144. "Budapest 11",
  145. "Budapest 12",
  146. "Budapest 13",
  147. "Budapest 14",
  148. "Budapest 15",
  149. "Budapest 16",
  150. "Budapest 17",
  151. "Budapest 18",
  152. "Budapest 19",
  153. "Budapest 20",
  154. "Budapest 21",
  155. "Budapest 22",
  156. "Budapest 23"
  157. );
  158. $city = $segments[2];
  159. $city = str_replace($roman,$arab,$city);
  160. $city = str_replace("-kerulet","",$city);
  161. $_REQUEST['city'] = $city;
  162. $_REQUEST['ertekesites'] = $segments[0];
  163. if ($segments[1]=='lakas') {
  164. $_REQUEST['jelleg'] = 'Lakóingatlan - tarsashazi';
  165. }
  166. elseif ($segments[1]=='csaladihaz') {
  167. $_REQUEST['jelleg'] = 'Lakóingatlan - csaladihaz';
  168. }
  169. elseif ($segments[1]=='epuletresz') {
  170. $_REQUEST['jelleg'] = 'Lakóingatlan - epuletresz';
  171. }
  172. elseif ($segments[1]=='hazresz') {
  173. $_REQUEST['jelleg'] = 'Lakóingatlan - hazresz';
  174. }
  175. elseif ($segments[1]=='ikerhaz') {
  176. $_REQUEST['jelleg'] = 'Lakóingatlan - ikerhaz';
  177. }
  178. elseif ($segments[1]=='teljesepulet') {
  179. $_REQUEST['jelleg'] = 'Lakóingatlan - teljesepulet';
  180. }
  181. else {
  182. $_REQUEST['jelleg'] = $segments[1];
  183. }
  184. $segments[2] = 'filter';
  185. $_REQUEST['from'] = '/';
  186. }
  187. elseif (stristr($segments[2],'?')) {
  188. $controller = 'property';
  189. $action = 'search';
  190. $_REQUEST['city'] = '';
  191. $segments[2] = 'filter';
  192. }
  193. else {
  194. $controller = 'property';
  195. $action = 'show';
  196. $segments[2] = $segments[3];
  197. }
  198. break;
  199. case 'berletijog':
  200. if ($segments[3]=='') {
  201. $controller = 'property';
  202. $action = 'search';
  203. $roman = array(
  204. "budapest-i",
  205. "budapest-ii",
  206. "budapest-iii",
  207. "budapest-iv",
  208. "budapest-v",
  209. "budapest-vi",
  210. "budapest-vii",
  211. "budapest-viii",
  212. "budapest-ix",
  213. "budapest-x",
  214. "budapest-xi",
  215. "budapest-xii",
  216. "budapest-xiii",
  217. "budapest-xiv",
  218. "budapest-xv",
  219. "budapest-xvi",
  220. "budapest-xvii",
  221. "budapest-xviii",
  222. "budapest-xix",
  223. "budapest-xx",
  224. "budapest-xxi",
  225. "budapest-xxii",
  226. "budapest-xxiii");
  227. $arab = array(
  228. "Budapest 01",
  229. "Budapest 02",
  230. "Budapest 03",
  231. "Budapest 04",
  232. "Budapest 05",
  233. "Budapest 06",
  234. "Budapest 07",
  235. "Budapest 08",
  236. "Budapest 09",
  237. "Budapest 10",
  238. "Budapest 11",
  239. "Budapest 12",
  240. "Budapest 13",
  241. "Budapest 14",
  242. "Budapest 15",
  243. "Budapest 16",
  244. "Budapest 17",
  245. "Budapest 18",
  246. "Budapest 19",
  247. "Budapest 20",
  248. "Budapest 21",
  249. "Budapest 22",
  250. "Budapest 23"
  251. );
  252. $city = $segments[2];
  253. $city = str_replace($roman,$arab,$city);
  254. $city = str_replace("-kerulet","",$city);
  255. $_REQUEST['city'] = $city;
  256. $_REQUEST['ertekesites'] = $segments[0];
  257. if ($segments[1]=='lakas') {
  258. $_REQUEST['jelleg'] = 'Lakóingatlan - tarsashazi';
  259. }
  260. elseif ($segments[1]=='csaladihaz') {
  261. $_REQUEST['jelleg'] = 'Lakóingatlan - csaladihaz';
  262. }
  263. elseif ($segments[1]=='epuletresz') {
  264. $_REQUEST['jelleg'] = 'Lakóingatlan - epuletresz';
  265. }
  266. elseif ($segments[1]=='hazresz') {
  267. $_REQUEST['jelleg'] = 'Lakóingatlan - hazresz';
  268. }
  269. elseif ($segments[1]=='ikerhaz') {
  270. $_REQUEST['jelleg'] = 'Lakóingatlan - ikerhaz';
  271. }
  272. elseif ($segments[1]=='teljesepulet') {
  273. $_REQUEST['jelleg'] = 'Lakóingatlan - teljesepulet';
  274. }
  275. else {
  276. $_REQUEST['jelleg'] = $segments[1];
  277. }
  278. $segments[2] = 'filter';
  279. $_REQUEST['from'] = '/';
  280. }
  281. elseif (stristr($segments[2],'?')) {
  282. $controller = 'property';
  283. $action = 'search';
  284. $_REQUEST['city'] = '';
  285. $segments[2] = 'filter';
  286. }
  287. else {
  288. $controller = 'property';
  289. $action = 'show';
  290. $segments[2] = $segments[3];
  291. }
  292. break;
  293. case 'kiado':
  294. if ($segments[3]=='') {
  295. $controller = 'property';
  296. $action = 'search';
  297. $roman = array(
  298. "budapest-i",
  299. "budapest-ii",
  300. "budapest-iii",
  301. "budapest-iv",
  302. "budapest-v",
  303. "budapest-vi",
  304. "budapest-vii",
  305. "budapest-viii",
  306. "budapest-ix",
  307. "budapest-x",
  308. "budapest-xi",
  309. "budapest-xii",
  310. "budapest-xiii",
  311. "budapest-xiv",
  312. "budapest-xv",
  313. "budapest-xvi",
  314. "budapest-xvii",
  315. "budapest-xviii",
  316. "budapest-xix",
  317. "budapest-xx",
  318. "budapest-xxi",
  319. "budapest-xxii",
  320. "budapest-xxiii");
  321. $arab = array(
  322. "Budapest 01",
  323. "Budapest 02",
  324. "Budapest 03",
  325. "Budapest 04",
  326. "Budapest 05",
  327. "Budapest 06",
  328. "Budapest 07",
  329. "Budapest 08",
  330. "Budapest 09",
  331. "Budapest 10",
  332. "Budapest 11",
  333. "Budapest 12",
  334. "Budapest 13",
  335. "Budapest 14",
  336. "Budapest 15",
  337. "Budapest 16",
  338. "Budapest 17",
  339. "Budapest 18",
  340. "Budapest 19",
  341. "Budapest 20",
  342. "Budapest 21",
  343. "Budapest 22",
  344. "Budapest 23"
  345. );
  346. $city = $segments[2];
  347. $city = str_replace($roman,$arab,$city);
  348. $city = str_replace("-kerulet","",$city);
  349. $_REQUEST['city'] = $city;
  350. $_REQUEST['ertekesites'] = $segments[0];
  351. if ($segments[1]=='lakas') {
  352. $_REQUEST['jelleg'] = 'Lakóingatlan - tarsashazi';
  353. }
  354. elseif ($segments[1]=='csaladihaz') {
  355. $_REQUEST['jelleg'] = 'Lakóingatlan - csaladihaz';
  356. }
  357. elseif ($segments[1]=='epuletresz') {
  358. $_REQUEST['jelleg'] = 'Lakóingatlan - epuletresz';
  359. }
  360. elseif ($segments[1]=='hazresz') {
  361. $_REQUEST['jelleg'] = 'Lakóingatlan - hazresz';
  362. }
  363. elseif ($segments[1]=='ikerhaz') {
  364. $_REQUEST['jelleg'] = 'Lakóingatlan - ikerhaz';
  365. }
  366. elseif ($segments[1]=='teljesepulet') {
  367. $_REQUEST['jelleg'] = 'Lakóingatlan - teljesepulet';
  368. }
  369. else {
  370. $_REQUEST['jelleg'] = $segments[1];
  371. }
  372. $segments[2] = 'filter';
  373. $_REQUEST['from'] = '/';
  374. }
  375. elseif (stristr($segments[2],'?')) {
  376. $controller = 'property';
  377. $action = 'search';
  378. $_REQUEST['city'] = '';
  379. $segments[2] = 'filter';
  380. }
  381. else {
  382. $controller = 'property';
  383. $action = 'show';
  384. $segments[2] = $segments[3];
  385. }
  386. break;
  387. case 'arcsokkentett-ingatlanok':
  388. ///property/search/filter/?statusz=arcsokkent&from=/property/search/filter/
  389. $controller = 'property';
  390. $action = 'search';
  391. $segments[2] = 'filter';
  392. $_REQUEST['statusz'] = 'arcsokkent';
  393. $_REQUEST['city'] = '';
  394. $_REQUEST['from'] = '/property/search/filter/';
  395. break;
  396. case 'elado-otthonok':
  397. ///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/
  398. $controller = 'property';
  399. $action = 'search';
  400. $segments[2] = 'filter';
  401. $_REQUEST['statusz'] = 'off';
  402. $_REQUEST['ertekesites'] = 'elado';
  403. $_REQUEST['from'] = '/property/search/filter/';
  404. break;
  405. ///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/
  406. case 'kiado-otthonok':
  407. $controller = 'property';
  408. $action = 'search';
  409. $segments[2] = 'filter';
  410. $_REQUEST['statusz'] = 'off';
  411. $_REQUEST['ertekesites'] = 'kiado';
  412. $_REQUEST['from'] = '/property/search/filter/';
  413. break;
  414. ///property/search/filter/?statusz=legujabb&from=/property/search/filter/
  415. case 'legujabb-ajanlataink':
  416. $controller = 'property';
  417. $action = 'search';
  418. $segments[2] = 'filter';
  419. $_REQUEST['statusz'] = 'legujabb';
  420. $_REQUEST['from'] = '/property/search/filter/';
  421. break;
  422. ///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/
  423. case 'uzleti-ingatlanok':
  424. $controller = 'property';
  425. $action = 'search';
  426. $segments[2] = 'filter';
  427. break;
  428. case 'admin':
  429. //donothing
  430. break;
  431. case 'blog':
  432. //donothing
  433. break;
  434. case 'rockhome-tanacsadok':
  435. $controller = 'agents';
  436. if ($segments[1]=='search') {
  437. $action = 'search';
  438. }
  439. elseif ($segments[1]=='reorder') {
  440. $action = 'reorder';
  441. }
  442. elseif ($segments[1]=='rate') {
  443. $action = 'rate';
  444. }
  445. elseif ($segments[1]=='office') {
  446. $action = 'office';
  447. }
  448. elseif ($segments[1]=='iroda') {
  449. $action = 'office';
  450. }
  451. elseif ($segments[1]=='properties') {
  452. $action = 'properties';
  453. }
  454. elseif ($segments[1]=='sendcontact') {
  455. $action = 'sendcontact';
  456. }
  457. elseif ($segments[1]=='pdfexport') {
  458. $action = 'pdfexport';
  459. }
  460. elseif ($segments[1]=='vcard') {
  461. $action = 'vcard';
  462. }
  463. else {
  464. $action = 'show';
  465. $segments[2] = $segments[1];
  466. }
  467. break;
  468. case 'profile':
  469. //donothing
  470. break;
  471. case 'auth':
  472. //donothing
  473. break;
  474. case 'contact':
  475. //donothing
  476. break;
  477. case 'error':
  478. //donothing
  479. break;
  480. case 'pricefill':
  481. //donothing
  482. break;
  483. case 'packages':
  484. $controller = 'pages';
  485. $action = 'packages';
  486. $segments[2] = $segments[1];
  487. break;
  488. case 'data-management-information':
  489. $controller = 'pages';
  490. $action = 'gdpr';
  491. break;
  492. case 'terms-and-conditions':
  493. $controller = 'pages';
  494. $action = 'terms';
  495. break;
  496. case 'privacy-policy':
  497. $controller = 'pages';
  498. $action = 'privacy';
  499. break;
  500. case 'refund-policy':
  501. $controller = 'pages';
  502. $action = 'refound';
  503. break;
  504. case 'order':
  505. $controller = 'pages';
  506. $action = 'order';
  507. break;
  508. case 'payment':
  509. $controller = 'pages';
  510. $action = 'status';
  511. $segments[2] = $segments[1];
  512. break;
  513. case 'api':
  514. $controller = 'api';
  515. $action = $segments[1];
  516. break;
  517. case '':
  518. break;
  519. default:
  520. $controller = 'pages';
  521. $action = 'show';
  522. $segments[2] = $segments[0].'_'.$segments[1];
  523. break;
  524. }
  525. 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') {
  526. $controller = 'single';
  527. $action = 'show';
  528. $segments[2] = $segments[0];
  529. $_REQUEST['code'] = $segments[0];
  530. }
  531. if ($segments[0]=='single' && $segments[1]=='sendcontact') {
  532. $controller = 'single';
  533. $action = 'sendcontact';
  534. }
  535. $result['controller'] = $controller;
  536. $result['action'] = $action;
  537. $result['segments'] = $segments;
  538. return $result;
  539. }
  540. ?>