rdeto WHERE nagyveg >= NOW() AND country_id = ' . $country_id . ($fokat > 0 ? ' AND fokat = ' . $fokat : '') . $sql_neme ); } while ( $row = $res->fetchRow() ) { $a_aktivHirdetok[] = $row['id']; } if (!empty($a_aktivHirdetok)) { $a_cim_id = array(); if ($keresohoz === true and $i_neme == 99) { // a keresővel szinkronban működő valós páros hirdetések számához való lekérdezés (dzsozi @ 160223) $sql = "SELECT hirdeto_cim." . $s_level . "_id, COUNT(DISTINCT hirdeto_rel.id) AS szam FROM hirdeto_cim, hirdeto_rel WHERE hirdeto_cim.hird_id IN (" . implode(',', $a_aktivHirdetok) . ") AND hirdeto_cim." . $s_level . "_id > 0 AND ( (hirdeto_rel.hird_id_1 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (1,3)) OR (hirdeto_rel.hird_id_2 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (2,3)) ) AND hirdeto_rel.veg >= NOW() AND hirdeto_rel.`status` = 1 AND hirdeto_rel.van_kep = 1 GROUP BY hirdeto_cim." . $s_level . "_id UNION ( SELECT 'budapest', COUNT(DISTINCT hirdeto_rel.id) AS szam FROM hirdeto_cim, hirdeto_rel WHERE hirdeto_cim.hird_id IN (" . implode(',', $a_aktivHirdetok) . ") AND hirdeto_cim.level_1_id = 1 AND ( (hirdeto_rel.hird_id_1 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (1,3)) OR (hirdeto_rel.hird_id_2 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (2,3)) ) AND hirdeto_rel.veg >= NOW() AND hirdeto_rel.`status` = 1 AND hirdeto_rel.van_kep = 1 ) UNION ( SELECT 'buda', COUNT(DISTINCT hirdeto_rel.id) AS szam FROM hirdeto_cim, hirdeto_rel WHERE hirdeto_cim.hird_id IN (" . implode(',', $a_aktivHirdetok) . ") AND hirdeto_cim." . $s_level . "_id IN (52, 13, 15, 8, 62, 128) AND ( (hirdeto_rel.hird_id_1 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (1,3)) OR (hirdeto_rel.hird_id_2 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (2,3)) ) AND hirdeto_rel.veg >= NOW() AND hirdeto_rel.`status` = 1 AND hirdeto_rel.van_kep = 1 ) UNION ( SELECT 'pest', COUNT(DISTINCT hirdeto_rel.id) AS szam FROM hirdeto_cim, hirdeto_rel WHERE hirdeto_cim.hird_id IN (" . implode(',', $a_aktivHirdetok) . ") AND hirdeto_cim." . $s_level . "_id IN (39, 21, 22, 5, 14, 10, 16, 2, 12, 18, 82, 47, 30, 6, 166, 74, 103) AND ( (hirdeto_rel.hird_id_1 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (1,3)) OR (hirdeto_rel.hird_id_2 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (2,3)) ) AND hirdeto_rel.veg >= NOW() AND hirdeto_rel.`status` = 1 AND hirdeto_rel.van_kep = 1 ) UNION ( SELECT 'belvaros', COUNT(DISTINCT hirdeto_rel.id) AS szam FROM hirdeto_cim, hirdeto_rel WHERE hirdeto_cim.hird_id IN (" . implode(',', $a_aktivHirdetok) . ") AND hirdeto_cim." . $s_level . "_id IN (52, 21, 22, 5, 14, 10) AND ( (hirdeto_rel.hird_id_1 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (1,3)) OR (hirdeto_rel.hird_id_2 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (2,3)) ) AND hirdeto_rel.veg >= NOW() AND hirdeto_rel.`status` = 1 AND hirdeto_rel.van_kep = 1 ) UNION ( SELECT 'videk', COUNT(DISTINCT hirdeto_rel.id) AS szam FROM hirdeto_cim, hirdeto_rel WHERE hirdeto_cim.hird_id IN (" . implode(',', $a_aktivHirdetok) . ") AND hirdeto_cim.level_1_id != 1 AND ( (hirdeto_rel.hird_id_1 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (1,3)) OR (hirdeto_rel.hird_id_2 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (2,3)) ) AND hirdeto_rel.veg >= NOW() AND hirdeto_rel.`status` = 1 AND hirdeto_rel.van_kep = 1 ) UNION ( SELECT 'osszes', COUNT(DISTINCT hirdeto_rel.id) AS szam FROM hirdeto_cim, hirdeto_rel WHERE hirdeto_cim.hird_id IN (" . implode(',', $a_aktivHirdetok) . ") AND hirdeto_cim." . $s_level . "_id > 0 AND ( (hirdeto_rel.hird_id_1 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (1,3)) OR (hirdeto_rel.hird_id_2 = hirdeto_cim.hird_id AND hirdeto_rel.kinel_fogadnak IN (2,3)) ) AND hirdeto_rel.veg >= NOW() AND hirdeto_rel.`status` = 1 AND hirdeto_rel.van_kep = 1 ) "; $res = query($sql); } else { $res = query( 'SELECT ' . $s_level . '_id, COUNT(hird_id) AS szam FROM hirdeto_cim WHERE hird_id IN (' . implode( ',', $a_aktivHirdetok ) . ') AND ' . $s_level . '_id > 0 GROUP BY ' . $s_level . '_id' ); } while ( $row = $res->fetchRow() ) { $a_hirdetoszamok[$fokat][$row[$s_level . '_id']]['szam'] = $row['szam']; if (is_numeric($row[$s_level . '_id'])) { $a_cim_id[] = $row[$s_level . '_id']; } } if (is_array($a_cim_id) && !empty($a_cim_id)) { $res = query( 'SELECT id, name, sort,parent_id FROM address_' . $s_level . ' WHERE id IN (' . implode(',', $a_cim_id) . ')' ); while ( $row = $res->fetchRow() ) { $a_hirdetoszamok[$fokat][$row['id']]['nev'] = $row['name']; $a_hirdetoszamok[$fokat][$row['id']]['sort'] = $row['sort']; $a_hirdetoszamok[$fokat][$row['id']]['parent_id'] = $row['parent_id']; $a_hirdetoszamok[$fokat][$row['id']]['megye_nev'] = getOne( "select name from address_level_1 where id=" . $row['parent_id'] ); } } $cache->set($s_cacheKey, $a_hirdetoszamok); } } } return $a_hirdetoszamok; } else { return false; } } /** * HirdetoSzamok4() * * @param integer $i_level * @param integer $i_neme * @return */ function HirdetoSzamok4($i_level = 1, $i_neme = 0) // az új hirdető adatlapok kapcsán a blocks/lockinwall3.php-ben van meghívva (dzsozi @ 150708) { global $alap, $cache, $country_id, $lap; $a_nemek = array( 0 => 'Nő', 1 => 'Férfi', 2 => 'Travi', 3 => 'Összes', 99 => 'Páros' // ez itt nem lesz jó ha a párosokat nem nemként kezeljük majd (dzsozi @ 150708) ); if (array_key_exists($i_neme, $a_nemek)) { $s_level = 'level_' . $i_level; $s_cacheKey = 'hirdetoszamok4_level_' . $i_level . '_' . $i_neme; if ($lap == 'hirdetesek_listaja') { $s_cacheKey .= '_hirdi_lista'; } if ( ( $a_hirdetoszamok = $cache->get($s_cacheKey)) === false ) { $a_hirdetoszamok = array(); if ($lap == 'hirdetesek_listaja') { $sql_neme = ''; } else { switch ($i_neme) { case 3: $sql_neme = ''; break; //összes case 99: $sql_neme = ' AND ( id IN (SELECT hird_id_1 FROM hirdeto_rel WHERE `status` = 1 AND veg >= NOW()) OR id IN (SELECT hird_id_2 FROM hirdeto_rel WHERE `status` = 1 AND veg >= NOW()) ) '; break; //páros // ez itt nem lesz jó ha a párosokat nem nemként kezeljük majd (dzsozi @ 150708) default: $sql_neme = ' AND neme = ' . $i_neme; //nő, férfi, travi } } for ( $fokat = 0; $fokat <= 4; $fokat++ ) // 1=szexpartner, 2=csak masszázs, 3=szexpartner-masszázs, 4=erotikus masszázs (dzsozi @ 150708) { $a_aktivHirdetok = array(); switch ($fokat) { case 1: { $sql_fokat = " AND kateg_szexpartner = 1 "; $fokat_key = 'szexpartner'; } break; case 2: { $sql_fokat = " AND kateg_csak_massz = 1 "; $fokat_key = 'csak_massz'; } break; case 3: { $sql_fokat = " AND kateg_szex_massz = 1 "; $fokat_key = 'szex_massz'; } break; case 4: { $sql_fokat = " AND kateg_erotikus_massz = 1 "; $fokat_key = 'erotikus_massz'; } break; } $sql = "SELECT id FROM hirdeto_uj WHERE country_id = " . intval($country_id) . " " . ($fokat > 0 ? $sql_fokat : '') . " " . $sql_neme . " " . ($lap != 'hirdetesek_listaja' ? ' AND aktiv = 1 ' : ''); $res = query($sql); while ( $row = $res->fetchRow() ) { $a_aktivHirdetok[] = $row['id']; } if (!empty($a_aktivHirdetok)) { $a_cim_id = array(); $res = query( 'SELECT ' . $s_level . '_id, COUNT(hird_id) AS szam FROM hirdeto_uj_cim WHERE hird_id IN (' . implode( ',', $a_aktivHirdetok ) . ') AND ' . $s_level . '_id > 0 GROUP BY ' . $s_level . '_id' ); while ( $row = $res->fetchRow() ) { $a_hirdetoszamok[$fokat_key][$row[$s_level . '_id']]['szam'] = $row['szam']; $a_cim_id[] = $row[$s_level . '_id']; } if (is_array($a_cim_id) && !empty($a_cim_id)) { $res = query( 'SELECT id, name, sort FROM address_' . $s_level . ' WHERE id IN (' . implode( ',', $a_cim_id ) . ')' ); while ( $row = $res->fetchRow() ) { $a_hirdetoszamok[$fokat_key][$row['id']]['nev'] = $row['name']; $a_hirdetoszamok[$fokat_key][$row['id']]['sort'] = $row['sort']; } } $cache->set($s_cacheKey, $a_hirdetoszamok); } } } return $a_hirdetoszamok; } else { return false; } } /** * HirdetoSzamokCallgirlNyitolap() * * @param integer $fokat * @return */ function HirdetoSzamokCallgirlNyitolap($fokat = 1) { global $alap, $cache; $ret = false; if ($fokat == 1 or $fokat == 2) { $ret = $cache->get('hirdetoszamok_callgirl_nyitolap_' . $fokat, 'hirdeto_szamok'); if ($ret === false) { $ret = array(); /* $sql = "SELECT address_country.id AS country_id, address_country.code AS country_code, COUNT(hirdeto.id) AS szam FROM hirdeto, address_country WHERE hirdeto.fokat = " . $fokat . " AND hirdeto.veg >= NOW() AND hirdeto.nagyveg >= NOW() AND hirdeto.country_id = address_country.id GROUP BY address_country.id"; */ $sql = "SELECT address_country.id AS country_id, address_country.code AS country_code, COUNT(mv_hirdeto.hird_id) AS szam FROM mv_hirdeto, address_country WHERE mv_hirdeto.fokat = " . $fokat . " AND mv_hirdeto.country_id = address_country.id GROUP BY address_country.id"; $res = query($sql); if ($res->numRows() > 0) { while ( $row = $res->fetchRow() ) { // páros hirdetések számításba vétele (dzsozi @ 131003) $paros = getOne( 'SELECT COUNT(id) AS szam FROM hirdeto_rel WHERE van_kep = 1 AND veg >= NOW() AND `status` = 1 AND ( hird_id_1 IN ( SELECT id FROM hirdeto WHERE fokat = ' . $fokat . ' AND country_id = ' . $row['country_id'] . ' ) OR hird_id_2 IN ( SELECT id FROM hirdeto WHERE fokat = ' . $fokat . ' AND country_id = ' . $row['country_id'] . ' ) )' ); $row['szam'] += $paros; $ret[] = $row; } /* ez ide nem kell mert a nyitolap megnyitasakor mindket fokatra lefut a fgv minek kovetkezteban az 1-es cache torlodik is szinte egybol azutan, hogy letrejott es igy nem sok ertelme van a cachenek (dzsozi @ 131002) $cache->delete('hirdetoszamok_callgirl_nyitolap_1', 'hirdeto_szamok'); $cache->delete('hirdetoszamok_callgirl_nyitolap_2', 'hirdeto_szamok'); */ $cache->set('hirdetoszamok_callgirl_nyitolap_' . $fokat, $ret, 'hirdeto_szamok'); } } } return $ret; } /** * BeszamoloSzamok() * * @param integer $i_level * @return */ function BeszamoloSzamok($i_level = 1) { global $alap, $cache, $country_id; $s_level = 'level_' . $i_level; //if ( ( $a_beszamoloSzamok = $cache->get( 'beszamoloszamok_level_' . $i_level ) ) === false ) if (1 == 1) { $a_aktivBeszik = array(); $res = query('SELECT id FROM besz WHERE status = 1 AND country_id = ' . $country_id); while ( $row = $res->fetchRow() ) { $a_aktivBeszik[] = $row['id']; } $a_cim_id = array(); $res = query( 'SELECT ' . $s_level . '_id, COUNT(besz_id) AS szam FROM besz_cim WHERE besz_id IN (' . implode( ',', $a_aktivBeszik ) . ') GROUP BY ' . $s_level . '_id' ); while ( $row = $res->fetchRow() ) { $a_beszamoloSzamok_tmp[$row[$s_level . '_id']]['szam'] = $row['szam']; $a_cim_id[] = $row[$s_level . '_id']; } //hibakiir($a_cim_id); if (is_array($a_cim_id) && !empty($a_cim_id)) { $res = query( 'SELECT id, name, parent_id FROM address_' . $s_level . ' WHERE id IN (' . implode(',', $a_cim_id) . ')' ); while ( $row = $res->fetchRow() ) { $a_beszamoloSzamok[$row['parent_id']][$row['id']] = array('name' => $row['name'], 'szam' => $a_beszamoloSzamok_tmp[$row['id']]['szam']); } } $cache->set('beszamoloszamok_level_' . $i_level, $a_beszamoloSzamok); } return $a_beszamoloSzamok; } /** * BeszamoloSzamok2() * * @param integer $i_level * @return */ function BeszamoloSzamok2($i_level = 1) { global $alap, $cache, $country_id; $s_level = 'level_' . $i_level; if ( ( $a_beszamoloszamok = $cache->get('beszamoloszamok_level_' . $i_level)) === false ) //if ( 1 == 1 ) { $a_beszamoloszamok = array(); for ( $fokat = 0; $fokat <= 2; $fokat++ ) { $a_aktivBeszik = array(); $res = query( 'SELECT id FROM besz WHERE status = 1 AND country_id = ' . $country_id . ($fokat > 0 ? ' AND besz_tipus = ' . $fokat : '') ); while ( $row = $res->fetchRow() ) { $a_aktivBeszik[] = $row['id']; } if (!empty($a_aktivBeszik)) { $a_cim_id = array(); $res = query( 'SELECT ' . $s_level . '_id, COUNT(besz_id) AS szam FROM besz_cim WHERE besz_id IN (' . implode(',', $a_aktivBeszik) . ') AND ' . $s_level . '_id > 0 GROUP BY ' . $s_level . '_id' ); while ( $row = $res->fetchRow() ) { $a_beszamoloszamok[$fokat][$row[$s_level . '_id']]['szam'] = $row['szam']; $a_cim_id[] = $row[$s_level . '_id']; } //hibakiir($a_cim_id); if (is_array($a_cim_id) && !empty($a_cim_id)) { $res = query( 'SELECT id, name, sort FROM address_' . $s_level . ' WHERE id IN (' . implode( ',', $a_cim_id ) . ')' ); while ( $row = $res->fetchRow() ) { $a_beszamoloszamok[$fokat][$row['id']]['nev'] = $row['name']; $a_beszamoloszamok[$fokat][$row['id']]['sort'] = $row['sort']; } } $cache->set('beszamoloszamok_level_' . $i_level, $a_beszamoloszamok); } } } return $a_beszamoloszamok; } /** * BeszamoloSzamok3() * * @return */ function BeszamoloSzamok3() { global $alap, $cache; $a_b = $cache->get('beszamoloszamok3', 'beszamolok'); if ($a_b === false) { $res = query( "select count(id) c,besz_tipus,if(elegedett=3,60,if(elegedett=2 and sorrend!=99,50,sorrend)) sorrend from besz where status=1 group by besz_tipus,3" ); $a_b = array(); while ( $row = $res->fetchRow() ) { $a_b[$row["besz_tipus"]][$row["sorrend"]] = $row["c"]; } $cache->set('beszamoloszamok3', $a_b, 'beszamolok'); } return $a_b; } /** * HirdetoComUser() * * @param mixed $user_id * @return */ function HirdetoComUser($user_id) { global $alap, $cache; $s_cacheKey = $user_id; if ( ( $liddd = $cache->get($s_cacheKey, 'hirdeto_com_user')) !== false ) { return $liddd; } $liddd = 0; $res = query('SELECT id FROM hirdeto WHERE com_user_id = ' . $user_id . ' AND nagyveg >= NOW()'); if ($res->numRows() == 1) { $row = $res->fetchRow(); $liddd = $row['id']; } else { $res = query('SELECT id FROM hirdeto WHERE user_id = ' . $user_id . ' AND nagyveg >= NOW()'); if ($res->numRows() == 1) { $row = $res->fetchRow(); $liddd = $row['id']; } } $cache->set($s_cacheKey, $liddd, 'hirdeto_com_user', 3600); return $liddd; } /** * AddressCountry() * * @return */ function AddressCountry() { global $alap, $cache; $s_cacheKey = 'address_country'; if ( ( $a_address_country = $cache->get($s_cacheKey)) !== false ) { return $a_address_country; } $a_address_country = array(); $i_szam = 0; $res = query("SELECT * FROM address_country"); while ( $row = $res->fetchRow() ) { $a_address_country[$i_szam]['id'] = $row['id']; $a_address_country[$i_szam]['telephone_code'] = $row['telephone_code']; $a_address_country[$i_szam]['telephone_length'] = $row['telephone_length']; $a_address_country[$i_szam]['default_lang'] = $row['default_lang']; $a_address_country[$i_szam]['domain'] = $row['domain']; $a_address_country[$i_szam]['code'] = $row['code']; $a_address_country[$i_szam]['gmap_latitude'] = $row['gmap_latitude']; $a_address_country[$i_szam]['gmap_longitude'] = $row['gmap_longitude']; $a_address_country[$i_szam]['gmap_zoom'] = $row['gmap_zoom']; $i_szam++; } $cache->set($s_cacheKey, $a_address_country, '', 86400); return $a_address_country; } /** * HirdetesekSzama() * * @return */ function HirdetesekSzama() { global $alap, $cache; if ( ( $szam = $cache->get('HirdetesekSzama')) !== false ) { return $szam; } $szam = getOne('SELECT COUNT(hird_id) AS szam FROM mv_hirdeto WHERE country_id = 1'); //$szam = getOne('SELECT COUNT(id) AS szam FROM hirdeto WHERE nagyveg >= NOW()'); $cache->set('HirdetesekSzama', $szam, 'hirdeto_szamok', 600); return $szam; } /** * GetAddressLevel() * * @param mixed $inp_id * @param integer $i_level * @return */ function GetAddressLevel($inp_id, $i_level = 1) { global $alap, $cache; if (isset($inp_id) && is_numeric($inp_id) && $inp_id > 0) { if (isset($i_level) && is_numeric($i_level) && $i_level > 0) { $res = query('SELECT name FROM address_level_' . $i_level . ' WHERE id = ' . $inp_id); if ($res->numRows() > 0) { $row = $res->fetchRow(MDB2_FETCHMODE_ASSOC); return $row['name']; } } } return ''; } /** * GetLevel1() * * @param mixed $inp_id * @return */ function GetLevel1($inp_id) { global $alap, $cache; if ( ( $a_address_level_1 = $cache->get('addess_level_1', 'address_cache')) === false ) { $a_address_level_1 = array(); $sql = 'SELECT id, name FROM address_level_1 ORDER BY id'; $res = query($sql); if ($res->numRows() > 0) { while ( $row = $res->fetchRow() ) { $a_address_level_1[$row['id']] = $row['name']; } } $cache->set('addess_level_1', $a_address_level_1, 'address_cache', -1); } if (isset($inp_id) && is_numeric($inp_id) && $inp_id > 0) { return $a_address_level_1[$inp_id]; } else { return '.'; } } /** * OrszagokHirdetovel() * * @param bool $lang * @param integer $fokat * @return */ function OrszagokHirdetovel($lang = false, $fokat = 0) { global $alap, $cache, $user, $lang_country; if ($lang === false) { $lang = $user->lang; } $s_cacheKey = 'OrszagokHirdetovel_' . $fokat; $s_cacheGroup = 'hirdeto_szamok'; // if ( ( $ret = $cache->get( $s_cacheKey, $s_cacheGroup ) ) === false ) // { $ret = array(); $res = query( 'SELECT id, code, (SELECT COUNT(id) FROM hirdeto WHERE hirdeto.nagyveg>=NOW() and hirdeto.country_id = address_country.id' . ($fokat > 0 ? ' AND hirdeto.fokat = ' . intval($fokat) : '') . ') AS szam FROM address_country ORDER BY address_country.sort' ); if ($res->numRows() > 0) { //$ret = array(); while ( $row = $res->fetchRow() ) { if ($row['szam'] > 0) $ret[] = array('id' => $row['id'], 'code' => $row['code'], 'name' => $lang_country[$row['id']], 'szam' => $row['szam']); } //return $ret; //$cache->set($s_cacheKey, $ret, $s_cacheGroup); } //} //return false; return $ret; } /** * OrszagokHirdetovel2() * * @param integer $fokat * @return */ function OrszagokHirdetovel2($fokat = 0) { global $alap, $cache, $user, $lang_country; $s_cacheKey = 'OrszagokHirdetovel2_' . $fokat; $s_cacheGroup = 'hirdeto_szamok'; if ( ( $ret = $cache->get($s_cacheKey, $s_cacheGroup)) === false ) { $ret = array(); $sql = 'SELECT id, code FROM address_country WHERE id IN (SELECT country_id FROM mv_hirdeto) ORDER BY address_country.sort'; $res = query($sql); if ($res->numRows() > 0) { while ( $row = $res->fetchRow() ) { $a_szamok = HirdetoSzamokCallgirl($row['id']); $s_holszam = ''; $a_keresoSzamok['no'] = $a_szamok[$fokat]['no'][$s_holszam]; $a_keresoSzamok['ferfi'] = $a_szamok[$fokat]['ferfi'][$s_holszam]; $a_keresoSzamok['travi'] = $a_szamok[$fokat]['travi'][$s_holszam]; $a_keresoSzamok['par'] = $a_szamok[$fokat]['par'][$s_holszam]; if (!is_numeric($a_keresoSzamok['no']) || $a_keresoSzamok['no'] < 0) { $a_keresoSzamok['no'] = 0; } if (!is_numeric($a_keresoSzamok['ferfi']) || $a_keresoSzamok['ferfi'] < 0) { $a_keresoSzamok['ferfi'] = 0; } if (!is_numeric($a_keresoSzamok['travi']) || $a_keresoSzamok['travi'] < 0) { $a_keresoSzamok['travi'] = 0; } if (!is_numeric($a_keresoSzamok['par']) || $a_keresoSzamok['par'] < 0) { $a_keresoSzamok['par'] = 0; } $a_keresoSzamok['osszes'] = $a_keresoSzamok['no'] + $a_keresoSzamok['ferfi'] + $a_keresoSzamok['travi'] + $a_keresoSzamok['par']; if ($a_keresoSzamok['osszes'] > 0) { $ret[] = array('id' => $row['id'], 'code' => $row['code'], 'name' => $lang_country[$row['id']], 'szam' => $a_keresoSzamok['osszes']); } } $cache->set($s_cacheKey, $ret, $s_cacheGroup); } } return $ret; } /** * WhereCountryId() * * @param mixed $country_id * @param bool $i_country_id_not * @return */ function WhereCountryId($country_id, $i_country_id_not = false) { global $domain; if ($domain != 'callgirl-list.com') { return ' = 1 '; } if (is_numeric($i_country_id_not)) { return ' != ' . $i_country_id_not . ' '; } if (is_numeric($country_id)) { if ($country_id > 0) { return ' = ' . $country_id . ' '; } else { return ' > 0 '; } } return ' = 1 '; } /** * KivalasztottOrszag() * * @return */ function KivalasztottOrszag() { global $country_id, $lang_country; if ($country_id > 0) { return $lang_country[$country_id]; } else { return $lang_country['europe']; } } /** * KivalasztottVaros() * * @param mixed $id * @return */ function KivalasztottVaros($id) { global $alap; $ret = ''; if (is_numeric($id) and $id > 0) { $sql = "SELECT parent_id, name FROM address_level_2 WHERE id = " . $id; $res = query($sql); if ($res->numRows() > 0) { $row = $res->fetchRow(); if ($row['parent_id'] == 1) { $ret = 'Budapest, ' . $row['name']; } else { $ret = $row['name']; } } } return $ret; } /** * OraSzamokSelect() * * @param string $selected * @return */ function OraSzamokSelect($selected = '') { $ret = ''; for ( $i = 0; $i <= 24; $i++ ) { $ret .= ''; } return $ret; } /** * OrszagValuta() * * @param mixed $country_id * @return */ function OrszagValuta($country_id) { return 'HUF'; } /** * JobboldalBoxok() * * @return */ function JobboldalBoxok() { global $alap, $cache, $user; $a_boxok = $cache->get('jobboldal_box'); if ($a_boxok === false) { $a_boxok = array(); $sql = "SELECT id, cim, tartalom, sorrend FROM jobboldal_box_" . $user->lang . " WHERE statusz = 1 ORDER BY sorrend"; $res_boxok = query($sql); if ($res_boxok->numRows() > 0) { while ( $row_boxok = $res_boxok->fetchRow() ) { $a_boxok[] = $row_boxok; } $cache->set('jobboldal_box', $a_boxok); } } return $a_boxok; } /** * JobboldalBoxokCallgirl() * * @return */ function JobboldalBoxokCallgirl() { global $alap, $cache, $user, $country_id; $a_boxok = $cache->get('jobboldal_box_' . $country_id, 'jobboldal_boxok'); if ($a_boxok === false) { $a_boxok = array(); $sql = "SELECT id, cim, tartalom, sorrend FROM callgirl_jobboldal_box_" . $user->lang . " WHERE statusz = 1 AND country_id " . WhereCountryId($country_id) . " ORDER BY sorrend"; $res_boxok = query($sql); if ($res_boxok->numRows() > 0) { while ( $row_boxok = $res_boxok->fetchRow() ) { $a_boxok[] = $row_boxok; } $cache->set('jobboldal_box_' . $country_id, $a_boxok, 'jobboldal_boxok'); } } return $a_boxok; } /** * TelephoneCode() * * @return */ function TelephoneCode() { global $alap; $a_telephonCode = array(); $res = query('SELECT id, telephone_code FROM address_country ORDER BY sort'); while ( $row = $res->fetchRow() ) { $a_telephonCode[$row['id']] = $row['telephone_code']; } return $a_telephonCode; } /** * HirdetesGUID() * * @return */ function HirdetesGUID() { global $c_plum, $alap; $guid = $c_plum->GenGUID(); $ok = false; while ($ok !== true) { $res_in = query('SELECT id FROM hirdeto WHERE guid = "' . $guid . '"'); if ($res_in->numRows() > 0) { $guid = $c_plum->GenGUID(); } else { $ok = true; } } return $guid; } /** * GetLink() * * @param mixed $lap * @param mixed $nyelv * @return */ function GetLink($lap, $nyelv) { include 'lang_callgirl/' . $nyelv . '_modul.php'; return $lang_modul[$lap]; } /** * HirdetoHirdetese() * * @param mixed $user_id * @param integer $lid * @return */ function HirdetoHirdetese($user_id, $lid = 0) { global $alap; $user_rang = getOne('SELECT rang FROM felhasznalok WHERE id = ' . $user_id); if ($user_rang >= 200) { return 0; } if ($lid > 0) { $res = query('SELECT id FROM hirdeto WHERE id = ' . $lid . ' AND user_id = ' . $user_id); if ($res->numRows() > 0) { return 2; } else { $res = query('SELECT id FROM hirdeto WHERE id = ' . $lid . ' AND com_user_id = ' . $user_id); if ($res->numRows() > 0) { return 3; } else { $res = query( 'SELECT id FROM hirdeto WHERE user_id = ' . $user_id . ' OR com_user_id = ' . $user_id ); if ($res->numRows() > 0) { return 1; } } } } else { $res = query('SELECT id FROM hirdeto WHERE user_id = ' . $user_id . ' OR com_user_id = ' . $user_id); if ($res->numRows() > 0) { return 1; } } return 0; } /** * IMGFlyer() * * @param mixed $s_img * @param mixed $s_link * @param mixed $s_tooltip * @param string $s_sizeClass * @param string $fillPercent * @param string $s_align * @return */ function IMGFlyer($s_img, $s_link, $s_tooltip, $s_sizeClass = '90x90', $fillPercent = '', $s_align = 'center') { $ret = '
' . $s_tooltip . '
' . (!empty($s_link) ? '' : '') . '
'; return $ret; } /** * BeszamoloSzamokCallgirl() * * @param integer $kategoria * @return */ function BeszamoloSzamokCallgirl($kategoria = 0) { global $alap, $cache; $s_cacheKey = 'BeszamoloSzamokCallgirl_' . $kategoria; $s_cacheGroup = 'beszamolok'; if ( ( $a_ret = $cache->get($s_cacheKey, $s_cacheGroup)) === false ) { $a_ret = array( -1 => getOne( 'SELECT COUNT(id) AS szam FROM besz WHERE status = 1' . ($kategoria > 0 ? " AND besz_tipus=" . intval( $kategoria ) : "") . ' AND country_id > 0' ) ); $sql = 'SELECT country_id, COUNT(id) AS szam FROM besz WHERE status = 1' . ($kategoria > 0 ? " AND besz_tipus=" . intval($kategoria) : "") . ' AND country_id > 0 GROUP BY country_id'; $res = query($sql); while ( $row = $res->fetchRow() ) { $a_ret[$row['country_id']] = $row['szam']; } $cache->set($s_cacheKey, $a_ret, $s_cacheGroup); } return $a_ret; } /** * isValidEmail() * * @param mixed $address * @return */ function isValidEmail($address) { if (!preg_match("/^[_\.0-9a-zA-Z-]+(\+[_\.0-9a-zA-Z-]+)?@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $address)) { return false; } else { return true; } } /** * text2keywords() * * @param mixed $str * @return */ function text2keywords($str) { $a_metax = array_unique(preg_split('/[^\pL]+/u', strtolower($str))); $a_metaz = array(); foreach ($a_metax as $s_meta) { if (strlen($s_meta) > 3) { $a_metaz[] = $s_meta; } } return implode(", ", $a_metaz); } /** * keresoVarosTombCallgirl() * * @param string $tipus * @param integer $country_id * @return */ function keresoVarosTombCallgirl($tipus = 'normal', $country_id = -1) { global $alap, $cache, $kereso_fokat, $translator, $user; if ($tipus == 'normal') { $s_cacheGroup = 'address_cache'; $s_cacheKey = 'kereso_varos_select_' . $kereso_fokat . '_' . $country_id; $sql_neme = ''; if (isset($_COOKIE['kereso_neme']) and in_array($_COOKIE['kereso_neme'], array(0, 1, 2))) { $sql_neme = " AND neme = " . intval($_COOKIE['kereso_neme']); $s_cacheKey .= '_' . $_COOKIE['kereso_neme']; } } else //páros { $s_cacheGroup = 'address_cache'; $s_cacheKey = 'kereso_varos_select_paros_' . $kereso_fokat . '_' . $country_id; } $a_varosok = $cache->get($s_cacheKey, $s_cacheGroup); if ($a_varosok === false) { $a_hird_id = array(); $a_varosok = array(); $sql_fokat = ''; if (isset($kereso_fokat) and ($kereso_fokat == 1 or $kereso_fokat == 2)) { $sql_fokat = " hirdeto.fokat = " . $kereso_fokat . " AND "; } if ($tipus == 'normal') { $sql = "SELECT id FROM hirdeto WHERE " . $sql_fokat . " country_id " . WhereCountryId($country_id) . " AND nagyveg >= NOW()" . $sql_neme; } else //páros { $sql = "SELECT DISTINCT hirdeto.id FROM hirdeto, hirdeto_rel WHERE " . $sql_fokat . " hirdeto.country_id " . WhereCountryId($country_id) . " AND hirdeto.nagyveg >= NOW() AND (hirdeto.id = hirdeto_rel.hird_id_1 OR hirdeto.id = hirdeto_rel.hird_id_2) AND hirdeto_rel.`status` = 1 AND hirdeto_rel.van_kep = 1 AND hirdeto_rel.veg >= NOW()"; } $res = query($sql); if ($res->numRows() > 0) { while ( $row = $res->fetchRow() ) { $a_hird_id[] = $row['id']; } $sql = "SELECT address_level_2.id, address_level_2.parent_id, address_level_2.sort, address_level_2.name AS varos, address_level_1.name AS megye, address_level_1.parent_id AS country_id, (SELECT COUNT(hirdeto_cim.level_1_id) FROM hirdeto_cim WHERE hirdeto_cim.hird_id IN (" . implode(',', $a_hird_id) . ") AND hirdeto_cim.level_1_id = address_level_1.id) AS megye_szam, (SELECT COUNT(hirdeto_cim.level_2_id) FROM hirdeto_cim WHERE hirdeto_cim.hird_id IN (" . implode(',', $a_hird_id) . ") AND hirdeto_cim.level_2_id = address_level_2.id) AS varos_szam FROM address_level_2, address_level_1 WHERE address_level_2.parent_id = address_level_1.id " . ($country_id > 0 ? " AND address_level_1.parent_id = " . $country_id . " " : "") . " AND address_level_2.id IN (SELECT DISTINCT hirdeto_cim.level_2_id FROM hirdeto_cim WHERE hirdeto_cim.hird_id IN (" . implode(',', $a_hird_id) . ")) ORDER BY megye, sort, varos"; $res = query($sql); while ( $row = $res->fetchRow() ) { $a_varosok[$row['id']]['country_id'] = $row['country_id']; $a_varosok[$row['id']]['megye_id'] = $row['parent_id']; $a_varosok[$row['id']]['varos_id'] = $row['id']; $a_varosok[$row['id']]['orszag'] = $translator->Translate($row['country_id'], 'lang_country'); $a_varosok[$row['id']]['megye'] = $row['megye']; $a_varosok[$row['id']]['megyeszam'] = $row['megye_szam']; //$a_varosok[$row['id']]['varos'] = $row['varos'].' ('.$row['szam'].')'; $a_varosok[$row['id']]['varos'] = $row['varos']; $a_varosok[$row['id']]['varos_sort'] = $row['sort']; $a_varosok[$row['id']]['varosszam'] = $row['varos_szam']; } //rendezés foreach ($a_varosok as $key => $row) { $field_country_id[$key] = $row['country_id']; $field_megye_id[$key] = $row['megye_id']; $field_varos_id[$key] = $row['varos_id']; $field_orszag[$key] = $row['orszag']; $field_megye[$key] = $row['megye']; $field_varos[$key] = $row['varos']; $field_varos_sort[$key] = $row['varos_sort']; } array_multisort( $field_orszag, SORT_ASC, $field_megye, SORT_ASC, $field_varos_sort, SORT_ASC, $field_varos, SORT_ASC, $field_country_id, SORT_ASC, $field_megye_id, SORT_ASC, $field_varos_id, SORT_ASC, $a_varosok ); } $cache->set($s_cacheKey, $a_varosok, $s_cacheGroup); } return $a_varosok; } /** * beszamoloVarosTomb() * * @param integer $fokat * @param integer $country_id * @return */ function beszamoloVarosTomb($fokat = 0, $country_id = -1) { global $alap, $cache, $translator, $user; if (!isset($fokat) or !in_array($fokat, array(1, 2))) { $fokat = 0; } $s_cacheGroup = 'address_cache'; $s_cacheKey = 'beszamolo_varos_select_' . $fokat . '_' . $country_id; $a_varosok = $cache->get($s_cacheKey, $s_cacheGroup); if ($user->id == 66640) { //$a_varosok = false; } if ($a_varosok === false) { $a_varosok = array(); $sql = "SELECT (SELECT name FROM address_level_1 WHERE id = besz_cim.level_1_id) AS level1name, (SELECT name FROM address_level_2 WHERE id = besz_cim.level_2_id) AS level2name, (SELECT sort FROM address_level_2 WHERE id = besz_cim.level_2_id) AS level2sort, COUNT(id) AS c, besz.country_id, besz_cim.level_1_id, besz_cim.level_2_id FROM besz, besz_cim WHERE besz.status = 1 " . ($fokat > 0 ? " AND besz.besz_tipus = " . intval($fokat) : "") . " AND besz_cim.besz_id = besz.id AND besz.country_id " . WhereCountryId($country_id) . " GROUP BY 2 ORDER BY 1,2"; if ($user->id == 66640) { //echo $sql.'
'; } $res = query($sql); $i = 0; while ( $row = $res->fetchRow() ) { if ($row['level_1_id'] > 0 and $row['level_2_id'] > 0) { $a_varosok[$i]['country_id'] = $row['country_id']; $a_varosok[$i]['megye_id'] = $row['level_1_id']; $a_varosok[$i]['varos_id'] = $row['level_2_id']; $a_varosok[$i]['orszag'] = $translator->Translate($row['country_id'], 'lang_country'); $a_varosok[$i]['megye'] = $row['level1name']; $a_varosok[$i]['varos'] = $row['level2name']; $a_varosok[$i]['varos_sort'] = $row['level2sort']; $a_varosok[$i]['varosszam'] = $row['c']; $i++; } } //rendezés foreach ($a_varosok as $key => $row) { $field_orszag[$key] = $row['orszag']; $field_megye[$key] = $row['megye']; $field_varos[$key] = $row['varos']; $field_varos_sort[$key] = $row['varos_sort']; } array_multisort( $field_orszag, SORT_ASC, $field_megye, SORT_ASC, $field_varos_sort, SORT_ASC, $field_varos, SORT_ASC, $a_varosok ); $cache->set($s_cacheKey, $a_varosok, $s_cacheGroup); } return $a_varosok; } /** * sendTweet() * * @param string $s_tweet * @param string $img * @return */ function sendTweet($s_tweet = '', $img = '') { global $user; if ($s_tweet != '') { require_once('class/twitter.class.php'); /* $consumerKey = 'bfcCDieTseIb2Eaplx5sg'; $consumerSecret = 'HKk8vYiuRGy9u1kaM1A5VvRlUy9RSBLvm1xth8dmWwI'; $accessToken = '2190625526-6vQ5Da1509Oz3Yf3mYsCZpJTWib05q78awgK9FB'; $accessTokenSecret = 'HS1R9SzRvdl4Mz6dziRsfRSqgStqLFTbLE22mjFAc7l1u'; */ $consumerKey = 'gf2S2dCGNDnEkYPtgHpQDg'; $consumerSecret = 'aSEuaDSpm8RNzTUbg8EDdLAGP1SdpPi0NQfzVUGoY'; $accessToken = '2161059796-YzrdNp27F9vq1eU0oj1IFrmcfnGGpK5g4q4nCqB'; $accessTokenSecret = 'lbTc7KUtf1WZdNDViwCblEOyINIO1BT34dDfR47uJfyE0'; $twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret); try { if ($img == '') { $tweet = $twitter->send($s_tweet); } else { $im = file_get_contents($img); $imgdata = base64_encode($im); $tweet = $twitter->sendMedia($s_tweet, $imgdata); } } catch (TwitterException $e) { if ($user->id == 4) { echo 'Tweet Error: ' . $e->getMessage(); } } } } /** * ujAdatlapLog() * * @return */ function ujAdatlapLog() { global $alap, $user; if ($user->id > 0 and $user->rang < 200) { $res_log = query("SELECT user_id FROM uj_adatlap_log WHERE user_id = " . $user->id); if ($res_log->numRows() < 1) { query("INSERT INTO uj_adatlap_log SET user_id = " . $user->id . ", becenev = '" . $user->becenev . "'"); } } } /** * kepalairasok() * * @param mixed $hird_id * @return */ function kepalairasok($hird_id) { global $alap, $cache; if (is_numeric($hird_id) and $hird_id > 0) { $a_kepalairas = array(); $sql = "SELECT kepszam, szoveg FROM hirdeto_kepalairas WHERE hird_id = " . $hird_id; $res = query($sql); if ($res->numRows() > 0) { while ( $row = $res->fetchRow() ) { $a_kepalairas[$row['kepszam']] = $row['szoveg']; } //$cache->set($s_cacheKey, $a_kepalairas, $s_cacheGroup); return $a_kepalairas; } else { return false; } } else { return false; } } /** * kepalairasok_2() * * @param mixed $hird_id * @return */ function kepalairasok_2($hird_id) { global $alap, $cache; if (is_numeric($hird_id) and $hird_id > 0) { $a_kepalairas = array(); $sql = "SELECT kepszam, szoveg, kicsi FROM hirdeto_kepalairas WHERE hird_id = " . $hird_id; $res = query($sql); if ($res->numRows() > 0) { while ( $row = $res->fetchRow() ) { $a_kepalairas[$row['kepszam']]['szoveg'] = $row['szoveg']; $a_kepalairas[$row['kepszam']]['kicsi'] = $row['kicsi']; } //$cache->set($s_cacheKey, $a_kepalairas, $s_cacheGroup); return $a_kepalairas; } else { return false; } } else { return false; } } /** * getBrowser() * * @return */ function getBrowser() { $u_agent = $_SERVER['HTTP_USER_AGENT']; $bname = 'Unknown'; $platform = 'Unknown'; $version = ""; //First get the platform? if (preg_match('/linux/i', $u_agent)) { $platform = 'linux'; } elseif (preg_match('/macintosh|mac os x/i', $u_agent)) { $platform = 'mac'; } elseif (preg_match('/windows|win32/i', $u_agent)) { $platform = 'windows'; } // Next get the name of the useragent yes seperately and for good reason if (preg_match('/MSIE/i', $u_agent) && !preg_match('/Opera/i', $u_agent)) { $bname = 'Internet Explorer'; $ub = "MSIE"; } elseif (preg_match('/Trident/i', $u_agent)) { $bname = 'Internet Explorer'; $ub = "rv:"; } elseif (preg_match('/Firefox/i', $u_agent)) { $bname = 'Mozilla Firefox'; $ub = "Firefox"; } elseif (preg_match('/OPR/i', $u_agent)) { $bname = 'Opera'; $ub = "OPR"; } elseif (preg_match('/Chrome/i', $u_agent)) { $bname = 'Google Chrome'; $ub = "Chrome"; } elseif (preg_match('/Safari/i', $u_agent)) { $bname = 'Apple Safari'; $ub = "Safari"; } elseif (preg_match('/Opera/i', $u_agent)) { $bname = 'Opera'; $ub = "Opera"; } elseif (preg_match('/Netscape/i', $u_agent)) { $bname = 'Netscape'; $ub = "Netscape"; } // finally get the correct version number $known = array('Version', $ub, 'other'); $pattern = '#(?' . join('|', $known) . ')[/ ]+(?[0-9.|a-zA-Z.]*)#'; if (!preg_match_all($pattern, $u_agent, $matches)) { // we have no matching number just continue } // see how many we have $i = count($matches['browser']); if ($i != 1) { //we will have two since we are not using 'other' argument yet //see if version is before or after the name if (strripos($u_agent, "Version") < strripos($u_agent, $ub)) { $version = $matches['version'][0]; } else { $version = $matches['version'][1]; } } else { $version = $matches['version'][0]; } // check if we have a number if ($version == null || $version == "") { $version = "?"; } return array( 'userAgent' => $u_agent, 'name' => $bname, 'version' => $version, 'platform' => $platform, 'pattern' => $pattern ); } /** * hirdeto_aktualis_ajanlatok_ids() * * @return */ function hirdeto_aktualis_ajanlatok_ids() { global $alap, $cache, $domain; $s_cacheKey = 'hirdeto_aktualis_ajanlatok_ids'; if ( ( $re = $cache->get($s_cacheKey, 'hirdetok')) !== false ) { return $re; } $sql = "select hird_id from hirdeto_akciok where hirdeto_akciok.statusz = 1 AND hirdeto_akciok.datum >'" . date( "Y-m-d H:i:s", strtotime("-6 hour") ) . "'"; $res = query($sql); while ( $row = $res->fetchRow() ) { $re[] = $row['hird_id']; } $cache->set($s_cacheKey, $re, 'hirdetok', 3600); return $re; } /** * hirdeto_parban_ids() * * @param mixed $kereso_fokat * @return */ function hirdeto_parban_ids($kereso_fokat) { global $alap, $cache, $domain; if (!isset($kereso_fokat) || $kereso_fokat > 2) { $kereso_fokat = 1; } $s_cacheKey = 'hirdeto_parban_ids_' . $kereso_fokat; if ( ( $re = $cache->get($s_cacheKey, 'hirdetok')) !== false ) { return $re; } $sql = "select hird_id_1 hird_id from hirdeto_rel hr where hr.veg>now() and hr.status=1 and hr.van_kep=1" . ($kereso_fokat == 2 ? " and van_masszazs=1" : "") . " union select hird_id_2 hird_id from hirdeto_rel hr where hr.veg>now() and hr.status=1 and hr.van_kep=1" . ($kereso_fokat == 2 ? " and van_masszazs=1" : ""); $res = query($sql); while ( $row = $res->fetchRow() ) { $re[] = $row['hird_id']; } $cache->set($s_cacheKey, $re, 'hirdetok', 3600); return $re; } /** * hirdeto_vanbovebbinfo_ids() * * @return */ function hirdeto_vanbovebbinfo_ids() { global $alap, $cache, $domain, $user; //if(!isset($kereso_fokat)||$kereso_fokat>2){$kereso_fokat=1;} $s_cacheKey = 'hirdeto_vanbovebbinfo_ids_' . $user->lang; if ( ( $re = $cache->get($s_cacheKey, 'hirdetok')) !== false ) { return $re; } $sql = "select hirdeto_id from hirdeto_" . $user->lang . " where automata_uzenet!=''"; $res = query($sql); while ( $row = $res->fetchRow() ) { $re[] = $row['hirdeto_id']; } $cache->set($s_cacheKey, $re, 'hirdetok', 3600); return $re; } /** * hirdeto_kedvencek_ids() * * @return */ function hirdeto_kedvencek_ids() { global $alap, $cache, $domain, $user; if ($user->id > 0) { $sql = "select lany_id from kedvencek where kedvencek.user_id=" . intval($user->id); $res = query($sql); $re = array(); while ( $row = $res->fetchRow() ) { $re[] = $row['lany_id']; } } else { $re = array(); } return $re; } /** * hirdeto_van_video_ids() * * @return */ function hirdeto_van_video_ids() { global $alap, $cache, $domain; $s_cacheKey = 'hirdeto_van_video_ids'; if ( ( $re = $cache->get($s_cacheKey, 'hirdetok')) !== false ) { return $re; } $sql = "select hird_id from hirdeto_video where status=1"; $res = query($sql); while ( $row = $res->fetchRow() ) { $re[] = $row['hird_id']; } $cache->set($s_cacheKey, $re, 'hirdetok', 900); return $re; } /** * hirdeto_user_megjegyzes() * * @return */ function hirdeto_user_megjegyzes() { global $alap, $cache, $domain, $user; $s_cacheKey = 'hirdeto_user_megjegyzes_' . $user->id; if (($re = $cache->get($s_cacheKey, 'megjegyzesuser')) === false) { $sql = "select hirdeto_user_megjegyzes.hird_id,hirdeto_user_megjegyzes.megjegyzes from hirdeto_user_megjegyzes,hirdeto where hirdeto_user_megjegyzes.hird_id=hirdeto.id " . (($user->rang < 140 or $user->rang >= 198) ? " and hirdeto.aktiv=1" : "") . " and hirdeto_user_megjegyzes.uid=" . $user->id; $res = query($sql); $re = array(); if ($res) { while ( $row = $res->fetchRow() ) { $re[$row['hird_id']] = $row['megjegyzes']; } } $cache->set($s_cacheKey, $re, 'megjegyzesuser', 300); } return $re; } /** * hirdeto_user_megjegyzes_2() * * @return */ function hirdeto_user_megjegyzes_2() { global $alap, $cache, $domain, $user; $s_cacheKey = 'hirdeto_user_megjegyzes2_' . $user->id; if ( ( $re = $cache->get($s_cacheKey, 'hirdetok')) !== false ) { return $re; } $sql = "SELECT hird_id, megjegyzes FROM hirdeto_user_megjegyzes, hirdeto_uj WHERE hirdeto_user_megjegyzes.uid = " . intval($user->id) . " AND hirdeto_user_megjegyzes.hird_id = hirdeto_uj.id " . ($user->rang < 200 ? " AND hirdeto.aktiv = 1 " : ""); $res = query($sql); $re = array(); while ( $row = $res->fetchRow() ) { $re[$row['hird_id']] = $row['megjegyzes']; } $cache->set($s_cacheKey, $re, 'hirdetok', 3600); return $re; } /** * chat_online_users() * * @return */ function chat_online_users() { global $alap, $cache, $domain; $s_cacheKey = 'chat_online_users'; if ( ( $re = $cache->get($s_cacheKey, 'felhasznalok')) !== false ) { return $re; } $now = date("Y-m-d H:i:00"); $sql = "select id,becenev from felhasznalok where chat_online>date_add('" . $now . "', INTERVAL -2 minute) order by chat_online desc limit 20"; $res = query($sql); $re = array(); while ( $row = $res->fetchRow() ) { $re[$row['id']] = $row['becenev']; } $cache->set($s_cacheKey, $re, 'felhasznalok', 30); return $re; } function rating() { global $lany; $rating_szam = 0; $rating_oszto = 0; $tempbesziszam = $lany['besz_count']; $rating_szam = $rating_szam + ($lany['besz_istenno'] * 100); $rating_oszto = $rating_oszto + $lany['besz_istenno']; $rating_szam = $rating_szam + ($lany['besz_felejthetetlen'] * 90); $rating_oszto = $rating_oszto + $lany['besz_felejthetetlen']; $rating_szam = $rating_szam + ($lany['besz_nagyonjo'] * 80); $rating_oszto = $rating_oszto + $lany['besz_nagyonjo']; $rating_szam = $rating_szam + ($lany['besz_jo'] * 70); $rating_oszto = $rating_oszto + $lany['besz_jo']; if ($lany['premium_szint'] >= 1) { $rating_szam = $rating_szam + ($lany['besz_egyeztetesi'] * 60); $rating_oszto = $rating_oszto + $lany['besz_egyeztetesi']; } else { $rating_szam = $rating_szam + ($lany['besz_egyeztetesi'] * 50); $rating_oszto = $rating_oszto + $lany['besz_egyeztetesi']; } if ($lany['premium_szint'] >= 1) { $rating_szam = $rating_szam + ($lany['besz_lehetnejobb'] * 50); $rating_oszto = $rating_oszto + $lany['besz_lehetnejobb']; } else { $rating_szam = $rating_szam + ($lany['besz_lehetnejobb'] * 30); $rating_oszto = $rating_oszto + $lany['besz_lehetnejobb']; } if ($lany['premium_szint'] >= 1) { $rating_szam = $rating_szam + ($lany['besz_rossz'] * 30); $rating_oszto = $rating_oszto + $lany['besz_rossz']; } else { $rating_szam = $rating_szam + ($lany['besz_rossz'] * 1); $rating_oszto = $rating_oszto + $lany['besz_rossz']; } $tempbesziszam = $lany['besz_count']; if ( $lany['besz_egy_evnel_regebbi_is'] != -1 and $lany['besz_egy_evnel_regebbi_is'] != 1 and $lany['premium_szint'] >= 2 ) { $tempbesziszam = $rating_oszto; } if ($tempbesziszam > 2) { if ($lany['premium_szint'] == 3) $rating_szam = $rating_szam + ($tempbesziszam * 5); elseif ($lany['premium_szint'] == 2) $rating_szam = $rating_szam + ($tempbesziszam * 3); elseif ($lany['premium_szint'] == 1) $rating_szam = $rating_szam + $tempbesziszam * 1; else $rating_szam = $rating_szam - ($tempbesziszam * 5); } else { if ($lany['premium_szint'] == 3) $rating_szam = $rating_szam - ($tempbesziszam * 5); elseif ($lany['premium_szint'] == 2) $rating_szam = $rating_szam - ($tempbesziszam * 3); elseif ($lany['premium_szint'] == 1) $rating_szam = $rating_szam - $tempbesziszam * 5; else $rating_szam = $rating_szam - ($tempbesziszam * 10); } $rating_szam = $rating_szam - $lany['besz_inaktiv'] * 10; $rating_szam = $rating_szam - $lany['besz_nem_ellenorzott'] * 15; $beszi_rating = ceil($rating_szam / $rating_oszto); /////////////////////////////////////////////// $rating = $beszi_rating; if ($lany['aktiv'] == 0) { if ($tempbesziszam > 4) $rating = $rating - 6; else $rating = $rating - 10; } else { if ($lany['retusalatlan'] == 4) $rating = $rating - 1; elseif ($lany['retusalatlan'] == 5) $rating = $rating + 1; elseif ($lany['retusalatlan'] == 1) $rating = $rating + 5; if ($lany['bovebb_info'] > 0) $rating = $rating + 2; if ($lany['fel_ora'] > 0 or $lany['egy_ora'] > 0) $rating = $rating + 4; $tempido = time() - 2 * 24 * 60 * 60; $szamitoido = date("Y-m-d H:m:s", $tempido); if ($lany['utoljara_active'] >= $szamitoido) $rating = $rating + 2; $tempido = time() - 7 * 24 * 60 * 60; $szamitoido = date("Y-m-d H:m:s", $tempido); if ($lany['utoljara_active'] <= $szamitoido) $rating = $rating - 1; if ($lany['eletkor_check'] == 1) $rating = $rating + 3; if ($lany['kf'] == 99) $rating--; if ($lany['nf'] == 99) $rating--; if ($lany['nfv'] == 99) $rating--; } if ($tempbesziszam >= 5) { $rating = $rating + 1; } if ($tempbesziszam >= 10) { $rating = $rating + 1; } if ($tempbesziszam >= 20) { $rating = $rating + 1; } if ($tempbesziszam >= 40) { $rating = $rating + 1; } if ($tempbesziszam >= 60) { $rating = $rating + 1; } if ($tempbesziszam >= 100) { $rating = $rating + 1; } if ($tempbesziszam >= 200) { $rating = $rating + 2; } if ($lany['besz_egyeztetesi'] == 0 && $lany['besz_lehetnejobb'] == 0 && $lany['besz_rossz'] == 0) $rating = $rating + 5; if ($tempbesziszam == 1) { if ($lany['p_alap'] == 0 && $lany['p_premium'] == 0 && $lany['p_vip'] == 0) $rating = $rating - 12; else $rating = $rating - 5; } if ($lany['vtr_ajanlastol'] >= 0 && $lany['premium_szint'] >= 2 && $rating <= 95) $rating = $rating + 1; if ($lany['vtr_ajanlastol'] >= 0 && $lany['premium_szint'] >= 2) $rating = $rating + 1; if ($lany['vtr_ajanlastol'] == -1 && $lany['premium_szint'] >= 2 && $rating >= 95) $rating = $rating - 1; if ($rating >= 100) $rating = 100; if ($lany['premium_szint'] > 0) { if ($lany['besz_istenno'] == 0) $rating = $rating - 1; } else { if ($lany['besz_istenno'] == 0) $rating = $rating - 3; if ($lany['besz_felejthetetlen'] == 0) $rating = $rating - 2; if ($lany['besz_nagyonjo'] == 0) $rating = $rating - 1; } if ($tempbesziszam <= 15) $rating--; if ($rating <= 1) $rating = 1; if ($tempbesziszam <= 0) $rating = "?"; return $rating; } function kedvezmeny($szamolas_tipus = '1') { global $lany; $target_time = strtotime("2024-11-30 23:59:00"); // Cél időpont $current_time = time(); // Jelenlegi szerver idő if ($current_time > $target_time) { // A feltétel igaz, a script folytatódhat $alap_kredit_napiar = 690; // Ide írd a további kódot } else $alap_kredit_napiar = 600; $emelt_e = getOne('select count(hird_id) from hirdetes_dij_emelt where hird_id="' . $lany['id'] . '"'); if ($emelt_e >= 1) $alap_kredit_napiar = 3000; $kedvezmeny_ar = 0; $kedvezmeny_lista = ""; $rating = rating(); /* if($rating==100) { $kedvezmeny_ar= $kedvezmeny_ar+10; $kedvezmeny_lista.='100 rating, '; }*/ if ($lany['done'] == 1) { $kedvezmeny_ar = $kedvezmeny_ar + 25; $kedvezmeny_lista .= 'exclusive, '; } if ($lany['retusalatlan'] == 21) { $kedvezmeny_ar = $kedvezmeny_ar + 10; $kedvezmeny_lista .= 'retusálatlan, '; } if ($lany['eletkor_check'] != 1) { $kedvezmeny_ar = $kedvezmeny_ar + 10; $kedvezmeny_lista .= 'ellenőrzött kor, '; } $aktiv_hirdetesek_szama = getone( 'select count(id) from hirdeto where user_id=' . $lany['user_id'] . ' and aktiv=1' ); if ($aktiv_hirdetesek_szama > 3 && $aktiv_hirdetesek_szama <= 7) { $kedvezmeny_ar = $kedvezmeny_ar + 25; $kedvezmeny_lista .= '3-7 aktív hirdetés, '; } elseif ($aktiv_hirdetesek_szama >= 8) { $kedvezmeny_ar = $kedvezmeny_ar + 50; $kedvezmeny_lista .= '8 vagy több aktív hirdetés, '; } $kedvezmeny_lista = substr_replace($kedvezmeny_lista, '', -2, 2); $napidijj = $alap_kredit_napiar - $kedvezmeny_ar; $havidijj = $napidijj * 30; if ($lany['level_1_name'] != 'Budapest') { $napidijj = ceil($napidijj / 2); $havidijj = $napidijj * 30; } if ($szamolas_tipus == 1) if ($lany['szabin'] == 1) { $napidijj = 115; $havidijj = $napidijj * 30; } $kedve = array( "napidijj" => $napidijj, "havidijj" => $havidijj, "kedvezmeny_ar" => $kedvezmeny_ar, "kedvezmeny_lista" => $kedvezmeny_lista, ); return $kedve; } /** * crawlerDetect() * * @param mixed $user_agent * @return */ function crawlerDetect($user_agent) { $crawlers_agents = 'Google|msnbot|Rambler|Yahoo|AbachoBOT|accoona|AcioRobot|ASPSeek|CocoCrawler|Dumbot|FAST-WebCrawler|GeonaBot|Gigabot|Lycos|MSRBOT|Scooter|AltaVista|IDBot|eStyle|Scrubby'; return strpos($crawlers_agents, $user_agent); } /** * gotoadbutton() * * @param mixed $hird_id * @param mixed $fokat * @param mixed $name * @param string $lany * @return */ function gotoadbutton($hird_id, $fokat, $name, $lany = "") { global $translator, $lang_modul, $newlook, $gotoadbutton_namelimit, $pda, $user; if ($lany['level_1_name'] == 'Budapest') { $s_link = '/' . ($lany['fokat'] == 2 ? $lang_modul['masszazs'] : $lang_modul['szexpartner']); } else if (isset($lany['paros'])) { } else { switch ($lany['neme']) { case '0': $s_link = '/' . ($lany['fokat'] == 2 ? $lang_modul['videki_lany_masszazs'] : $lang_modul['videki_lany_szexpartner']); $tooltip_extra = (mt_rand(0, 10) < 3 ? "Vidékilény" : "Vidéki lény"); break; case '1': $s_link = '/' . ($lany['fokat'] == 2 ? $lang_modul['videki_fiu_masszazs'] : $lang_modul['videki_fiu_szexpartner']); $tooltip_extra = "Vidéki fié"; break; case '2': $s_link = '/' . ($lany['fokat'] == 2 ? $lang_modul['videki_travi_masszazs'] : $lang_modul['videki_travi_szexpartner']); $tooltip_extra = "Vidéki travi"; break; } } if ($lany['level_1_name'] == 'Budapest') $s_link .= '/' . $lany['id'] . '/' . $lany['name'] . '-Budapest-' . ($lany['fokat'] == 2 ? 'masszazs' : '') . ($lany['fokat'] == 1 ? 'szexpartner' : '') . '-' . ($lany['neme'] == 0 ? 'no' : '') . ($lany['neme'] == 1 ? 'ferfi' : '') . ($lany['neme'] == 2 ? 'transzi' : '') . ($lany['neme'] == 99 ? 'par' : '') . '-' . $lany['htelefon']; else $s_link .= '/' . $lany['id'] . '/' . $lany['name'] . '-' . $lany['level_2_name'] . '-videkilany-' . ($lany['fokat'] == 2 ? 'masszazs' : '') . ($lany['fokat'] == 1 ? 'szexpartner' : '') . '-' . ($lany['neme'] == 0 ? 'no' : '') . ($lany['neme'] == 1 ? 'ferfi' : '') . ($lany['neme'] == 2 ? 'transzi' : '') . ($lany['neme'] == 99 ? 'par' : '') . '-' . $lany['htelefon']; $ekezetes = array(' ', 'é', 'é', 'é', 'é', 'é', 'Õ', 'é', 'é', 'Û', 'é', 'é', 'é', 'é', 'é', 'õ', 'é', 'é', 'û', 'é', 'é ', 'é', 'é', 'lé', 'é', '+'); $ekezettelen = array('', 'a', 'e', 'i', 'o', 'o', 'o', 'u', 'u', 'u', 'a', 'e', 'i', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'U', 'o', 'o', 'u', ''); $s_link = strtolower(str_replace($ekezetes, $ekezettelen, $s_link)); //$s_link .= '/?lid='.$lany['id'].'&l2='.urlencode($lany['level_2_name']).'&l1='.urlencode($lany['level_1_name']).'&nev='.urlencode($lany['name']); if (isset($pda) and $pda == 1 and $user->id == 66640) { return '

