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.'; } $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_pont' => $user->rang, '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_pont' => $user->rang, '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.1, 'max_tokens' => 300 ]; $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); $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 ===== 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 = 5.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)); $sections = []; /* ========================= 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 (NEM KAPU!) ========================= */ $fileNorm = normalizeText($content); $fileBonus = 0.0; foreach ($questionWords as $qw) { if (mb_strlen($qw) >= 3 && str_contains($fileNorm, $qw)) { $fileBonus += 0.3; } } /* ========================= 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; $score = 0.0; /* ===== KEYWORDS ===== */ foreach ($keywords as $kw) { if (mb_strlen($kw) < 3) continue; foreach ($questionWords as $qw) { if (str_contains($qw, $kw)) { $score += 5; break; } } } /* ===== TITLE ===== */ $titleNorm = normalizeText($title); $titleNorm = preg_replace( '/\b(mi|mit|hogyan|miert|jelent|hogy|az|a)\b/u', '', $titleNorm ); foreach (explode(' ', $titleNorm) as $tw) { if (mb_strlen($tw) < 3) continue; foreach ($questionWords as $qw) { if ($tw === $qw) { $score += 3; break; } } } /* ===== BODY ===== */ $bodyNorm = normalizeText($body); foreach ($questionWords as $qw) { if (mb_strlen($qw) >= 4 && str_contains($bodyNorm, $qw)) { $score += 1; } } /* ===== FILE BONUS ===== */ $score += $fileBonus; /* $dbg("--- FILE: {$fileBase} ---"); $dbg("File bonus: {$fileBonus}"); $dbg("Section: '{$title}' | score=" . round($score, 2)); $dbg("Keywords: " . implode(', ', $keywords));*/ /* ===== CSAK A SCORE DÖNT ===== */ if ($score >= $MIN_SCORE) { $sections[] = [ 'score' => round($score, 2), 'text' => $sectionText, 'file' => $fileBase, 'title' => $title ]; } } } /* ========================= RENDEZÉS + LIMIT ========================= */ usort($sections, fn($a, $b) => $b['score'] <=> $a['score']); $sections = array_slice($sections, 0, 5); foreach ($sections as $s) { $dbg("FINAL: {$s['file']} | {$s['title']} | score={$s['score']}"); } /* ========================= KIMENET ========================= */ if (empty($sections)) { $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 ""; } $out = ''; 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; }*/