getIPAddress(); if ($ip!='') { return true; } else { return false; } } static function getIPAddress() { return $_SERVER['REMOTE_ADDR']; } static function validate_ip($ip) { if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false) { return false; } return true; } static function getMainCategories() { self::dbconnect(); global $conn; $res = mysqli_query($conn,"select * from azonics_categories where category_status='0' order by category_id asc;"); if (mysqli_num_rows($res)>0) { while ($row = mysqli_fetch_object($res)) { $menu[] = $row; } } return $menu; } static function checkAgentInFavorites($agentid) { self::dbconnect(); global $conn; $res = mysqli_query($conn,"select * from saved_agents where sp_userid='".$_SESSION['userid']."' and sp_agent_id='".$agentid."' and sp_status='1';"); if (mysqli_num_rows($res)>0) { return true; } else { return false; } } static function checkOfficeInFavorites($officeid) { self::dbconnect(); global $conn; $res = mysqli_query($conn,"select * from saved_offices where sp_userid='".$_SESSION['userid']."' and sp_office_id='".$officeid."' and sp_status='1';"); if (mysqli_num_rows($res)>0) { return true; } else { return false; } } static function get_user_data($userid) { self::dbconnect(); global $conn; if ($userid!='') { $res = mysqli_query($conn,"SELECT * FROM users WHERE id='".$userid."';"); if (mysqli_num_rows($res)>0) { return mysqli_fetch_object($res); } else { return false; } } else { return false; } } static function checkPropertyInFavorites($propertyID) { self::dbconnect(); global $conn; $res = mysqli_query($conn,"select * from saved_properties where sp_userid='".$_SESSION['userid']."' and sp_property_id='".$propertyID."' and sp_status='1';"); if (mysqli_num_rows($res)>0) { return true; } else { return false; } } static function getUsernameByUserID($uid='') { self::dbconnect(); global $conn; if ($uid) { $res = mysqli_query($conn,"select * from azonics_users where user_id='".$uid."';"); if (mysqli_num_rows($res)>0) { $row = mysqli_fetch_array($res); return $row['user_nick']; } else { return ''; } } else { return false; } } static function getPropertyImagesCount($id) { self::dbconnect2(); global $conn; if ($id!=='') { $res = mysqli_query($conn,"SELECT * FROM hiper_ingatlan_kep WHERE regszam='".$id."' ORDER BY sorrend ASC;"); return mysqli_num_rows($res); } else { return 0; } } static function getOfficeName($officeID) { self::dbconnect(); global $conn; if ($officeID!='') { $res = mysqli_query($conn,"SELECT * FROM hiper_iroda WHERE azonosito='".$officeID."';"); if (mysqli_num_rows($res)>0) { $row = mysqli_fetch_array($res); return $row['nev']; } else { return false; } } else { return false; } } static function get_image_url($fname) { $maindir = substr($fname,1,3); $subdir = substr($fname,1,5); //return 'https://prod.rockhome.hu:8445/pictures/ingatlan/'.$maindir.'/'.$subdir.'/'.$fname; return 'https://prod.rockhome.hu'.$fname; } static function get_image_url_mark($fname) { return 'https://prod.rockhome.hu'.$fname; } static function url_exists($url) { $file = $url; $file_headers = @get_headers($file); if(!$file_headers || stristr($file_headers[0],"404 Not Found")) { $exists = false; } else { $exists = true; } return $exists; } static function getOfficeRate($id,$justVotesNumber=false) { self::dbconnect(); global $conn; if ($id!=='') { $res = mysqli_query($conn,"SELECT SUM(rate) AS maxpoints, COUNT(rate) AS votes FROM iroda_ratings WHERE iroda='".$id."' AND statusz='1';"); if (mysqli_num_rows($res)>0) { $row = mysqli_fetch_array($res); $rate = round($row['maxpoints']/$row['votes']); if ($justVotesNumber) { return $row['votes']; } else { return $rate; } } else { return 0; } } else { return 0; } } static function getTitleByURL() { self::dbconnect(); global $conn; $temp = explode('?',$_SERVER['REQUEST_URI']); $res = mysqli_query($conn,"SELECT * FROM azonics_news WHERE slide_title='".$temp[0]."';"); if (mysqli_num_rows($res)>0 && $temp[0]!='/') { $row = mysqli_fetch_array($res); return $row['slide_subtitle']; } else { return 'Rock Home ingatlanok'; } } static function getKeywordsByURL() { self::dbconnect(); global $conn; $temp = explode('?',$_SERVER['REQUEST_URI']); $res = mysqli_query($conn,"SELECT * FROM azonics_news WHERE slide_title='".$temp[0]."';"); if (mysqli_num_rows($res)>0 && $temp[0]!='/') { $row = mysqli_fetch_array($res); return $row['slide_buttontitle']; } else { return 'Rock Home, ingatlanok'; } } static function getDescriptionByURL() { self::dbconnect(); global $conn; $temp = explode('?',$_SERVER['REQUEST_URI']); $res = mysqli_query($conn,"SELECT * FROM azonics_news WHERE slide_title='".$temp[0]."';"); if (mysqli_num_rows($res)>0 && $temp[0]!='/') { $row = mysqli_fetch_array($res); return $row['slide_buttonURL']; } else { return 'A Rock Home dinamikusan növekvő ingatlanhálózata magas szinvonalú és emberközpontú szolgáltatásokkal vár. Lakáseladás, kiadás vagy vétel? Velünk biztosan jól jársz! Új hangot hozunk a hazai ingatlanközvetítésbe - okosabban, gyorsabban, személyesebben - és persze rockosabban.'; } } static function getAgentRate($id,$justVotesNumber=false) { self::dbconnect(); global $conn; if ($id!=='') { $res = mysqli_query($conn,"SELECT SUM(rate) AS maxpoints, COUNT(rate) AS votes FROM munkatars_ratings WHERE munkatars='".$id."' AND statusz='1';"); if (mysqli_num_rows($res)>0) { $row = mysqli_fetch_array($res); $rate = round($row['maxpoints']/$row['votes']); if ($justVotesNumber==true) { return $row['votes']; } else { return $rate; } } else { return 0; } } else { return 0; } } static function getErtekesitesTipusOptions($selected='') { } static function getKey($key,$val) { self::dbconnect2(); global $conn; if ($key!='' && $val!='') { $res = mysqli_query($conn,"SELECT `config_value` AS emelet FROM `dictionary` WHERE `group`='".$key."' AND `config_key`='".$val."';") or die(mysqli_error($conn)); if (mysqli_num_rows($res)>0) { $row = mysqli_fetch_array($res); return $row['emelet']; } else { return false; } } else { return false; } } static function getPropertyTeaser($property,$showAddress=true) { if ($property->ertekesites=='elado') { $result = 'Eladó'; } else { $result = 'Kiadó'; } if ($property->tipus=='tarsashazi') { $result.= ' lakás'; } elseif ($property->tipus=='csaladihaz') { $result.= ' családi ház'; } elseif ($property->tipus=='epuletresz') { $result.= ' épületrész'; } elseif ($property->tipus=='hazresz') { $result.= ' házrész'; } elseif ($property->tipus=='ikerhaz') { $result.= ' ikerház'; } elseif ($property->tipus=='onalloepulet') { $result.= ' önálló épület'; } elseif ($property->tipus=='teljesepulet' && $property->jelleg!='telek') { $result.= ' teljes épület'; } elseif ($property->tipus=='beruhazasi') { $result.= ' beruházás'; } elseif ($property->jelleg=='garazs') { $result.= ' garázs'; } elseif ($property->jelleg=='kereskedelmi') { $result.= ' kereskedelmi'; } elseif ($property->jelleg=='mezogazdasagi') { $result.= ' mezőgazdasági'; } elseif ($property->tipus=='tarolo') { $result.= ' tároló'; } elseif ($property->jelleg=='telek') { $result.= ' telek'; } /*if ($showAddress) { if (stristr($property->telepules,'Budapest')) { $result.= ' '.$property->telepules.'. kerület'; } else { $result.= ' '.$property->telepules; } }*/ return $result; } static function getPageSlug($pageID) { self::dbconnect(); global $conn; if ($pageID!='') { $res = mysqli_query($conn,"SELECT page_slug FROM azonics_pages WHERE page_id='".$pageID."';"); if (mysqli_num_rows($res)>0) { $row = mysqli_fetch_array($res); return $row['page_slug']; } else { return false; } } else { return false; } } static function generateSlug($key) { $key = strtolower($key); $key = str_replace(" ","-",$key); $key = str_replace(".","",$key); $key = str_replace("(","-",$key); $key = str_replace(")","-",$key); $accented = array( "á", "é", "í", "ó", "ö", "ő", "ú", "ü", "ű" ); $mask = array( "a", "e", "i", "o", "o", "o", "u", "u", "u" ); $key = str_replace($accented,$mask,$key); if (stristr($key,'budapest')) { $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" ); $key = str_replace($arab,$roman,$key); $key.= '-kerulet'; } return $key; } }