' . (isset($gotoadbutton_namelimit) && $gotoadbutton_namelimit > 3 && strlen($name) > $gotoadbutton_namelimit ? $translator->Translate(1016, 'lang_alt') : sprintf( $translator->Translate(1129, 'lang_alt'), $name )) . '

'; } else if ($newlook == 1405) { return '

' . (isset($gotoadbutton_namelimit) && $gotoadbutton_namelimit > 3 && strlen($name) > $gotoadbutton_namelimit ? $translator->Translate(1016, 'lang_alt') : sprintf( $translator->Translate(1129, 'lang_alt'), $name )) . '

'; //(isset($lany['htelefon_plain']) && $lany['htelefon_plain']!=''?'&htelefon='.urlencode($lany['htelefon_plain']):($lany['htelefon']!=''?'&htelefon='.urlencode(preg_replace_callback("/[^\d]/","",$lany['htelefon'])):'')) } else { return '' . sprintf($translator->Translate(1129, 'lang_alt'), $name) . ''; //(isset($lany['htelefon_plain']) && $lany['htelefon_plain']!=''?'&htelefon='.urlencode($lany['htelefon_plain']):($lany['htelefon']!=''?'&htelefon='.urlencode(preg_replace_callback("/[^\d]/","",$lany['htelefon'])):'')) } //return ''.sprintf($translator->Translate(1129, 'lang_alt'), $name).''; } /** * top3_beszi_by_sorrend() * * @param mixed $lany * @return */ function top3_beszi_by_sorrend($lany) { global $a_beszamolo, $user, $alap; $sql = "SELECT sorrend, COUNT(*) c FROM besz WHERE hird_id = " . $lany['id'] . (isset($a_beszamolo) && array_key_exists('id', $a_beszamolo) && intval( $a_beszamolo['id'] ) > 0 ? " AND besz.id != " . intval($a_beszamolo['id']) : "") . " AND status = 1"; if ( isset($lany['besz_egy_evnel_regebbi_is']) and $lany['besz_egy_evnel_regebbi_is'] != '' and $lany['besz_egy_evnel_regebbi_is'] == 0 and $user->rang < 200 and $user->id != $lany['user_id'] and ($user->id != $lany['com_user_id'] or $lany['com_user_id'] == 0) ) { $sql .= " AND `date` >= '" . date("Y-m-d H:i:s", strtotime("-1 year")) . "'"; } $sql .= " GROUP BY sorrend ORDER BY sorrend"; $res_top3_beszi_by_sorrend = query($sql); return $res_top3_beszi_by_sorrend; } /** * date2str() * * @param mixed $datum * @return */ function date2str($datum) { $tegnapelott = date("Y-m-d", strtotime("-2 day")); $tegnap = date("Y-m-d", strtotime("-1 day")); $ma = date("Y-m-d"); $holnap = date("Y-m-d", strtotime("+1 day")); $holnaputan = date("Y-m-d", strtotime("+2 day")); switch ($datum) { case $tegnapelott: $str = 'tegnapelőtt'; break; case $tegnap: $str = 'tegnap'; break; case $ma: $str = 'ma'; break; case $holnap: $str = 'holnap'; break; case $holnaputan: $str = 'holnapután'; break; default: $str = $datum; } return $str; } /** * content_rel_box() * * @param mixed $comment * @param mixed $content * @return */ function content_rel_box($comment, $content) { $reg_exUrl = "/(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; $doboz_url = ''; if (preg_match($reg_exUrl, $comment, $url)) { $doboz_url = $url[0]; } if ($doboz_url != '') { return '
' . $content . ' LINK
'; } else { return '
' . $content . '
'; } } /** * content_rel_box_n() * * @param mixed $comment * @param mixed $content * @return */ function content_rel_box_n($comment, $content) { $reg_exUrl = "/(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; $ret = ''; $doboz_url = ''; if (preg_match($reg_exUrl, $comment, $url)) { $doboz_url = $url[0]; } if ($doboz_url != '') { $ret .= '
' . $content . '
'; } else { $ret .= '
' . $content . '
'; } return $ret; } function tisztitlaci(string $input): string { // Script tagek törlése teljes blokkal $clean = preg_replace('#(.*?)#is', '', $input); // HTML tagek törlése $clean = strip_tags($clean); // URL-ek cseréje ***-ra $clean = preg_replace( '#https?://[\w\-\.\?\=/%&]+|www\.[\w\-\.\?\=/%&]+#i', '***', $clean ); // "rosszlányok" szó cseréje ékezetes és ékezet nélküli változatokban $clean = preg_replace( '/rosszl[aá]nyok/iu', '***', $clean ); return $clean; } function normalize_url_for_http($url) { $parts = parse_url($url); if (!$parts || empty($parts['host'])) { return $url; } // HOST: IDN → ASCII $host = idn_to_ascii($parts['host'], IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46); // PATH: UTF-8 → rawurlencode szegmensek $path = ''; if (!empty($parts['path'])) { $segments = explode('/', $parts['path']); $segments = array_map('rawurlencode', $segments); $path = implode('/', $segments); } $query = isset($parts['query']) ? '?' . $parts['query'] : ''; $scheme = $parts['scheme'] ?? 'https'; return $scheme . '://' . $host . $path . $query; } function parse_content_rel($msg) { // Biztonságos és pontos URL-felismerés (kötőjelek, query stringek, stb.) $reg_exUrl = '~https?://[^\s<>"\']+~i'; $content = ''; global $user; echo $reg_exUrl; if (preg_match($reg_exUrl, $msg, $match)) { $url = $match[0]; // NORMALIZÁLÁS $url = preg_replace('/\\\\n+.*$/', '', $url); // 🔥 URL-decode egyszer (ha már kódolt) $url = rawurldecode($url); // 🔥 whitespace vágás $url = trim($url); // innen mehet HTTP_Request2($url) $path = parse_url($url, PHP_URL_PATH); $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); $allowed_extensions = ['jpg', 'png', 'gif', 'bmp', 'webp']; if (in_array($ext, $allowed_extensions, true)) { $content .= '
'; } else { if (stripos($url, 'youtu.be') !== false || stripos($url, 'youtube.com') !== false) { $content .= parse_youtube_url($url); } else { $content .= parse_website($url); } } } return $content; } /** * parse_youtube_url() * * @param string $url * @param string $return * @param integer $width * @param integer $height * @param integer $rel * @return string */ function parse_youtube_url($url, $return = 'embed', $width = 350, $height = 197, $rel = 0) { $urls = parse_url($url); $id = ''; if ($urls['host'] == 'youtu.be') { // URL formája: http://youtu.be/xxxx $id = ltrim($urls['path'], '/'); } elseif (strpos($urls['path'], 'embed') !== false) { // URL formája: http://www.youtube.com/embed/xxxx $path_parts = explode('/', $urls['path']); $id = end($path_parts); } elseif (!empty($urls['query'])) { // URL formája: http://www.youtube.com/watch?v=xxxx parse_str($urls['query'], $query_params); if (isset($query_params['v'])) { $id = $query_params['v']; } } if (empty($id)) { return ''; } return '
'; } /** * parse_website() * * @param string $url * @param bool $fbimg * @param integer $resend_counter * @return string */ /** * parse_website() * * @param string $url * @param bool $fbimg * @param int $resend_counter * @return string */ function parse_website($url, $fbimg = true, $resend_counter = 0) { $ret = ''; $url = normalize_url_for_http($url); require_once('HTTP/Request2.php'); try { $req = new HTTP_Request2($url, HTTP_Request2::METHOD_GET); $req->setConfig([ 'timeout' => 6, 'follow_redirects' => true, 'max_redirects' => 5, ]); $req->setHeader([ 'User-Agent' => 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)', 'Accept' => 'text/html', 'Accept-Encoding' => 'identity', ]); $response = $req->send(); $html = $response->getBody(); if (substr($html, 0, 2) === "\x1f\x8b") { $html = gzdecode($html); } } catch (Exception $e) { if ($resend_counter < 2) { return parse_website($url, $fbimg, ++$resend_counter); } return ''; } // --- META KINYERÉS --- $title = ''; $description = ''; $img = ''; // TITLE if (preg_match('/]*>(.*?)<\/title>/is', $html, $m)) { $title = trim(html_entity_decode($m[1], ENT_QUOTES, 'UTF-8')); } // META DESCRIPTION if (preg_match('/
'; } if ($title !== '') { $ret .= '

' . htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . '


'; } if ($description !== '') { $ret .= htmlspecialchars($description, ENT_QUOTES, 'UTF-8') . '
'; } if ($domain !== '') { $ret .= '
' . htmlspecialchars($domain, ENT_QUOTES, 'UTF-8') . '
'; } return $ret; } /** * onlineHirdetok() * * @param integer $a * @return */ function onlineHirdetok($a = 0) { global $alap, $a_onlineHirdetok, $cache; /* if (is_array($a_onlineHirdetok)) { return $a_onlineHirdetok; } if ($a == 0) { error_log("Nincs meg az online hirdetok tomb!!! - " . serialize($a_onlineHirdetok)); } $s_cacheKey = 'hirdetok'; $s_cacheGroup = 'online'; $a_ret = $cache->get($s_cacheKey, $s_cacheGroup); if ($a_ret === false) {*/ $a_ret = array(); $sql = "SELECT DISTINCT hirdeto.id FROM hirdeto, online_hirdeto WHERE hirdeto.aktiv=1 AND ( (hirdeto.user_id = online_hirdeto.user_id) OR (hirdeto.com_user_id = online_hirdeto.user_id) )"; $res = query($sql); while ( $row = $res->fetchRow() ) { $a_ret[] = $row['id']; } // $cache->set($s_cacheKey, $a_ret, $s_cacheGroup, 300); //} return $a_ret; } /** * onlineFelhasznalok() * * @param integer $a * @return */ function onlineFelhasznalok($a = 0) { global $alap, $a_onlineFelhasznalok, $cache; /* if (is_array($a_onlineFelhasznalok)) { return $a_onlineFelhasznalok; } if ($a == 0) { error_log("Nincs meg az online felhasznalok tomb!!! " . $a . " - " . serialize($a_onlineFelhasznalok)); } $s_cacheKey = 'felhasznalok'; $s_cacheGroup = 'online'; $a_ret = $cache->get($s_cacheKey, $s_cacheGroup); if ($a_ret === false) {*/ $a_ret = array(); $sql = "SELECT DISTINCT user_id FROM online WHERE user_id > 0"; $res = query($sql); while ( $row = $res->fetchRow() ) { $a_ret[] = $row['user_id']; } // $cache->set($s_cacheKey, $a_ret, $s_cacheGroup, 300); // } return $a_ret; } /** * cache_onlineFelhasznalok() * * @return */ function cache_onlineFelhasznalok() { global $cache; $a_ret = array(); $sql = "SELECT DISTINCT user_id FROM online WHERE user_id > 0"; $res = query($sql); while ( $row = $res->fetchRow() ) { $a_ret[] = $row['user_id']; } $cache->set('felhasznalok', $a_ret, 'online', 300); } /** * cache_onlineHirdetok() * * @return */ function cache_onlineHirdetok() { global $cache; $a_ret = array(); $sql = "SELECT DISTINCT hirdeto.id FROM hirdeto, online_hirdeto WHERE hirdeto.nagyveg >= NOW() AND ( (hirdeto.com_user_id = 0 AND hirdeto.user_id = online_hirdeto.user_id) OR (hirdeto.com_user_id > 0 AND hirdeto.com_user_id = online_hirdeto.user_id) )"; $res = query($sql); while ( $row = $res->fetchRow() ) { $a_ret[] = $row['id']; } $cache->set('hirdetok', $a_ret, 'online', 300); } /** * hirdeto_dir() * * @param mixed $hird_id * @return */ function hirdeto_dir($hird_id) { return floor($hird_id / 1000) . "000"; } /** * mostHivhatoHirdetok() * * @param integer $a * @return */ function mostHivhatoHirdetok($a = 0) { global $alap, $a_mostHivhatoHirdetok, $cache; if (is_array($a_mostHivhatoHirdetok)) { return $a_mostHivhatoHirdetok; } if ($a == 0) { error_log("Nincs meg a most hivhato hirdetok tomb!!! - " . serialize($a_mostHivhatoHirdetok)); } $s_cacheKey = 'mostHivhatoHirdetok'; $s_cacheGroup = 'hirdetok'; $a_ret = $cache->get($s_cacheKey, $s_cacheGroup); if ($a_ret === false) { $a_ret = array(); $now = date("Y-m-d H:i:00"); /* $sql = "SELECT id FROM hirdeto WHERE nagyveg >= '".$now."' AND ( id IN (SELECT hird_id FROM hirdeto_altalanos WHERE lehet_hivni_most = 1 AND lehet_hivni_most_datum >= '".$now."') OR id IN (SELECT hird_id FROM hirdeto_hivhato_ma WHERE (tol_1_ido <= '".date("H:i:00")."' AND ig_1_ido >= '".date("H:i:00")."') OR (tol_2_ido <= '".date("H:i:00")."' AND ig_2_ido >= '".date("H:i:00")."')) )"; */ /* "László: a now az kicsit keves baszod 1. ird at a lekerdezes tpobbi reszet is 5 percre + adjal neki cachet" - 10:02 2015.04.07. */ $sql = "SELECT id FROM hirdeto WHERE aktiv=1 AND ( id IN (SELECT hird_id FROM hirdeto_altalanos WHERE lehet_hivni_most = 1 AND lehet_hivni_most_datum >= '" . $now . "') OR id IN (SELECT hird_id FROM hirdeto_hivhato_ma WHERE (tol_1_ido <= '" . date("H:i:00") . "' AND ig_1_ido >= '" . date("H:i:00") . "') OR (tol_2_ido <= '" . date("H:i:00") . "' AND ig_2_ido >= '" . date("H:i:00") . "')) )"; $res = query($sql); while ( $row = $res->fetchRow() ) { $a_ret[] = $row['id']; } $cache->set($s_cacheKey, $a_ret, $s_cacheGroup, 300); } return $a_ret; } /** * mostSzabadHirdetok() * * @param integer $a * @return */ function mostSzabadHirdetok($a = 0) { global $alap, $a_mostSzabadHirdetok; if (is_array($a_mostSzabadHirdetok)) { return $a_mostSzabadHirdetok; } if ($a == 0) { error_log("Nincs meg a most szabad hirdetok tomb!!! - " . serialize($a_mostSzabadHirdetok)); } $a_ret = array(); $sql = "SELECT DISTINCT hird_id FROM hirdeto_calendar WHERE `start` <= NOW() AND `end` >= NOW()"; $res = query($sql); while ( $row = $res->fetchRow() ) { $a_ret[] = $row['hird_id']; } return $a_ret; } /** * RanghozBeszi() * * @param mixed $rang * @return */ function RanghozBeszi($rang) { $re = 1; switch ($rang) { case 103: $re = 2; break; case 104: $re = 3; break; case 105: $re = 4; break; case 106: $re = 5; break; case 107: $re = 6; break; case 108: $re = 7; break; case 109: $re = 8; break; case 110: $re = 9; break; case 111: $re = 10; break; case 112: $re = 11; break; case 113: $re = 12; break; case 114: $re = 13; break; case 115: $re = 14; break; case 116: $re = 15; break; case 117: $re = 16; break; case 118: $re = 17; break; case 119: $re = 18; break; case 120: $re = 19; break; case 121: $re = 20; break; } return $re; } /** * validateDate() * * @param mixed $date * @param string $format * @return */ function validateDate($date, $format = 'Y-m-d') { $d = DateTime::createFromFormat($format, $date); return $d && $d->format($format) == $date; } /** * OnlyAlphaNum() * * @param mixed $str * @param bool $lc * @return */ function OnlyAlphaNum($str, $lc = true) // csak az angol abc betűit és a számokat adja vissza a stringből (dzsozi @ 160414) { $str = str_replace('ö', 'o', $str); $str = str_replace('Ö', 'o', $str); $str = str_replace('ü', 'u', $str); $str = str_replace('Ü', 'u', $str); $str = str_replace('ó', 'o', $str); $str = str_replace('Ó', 'o', $str); $str = str_replace('ő', 'o', $str); $str = str_replace('Ő', 'o', $str); $str = str_replace('ú', 'u', $str); $str = str_replace('Ú', 'u', $str); $str = str_replace('é', 'e', $str); $str = str_replace('É', 'e', $str); $str = str_replace('á', 'a', $str); $str = str_replace('Á', 'a', $str); $str = str_replace('ű', 'u', $str); $str = str_replace('Ű', 'u', $str); $str = str_replace('í', 'i', $str); $str = str_replace('Í', 'i', $str); $str = preg_replace_callback('([^A-Za-z0-9-]+)', function () { return ''; }, $str); if ($lc === true) { $str = strtolower($str); } return $str; } /** * replaceKerulet() * * @param mixed $str * @return */ function replaceKerulet($str) // római kerület számok konvertálása (dzsozi @ 160414) { $str = str_replace('XXIII.', '23.', $str); $str = str_replace('XXII.', '22.', $str); $str = str_replace('XXI.', '21.', $str); $str = str_replace('XX.', '20.', $str); $str = str_replace('XIX.', '19.', $str); $str = str_replace('XVIII.', '18.', $str); $str = str_replace('XVII.', '17.', $str); $str = str_replace('XVI.', '16.', $str); $str = str_replace('XV.', '15.', $str); $str = str_replace('XIV.', '14.', $str); $str = str_replace('XIII.', '13.', $str); $str = str_replace('XII.', '12.', $str); $str = str_replace('XI.', '11.', $str); $str = str_replace('IX.', '9.', $str); $str = str_replace('X.', '10.', $str); $str = str_replace('VIII.', '8.', $str); $str = str_replace('VII.', '7.', $str); $str = str_replace('VI.', '6.', $str); $str = str_replace('IV.', '4.', $str); $str = str_replace('V.', '5.', $str); $str = str_replace('III.', '3.', $str); $str = str_replace('II.', '2.', $str); $str = str_replace('I.', '1.', $str); return $str; } /** * TelepulesTomb() * * @param integer $cid * @param bool $besz * @return */ function TelepulesTomb($cid = 1, $besz = false) // település tömb subdomain kezeléshez (dzsozi @ 160414) { global $alap; $ret = array(); $cid = intval($cid); if ($cid < 0) $cid = 0; $sql = "SELECT id, name FROM address_level_2 WHERE id IN (SELECT DISTINCT level_2_id FROM " . ($besz == false ? "hirdeto_cim" : "besz_cim") . ") " . ($cid > 0 ? " AND parent_id IN (SELECT id FROM address_level_1 WHERE parent_id = " . $cid . ")" : ""); $res = query($sql); while ( $row = $res->fetchRow() ) { $index = OnlyAlphaNum(replaceKerulet($row['name'])); $ret[$index] = array( 'id' => $row['id'], 'name' => $row['name'], ); } return $ret; } /** * MegyeTomb() * * @param integer $cid * @param bool $besz * @return */ function MegyeTomb($cid = 1, $besz = false) // megye tömb subdomain kezeléshez (dzsozi @ 160419) { global $alap; $ret = array(); $cid = intval($cid); if ($cid < 0) $cid = 0; $sql = "SELECT id, name FROM address_level_1 WHERE id IN (SELECT DISTINCT level_1_id FROM " . ($besz == false ? "hirdeto_cim" : "besz_cim") . ") " . ($cid > 0 ? " AND parent_id = " . $cid : ""); $res = query($sql); while ( $row = $res->fetchRow() ) { $index = OnlyAlphaNum($row['name']); $ret[$index] = array( 'id' => $row['id'], 'name' => $row['name'], ); } return $ret; } /** * img_list_item() * * @param mixed $row * @return */ function img_list_item($row) { global $more_kiiras, $i_kepmode, $uj_kepek_listaja, $lany, $user; $size = mt_rand(100, 160); // https://beszamolok.com/szexpartner_kep.php?adat=Sindy+szexpartner+hirdet%C5%91+Budapest%2C+XIII.+ker%C3%BClet&lid=199424&kepszam=8951649 if (($row['is_video'] == 1 && $lany['premium_szint'] < 3)) { } else { $kiiras .= ''; // if($user->id==4)print_r($uj_kepek_listaja); $rowindex = $row['kepszam'] . '.webp'; if ($uj_kepek_listaja[$rowindex] == 1) { $van_uj_kepe = 1; $kiiras .= '
ÚJ KÉP !
'; } if ($row['is_video'] == 1) { $kiiras .= '
VIDEÓ!
'; } $kiiras .= '' . strip_tags($row['kepalairas'])
			. ''; //print_r($row); //if(isset($more_kiiras)&&$more_kiiras!=''){$kiiras.=$more_kiiras;} $kiiras .= '
'; } return $kiiras; } function img_list_item_laci($row, $arckep = 0) { global $more_kiiras, $i_kepmode, $uj_kepek_listaja, $lany, $user; if ($lany['kezdokep'] == $row['kepszam']) { if ( !is_file('/home/beszamolok/public_html/kepek/hirdeto/' . hirdeto_dir($lany['id']) . '/' . $lany['id'] . '/' . $row['kepszam'] . '_175x175.webp') or !is_file('/home/beszamolok/public_html/kepek/hirdeto/' . hirdeto_dir($lany['id']) . '/' . $lany['id'] . '/' . $row['kepszam'] . '_245x245.webp') or !is_file('/home/beszamolok/public_html/kepek/hirdeto/' . hirdeto_dir($lany['id']) . '/' . $lany['id'] . '/' . $row['kepszam'] . '_120x120.webp') ) { if (is_file('/home/beszamolok/public_html' . $row['tn'] . '_800x800.webp')) { thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '_800x800.webp', '/home/beszamolok/public_html/kepek/hirdeto/' . hirdeto_dir($lany['id']) . '/' . $lany['id'] . '/' . $row['kepszam'] . '_175x175.webp', 175, 175 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '_800x800.webp', '/home/beszamolok/public_html/kepek/hirdeto/' . hirdeto_dir($lany['id']) . '/' . $lany['id'] . '/' . $row['kepszam'] . '_120x120.webp', 120, 120 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '_800x800.webp', '/home/beszamolok/public_html/kepek/hirdeto/' . hirdeto_dir($lany['id']) . '/' . $lany['id'] . '/' . $row['kepszam'] . '_145x145.webp', 245, 245 ); } else { if (is_file('/home/beszamolok/public_html' . $row['tn'] . '_245x245.webp')) { thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '_245x245.webp', '/home/beszamolok/public_html/kepek/hirdeto/' . hirdeto_dir($lany['id']) . '/' . $lany['id'] . '/' . $row['kepszam'] . '_175x175.webp', 175, 175 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '_245x245.webp', '/home/beszamolok/public_html/kepek/hirdeto/' . hirdeto_dir($lany['id']) . '/' . $lany['id'] . '/' . $row['kepszam'] . '_120x120.webp', 120, 120 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '_245x245.webp', '/home/beszamolok/public_html/kepek/hirdeto/' . hirdeto_dir($lany['id']) . '/' . $lany['id'] . '/' . $row['kepszam'] . '_145x145.webp', 245, 245 ); } } } } $kiiras = ''; // https://beszamolok.com/szexpartner_kep.php?adat=Sindy+szexpartner+hirdet%C5%91+Budapest%2C+XIII.+ker%C3%BClet&lid=199424&kepszam=8951649 if (isset($row['is_video']) && $row['is_video'] == true) { $kiiras .= ''; $rowindex = $row['kepszam'] . '.webp'; $kiiras .= '' . strip_tags($row['kepalairas'])
			. ''; if ($row['is_video'] == true) { $kiiras .= 'VIDEÓ '; } $kiiras .= '
'; } else { $kiiras .= ''; $rowindex = $row['kepszam'] . '.webp'; $row['tn'] = str_replace('.webp', '', $row['full']); if (!is_file('/home/beszamolok/public_html' . $row['tn'] . '_245x245.webp') or !is_file('/home/beszamolok/public_html' . $row['tn'] . '_105x105.webp') or !is_file('/home/beszamolok/public_html' . $row['tn'] . '_175x175.webp')) { if (is_file('/home/beszamolok/public_html' . $row['tn'] . '_800x800.webp')) { thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '_800x800.webp', '/home/beszamolok/public_html' . $row['tn'] . '_105x105.webp', 105, 105 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '_800x800.webp', '/home/beszamolok/public_html' . $row['tn'] . '_175x175.webp', 175, 175 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '_800x800.webp', '/home/beszamolok/public_html' . $row['tn'] . '_150x150.webp', 150, 150 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '_800x800.webp', '/home/beszamolok/public_html' . $row['tn'] . '_245x245.webp', 245, 245 ); } elseif (is_file('/home/beszamolok/public_html' . $row['tn'] . '.webp')) { thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '.webp', '/home/beszamolok/public_html' . $row['tn'] . '_105x105.webp', 105, 105 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '.webp', '/home/beszamolok/public_html' . $row['tn'] . '_175x175.webp', 175, 175 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '.webp', '/home/beszamolok/public_html' . $row['tn'] . '_245x245.webp', 245, 245 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '.webp', '/home/beszamolok/public_html' . $row['tn'] . '_150x150.webp', 150, 150 ); } elseif (is_file('/home/beszamolok/public_html' . $row['tn'] . '.jpg')) { thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '.jpg', '/home/beszamolok/public_html' . $row['tn'] . '_105x105.webp', 105, 105 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '.jpg', '/home/beszamolok/public_html' . $row['tn'] . '_175x175.webp', 175, 175 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '.jpg', '/home/beszamolok/public_html' . $row['tn'] . '_150x150.webp', 150, 150 ); thumbkeszito( '/home/beszamolok/public_html' . $row['tn'] . '.jpg', '/home/beszamolok/public_html' . $row['tn'] . '_245x245.webp', 245, 245 ); } } if (($arckep == 0 && $row['vip'] == 0) or ($arckep == 1 && $row['vip'] == 1 && $user->rang > $lany['arckep'] && ($user->rang < 144 or $user->rang > 190)) ) { $kiiras .= '' . strip_tags($row['kepalairas']) . ''; if (isset($uj_kepek_listaja[$rowindex]) && $uj_kepek_listaja[$rowindex] == 1) { if (is_file('/home/beszamolok/public_html' . $row['tn'] . '_800x800.webp')) { $van_uj_kepe = 1; $kiiras .= 'ÚJ KÉP! '; } else { query('delete from hirdeto_uj_kepek where hird_id=' . $lany['id'] . ' and kepnev="' . $uj_kepek_listaja[$rowindex] . '"'); } } //print_r($row); //if(isset($more_kiiras)&&$more_kiiras!=''){$kiiras.=$more_kiiras;} } $kiiras .= ''; } return $kiiras; } function chatuzenet_admintol($kinek, $szoveg, $kepopcio = "") { global $alap; $chatid = '8c' . $kinek; $bevenev = getOne('select becenev from felhasznalok where id=' . intval($kinek)); if ($szoveg != "") { $row_user = getRow( "SELECT felhasznalok.rang,felhasznalok.device_id,felhasznalok.id,felhasznalok.becenev,felhasznalok.email,felhasznalok.lang FROM felhasznalok WHERE id=" . $kinek ); query( 'INSERT INTO `beszamolok`.`messages_new` ( `datum`, `user1`, `user2`, `kitol`, `kinek`, `szoveg`, `chat_id`) VALUES(now(),6,' . $kinek . ',6,' . $kinek . ',"Kedves ' . $bevenev . '! ' . addslashes($szoveg) . ' (erre az üzenetre soha ne válaszolj, ez egy automatikus rendszer üzenet, Webmesternek írj, ha kérdés merül fel)","6c' . $kinek . '")' ); /*sendgcm( $row_user['device_id'], 'A rendszer új üzenetet küldött: ' . $a_values['msg'], 0, 0, 6, $row_user['rang'], $chatid, $kinek );*/ sendPush($kinek, 'RENDSZERÜZENET', $szoveg, $kepopcio); } } function ekezetlenit($mit) { $ekezetes = array(' ', 'Á', 'É', 'Í', 'Ó', 'Ö', 'Õ', 'Ú', 'Ü', 'Û', 'á', 'é', 'í', 'ó', 'ö', 'õ', 'ú', 'ü', 'û', 'ű', 'Ű ', 'Ő', 'ő', 'lő', 'ű', '+'); $ekezettelen = array('-', 'a', 'e', 'i', 'o', 'o', 'o', 'u', 'u', 'u', 'a', 'e', 'i', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'U', 'o', 'o', 'u', ''); return strtolower(str_replace($ekezetes, $ekezettelen, $mit)); } function discord_push($type, $url, $cim, $szoveg, $kep) { if ($type == 1) { $webhookurl = "https://discord.com/api/webhooks/762664676517085254/2cfryUcVpzDCUJUI4enn47Uq_zMfPXWNhb2vXNh8A7MS_MZIPFhNH1wC7ZVoU80PaH_4"; $content = "Új hirdető"; } if ($type == 2) { $webhookurl = "https://discord.com/api/webhooks/762664676517085254/2cfryUcVpzDCUJUI4enn47Uq_zMfPXWNhb2vXNh8A7MS_MZIPFhNH1wC7ZVoU80PaH_4"; $content = "Visszatérő hirdető"; } if ($type == 3) { $webhookurl = "https://discordapp.com/api/webhooks/762968911452176384/cOoR79Rwmhhibbg_MJcukLfSMgiU-ajy8ty9CN3qrgvLrV3-P-DGmXOsW71AokaG4JGo"; $content = "Új beszámoló"; } if ($type == 4) { $webhookurl = "https://discordapp.com/api/webhooks/762985987986161664/qF_ITBCgfKgAtAZ5C63Tbjr5GzTzxmuW34GeNyO1fAFaKPqwU3F51QfDj6B4Qc-1GQGh"; $content = "Új hozzászólás csevegéshez"; } if ($type == 5) { $webhookurl = "https://discordapp.com/api/webhooks/762992715851235338/m3sjFeDiUOpaNoegq0fSOpLU6RfxOO6i9-eRhlSh3xKvwZiM1GUljEtlS6Hkbdr_o-Ho"; $content = "Új hozzászólás beszámolóhoz"; } if ($type == 6) { $webhookurl = "https://discordapp.com/api/webhooks/763004074764927016/4wam01rzpSdC247kKPEJBVCvv-7GRnBu5u7XTKf2YTnJzJhWXuctswkxNRghwv6Ke1e9"; $content = "Új hozzászólás fórumhoz"; } $szoveg = str_replace( '\n', ' ', $szoveg ); //======================================================================================================= // Compose message. You can use Markdown // Message Formatting -- https://discordapp.com/developers/docs/reference#message-formatting //======================================================================================================== $timestamp = date("c", strtotime("now")); $json_data = json_encode( [ // Message "content" => $content, // Username "username" => "beszamolok.com", // Avatar URL. // Uncoment to replace image set in webhook //"avatar_url" => "https://ru.gravatar.com/userimage/28503754/1168e2bddca84fec2a63addb348c571d.jpg?size=512", // Text-to-speech "tts" => false, // File upload // "file" => "", // Embeds Array "embeds" => [ [ // Embed Title "title" => $cim . ' (kattints ide, ha meg akarod nézni)', // Embed Type "type" => "rich", // Embed Description "description" => ' ' . $szoveg . ' @everyone', // URL of title link "url" => $url, // Timestamp of embed must be formatted as ISO8601 "timestamp" => $timestamp, // Embed left border color in HEX "color" => hexdec( "3366ff" ), // Footer "footer" => [ "text" => "beszamolok.com", "icon_url" => "https://beszamolok.com/images/design/logo_guggolo.jpg" ], // Image to send "image" => [ "url" => $kep ], // Thumbnail //"thumbnail" => [ // "url" => "https://ru.gravatar.com/userimage/28503754/1168e2bddca84fec2a63addb348c571d.jpg?size=400" //], // Author "author" => [ "name" => "beszamolok", "url" => "https://beszamolok.com" ], // Additional Fields array /* "fields" => [ // Field 1 [ "name" => "", "value" => "beszamolok", "inline" => false ], ]*/ ] ] ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); $ch = curl_init($webhookurl); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); // If you need to debug, or find out why you can't send message uncomment line below, and execute script. // echo $response; curl_close($ch); } function hanyadik($lid, $kat) { $hanyadik_sql = query( 'select hird_id from hirdetes_jelentkezes where fokat=' . $kat . ' order by pontszam desc,mikor ASC' ); $hanyadik_v = 0; while ( $row = $hanyadik_sql->fetchRow() ) { $hanyadik_v++; if ($row['hird_id'] == $lid) break; } return $hanyadik_v; } function moderalas_bunti($honnan, $mit, $user_id, $mod_tipus = 0) { global $user, $moderalas_tipus; if (is_numeric($user_id)) $user_adat = getrow('select * from felhasznalok where id=' . $user_id); else { echo "Hiba!!!"; exit(); } if ($mod_tipus > 0) { if ($user_adat['hiba_szam'] <= 3) $premium_levonas = $user_adat['hiba_szam'] + 1; if ($user_adat['hiba_szam'] == 4) { if ($user_adat['premium_vendeg'] > 0) $premium_levonas = $user_adat['premium_vendeg']; else $premium_levonas = 30; } if ($user_adat['hiba_szam'] >= 5) { if ($user_adat['premium_vendeg'] > 0) $premium_levonas = $user_adat['premium_vendeg'] + 30; else $premium_levonas = 30; } $gondolkodasi_ido = 0; $egyeb_tilt = 0; // echo "

user_rangja:". $user_adat['rang'];'

'; if ($user_adat['rang'] <= 101 and $user_adat['rang'] <= 25) { if ($user_adat['hiba_szam'] == 0); $gondolkodasi_ido = 43200; if ($user_adat['hiba_szam'] == 1) $gondolkodasi_ido = 86400; if ($user_adat['hiba_szam'] == 2) $gondolkodasi_ido = 172800; if ($user_adat['hiba_szam'] >= 3) $gondolkodasi_ido = 259200; if ($user_adat['hiba_szam'] >= 4) $egyeb_tilt = 1; if ($user_adat['hiba_szam'] >= 4) $egyeb_tilt = 2; } elseif ($user_adat['rang'] <= 121) { if ($user_adat['hiba_szam'] == 0); $gondolkodasi_ido = 0; if ($user_adat['hiba_szam'] == 1) $gondolkodasi_ido = 0; if ($user_adat['hiba_szam'] == 2) $gondolkodasi_ido = 10800; if ($user_adat['hiba_szam'] == 3) $gondolkodasi_ido = 43200; if ($user_adat['hiba_szam'] == 4) $gondolkodasi_ido = 86400; if ($user_adat['hiba_szam'] == 5) $gondolkodasi_ido = 172800; if ($user_adat['hiba_szam'] == 6) $gondolkodasi_ido = 259200; if ($user_adat['hiba_szam'] >= 7) $gondolkodasi_ido = 604800; if ($user_adat['hiba_szam'] >= 7) $egyeb_tilt = 1; if ($user_adat['hiba_szam'] >= 8) $egyeb_tilt = 2; } $mod_meddig = date("Y-m-d H:i:s", (time() + $gondolkodasi_ido)); query( 'INSERT INTO `beszamolok`.`moderalas_bunti` (`ki`, `honnan`, `mit`, `mikor`, `user_id`, `tipus`) VALUES (' . $user->id . ', "' . $honnan . '", "' . $mit . '", NOW(), ' . $user_id . ', ' . $mod_tipus . ')' ); query('delete from moderalas_hibaszam where user_id=' . $user_id); $hibaszam_meddig = date("Y-m-d H:i:s", (time() + $gondolkodasi_ido + 864000)); query('insert into moderalas_hibaszam (user_id,datum) VALUES (' . $user_id . ',"' . $hibaszam_meddig . '")'); // echo '<br><br>'.$idotartam.'<br><br>'; // echo($gondolkodasi_ido.'<br><br>'); // echo "user id:".$user_id; // echo '<br><br>'.$mod_meddig.'<br><br>'; query( 'update felhasznalok set hiba_szam=hiba_szam+1, premium_vendeg=premium_vendeg-' . $premium_levonas . ',meddig="' . $mod_meddig . '" where id=' . $user_adat['id'] ); if ($gondolkodasi_ido > 0) { chatuzenet_admintol( $user_id, "Hozzászólásod moderáltuk, és gondolkodási időt kaptál. A moderálás indoka: " . $moderalas_tipus[$mod_tipus] . " A törölt hozzászolás: " . $honnan . " " . $mit ); require_once('class/felhasznalo.php'); $c_felhasznalo = new Felhasznalo(); if ($user_adat['rang'] < 100) { query('update felhasznalok set pont=bunti_pont,rang=bunti_rang where id=' . $user_id); } if ($egyeb_tilt == 1) query( 'update felhasznalok set pont=101 , rang=101,meddig="' . $mod_meddig . '" where id=' . $user_adat['id'] ); if ($egyeb_tilt == 2) $c_felhasznalo->BuntiFormMent($user_adat['becenev'], 24, $moderalas_tipus[$mod_tipus]); else $c_felhasznalo->BuntiFormMent($user_adat['becenev'], 28, $moderalas_tipus[$mod_tipus]); } chatuzenet_admintol( $user_id, "Hozzászólásod moderáltuk. Kérünk figyelj oda milyen módon kommunikálsz, és tartsd tiszteletben a moderálási elveket. A moderálás indokas: " . $moderalas_tipus[$mod_tipus] . " A törölt hozzászolás: " . $honnan . " " . $mit ); } else { chatuzenet_admintol( $user_id, "Hozzászólásod moderáltuk. Egyenlőre nem történt prémium nap levonás, és hibapontot sem kaptál, Viszont a jövőben kérünk figyelj oda milyen módon kommunikálsz, és tartsd tiszteletben a moderálási elveket, amiket az oldal alján találsz. A törölt hozzászolás: " . $honnan . " " . $mit ); } return; } function hirfolyam_add($cim, $leiras, $kep, $user_id, $tipus, $link) { $leiras = text_ellenorzes($leiras); if ($user_id == 8) $user_id = 6; query( 'insert into hirfolyam(datum, cim, leiras, kep, user_id, tipus, link) VALUES(NOW(),"' . $cim . '","' . $leiras . '","' . $kep . '","' . $user_id . '","' . $tipus . '","' . $link . '")' ); } function random_ajanlo($r_nem = 0, $r_limit = 10) { global $i; global $premium_megnevezes; global $user; $kiiras = ''; if ($r_nem == 0) $rand_nem = rand(1, 2); else $rand_nem = $r_nem; $leker = query('select id from hirdeto where aktiv=1 and fokat=' . $rand_nem . ' order by rand() limit 15 '); $c = 0; while ( $row = $leker->fetchrow() ) { $lanyok[$c] = KiemeletLanyLekerdezes($row['id']); $c++; } echo '<div class="kiemelt_kozep">'; $i = 0; for ( $i = 0; $i < $r_limit; $i++ ) { echo '<a href="' . $lanyok[$i]['url'] . '" title="' . $lanyok[$i]['name'] . ' ' . randomszo() . ' ' . $lanyok[$i]['htelefon'] . ' ' . ($lanyok[$i]['fokat'] == 1 ? ' szexpartner ' : ' erotikus masszázs ') . '" style="margin:10px;width:120px; display: inline-block; " target="blank">' . $lanyok[$i]['img'] . '<br>' . $lanyok[$i]['name'] . '</a>'; } echo $kiiras . '</div>'; } function spam_ellenor_log($tipus, $szoveg) { global $user; $most = date("Y-m-d H:i:s"); $tegnap = date("Y-m-d H:i:s", (time() - 60 * 60)); $tipus_name[1] = 'csevegés'; $tipus_name[2] = 'üzenőfal'; $tipus_name[3] = 'beszámoló beszélgetés'; $tipus_name[4] = 'infobazis'; $szunet[1] = '4'; $szunet[2] = '5'; $szunet[3] = '4'; $szunet[4] = '3'; query('delete from log_hozzaszolas ido<="' . $tegnap . '"'); $varakozas = $szunet[$tipus]; $ip = $_SERVER['HTTP_CLIENT_IP'] ? $_SERVER['HTTP_CLIENT_IP'] : ($_SERVER['HTTP_X_FORWARDED_FOR'] ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']); $utolso = getRow('select * from log_hozzaszolas where user_id="' . $user->id . '" order by ido desc limit 1'); $d1 = strtotime($most); $d2 = strtotime($utolso['ido']); $intervallum = $d1 - $d2; $bejegyzes_szam = getOne( 'select count(ido) from log_hozzaszolas where user_id="' . $user->id . '" and tilt=1 and ido>="' . $tegnap . '"' ); $bejegyzes_szam_ip = getOne( 'select count(ido) from log_hozzaszolas where ip="' . $ip . '" and tilt=1 order by ido desc léimit 1' ); $utolso_bejegyzes = getOne('select tilt from log_hozzaszolas where user_id="' . $user->id . '" '); $utolso_bejegyzes_ip = getOne('select tilt from log_hozzaszolas where ip="' . $ip . '" '); if ($utolso_bejegyzes_ip == 1) $utolso_bejegyzes = 1; if ($bejegyzes_szam > $bejegyzes_szam_ip) $bejegyzes_szam_sum = $bejegyzes_szam; else $bejegyzes_szam_sum = $bejegyzes_szam_ip; if ($intervallum >= ($varakozas + rand(1, 5)) and ($bejegyzes_szam_sum == 0 or $utolso_bejegyzes == 0)) { $ell['mehet'] = "igen"; } else { $varakozas = ($bejegyzes_szam_sum) * 5 + $varakozas; if ($varakozas <= $intervallum) { $ell['mehet'] = "igen"; } else { $ell['mehet'] = "nem"; $ell['darab'] = $bejegyzes_szam; $ell['szoveg'] = 'Túl gyorsan írtad a bejegyzéseket egymás után, spam védelem bekapcsolt, lassíts kérlek.'; chatuzenet_admintol($user->id, $ell['szoveg']); chatuzenet_admintol( 76638, 'Lehetséges spam probléma, ellenőrizd. Felhasználó: ' . $user->becenev . '. ahova írt: ' . $tipus_name[$tipus] ); chatuzenet_admintol( 4, 'Lehetséges spam probléma, ellenőrizd. Felhasználó: ' . $user->becenev . '. ahova írt: ' . $tipus_name[$tipus] ); } if ($bejegyzes_szam_sum >= 4) { require_once('/home/beszamolok/public_html/class/felhasznalo.php'); $c_felhasznalo = new Felhasznalo(); $c_felhasznalo->BuntiFormMent($user->becenev, 27, 'spam'); } } if ($ell['mehet'] == "nem") $tilt = 1; else $tilt = 0; query( "INSERT INTO `beszamolok`.`log_hozzaszolas` (`user_id`, `ip`, `ido`, `tipus`, `mit`, `tilt`) VALUES ('" . $user->id . "', '" . $ip . "', '" . $most . "', '" . $tipus . "', '" . $szoveg . "', '" . $tilt . "')" ); return $ell; } function getCreationTime($filePath) { // Megpróbáljuk lekérni az EXIF adatokat global $user; if (function_exists('exif_read_data')) { $exif = @exif_read_data($filePath); /* if($user->id==4) { print_r($exif); echo $filePath; echo '<br>'; echo '<br>'; echo "FileDateTime=".date("Y.m.d.",$exif['FileDateTime']); echo "<br>DateTime=".$exif['DateTime']; echo "<br>OriginalDateTime=".$exif['DateTimeOriginal']; echo '<br>'; }*/ if (isset($exif['DateTimeOriginal'])) { $ret['keszites'] = substr($exif['DateTimeOriginal'], 0, 10); $ret['keszites'] = str_replace(':', '-', $ret['keszites']); $ret['keszites'] = str_replace('.', '-', $ret['keszites']); } else $ret['keszites'] = ' ismeretlen, lehet 1 napos, de több éves is'; //if (isset($ret['Software']) or isset($ret['Software'])) //{ $ret['Software'] = (isset($exif['Software']) ? $exif['Software'] : ''); $ret['software'] = (isset($exif['software']) ? $exif['software'] : ''); //} /*else { $ret['Software'] = 'ismeretlen'; $ret['software'] = 'ismeretlen'; }*/ if (isset($exif['DateTime'])) $ret['modositas'] = substr($exif['DateTime'], 0, 10); else $ret['modositas'] = ' ismeretlen, lehet 1 napos, de több éves is'; if (isset($ret['filetime'])) $ret['filetime'] = date('Y-m-d', $exif['FileDateTime']); else $ret['filetime'] = ' ismeretlen, lehet 1 napos, de több éves is'; /*if ($ret['keszites'] <= '1999-01-01') $ret['keszites'] = 'ismeretlen'; if ($ret['modositas'] <= '1999-01-01') $ret['modositas'] = 'ismeretlen'; if ($ret['filetime'] <= '1999-01-01') $ret['filetime'] = 'ismeretlen';*/ return $ret; } return false; } function thumbkeszito($kepfile, $output, $meret1, $meret2) { $image = new Gmagick(); $image->readImage($kepfile); if ($meret1 <= $meret2) $max_length = $meret2; else $max_length = $meret1; $width = $image->getImageWidth(); $height = $image->getImageHeight(); if ($width > $height) { $new_height = $max_length; $new_width = intval($max_length * $width / $height); } else { $new_width = $max_length; $new_height = intval($max_length * $height / $width); } $image->resizeimage($new_width, $new_height, 10, 0.5); $image->setImageBackgroundColor("white"); $w = $image->getImageWidth(); $h = $image->getImageHeight(); $off_top = 0; $off_left = 0; if ($w < $h) { $off_top = (($meret2 - $h) / 2) * -1; } else { $off_left = (($meret1 - $w) / 2) * -1; } $image->cropimage($meret1, $meret2, $off_left, $off_top); //$image->cropthumbnailimage($meret1,$meret2); $image->writeImage($output); $image->destroy(); return true; } function face_share_btn() { $facelink = 'https://beszamolok.com' . $_SERVER['REQUEST_URI']; $btn_code = ' <a target="_blank" class="default" href="https://www.facebook.com/sharer/sharer.php?u=' . $facelink . '&amp;src=sdkpreparse" style="color:#ffffff;height:fit-content;padding-right:5px;background-color:#0866ff !important"> <div class="fb-share-button" data-href="' . $facelink . '" data-layout="" data-size=""><img src="/images/design/facebook.png" style="float:left; vertical-align: bottom;">megosztás</div></a> '; return $btn_code; } function nagybetu($string, $encoding = 'UTF-8') { $first_char = mb_strtoupper(mb_substr($string, 0, 1, $encoding), $encoding); $rest_of_string = mb_substr($string, 1, null, $encoding); return $first_char . $rest_of_string; } function EgyBeszamolo($bid, $b_admin = false) { global $translator, $lang_beszCimke, $lang_modul, $domain, $beszi_bes; //include_once('includes/besz_cimke.php'); include('includes/besz_cimke.php'); /* $s_cacheKey = 'beszamolo_' . $bid; if ( !$b_admin ) { if ( ($beszamolo = $this->cache->get( $s_cacheKey, 'beszamolo' )) !== false ) { return $beszamolo; } } */ $beszamolo = array(); global $beszamolo, $beszi_bes, $user, $country_id; if ($domain == 'callgirl-list.com') { $s_whereCountryId = ' 1 = 1 '; } $result = query( 'SELECT * FROM besz LEFT JOIN besz_' . $user->lang . ' ON (besz.id = besz_' . $user->lang . '.besz_id) WHERE id= ' . $bid ); global $user; /* if ($this->user->id == 66640) { echo 'SELECT * FROM besz LEFT JOIN besz_' . $user->lang . ' ON (besz.id = besz_' . $user->lang . '.besz_id) WHERE ' . (!$b_admin ? ' besz.status=1 AND ' : '') . ' id= ' . $bid . ' AND ' . $s_whereCountryId; } */ $now = date("Y-m-d H:i:00"); if ($result->numRows() > 0) { $tomb = $result->fetchRow(MDB2_FETCHMODE_ASSOC); $beszamolo = $tomb; if (substr($beszamolo['datum_randi'], 0, 7) == "0000-00") $beszamolo['datum_randi'] = $beszamolo['datum_aktivalas']; $beszamolo['user_rang'] = getOne('select rang from felhasznalok where id=' . $beszamolo['user_id']); //list($id, $date, $title, $reviewer, $lead, $email, $besorolas, $kategoria, $telefon, $semmi, $action, $egyeztetes, $megkozelites, $elszamolas, $lany, $action_ertek, $egyeztetes_ertek, $megkozelites_ertek, $elszamolas_ertek, $lany_ertek, $megjegyzes, $helyszin, $helyszin_ertek, $pontszam, $osszkep, $osszkep_ertek, $reagalas, $megye_nev, $telepules_nev, $varosresz_nev) = $tomb; //die ('SELECT id, user_id, com_user_id, name FROM hirdeto WHERE htelefon = "' . $tomb['htelefon'] . '"' . (!$b_admin ? ' and nagyveg>NOW() order by nagyveg DESC' : '')); //$holhirdet = getRow( 'SELECT id, user_id, com_user_id, name, neten, rang_bejelentkezes FROM hirdeto WHERE htelefon = "' . $tomb['htelefon'] . '"' . (!$b_admin ? ' and nagyveg>NOW() order by nagyveg DESC' : '') ); //$holhirdet = getRow( 'SELECT hirdeto.id, hirdeto.user_id, hirdeto.com_user_id, hirdeto.name, hirdeto_altalanos.neten, hirdeto_altalanos.rang_bejelentkezes FROM hirdeto, hirdeto_altalanos WHERE hirdeto.id = "' . $tomb['hird_id'] . '" AND hirdeto.id = hirdeto_altalanos.hird_id ' . (!$b_admin ? ' AND hirdeto.nagyveg > NOW() ORDER BY nagyveg DESC' : '') ); $holhirdet = getRow( 'SELECT hirdeto.id,hirdeto.aktiv,hirdeto.kezdokep, hirdeto.user_id, hirdeto.com_user_id, hirdeto.name FROM hirdeto WHERE hirdeto.id = "' . $tomb['hird_id'] . '" ' ); if (is_array($holhirdet) && $holhirdet['id'] > 0) { $beszamolo['hirdeteslink'] = '<a href="/' . $lang_modul['szexpartner'] . '/?lid=' . $holhirdet['id'] . '">' . $translator->Translate(1032, 'lang_alt') . '</a>'; $beszamolo['hirdetesid'] = $holhirdet['id']; $beszamolo['hird_id'] = $holhirdet['id']; $beszamolo['hirdeto_id'] = $holhirdet['id']; $beszamolo['lanynev'] = $holhirdet['name']; $beszamolo['hirdetonk'] = 1; $beszamolo['aktiv'] = $holhirdet['aktiv']; $beszamolo['hirdetes_user_id'] = $holhirdet['user_id']; $beszamolo['hirdetes_com_user_id'] = $holhirdet['com_user_id']; //$beszamolo['hirdetes_neten'] = $holhirdet['neten']; //$beszamolo['hirdetes_rang_bejelentkezes'] = $holhirdet['rang_bejelentkezes']; } else { $beszamolo['aktiv'] = 0; $beszamolo['hirdeteslink'] = $translator->Translate(65, 'lang_alt'); $beszamolo['hirdetonk'] = 0; $beszamolo['hirdetesid'] = getOne("select id from hirdeto where htelefon='" . $tomb['htelefon'] . "' "); } foreach ($tomb as $key => $value) { $beszamolo[$key] = $value; } if ($tomb['o_lang'] != $user->lang) { $row_orig = getRow("SELECT * FROM besz_" . $tomb['o_lang'] . " WHERE besz_id = " . $bid); $beszamolo['o_lead'] = $row_orig['lead']; $beszamolo['o_egyeztetes'] = $row_orig['egyeztetes']; $beszamolo['o_megkozelites'] = $row_orig['megkozelites']; $beszamolo['o_helyszin'] = $row_orig['helyszin']; $beszamolo['o_lany'] = $row_orig['lany']; $beszamolo['o_action'] = $row_orig['action']; $beszamolo['o_masszazs'] = $row_orig['masszazs']; $beszamolo['o_levezetes'] = $row_orig['levezetes']; $beszamolo['o_elszamolas'] = $row_orig['elszamolas']; $beszamolo['o_osszkep'] = $row_orig['osszkep']; $beszamolo['o_problemak'] = $row_orig['problemak']; $beszamolo['o_megjegyzes'] = $row_orig['megjegyzes']; // a besz lang táblákban nincs is megjegyzés mező! - Z 170331 //$beszamolo['o_megjegyzes'] = $tomb['megjegyzes']; } else { $beszamolo['o_lead'] = $tomb['lead']; $beszamolo['o_egyeztetes'] = $tomb['egyeztetes']; $beszamolo['o_megkozelites'] = $tomb['megkozelites']; $beszamolo['o_helyszin'] = $tomb['helyszin']; $beszamolo['o_lany'] = $tomb['lany']; $beszamolo['o_action'] = $tomb['action']; $beszamolo['o_masszazs'] = $tomb['masszazs']; $beszamolo['o_levezetes'] = $tomb['levezetes']; $beszamolo['o_elszamolas'] = $tomb['elszamolas']; $beszamolo['o_osszkep'] = $tomb['osszkep']; $beszamolo['o_problemak'] = $tomb['problemak']; $beszamolo['o_megjegyzes'] = $tomb['megjegyzes']; } $konyvtar = melyKonyvtarba($beszamolo['id'], 1000); if (isset($holhirdet['aktiv']) && $holhirdet['aktiv'] > 0) { $beszamolo['img'] = '/kepek/hirdeto/' . hirdeto_dir($beszamolo['hird_id']) . '/' . $beszamolo['hird_id'] . '/' . $holhirdet['kezdokep'] . '_120x120.webp'; } else { $leker = getRow( 'select site_id,kep,id from nyilvantartas where telefon="' . $beszamolo['htelefon'] . '" and status=1' ); if (!empty($leker)) { $img_meret = 1; if ($leker['site_id'] == 1) $beszamolo['img'] = 'https://beszamolok.com/tmprl/' . $leker['id'] . '.jpg'; if ($leker['site_id'] == 2) $beszamolo['img'] = ' https://' . $leker['kep'] . '"'; } elseif (!is_file('/home/beszamolok/public_html/kepek/besz/' . $konyvtar . '/' . $beszamolo['id'] . '.jpg')) $beszamolo['img'] = '/images/nincs_kep_nagy.gif'; else $beszamolo['img'] = '/kepek/besz/' . $konyvtar . '/' . $beszamolo['id'] . '.jpg'; } $beszamolo['cimke_pozitiv'] = ''; $beszamolo['cimke_negativ'] = ''; $beszamolo['cimke_pozitiv_id'] = array(); $beszamolo['cimke_negativ_id'] = array(); $sql = 'SELECT cimke_id FROM besz_cimke WHERE besz_id = ' . $bid; $res = query($sql); while ( $row = $res->fetchRow() ) { if (isset($beszCimke[$row['cimke_id']]['pozitiv']) && $beszCimke[$row['cimke_id']]['pozitiv'] == 1) { $beszamolo['cimke_pozitiv'] .= $beszCimke[$row['cimke_id']]['nev'] . ', '; $beszamolo['cimke_pozitiv_id'][] = $row['cimke_id']; } elseif (isset($beszCimke[$row['cimke_id']]['negativ'])) { $beszamolo['cimke_negativ'] .= $beszCimke[$row['cimke_id']]['nev'] . ', '; $beszamolo['cimke_negativ_id'][] = $row['cimke_id']; } } $beszamolo['cimke_pozitiv'] = substr($beszamolo['cimke_pozitiv'], 0, -2); $beszamolo['cimke_negativ'] = substr($beszamolo['cimke_negativ'], 0, -2); /*if ( is_array($holhirdet) && $holhirdet['aktiv'] > 0 ) $row_cim = getRow("SELECT longitude, latitude, level_1_id,level_2_id FROM hirdeto_cim WHERE hird_id = ".$tomb['hird_id']); if($row_cim['level_1_id']=='') $row_cim = getRow("SELECT longitude, latitude, level_1_id,level_2_id FROM besz_cim WHERE besz_id = ".$bid); if($row_cim['level_1_id']=='') $row_cim = getRow("SELECT longitude, latitude, level_1_id,level_2_id FROM hirdeto_cim WHERE hird_id =201727"); */ $level_1_name = ""; $level_2_name = ""; $row_cim = getRow("SELECT longitude, latitude, level_1_id,level_2_id FROM besz_cim WHERE besz_id = " . $bid); if (isset($row_cim['level_1_id']) && is_numeric($row_cim['level_1_id'])) $level_1_name = GetAddressLevel($row_cim['level_1_id'], 1); if (isset($row_cim['level_2_id']) && is_numeric($row_cim['level_2_id'])) $level_2_name = GetAddressLevel($row_cim['level_2_id'], 2); $beszamolo['cim'] = $level_1_name . ', ' . $level_2_name; /* $beszamolo['cim_longitude'] = $row_cim['longitude']; $beszamolo['cim_latitude'] = $row_cim['latitude']; $beszamolo['level_1_id']=$row_cim['level_1_id']; $beszamolo['level_2_id']=$row_cim['level_2_id']; $beszamolo['level_1_name']=$level_1_name; $beszamolo['level_2_name']=$level_2_name;*/ /* if ( !$b_admin ) { $this->cache->set( $s_cacheKey, $beszamolo, 'beszamolo', 86400 ); } */ $beszamolo['id'] = $bid; //$beszamolo['datum_kozzeteve'] = getOne("SELECT datum FROM rendszer_log WHERE adat_id = ".$bid." AND tipus = 34"); /* if ($beszamolo['elegedett'] == 2 and $beszamolo['sorrend'] != 99) { $beszamolo['sorrend'] = 50; }*/ /* if ($beszamolo['elegedett'] == 3 && $beszamolo['sorrend']==60) { $beszamolo['sorrend'] = 60; }*/ /*if ($user->id == 10801) { print_r($beszamolo); }*/ //echo $beszamolo['sorrend']; $beszamolo['link'] = '/beszamolo/' . urlencode($beszamolo['title']) . '-36' . $beszamolo['htelefon'] . '/' . $beszamolo['id']; $beszamolo['ertekeles_igen'] = getOne( 'select count(ertekeles) from besz_ertekeles where besz_id=' . $bid . ' and ertekeles=1' ); $beszamolo['ertekeles_atlagos'] = getOne( 'select count(ertekeles) from besz_ertekeles where besz_id=' . $bid . ' and ertekeles=2' ); $beszamolo['ertekeles_nem'] = getOne( 'select count(ertekeles) from besz_ertekeles where besz_id=' . $bid . ' and ertekeles=0' ); } /*if ($domain == 'callgirl-list.com') { $country_id = $tmp_country_id; }*/ return ($beszamolo); } function megyelist_select() { global $megyelist, $megye; $str = '<select name="megye" class="form-control">'; foreach ($megyelist as $key => $value) { $str .= '<option value="' . $key . '"' . (isset($megye) && $megye == $key ? ' selected="selected"' : '') . '>' . $value . '</option>'; } $str .= '</select>'; return $str; } function hetnaponbelul($date) { // A mai dátum napra kerekítve $today = new DateTime(); $today->setTime(0, 0, 0); // Az időt nullázzuk, hogy csak a dátumot vegyük figyelembe // A bemeneti dátum napra kerekítve $inputDate = new DateTime($date); $inputDate->setTime(0, 0, 0); // Az időt nullázzuk, hogy csak a dátumot vegyük figyelembe // A különbség kiszámítása napokban $interval = $today->diff($inputDate)->days; // Ellenőrizzük, hogy a különbség 7 napnál kisebb vagy egyenlő-e és a dátum nem jövőbeli return $interval <= 7 && $inputDate <= $today; } function sendPush( $f_user_id, $title, $body, $f_image = "https://beszamolok.com/images/megosztas_logo.jpg", $f_data = [] ) { global $user; if ($f_user_id != "") { $body = str_replace('<br>', '', $body); $body = str_replace('<br />', '', $body); $body = str_replace('</p>', '', $body); $body = str_replace('\\n', '', $body); $body = str_replace('\n', '', $body); $body = strip_tags($body); if (!isset($f_data['tipus'])) $f_data['tipus'] = 'ures'; $f_data['tipus'] = $f_image; if (is_numeric($f_user_id)) { $fcmToken = getOne('select device_id from felhasznalok where id=' . $f_user_id); if ($fcmToken != '') { $kaporang = getOne('select rang from felhasznalok where device_id="' . $fcmToken . '"'); if ($kaporang < 135 or $kaporang >= 198) { $serviceAccountFile = '/home/beszamolok/public_html/reborn/includes/vendegapp-firebase-adminsdk-p6f2m-688bb11bfd.json'; $url = 'https://fcm.googleapis.com/v1/projects/vendegapp/messages:send'; } else { $serviceAccountFile = '/home/beszamolok/public_html/reborn/includes/hirdetialkalmazs-firebase-adminsdk-ijrhq-821d5e5eeb.json'; $url = 'https://fcm.googleapis.com/v1/projects/hirdetialkalmazs/messages:send'; } // Hozz létre egy OAuth2 token-t a Service Account JSON fájl alapján $accessToken = getAccessToken($serviceAccountFile); // Az üzenet adatai $f_data["title"] = $user->becenev . ' - ' . $title; $f_data["message"] = $body; $f_data["f_image"] = $f_image; $data = [ "message" => [ "token" => $fcmToken, "data" => $f_data ] ]; // JSON formázás $dataString = json_encode($data); // HTTP kérés beállításai $headers = [ "Authorization: Bearer $accessToken", "Content-Type: application/json", ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString); $result = curl_exec($ch); if ($result === FALSE) { die('Curl failed: ' . curl_error($ch)); } curl_close($ch); } } } } function getAccessToken($serviceAccountFile) { // Lépések az OAuth2 token megszerzéséhez $credentials = json_decode(file_get_contents($serviceAccountFile), true); $tokenUrl = $credentials['token_uri']; $privateKey = $credentials['private_key']; $clientEmail = $credentials['client_email']; $now = time(); $expiration = $now + 3600; // JWT Token létrehozása $header = [ 'alg' => 'RS256', 'typ' => 'JWT' ]; $claims = [ 'iss' => $clientEmail, 'scope' => 'https://www.googleapis.com/auth/firebase.messaging', 'aud' => $tokenUrl, 'iat' => $now, 'exp' => $expiration ]; $headerEncoded = base64_encode(json_encode($header)); $claimsEncoded = base64_encode(json_encode($claims)); $signature = ''; openssl_sign("$headerEncoded.$claimsEncoded", $signature, $privateKey, OPENSSL_ALGO_SHA256); $signatureEncoded = base64_encode($signature); $jwt = "$headerEncoded.$claimsEncoded.$signatureEncoded"; // HTTP kérés az OAuth2 token megszerzéséhez $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $tokenUrl); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['grant_type' => 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion' => $jwt])); $response = curl_exec($ch); if ($response === FALSE) { die('Curl failed: ' . curl_error($ch)); } curl_close($ch); $tokenInfo = json_decode($response, true); return $tokenInfo['access_token']; } function linkkieg($kerdojel = 0) { if ($kerdojel == 1) return '?tcachefriss=' . rand(30000000, 9999999999999); else return '&tcachefriss=' . rand(30000000, 9999999999999); } function infokeres($telefon = '', $mennyit = 1) { global $vanmar; if ($telefon == "" or !is_numeric($telefon)) { return 'Hibás / nem létező telefon adat lekérdezés...'; } else { $muvesznevek = array(); $telefonszamok = array(); $lanykepek = array(); $kiir = ''; $secondcim = 0; if ($mennyit == 1) { $aktivok = query( 'select id,nev,datum from nyilvantartas where telefon="' . $telefon . '" and status=1 order by id desc' ); if ($aktivok->numRows() >= 1) { $secondcim = 1; $kiir .= '<br /><strong style="line-height:3;margin-left:15px;color: #9f001b;">Ellenőrizetlen hirdetések:</strong><br />'; } if ($aktivok->numRows() >= 1) while ( $row = $aktivok->fetchRow() ) { $vanmar++; $lanykepek[] = '<img src="/tmprl/' . $row['id'] . '.jpg?t=' . rand(1, 9999999) . '" onerror="this.onerror=null; this.src=\'https://beszamolok.com/images/nincs_kep_kicsi.gif\'" style=" max-height: 90px; float:left; max-width:90px !important; margin: 5px; border-radius: 5px; vertical-align: top; ">'; $kiir .= '<li style="list-style-type: none;display:table;font-size:16px;"> <strong>' . $row['nev'] . '</strong> - AKTÍV </li>'; $muvesznevek[] = $row['nev']; $rltol_mehet = 0; $van_rl_aktiv = 0; } $inaktivok = query( 'select id,nev,datum from nyilvantartas where telefon="' . $telefon . '" and status!=1 order by datum ASC' ); if ($inaktivok->numRows() >= 1) { if ($secondcim == 0) $kiir .= '<br /><strong style="line-height:3;margin-left:15px;color: #9f001b;">Ellenőrizetlen hirdetések</strong><br />'; } $h = 0; if ($inaktivok->numRows() >= 1) while ( $row = $inaktivok->fetchRow() ) { $h++; $lanykepek[] = '<img src="/tmprl/' . $row['id'] . '.jpg?t=' . rand(1, 9999999) . '" onerror="this.onerror=null; this.src=\'https://beszamolok.com/images/nincs_kep_kicsi.gif\'" style=" max-height: 90px; float:left; max-width:90px !important; margin: 5px; border-radius: 5px; vertical-align: top; ">'; $currentDate = new DateTime(); $checkDate = DateTime::createFromFormat('Y-m-d', $row['datum']); $interval = $checkDate->diff($currentDate); if ($interval->days > 30 && $checkDate < $currentDate) { $rltol_mehet = 1; } else { $rltol_mehet = 0; } $vanmar++; $kiir .= '<li style="list-style-type: none;display:table;font-size:16px;"> <strong>' . $row['nev'] . '</strong> - INAKTÍV (' . $row['datum'] . ') </li>'; $muvesznevek[] = $row['nev']; } if ($vanmar == 0) $kiir .= 'Ezen a számon nem tartunk nyílván hirdetést az interneten más oldalakon.<br>'; /*else $kiir .= '<i style="font-size:10px;">* Nálunk nem hirdetőkről szóló infókat nem tudjuk ellenőrizni, ezért ide ellenőrzés nélékül, cenzúrázatlanul lehet bejegyzést írni. </i><br />'; //Aki olvassa az pedig legyen tisztában vele, hogy nem ellenőrzött az infó. Inakív hirdetések képeit jogi szempontból nem jelenítjük meg.*/ $sqlCsoportId = " SELECT csoport_id FROM alias_telefon WHERE telefon like '%" . $telefon . "%' "; $csoport_id_lista = query($sqlCsoportId); if ($csoport_id_lista->numRows() >= 1) { while ( $qrow = $csoport_id_lista->fetchRow() ) { $csoport_id = $qrow['csoport_id']; // Végső lekérdezés: találatok mindkét táblából $sqlTalalatok = " SELECT telefon AS adat, datum, csoport_id FROM alias_telefon WHERE csoport_id = " . $csoport_id; $talalatokl = query($sqlTalalatok); // Eredmény feldolgozása if ($talalatokl->numRows() > 0) { while ( $mrow = $talalatokl->fetchRow() ) { if (trim($mrow['adat']) != '' and trim($mrow['adat']) != $telefon) { $telefonszamok[] = $mrow['adat']; } } } $sqlTalalatok_nev = " SELECT nev AS adat, datum, csoport_id FROM alias_nev WHERE csoport_id = " . $csoport_id; $talalatokk = query($sqlTalalatok_nev); // Eredmény feldolgozása if ($talalatokk->numRows() > 0) { while ( $brow = $talalatokk->fetchRow() ) { if (trim($brow['adat']) != '') { $muvesznevek[] = $brow['adat']; } } } } } if ($vanmar > 0) { $kiir .= '<hr>A <i class="fa sarga">' . $telefon . '</i> telefonszámhoz kapcsolódó<br> más telefonszámok:'; if (sizeof($telefonszamok) > 0) $kiir .= ' <strong class="sarga">' . implode( ", ", array_unique( $telefonszamok ) ) . '</strong>'; else $kiir .= ' <strong class="sarga">nincs</strong>'; $kiir .= '<br>'; if (sizeof($muvesznevek) > 0) $kiir .= ' művésznevek: <strong class="sarga">' . implode(", ", array_unique($muvesznevek)) . '</strong><br>'; else $kiir .= ' <strong class="sarga">nincs</strong>'; $kiir .= 'Kapcsolódó képek:'; if (sizeof($lanykepek) > 0) $kiir . '<div style="display: flex;">' . implode( " ", array_unique( $lanykepek ) ) . '</div>'; else $kiir .= '<strong class="sarga"> nincs</strong>'; $kiir .= '<br><br><strong>Tudsz más névről / telefonszámről amin hirdet(ett) vagy van beszámolója?</strong><br><br>Jelezd felénk <button class="default" href="#" onclick="document.getElementById(\'visszajelzes-hozzakotes\').style.display=\'block\'; return false;" target="_blank">ide kattintva</button>, hogy összeköthessük! Ha hasznos infót küldesz be, 1-3 premium vendég napot írunk fel ! <br> <div id="visszajelzes-hozzakotes" style="display: none; border:1px solid var(--border-color);padding:5px;"><i>Kérünk írde be ide az általad ismert, itt jelenleg nem szereplő telefonszámát és/vagy művésznevét</i><br> <form action="/bekuldes_uzenetben/index.php" method="post" enctype="multipart/form-data" name="adatok" id="adatok" > <input type="hidden" name="telefon" value="' . $telefon . '"> <br> Eddig nem összekapcsolt telefonszám / név ehhez :<br> Név: <input type="text" name="leiras_nev" maxlength="200" style="width:200px;"> <br> Telefonszám: <input type="text" name="leiras_telefon" maxlength="200" style="width:200px"> <br> <input type="submit" class="submit" name="elkuld" value="beküldés"> </form></div> '; } } } $kiir .= '<hr>'; return $kiir; } function checkCimkeForLid($lid) { // Elozo teljes honap datumszakasz $from_date = date("Y-m-01 00:00:00", strtotime("first day of last month")); $to_date = date("Y-m-t 23:59:59", strtotime("last day of last month")); // SQL: van-e barmely cimke $sql = "SELECT COUNT(*) as cnt FROM besz_cimkek bc JOIN besz b ON bc.besz_id = b.id WHERE b.hird_id = $lid AND b.status = 1 AND b.datum_aktivalas BETWEEN '$from_date' AND '$to_date' AND ( bc.kulso IS NOT NULL AND bc.kulso != 0 OR bc.elojatek IS NOT NULL AND bc.elojatek != 0 OR bc.masszazs IS NOT NULL AND bc.masszazs != 0 OR bc.action IS NOT NULL AND bc.action != 0 OR bc.szemelyiseg IS NOT NULL AND bc.szemelyiseg != 0 )"; $res = query($sql); $row = $res->fetchRow(); if ($row['cnt'] > 0) { return "van"; } else { return "nincs"; } } function checkTimeDiff() { global $kul_tims; $now = microtime(true); if (isset($kul_tims) && is_numeric($kul_tims)) { $diff = abs($now - $kul_tims); //echo "Eltelt idő másodpercben: {$diff} <br>"; } else { echo "A \$kul_tims változó nincs beállítva vagy nem numerikus."; } $kul_tims = $now; } function generateAlphaNumericToken($length = 40): string { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; $token = ''; for ($i = 0; $i < $length; $i++) { $token .= $chars[random_int(0, strlen($chars) - 1)]; } return $token; } function askAI(string $question): string { global $user, $OPENAI_API_KEY; if (!$OPENAI_API_KEY) { return 'Az AI szolgáltatás jelenleg nem érhető el.'; } if ( stripos($string, 'rosszlanyok') === false && stripos($string, 'rosszlányok') === false ) { $question = str_replace( ['beszi', 'lány', 'lany', 'csaj', 'ribanc', 'kurva', 'picsa', 'prosti'], ['beszámoló', 'hirdető', 'hirdető', 'hirdető', 'hirdető', 'hirdető', 'hirdető', 'hirdető'], $question ); } $knowledge = trim(loadRelevantKnowledgeByRank( (int)$user->rang, $question )); // ha NINCS tudásbázis találat // normál scope if ($user->rang > 190) { $scope = 'user'; } elseif ($user->rang >= 145 && $user->rang <= 160) { $scope = 'advertiser'; } elseif ($user->rang >= 101 && $user->rang <= 140) { $scope = 'user'; } else { $scope = 'anon'; } $rangszam=(int)$user->rang; global $rangok_html_nelkul; $rang_megnevezess = $rangok_html_nelkul[$rangszam] ?? null; if ($knowledge =='') { // 1️⃣ kiírjuk a fallback szöveget $fallbackText = $knowledge; // 2️⃣ meghívjuk az AI-t fallback agenttel $payload = [ 'question' => $question, 'knowledge' => '', 'rang' => $rang_megnevezess, 'nev' => $user->becenev, 'scope' => 'fallback' ]; $aiAnswer = callAgent($payload); $scope='fallback'; return trim($fallbackText . "\n\n" . $aiAnswer); } $payload = [ 'question' => $question, 'knowledge' => $knowledge, 'rang' => $rang_megnevezess, 'nev' => $user->becenev, 'scope' => $scope ]; return callAgent($payload); } function callAgent(array $payload): string { global $user, $OPENAI_API_KEY, $OPENAI_MODEL; static $agentCache = []; $scope = $payload['scope'] ?? 'anon'; if (!isset($agentCache[$scope])) { $agentFile = "/home/beszamolok/public_html/reborn/ai/agents/{$scope}.txt"; if (!is_file($agentFile)) { return 'AI agent konfigurációs hiba.'; } $agentCache[$scope] = file_get_contents($agentFile); } $messages = [ [ 'role' => 'system', 'content' => $agentCache[$scope] ], [ 'role' => 'user', 'content' => json_encode($payload, JSON_UNESCAPED_UNICODE) ] ]; $request = [ 'model' => $OPENAI_MODEL, 'messages' => $messages, 'temperature' => 0.6, 'max_tokens' => 200 ]; $ch = curl_init('https://api.openai.com/v1/chat/completions'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Authorization: Bearer ' . $OPENAI_API_KEY ], CURLOPT_POSTFIELDS => json_encode($request), CURLOPT_TIMEOUT => 20 ]); $response = curl_exec($ch); if ($response === false) { curl_close($ch); return 'AI kommunikációs hiba.'; } curl_close($ch); $data = json_decode($response, true); // ===== DEKÓDOLT DATA LOG ===== file_put_contents( '/home/beszamolok/public_html/reborn/ai/ai_full_response.log', "RESPONSE DECODED:\n" . json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n\n", FILE_APPEND ); $rawAnswer = trim($data['choices'][0]['message']['content'] ?? ''); // ===== DEBUG: nyers agent válasz ===== file_put_contents( '/home/beszamolok/public_html/reborn/ai/ai_debug.log', "AGENT RAW ANSWER >>>" . $rawAnswer . "<<<\n", FILE_APPEND ); $finalAnswer = $rawAnswer; $noInfo = 'Erről nincs információ a rendszerben'; // ===== FORCE OVERRIDE ===== if ( stripos($rawAnswer, $noInfo) !== false && isset($payload['knowledge']) && trim($payload['knowledge']) !== '' ) { $finalAnswer = trim($payload['knowledge']); } if ($finalAnswer === '') { $finalAnswer = $noInfo; } // ===== AI CHAT LOG MENTÉS ===== $finalAnswer = str_replace('\/','/',$finalAnswer); $finalAnswer = preg_replace( '/\[(.*?)\]\((https?:\/\/[^\)]+)\)/', '<a href="$2" class="default">$1</a>', $finalAnswer ); $finalAnswer = str_ireplace('knowledge', 'TUDÁSTÁR', $finalAnswer); return $finalAnswer; } function loadRelevantKnowledgeByRank(int $rang, string $question): string { /* ========================= DEBUG ========================= */ global $user; $DEBUG = true; $DEBUG_LOG = '/home/beszamolok/public_html/reborn/ai/ai_debug.log'; $MIN_SCORE = 6.0; $dbg = function (string $msg) use ($DEBUG, $DEBUG_LOG) { if ($DEBUG) { file_put_contents( $DEBUG_LOG, '[' . date('Y-m-d H:i:s') . '] ' . $msg . "\n", FILE_APPEND ); } }; $dbg("==== NEW QUERY ===="); $dbg("RAW question: {$question}"); $dbg("User rang: {$rang}"); /* ========================= SCOPE ========================= */ if ($rang >= 101) { $scope = 'user'; } else { $scope = 'anon'; } $dbg("Scope: {$scope}"); $dir = __DIR__ . "/../ai/knowledge/{$scope}/"; /* ========================= NORMALIZÁLÁS ========================= */ $questionNorm = normalizeText($question); $questionWords = array_values( array_filter(preg_split('/\s+/u', $questionNorm)) ); $dbg("Normalized question: {$questionNorm}"); $dbg("Question words: " . implode(', ', $questionWords)); /* ========================= TELEFONSZÁM DETEKTÁLÁS ========================= */ $phoneDetected = false; // minden nem szám karakter eltávolítása $digitsOnly = preg_replace('/\D+/', '', $question); // +36 kezelése if (str_starts_with($digitsOnly, '36')) { $digitsOnly = substr($digitsOnly, 2); } // ha pontosan 9 számjegy marad (2 körzet + 7 szám) if (preg_match('/^\d{9}$/', $digitsOnly)) { $phoneDetected = true; $dbg("PHONE DETECTED: {$digitsOnly}"); } $sections = []; //$allSections = []; /* ========================= MD FÁJLOK BEJÁRÁSA ========================= */ foreach (glob($dir . '*.md') as $file) { $fileBase = basename($file); $content = file_get_contents($file); /* ---------- KEYWORDS ---------- */ $keywords = []; if (preg_match('/@keywords\s*:\s*(.+)/i', $content, $m)) { $keywords = array_values(array_filter(array_map( fn($k) => normalizeText(trim($k)), explode(',', $m[1]) ))); } /* ========================= FILE BONUS (1) – GYENGÍTETT, ARÁNYOS Cél: a teljes fájl relevanciáját jelezni, de ne nyomja el a section-szintű találatokat ========================= */ $fileNorm = normalizeText($content); $fileBonus = 0.0; foreach ($questionWords as $qw) { if (mb_strlen($qw) >= 3 && str_contains($fileNorm, $qw)) { $fileBonus += 0.1; } } /* ========================= SZEKCIÓK ========================= */ $parts = preg_split('/\n##\s+/u', $content); array_shift($parts); foreach ($parts as $part) { $lines = explode("\n", $part, 2); $title = trim($lines[0]); $body = $lines[1] ?? ''; $sectionText = "## " . $title . "\n" . $body; $sectionNorm = normalizeText($sectionText); $score = 0.0; /* Állapotjelzők a későbbi finomításhoz */ $hasTitleMatch = false; $hasBodyMatch = false; $keywordHit = false; $questionHit = false; /* ========================= KEYWORDS – FILE LEVEL Duplikált keyword is számít Max 3 találat, 5 pont / találat ========================= */ $keywordMatches = 0; foreach ($keywords as $kw) { if (mb_strlen($kw) < 3) continue; foreach ($questionWords as $qw) { if (mb_strlen($qw) < 3) continue; if ( $qw === $kw || str_starts_with($qw, $kw) || str_starts_with($kw, $qw) ) { $keywordMatches++; break; // egy keyword példány csak egyszer számítson } } if ($keywordMatches >= 3) { break; // max 3 találat } } if ($keywordMatches > 0) { $score += $keywordMatches * 5; $keywordHit = true; } /* ========================= TITLE MATCH (2) Prefix-alapú + stopword-bővítés Cél: ragozott alakok kezelése, zajszavak kizárása ========================= */ $titleNorm = normalizeText($title); $titleNorm = preg_replace( '/\b(mi|mit|hogyan|miert|jelent|hogy|az|a|is|es|vagy|van|volt|lesz)\b/u', '', $titleNorm ); foreach (explode(' ', $titleNorm) as $tw) { if (mb_strlen($tw) < 3) continue; foreach ($questionWords as $qw) { if ( $tw === $qw || str_starts_with($tw, $qw) || str_starts_with($qw, $tw) ) { $score += 3; $hasTitleMatch = true; $questionHit = true; // break 2; } } } /* ========================= BODY MATCH (5) Arányos pontozás Cél: rövid, célzott szekciók előnyben ========================= $bodyNorm = normalizeText($body); $bodyLen = max(1, mb_strlen($bodyNorm)); foreach ($questionWords as $qw) { if (mb_strlen($qw) >= 4 && str_contains($bodyNorm, $qw)) { $score += 1; $hasBodyMatch = true; $questionHit = true; } } */ /* Arányosítás: hosszú szöveg ne nyerjen csak méretből if ($hasBodyMatch) { $score += min(2, 50 / $bodyLen); }*/ $REF_LEN = 50; $MAX_BODY = 4; $bodyNorm = normalizeText($body); $bodyLen = max(1, mb_strlen($bodyNorm)); $bodyWords = array_values( array_filter(preg_split('/\s+/u', $bodyNorm)) ); $bodyMatchCount = 0; foreach ($bodyWords as $bw) { if (mb_strlen($bw) < 3) continue; foreach ($questionWords as $qw) { if (mb_strlen($qw) < 3) continue; if ( $bw === $qw || str_starts_with($bw, $qw) || str_starts_with($qw, $bw) ) { $bodyMatchCount++; $hasBodyMatch = true; $questionHit = true; break; } } } if ($bodyMatchCount > 0) { if ($bodyLen <= $REF_LEN) { // 300 alatt fix +1 pont találatonként $rawScore = $bodyMatchCount; } else { // 300 felett arányos csökkenés $lengthFactor = $REF_LEN / $bodyLen; $rawScore = $bodyMatchCount * $lengthFactor; } $score += min($MAX_BODY, $rawScore); } /* ========================= FILE BONUS – csak lokális találatnál ========================= */ if ($hasTitleMatch || $hasBodyMatch) { $score += $fileBonus; } /* ========================= NEGATÍV SZŰRÉS Ha csak keyword van, de nincs title/body kapcsolat → visszafogás ========================= */ if (!$hasTitleMatch && !$hasBodyMatch && $keywordHit) { $score -= 10; } /* ========================= (5) KÉRDÉS-HIT HIÁNY → MÍNUSZ Cél: általános szekciók visszaszorítása ========================= if (!$questionHit) { $score -= 1.5; }*/ /* ========================= (6) DEBUG SCORE BREAKDOWN ========================= if ($DEBUG) { $dbg( "SCORE {$fileBase} | {$title} => " . round($score, 2) . " | Tittle:" . (int)$hasTitleMatch . " Body:" . (int)$hasBodyMatch . " Kulcs:" . (int)$keywordHit . " QuestionHit:" . (int)$questionHit ); }*/ /* $allSections[] = [ 'score' => round($score, 2), 'text' => $sectionText, 'file' => $fileBase, 'title' => $title ]; /* ========================= CSAK A SCORE DÖNT ========================= */ if ($score >= $MIN_SCORE) { $sections[] = [ 'score' => round($score, 2), 'text' => $sectionText, 'file' => $fileBase, 'title' => $title ]; } } } /*if (empty($sections) && !empty($allSections)) { usort($allSections, fn($a, $b) => $b['score'] <=> $a['score']); $sections[] = $allSections[0]; $dbg("FALLBACK USED: {$allSections[0]['file']} | {$allSections[0]['title']} | score={$allSections[0]['score']}"); }*/ /* ========================= RENDEZÉS + LIMIT ========================= */ usort($sections, fn($a, $b) => $b['score'] <=> $a['score']); $sections = array_slice($sections, 0, 8); foreach ($sections as $s) { $dbg("FINAL: {$s['file']} | {$s['title']} | score={$s['score']}"); } $out = ''; if ($phoneDetected) { $dbg("SQL: select * from hirdeto where htelefon=".$digitsOnly." and aktiv=1 order by id DESC limit 1"); $lanyadat = getRow( 'select * from hirdeto where htelefon='.$digitsOnly.' and aktiv=1 order by id DESC limit 1' ); if (isset($lanyadat['id']) && is_numeric($lanyadat['id'])) { $out = "## ".$lanyadat['name']." ".$lanyadat['htelefon']." hirdet hird hirdetes hirdeto - hirdető nálunk - ".($lanyadat['fokat']==1?'szexpartner':'erotikus masszázs')." - [".$lanyadat['name']." hirdetése](https://beszamolok.com/szexpartner/?lid=".$lanyadat['id'].") "; // return trim($out); // <<< EZ HIÁNYZIK MOST } } /* ========================= KIMENET ========================= */ if (empty($sections) && $out=='') { $dbg("NO MATCH → logging ai_no_match_log"); query(" INSERT INTO ai_no_match_log (user_id, user_rang, question, question_norm, created_at) VALUES ( " . $user->id . ", " . (int)$rang . ", '" . text_ellenorzes($question) . "', '" . text_ellenorzes($questionNorm) . "', NOW() ) "); return ""; } foreach ($sections as $s) { $out .= "\n\n" . $s['text']; } $dbg("TARTALOM: {$out}"); return trim($out); } function normalizeText(string $text): string { if (!mb_check_encoding($text, 'UTF-8')) { $text = mb_convert_encoding( $text, 'UTF-8', 'UTF-8, ISO-8859-2, WINDOWS-1250' ); } $text = mb_strtolower($text, 'UTF-8'); // ékezetek eltávolítása $text = str_replace( ['á','é','í','ó','ö','ő','ú','ü','ű'], ['a','e','i','o','o','o','u','u','u'], $text ); // ⚠️ FONTOS: szóköz MEGMARAD $text = preg_replace('/[^a-z0-9 ]+/u', ' ', $text); $text = preg_replace('/\s+/u', ' ', $text); return trim($text); } /* function getVertexAccessToken(): ?string { $keyFile = '/home/beszamolok/beszamolokai-9e86027f18ac.json'; if (!file_exists($keyFile)) { return null; } $creds = json_decode(file_get_contents($keyFile), true); if (!$creds || empty($creds['client_email']) || empty($creds['private_key'])) { return null; } $now = time(); // JWT header $header = rtrim(strtr(base64_encode(json_encode([ 'alg' => 'RS256', 'typ' => 'JWT' ])), '+/', '-_'), '='); // JWT claims $claim = rtrim(strtr(base64_encode(json_encode([ 'iss' => $creds['client_email'], 'scope' => 'https://www.googleapis.com/auth/cloud-platform', 'aud' => 'https://oauth2.googleapis.com/token', 'iat' => $now, 'exp' => $now + 3600 ])), '+/', '-_'), '='); // Sign $signatureInput = $header . '.' . $claim; openssl_sign( $signatureInput, $signature, $creds['private_key'], 'sha256' ); $jwt = $signatureInput . '.' . rtrim(strtr(base64_encode($signature), '+/', '-_'), '='); // Exchange JWT for access token $ch = curl_init('https://oauth2.googleapis.com/token'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/x-www-form-urlencoded'], CURLOPT_POSTFIELDS => http_build_query([ 'grant_type' => 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion' => $jwt ]), CURLOPT_TIMEOUT => 10 ]); $res = curl_exec($ch); curl_close($ch); if (!$res) { return null; } $data = json_decode($res, true); return $data['access_token'] ?? null; }*/