true, 'immersive_video_status_linkable_timestamps' => true, ]), 'variables' => json_encode($variables) ), 'url' => 'https://api.twitter.com/graphql/UvDeA1RnMDu77dkWqa29pg/FollowingByUserIDTimeline', ]; return $data; } public function ConnectTabTimeline($data) { $data = [ 'method' => 'GET', 'data' => array( "features" => json_encode(array( "responsive_web_graphql_exclude_directive_enabled" => true, "verified_phone_label_enabled" => false, "creator_subscriptions_tweet_preview_api_enabled" => true, "responsive_web_graphql_timeline_navigation_enabled" => true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled" => false, "c9s_tweet_anatomy_moderator_badge_enabled" => true, "tweetypie_unmention_optimization_enabled" => true, "responsive_web_edit_tweet_api_enabled" => true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled" => true, "view_counts_everywhere_api_enabled" => true, "longform_notetweets_consumption_enabled" => true, "responsive_web_twitter_article_tweet_consumption_enabled" => true, "tweet_awards_web_tipping_enabled" => false, "freedom_of_speech_not_reach_fetch_enabled" => true, "standardized_nudges_misinfo" => true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled" => true, "rweb_video_timestamps_enabled" => true, "longform_notetweets_rich_text_read_enabled" => true, "longform_notetweets_inline_media_enabled" => true, "responsive_web_enhance_cards_enabled" => false )), 'variables' => json_encode([ "count" => 10, "context" => json_encode(array( "contextualUserId" => (string)$data['user_id'], )) ]) ), 'url' => 'https://api.twitter.com/graphql/_8eBwRBVjY-TLIgF1ARgcg/ConnectTabTimeline', ]; return $data; } public static function profileHttpCode($code, $siteLang) { switch ($code) { case 200: return false; break; case 404: return $siteLang['noProfile']; break; case 503: return $siteLang['503']; break; } } public static function randomProxy() { $proxylist = [ '166.88.235.185:5813:ztkuezru:tuyfq9srpk95', '45.61.123.36:5715:ztkuezru:tuyfq9srpk95', '162.245.188.169:6128:ztkuezru:tuyfq9srpk95', '23.109.208.243:6767:ztkuezru:tuyfq9srpk95', '45.61.97.222:6748:ztkuezru:tuyfq9srpk95', '45.41.172.175:5918:ztkuezru:tuyfq9srpk95', '198.105.108.45:6067:ztkuezru:tuyfq9srpk95', '206.206.73.53:6669:ztkuezru:tuyfq9srpk95', '198.23.214.134:6401:ztkuezru:tuyfq9srpk95', '37.35.40.191:8281:ztkuezru:tuyfq9srpk95', '64.137.8.3:6685:ztkuezru:tuyfq9srpk95', '45.61.124.143:6472:ztkuezru:tuyfq9srpk95', '198.23.239.148:6554:ztkuezru:tuyfq9srpk95', '107.181.141.149:6546:ztkuezru:tuyfq9srpk95', '150.107.225.137:6402:ztkuezru:tuyfq9srpk95', '38.170.159.157:6748:ztkuezru:tuyfq9srpk95', '45.151.163.119:5872:ztkuezru:tuyfq9srpk95', '64.137.60.239:5303:ztkuezru:tuyfq9srpk95', '38.170.173.57:7608:ztkuezru:tuyfq9srpk95', '64.137.96.104:6671:ztkuezru:tuyfq9srpk95', '84.33.26.199:5870:ztkuezru:tuyfq9srpk95', '104.239.23.177:5938:ztkuezru:tuyfq9srpk95', '171.22.248.187:6079:ztkuezru:tuyfq9srpk95', '104.239.108.248:6483:ztkuezru:tuyfq9srpk95', '37.35.40.153:8243:ztkuezru:tuyfq9srpk95', '104.249.55.85:6453:ztkuezru:tuyfq9srpk95', '43.245.116.188:6703:ztkuezru:tuyfq9srpk95', '198.105.100.179:6430:ztkuezru:tuyfq9srpk95', '45.192.140.186:6776:ztkuezru:tuyfq9srpk95', '194.39.32.100:6397:ztkuezru:tuyfq9srpk95', '154.85.126.202:5209:ztkuezru:tuyfq9srpk95', '45.151.162.221:6623:ztkuezru:tuyfq9srpk95', '64.64.127.51:6004:ztkuezru:tuyfq9srpk95', '45.43.68.216:5856:ztkuezru:tuyfq9srpk95', '171.22.250.146:6265:ztkuezru:tuyfq9srpk95', '38.170.173.92:7643:ztkuezru:tuyfq9srpk95', '64.137.60.242:5306:ztkuezru:tuyfq9srpk95', '154.29.239.193:6232:ztkuezru:tuyfq9srpk95', '84.33.236.246:6889:ztkuezru:tuyfq9srpk95', '89.116.78.4:5615:ztkuezru:tuyfq9srpk95', '45.41.169.83:6744:ztkuezru:tuyfq9srpk95', '64.137.73.228:5316:ztkuezru:tuyfq9srpk95', '216.19.205.53:6374:ztkuezru:tuyfq9srpk95', '45.43.183.238:6550:ztkuezru:tuyfq9srpk95', '172.245.157.194:6779:ztkuezru:tuyfq9srpk95', '154.85.126.33:5040:ztkuezru:tuyfq9srpk95', '157.52.187.239:6179:ztkuezru:tuyfq9srpk95', '45.41.173.192:6559:ztkuezru:tuyfq9srpk95', '64.137.101.38:5352:ztkuezru:tuyfq9srpk95', '206.41.172.142:6702:ztkuezru:tuyfq9srpk95', '45.151.163.11:5764:ztkuezru:tuyfq9srpk95', '81.21.234.110:6499:ztkuezru:tuyfq9srpk95', '142.111.93.227:6788:ztkuezru:tuyfq9srpk95', '167.160.180.88:6639:ztkuezru:tuyfq9srpk95', '184.174.27.193:6416:ztkuezru:tuyfq9srpk95', '217.69.127.141:6762:ztkuezru:tuyfq9srpk95', '217.69.127.57:6678:ztkuezru:tuyfq9srpk95', '66.78.32.110:5160:ztkuezru:tuyfq9srpk95', '104.249.29.224:5917:ztkuezru:tuyfq9srpk95', '84.33.236.164:6807:ztkuezru:tuyfq9srpk95', '107.150.21.239:5855:ztkuezru:tuyfq9srpk95', '77.83.233.115:6733:ztkuezru:tuyfq9srpk95', '86.38.234.29:6483:ztkuezru:tuyfq9srpk95', '209.99.165.59:5964:ztkuezru:tuyfq9srpk95', '198.105.101.65:5694:ztkuezru:tuyfq9srpk95', '138.128.159.211:6702:ztkuezru:tuyfq9srpk95', '109.196.163.78:6176:ztkuezru:tuyfq9srpk95', '37.35.42.161:8763:ztkuezru:tuyfq9srpk95', '104.239.40.90:6709:ztkuezru:tuyfq9srpk95', '206.41.172.225:6785:ztkuezru:tuyfq9srpk95', '156.238.9.60:6951:ztkuezru:tuyfq9srpk95', '185.245.26.131:6648:ztkuezru:tuyfq9srpk95', '104.239.33.167:6522:ztkuezru:tuyfq9srpk95', '84.33.243.233:5924:ztkuezru:tuyfq9srpk95', '209.99.165.21:5926:ztkuezru:tuyfq9srpk95', '104.239.38.102:6635:ztkuezru:tuyfq9srpk95', '23.109.208.207:6731:ztkuezru:tuyfq9srpk95', '209.99.129.163:6151:ztkuezru:tuyfq9srpk95', '104.239.41.248:6603:ztkuezru:tuyfq9srpk95', '23.236.216.188:6218:ztkuezru:tuyfq9srpk95', '45.43.180.85:6724:ztkuezru:tuyfq9srpk95', '45.61.96.22:6002:ztkuezru:tuyfq9srpk95', '209.99.165.71:5976:ztkuezru:tuyfq9srpk95', '45.43.71.23:6621:ztkuezru:tuyfq9srpk95', '45.43.186.163:6381:ztkuezru:tuyfq9srpk95', '45.192.150.176:6359:ztkuezru:tuyfq9srpk95', '45.41.169.220:6881:ztkuezru:tuyfq9srpk95', '150.107.224.197:6112:ztkuezru:tuyfq9srpk95', '171.22.248.236:6128:ztkuezru:tuyfq9srpk95', '104.239.40.221:6840:ztkuezru:tuyfq9srpk95', '107.181.141.64:6461:ztkuezru:tuyfq9srpk95', '84.33.26.223:5894:ztkuezru:tuyfq9srpk95', '104.239.41.63:6418:ztkuezru:tuyfq9srpk95', '171.22.250.38:6157:ztkuezru:tuyfq9srpk95', '23.109.208.244:6768:ztkuezru:tuyfq9srpk95', '216.173.107.139:6107:ztkuezru:tuyfq9srpk95', '89.116.77.104:6099:ztkuezru:tuyfq9srpk95', '84.33.210.64:5998:ztkuezru:tuyfq9srpk95', '107.181.141.209:6606:ztkuezru:tuyfq9srpk95', '104.239.90.68:6459:ztkuezru:tuyfq9srpk95', '45.87.69.193:6198:ztkuezru:tuyfq9srpk95', '216.173.107.206:6174:ztkuezru:tuyfq9srpk95', '64.137.96.149:6716:ztkuezru:tuyfq9srpk95', '104.239.20.111:6186:ztkuezru:tuyfq9srpk95', '206.41.172.252:6812:ztkuezru:tuyfq9srpk95', '89.45.125.139:5865:ztkuezru:tuyfq9srpk95', '37.35.42.199:8801:ztkuezru:tuyfq9srpk95', '198.105.100.148:6399:ztkuezru:tuyfq9srpk95', '45.43.70.130:6417:ztkuezru:tuyfq9srpk95', '104.239.91.115:5839:ztkuezru:tuyfq9srpk95', '84.33.11.75:6357:ztkuezru:tuyfq9srpk95', '84.33.11.242:6524:ztkuezru:tuyfq9srpk95', '104.239.52.13:7175:ztkuezru:tuyfq9srpk95', '154.85.125.115:6326:ztkuezru:tuyfq9srpk95', '45.146.28.134:6314:ztkuezru:tuyfq9srpk95', '176.116.230.146:7232:ztkuezru:tuyfq9srpk95', '216.173.98.20:6022:ztkuezru:tuyfq9srpk95', '198.105.100.168:6419:ztkuezru:tuyfq9srpk95', '104.239.37.207:5859:ztkuezru:tuyfq9srpk95', '104.239.22.222:6600:ztkuezru:tuyfq9srpk95', '104.239.20.199:6274:ztkuezru:tuyfq9srpk95', '104.239.41.241:6596:ztkuezru:tuyfq9srpk95', '89.40.222.127:6503:ztkuezru:tuyfq9srpk95', '37.35.40.100:8190:ztkuezru:tuyfq9srpk95', '193.161.2.189:6612:ztkuezru:tuyfq9srpk95', '104.239.39.24:5953:ztkuezru:tuyfq9srpk95', '104.239.42.213:6238:ztkuezru:tuyfq9srpk95', '185.245.25.54:6315:ztkuezru:tuyfq9srpk95', '23.236.222.93:7124:ztkuezru:tuyfq9srpk95', '84.33.224.225:6249:ztkuezru:tuyfq9srpk95', '89.45.125.2:5728:ztkuezru:tuyfq9srpk95', '89.45.125.89:5815:ztkuezru:tuyfq9srpk95', '138.128.159.158:6649:ztkuezru:tuyfq9srpk95', '64.137.77.209:5644:ztkuezru:tuyfq9srpk95', '154.92.121.163:5182:ztkuezru:tuyfq9srpk95', '64.137.14.151:5817:ztkuezru:tuyfq9srpk95', '154.95.38.22:5680:ztkuezru:tuyfq9srpk95', '104.239.38.47:6580:ztkuezru:tuyfq9srpk95', '104.239.10.62:5733:ztkuezru:tuyfq9srpk95', '64.137.65.134:6813:ztkuezru:tuyfq9srpk95', '45.87.69.234:6239:ztkuezru:tuyfq9srpk95', '206.41.172.219:6779:ztkuezru:tuyfq9srpk95', '104.143.246.251:6206:ztkuezru:tuyfq9srpk95', '45.41.173.106:6473:ztkuezru:tuyfq9srpk95', '104.239.37.198:5850:ztkuezru:tuyfq9srpk95', '216.173.80.156:6413:ztkuezru:tuyfq9srpk95', '150.107.225.175:6440:ztkuezru:tuyfq9srpk95', '45.43.180.236:6875:ztkuezru:tuyfq9srpk95', '64.137.79.73:5987:ztkuezru:tuyfq9srpk95', '156.238.7.219:6231:ztkuezru:tuyfq9srpk95', '23.236.222.108:7139:ztkuezru:tuyfq9srpk95', '216.173.107.35:6003:ztkuezru:tuyfq9srpk95', '154.95.36.235:6929:ztkuezru:tuyfq9srpk95', '194.113.119.71:6745:ztkuezru:tuyfq9srpk95', '45.87.69.242:6247:ztkuezru:tuyfq9srpk95', '45.192.140.153:6743:ztkuezru:tuyfq9srpk95', '45.192.136.36:5330:ztkuezru:tuyfq9srpk95', '154.92.123.244:5582:ztkuezru:tuyfq9srpk95', '156.238.9.17:6908:ztkuezru:tuyfq9srpk95', '45.43.186.8:6226:ztkuezru:tuyfq9srpk95', '64.137.18.103:6297:ztkuezru:tuyfq9srpk95', '45.192.140.221:6811:ztkuezru:tuyfq9srpk95', '23.109.232.95:6015:ztkuezru:tuyfq9srpk95', '64.137.14.12:5678:ztkuezru:tuyfq9srpk95', '209.99.134.149:5845:ztkuezru:tuyfq9srpk95', '64.137.14.180:5846:ztkuezru:tuyfq9srpk95', '45.43.179.163:6170:ztkuezru:tuyfq9srpk95', '45.43.178.97:5804:ztkuezru:tuyfq9srpk95', '45.43.180.239:6878:ztkuezru:tuyfq9srpk95', '5.157.131.177:8437:ztkuezru:tuyfq9srpk95', '89.45.125.191:5917:ztkuezru:tuyfq9srpk95', '45.192.138.226:6868:ztkuezru:tuyfq9srpk95', '89.35.80.231:6886:ztkuezru:tuyfq9srpk95', '109.196.163.118:6216:ztkuezru:tuyfq9srpk95', '172.102.218.250:6150:ztkuezru:tuyfq9srpk95', '45.43.190.149:6667:ztkuezru:tuyfq9srpk95', '104.238.8.67:5925:ztkuezru:tuyfq9srpk95', '23.236.216.1:6031:ztkuezru:tuyfq9srpk95', '109.207.130.159:8166:ztkuezru:tuyfq9srpk95', '23.109.219.224:6448:ztkuezru:tuyfq9srpk95', '104.238.8.129:5987:ztkuezru:tuyfq9srpk95', '154.92.121.205:5224:ztkuezru:tuyfq9srpk95', '154.92.124.48:5076:ztkuezru:tuyfq9srpk95', '64.137.65.184:6863:ztkuezru:tuyfq9srpk95', '64.137.101.218:5532:ztkuezru:tuyfq9srpk95', '209.99.129.27:6015:ztkuezru:tuyfq9srpk95', '45.192.138.44:6686:ztkuezru:tuyfq9srpk95', '23.109.225.173:5804:ztkuezru:tuyfq9srpk95', '64.137.18.150:6344:ztkuezru:tuyfq9srpk95', '64.137.79.59:5973:ztkuezru:tuyfq9srpk95', '161.123.214.39:6394:ztkuezru:tuyfq9srpk95', '64.137.101.17:5331:ztkuezru:tuyfq9srpk95', '209.99.134.218:5914:ztkuezru:tuyfq9srpk95', '150.107.224.170:6085:ztkuezru:tuyfq9srpk95', '89.45.125.44:5770:ztkuezru:tuyfq9srpk95', '104.238.8.10:5868:ztkuezru:tuyfq9srpk95', '81.21.234.109:6498:ztkuezru:tuyfq9srpk95', '104.250.204.125:6216:ztkuezru:tuyfq9srpk95', '103.53.216.30:5114:ztkuezru:tuyfq9srpk95', '23.109.219.113:6337:ztkuezru:tuyfq9srpk95', '104.238.14.91:6476:ztkuezru:tuyfq9srpk95', '104.250.207.233:6631:ztkuezru:tuyfq9srpk95', '138.128.159.244:6735:ztkuezru:tuyfq9srpk95', '161.123.215.32:6643:ztkuezru:tuyfq9srpk95', '89.45.125.122:5848:ztkuezru:tuyfq9srpk95', '23.109.219.201:6425:ztkuezru:tuyfq9srpk95', '45.250.64.6:5643:ztkuezru:tuyfq9srpk95', '104.238.14.54:6439:ztkuezru:tuyfq9srpk95', '109.207.130.172:8179:ztkuezru:tuyfq9srpk95', '64.137.100.215:5270:ztkuezru:tuyfq9srpk95', '64.137.18.202:6396:ztkuezru:tuyfq9srpk95', '45.192.136.120:5414:ztkuezru:tuyfq9srpk95', '109.207.130.108:8115:ztkuezru:tuyfq9srpk95', '209.99.134.82:5778:ztkuezru:tuyfq9srpk95', '89.45.125.197:5923:ztkuezru:tuyfq9srpk95', '104.250.207.158:6556:ztkuezru:tuyfq9srpk95', '45.192.138.77:6719:ztkuezru:tuyfq9srpk95', '81.21.233.150:5856:ztkuezru:tuyfq9srpk95', '161.123.215.58:6669:ztkuezru:tuyfq9srpk95', '172.102.218.152:6052:ztkuezru:tuyfq9srpk95', '45.250.64.243:5880:ztkuezru:tuyfq9srpk95', '138.128.159.152:6643:ztkuezru:tuyfq9srpk95', '176.116.230.83:7169:ztkuezru:tuyfq9srpk95', '109.207.130.105:8112:ztkuezru:tuyfq9srpk95', '103.53.216.9:5093:ztkuezru:tuyfq9srpk95', '161.123.214.188:6543:ztkuezru:tuyfq9srpk95', '154.92.125.57:5358:ztkuezru:tuyfq9srpk95', '23.109.225.212:5843:ztkuezru:tuyfq9srpk95', '23.109.219.98:6322:ztkuezru:tuyfq9srpk95', '45.192.136.186:5480:ztkuezru:tuyfq9srpk95', '104.238.8.194:6052:ztkuezru:tuyfq9srpk95', '64.137.79.81:5995:ztkuezru:tuyfq9srpk95', '172.102.218.133:6033:ztkuezru:tuyfq9srpk95', '64.137.14.129:5795:ztkuezru:tuyfq9srpk95', '64.137.65.202:6881:ztkuezru:tuyfq9srpk95', '45.192.138.110:6752:ztkuezru:tuyfq9srpk95', '209.99.129.95:6083:ztkuezru:tuyfq9srpk95', '209.99.129.114:6102:ztkuezru:tuyfq9srpk95', '104.239.108.136:6371:ztkuezru:tuyfq9srpk95', '45.192.136.42:5336:ztkuezru:tuyfq9srpk95', '64.137.18.217:6411:ztkuezru:tuyfq9srpk95', '45.192.136.138:5432:ztkuezru:tuyfq9srpk95', '64.137.79.248:6162:ztkuezru:tuyfq9srpk95', '161.123.214.96:6451:ztkuezru:tuyfq9srpk95', '45.192.150.136:6319:ztkuezru:tuyfq9srpk95', '45.192.148.116:6450:ztkuezru:tuyfq9srpk95', '45.192.148.206:6540:ztkuezru:tuyfq9srpk95', '104.250.207.220:6618:ztkuezru:tuyfq9srpk95', '81.21.233.105:5811:ztkuezru:tuyfq9srpk95', '45.192.143.220:5293:ztkuezru:tuyfq9srpk95', ]; return list($proxy, $username, $password) = explode(':', $proxylist[array_rand($proxylist)]); } public static function gen_uuid() { return strtoupper(sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535))); } public static function pathCheck(): void { if (str_contains($_SERVER['REQUEST_URI'], ".php")) { $url = "https://xstalk.com/"; header("HTTP/1.1 301 Moved Permanently"); header("Location: $url"); } } public function numberConvert($number) { // Yüklenen dil dosyasındaki k, m, b sembollerini kontrol edin $k = $this->loadLanguage['k']; $m = $this->loadLanguage['m']; $b = $this->loadLanguage['b']; if ($number < 1000) { $format = number_format($number); } elseif ($number < 10000) { $format = round($number / 1000, 0) . $k; } elseif ($number < 1000000) { $format = round($number / 1000, 0) . $k; } elseif ($number < 1000000000) { $format = round($number / 1000000, 1) . $m; } else { $format = round($number / 1000000000, 2) . $b; } return $format; } public function timeAgo($time_ago) { if (!is_numeric($time_ago)) { $time_ago = strtotime($time_ago) ? strtotime($time_ago) : $time_ago; } $time = time() - $time_ago; if ($time <= 60) { return $this->loadLanguage['a_minute_ago']; } elseif ($time < 3600) { return round($time / 60) . ' ' . $this->loadLanguage['minutes_ago']; } elseif ($time < 86400) { return round($time / 3600) . ' ' . $this->loadLanguage['hours_ago']; } elseif ($time < 2592000) { return round($time / 86400) . ' ' . $this->loadLanguage['days_ago']; } elseif ($time < 31536000) { return round($time / 2592000) . ' ' . $this->loadLanguage['months_ago']; } else { return round($time / 31536000) . ' ' . $this->loadLanguage['years_ago']; } } public function mongoInsert($table, $check, $data) { $collection = $this->mongo_db->$table; $collection->updateOne($check, ['$set' => $data], ["upsert" => true]); } public function mongoCheck($table, $check) { $collection = $this->mongo_db->$table; $result = $collection->findOne($check); if ($result) { return $result; } else { return null; } } public function tokenListv1() //redis { $redis_key = 'NtokenList-' . rand(0, 4999); $cache_data = json_decode($this->redisCache->getCachedData($redis_key)); $is_redis = ($cache_data === NULL) ? 0 : $redis_key; if ($cache_data == NULL) { $collection = $this->mongo_db->users; $cache_data = $collection->aggregate([ ['$sample' => ['size' => 1]], ['$project' => ['auth_token' => 1, 'auth_token_secret' => 1]], ], ['hint' => ['auth_token' => 1, 'auth_token_secret' => 1]])->toArray()[0]; } return (object)array( 'is_redis' => $is_redis, 'access_token' => $cache_data->auth_token, 'access_token_secret' => $cache_data->auth_token_secret, ); } public function tokenList() //redis { $random_pair = $this->redisCache->getUsers(); return (object)array( 'is_redis' => 0, 'access_token' => $random_pair[0], 'access_token_secret' => $random_pair[1], ); } public static function short($kelime, $str = 10, $v) { $kelime = preg_replace('/\s+/', ' ', strip_tags($kelime)); if (strlen($kelime) > $str) { if (function_exists("mb_substr")) $kelime = mb_substr($kelime, 0, $str, "UTF-8") . $v; else $kelime = substr($kelime, 0, $str) . '..'; } return $kelime; } public function cron($action) { switch ($action) { case 'popularUsers': $multi_curl = new MultiCurl(); $multi_curl->setRetry(3); $multi_curl->setConcurrency(300); $popular_users = array( 'elonmusk', 'BarackObama', 'justinbieber', 'Cristiano', 'rihanna', 'taylorswift13', 'realDonaldTrump', 'ladygaga', 'YouTube', 'NASA', 'KimKardashian', 'EllenDeGeneres', 'X', 'selenagomez', 'BillGates', 'cnnbrk', 'neymarjr', 'CNN', 'jtimberlake', 'imVkohli', 'PMOIndia', 'nytimes', 'britneyspears', 'shakira', 'ddlovato', 'KingJames', 'BBCBreaking', 'ChampionsLeague', 'jimmyfallon', 'realmadrid', ); foreach ($popular_users as $user) { $multi_curl->addCurl(self::curlopt('usersShow', ['query' => $user], $user)); } $multi_curl->success(function ($instance) { if ($instance->httpStatusCode == 200) { $json = json_decode($instance->response); $jsond = json_decode(self::jsonCleaner($json, 'usersShow'), true); unset($jsond['entities']); $jsond['is_blue_verified'] = true; $this->mongo_db->popularUsers->updateOne(['id' => $jsond['id']], ['$set' => $jsond], ["upsert" => true]); echo $jsond['screen_name'] . " ok\n"; } }); $multi_curl->start(); $multi_curl->close(); $popular_users = $this->mongo_db->popularUsers->aggregate([ ['$sort' => ['followers_count' => -1]], ['$limit' => 20], ])->toArray(); if (count($popular_users) == 0) { exit; } file_put_contents(__DIR__ . '/../caches/popular_users.json', json_encode($popular_users)); break; case 'topics': $multi_curl = new MultiCurl(); $multi_curl->setRetry(3); $multi_curl->setConcurrency(300); $place_list = json_decode(file_get_contents(__DIR__ . "/../caches/place_list_country.json")); foreach ($place_list as $tag) { $multi_curl->addCurl(self::curlopt('trendsPlus', ['query' => $tag->woeid], $tag->countryCode)); } $multi_curl->success(function ($instance) { if ($instance->httpStatusCode == 200) { $json = json_decode($instance->response); file_put_contents(__DIR__ . '/../caches/hashtag/' . $instance->response_tw . '.json', $instance->response); echo $instance->response_tw . " ok\n"; } }); $multi_curl->start(); $multi_curl->close(); break; case 'countryTweets': $multi_curl = new MultiCurl(); $multi_curl->setRetry(3); $multi_curl->setConcurrency(300); $place_list = json_decode(file_get_contents(__DIR__ . "/../caches/place_list_country.json")); foreach ($place_list as $tag) { $country = ($tag->countryCode == 'Worldwide') ? 'en' : self::getLanguageFromCountry($tag->countryCode); $multi_curl->addCurl(self::curlopt('SearchTimeline', ['query' => 'lang:' . $country, 'cursor' => '', 'page' => 1], $tag->countryCode)); # $multi_curl->addCurl(self::curlopt('SearchTimeline', ['query' => 'from:memati073463379', 'cursor' => '', 'page' => 1], $tag->countryCode)); } $multi_curl->success(function ($instance) { if ($instance->httpStatusCode == 200) { $json = json_decode($instance->response); $json = self::jsonCleaner($json, 'SearchTimeline'); $json = json_decode($json); $json->cursor = self::encryptData(json_encode(array( 'cursor' => $json->cursor ?? null, 'query' => $instance->response_tw ))); //$json->cursor = self::signed($json->cursor); $json = json_encode($json); # file_put_contents(__DIR__ . '/../caches/countryTweets/tests.json', $instance->response); file_put_contents(__DIR__ . '/../caches/countryTweets/' . $instance->response_tw . '.json', $json); echo $instance->response_tw . " ok\n"; } }); $multi_curl->start(); $multi_curl->close(); break; case 'userToRedis': $collection = $this->mongo_db->users; $cache_data = $collection->find([], [ 'projection' => [ 'auth_token' => 1, 'auth_token_secret' => 1 ] ])->toArray(); foreach ($cache_data as $data) { $auth_token = $data['auth_token']; $secret = $data['auth_token_secret']; $this->redisCache->execute('sAdd', 'auth_secret_set', "$auth_token|$secret"); } break; case 'getRedisData': $random_pair = $this->redisCache->getUsers(); print_r($random_pair); break; case 'reloadLanguage': header('Content-Type: application/javascript; charset=UTF-8'); $supportedLanguages = ['en', 'es', 'pt', 'ru', 'de', 'fr', 'it', 'nl', 'pl', 'id', 'ar', 'th', 'vi', 'tr', 'ja', 'ko', 'zh-hant', 'zh-hans']; $siteUrl = 'https://xstalk.com'; foreach($supportedLanguages as $lang){ $siteLang = Arrow::loadLanguage($lang); $siteLang['siteUrl'] = $siteUrl . '/' . $lang; $siteLang['langCode'] = str_replace('_', '-', $siteLang['langCode']); $jsonLang = 'var jsonData = ' . json_encode($siteLang, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ';'; file_put_contents(__DIR__ . "/../js/languages/{$lang}.js", $jsonLang); } break; } } public static function loadHastag($default = 'Worldwide') { $languageFile = __DIR__ . "/../caches/hashtag/{$default}.json"; if (file_exists($languageFile)) { return json_decode(file_get_contents($languageFile), true); } else { $languageFile = __DIR__ . "/../caches/hashtag/Worldwide.json"; return json_decode(file_get_contents($languageFile), true); } } public static function loadTweet($default = 'Worldwide') { $languageFile = __DIR__ . "/../caches/countryTweets/{$default}.json"; if (file_exists($languageFile)) { return json_decode(file_get_contents($languageFile), true); } else { $languageFile = __DIR__ . "/../caches/countryTweets/Worldwide.json"; return json_decode(file_get_contents($languageFile), true); } } public static function loadHastagapi($value = 1) { $woeid = array( '1' => 'Worldwide', '1062617' => 'SG', '23424738' => 'AE', '23424740' => 'DZ', '23424747' => 'AR', '23424748' => 'AU', '23424750' => 'AT', '23424753' => 'BH', '23424757' => 'BE', '23424765' => 'BY', '23424768' => 'BR', '23424775' => 'CA', '23424782' => 'CL', '23424787' => 'CO', '23424796' => 'DK', '23424800' => 'DO', '23424801' => 'EC', '23424802' => 'EG', '23424803' => 'IE', '23424819' => 'FR', '23424824' => 'GH', '23424829' => 'DE', '23424833' => 'GR', '23424834' => 'GT', '23424846' => 'ID', '23424848' => 'IN', '23424852' => 'IL', '23424853' => 'IT', '23424856' => 'JP', '23424860' => 'JO', '23424863' => 'KE', '23424868' => 'KR', '23424870' => 'KW', '23424873' => 'LB', '23424874' => 'LV', '23424898' => 'OM', '23424900' => 'MX', '23424901' => 'MY', '23424908' => 'NG', '23424909' => 'NL', '23424910' => 'NO', '23424916' => 'NZ', '23424919' => 'PE', '23424922' => 'PK', '23424923' => 'PL', '23424924' => 'PA', '23424925' => 'PT', '23424930' => 'QA', '23424934' => 'PH', '23424935' => 'PR', '23424936' => 'RU', '23424938' => 'SA', '23424942' => 'ZA', '23424948' => 'SG', '23424950' => 'ES', '23424954' => 'SE', '23424957' => 'CH', '23424960' => 'TH', '23424969' => 'TR', '23424975' => 'GB', '23424976' => 'UA', '23424977' => 'US', '23424982' => 'VE', '23424984' => 'VN' ); if ($woeid[$value]) { $languageFile = __DIR__ . "/../caches/hashtag/{$woeid[$value]}.json"; if (file_exists($languageFile)) { return file_get_contents($languageFile); } } return false; } public static function countryIdToLanguage($value = 1) { $woeid = array( '1' => 'Worldwide', '1062617' => 'SG', '23424738' => 'AE', '23424740' => 'DZ', '23424747' => 'AR', '23424748' => 'AU', '23424750' => 'AT', '23424753' => 'BH', '23424757' => 'BE', '23424765' => 'BY', '23424768' => 'BR', '23424775' => 'CA', '23424782' => 'CL', '23424787' => 'CO', '23424796' => 'DK', '23424800' => 'DO', '23424801' => 'EC', '23424802' => 'EG', '23424803' => 'IE', '23424819' => 'FR', '23424824' => 'GH', '23424829' => 'DE', '23424833' => 'GR', '23424834' => 'GT', '23424846' => 'ID', '23424848' => 'IN', '23424852' => 'IL', '23424853' => 'IT', '23424856' => 'JP', '23424860' => 'JO', '23424863' => 'KE', '23424868' => 'KR', '23424870' => 'KW', '23424873' => 'LB', '23424874' => 'LV', '23424898' => 'OM', '23424900' => 'MX', '23424901' => 'MY', '23424908' => 'NG', '23424909' => 'NL', '23424910' => 'NO', '23424916' => 'NZ', '23424919' => 'PE', '23424922' => 'PK', '23424923' => 'PL', '23424924' => 'PA', '23424925' => 'PT', '23424930' => 'QA', '23424934' => 'PH', '23424935' => 'PR', '23424936' => 'RU', '23424938' => 'SA', '23424942' => 'ZA', '23424948' => 'SG', '23424950' => 'ES', '23424954' => 'SE', '23424957' => 'CH', '23424960' => 'TH', '23424969' => 'TR', '23424975' => 'GB', '23424976' => 'UA', '23424977' => 'US', '23424982' => 'VE', '23424984' => 'VN' ); if (array_key_exists($value, $woeid)) { return $woeid[$value]; } return 0; } public static function loadCountryTweets($value = 1) { $woeid = array( '1' => 'Worldwide', '1062617' => 'SG', '23424738' => 'AE', '23424740' => 'DZ', '23424747' => 'AR', '23424748' => 'AU', '23424750' => 'AT', '23424753' => 'BH', '23424757' => 'BE', '23424765' => 'BY', '23424768' => 'BR', '23424775' => 'CA', '23424782' => 'CL', '23424787' => 'CO', '23424796' => 'DK', '23424800' => 'DO', '23424801' => 'EC', '23424802' => 'EG', '23424803' => 'IE', '23424819' => 'FR', '23424824' => 'GH', '23424829' => 'DE', '23424833' => 'GR', '23424834' => 'GT', '23424846' => 'ID', '23424848' => 'IN', '23424852' => 'IL', '23424853' => 'IT', '23424856' => 'JP', '23424860' => 'JO', '23424863' => 'KE', '23424868' => 'KR', '23424870' => 'KW', '23424873' => 'LB', '23424874' => 'LV', '23424898' => 'OM', '23424900' => 'MX', '23424901' => 'MY', '23424908' => 'NG', '23424909' => 'NL', '23424910' => 'NO', '23424916' => 'NZ', '23424919' => 'PE', '23424922' => 'PK', '23424923' => 'PL', '23424924' => 'PA', '23424925' => 'PT', '23424930' => 'QA', '23424934' => 'PH', '23424935' => 'PR', '23424936' => 'RU', '23424938' => 'SA', '23424942' => 'ZA', '23424948' => 'SG', '23424950' => 'ES', '23424954' => 'SE', '23424957' => 'CH', '23424960' => 'TH', '23424969' => 'TR', '23424975' => 'GB', '23424976' => 'UA', '23424977' => 'US', '23424982' => 'VE', '23424984' => 'VN' ); if ($woeid[$value]) { $languageFile = __DIR__ . "/../caches/countryTweets/{$woeid[$value]}.json"; if (file_exists($languageFile)) { return file_get_contents($languageFile); } } return false; } public static function getLanguageFromCountry($countryCode) { $countryToLanguageMap = [ 'AF' => 'fa-AF', // Afganistan - Dari 'AL' => 'sq-AL', // Arnavutluk - Arnavutça 'DZ' => 'ar-DZ', // Cezayir - Arapça 'AS' => 'en-AS', // Amerikan Samoası - İngilizce 'AD' => 'ca-AD', // Andorra - Katalanca 'AO' => 'pt-AO', // Angola - Portekizce 'AI' => 'en-AI', // Anguilla - İngilizce 'AG' => 'en-AG', // Antigua ve Barbuda - İngilizce 'AR' => 'es-AR', // Arjantin - İspanyolca 'AM' => 'hy-AM', // Ermenistan - Ermenice 'AW' => 'nl-AW', // Aruba - Hollandaca 'AU' => 'en-AU', // Avustralya - İngilizce 'AT' => 'de-AT', // Avusturya - Almanca 'AZ' => 'az-AZ', // Azerbaycan - Azerice 'BS' => 'en-BS', // Bahamalar - İngilizce 'BH' => 'ar-BH', // Bahreyn - Arapça 'BD' => 'bn-BD', // Bangladeş - Bengalce 'BB' => 'en-BB', // Barbados - İngilizce 'BY' => 'ru-BY', // Belarus - Rusça 'BE' => 'nl-BE', // Belçika - Hollandaca (Felemenkçe) 'BZ' => 'en-BZ', // Belize - İngilizce 'BJ' => 'fr-BJ', // Benin - Fransızca 'BM' => 'en-BM', // Bermuda - İngilizce 'BT' => 'dz-BT', // Bhutan - Dzongka 'BO' => 'es-BO', // Bolivya - İspanyolca 'BA' => 'bs-BA', // Bosna-Hersek - Boşnakça 'BW' => 'en-BW', // Botsvana - İngilizce 'BR' => 'pt-BR', // Brezilya - Portekizce 'BN' => 'ms-BN', // Brunei - Malayca 'BG' => 'bg-BG', // Bulgaristan - Bulgarca 'BF' => 'fr-BF', // Burkina Faso - Fransızca 'BI' => 'fr-BI', // Burundi - Fransızca 'KH' => 'km-KH', // Kamboçya - Kmerce 'CM' => 'fr-CM', // Kamerun - Fransızca 'CA' => 'en-CA', // Kanada - İngilizce 'CV' => 'pt-CV', // Cape Verde - Portekizce 'KY' => 'en-KY', // Cayman Adaları - İngilizce 'CF' => 'fr-CF', // Orta Afrika Cumhuriyeti - Fransızca 'TD' => 'fr-TD', // Çad - Fransızca 'CL' => 'es-CL', // Şili - İspanyolca 'CN' => 'zh-CN', // Çin - Çince 'CO' => 'es-CO', // Kolombiya - İspanyolca 'KM' => 'ar-KM', // Komorlar - Arapça 'CG' => 'fr-CG', // Kongo - Fransızca 'CD' => 'fr-CD', // Demokratik Kongo Cumhuriyeti - Fransızca 'CR' => 'es-CR', // Kosta Rika - İspanyolca 'CI' => 'fr-CI', // Fildişi Sahili - Fransızca 'HR' => 'hr-HR', // Hırvatistan - Hırvatça 'CU' => 'es-CU', // Küba - İspanyolca 'CY' => 'el-CY', // Kıbrıs - Yunanca 'CZ' => 'cs-CZ', // Çek Cumhuriyeti - Çekçe 'DK' => 'da-DK', // Danimarka - Danca 'DJ' => 'fr-DJ', // Cibuti - Fransızca 'DM' => 'en-DM', // Dominika - İngilizce 'DO' => 'es-DO', // Dominik Cumhuriyeti - İspanyolca 'EC' => 'es-EC', // Ekvador - İspanyolca 'EG' => 'ar-EG', // Mısır - Arapça 'SV' => 'es-SV', // El Salvador - İspanyolca 'GQ' => 'es-GQ', // Ekvator Ginesi - İspanyolca 'ER' => 'ti-ER', // Eritre - Tigrinya 'EE' => 'et-EE', // Estonya - Estonca 'ET' => 'am-ET', // Etiyopya - Amharca 'FJ' => 'en-FJ', // Fiji - İngilizce 'FI' => 'fi-FI', // Finlandiya - Fince 'FR' => 'fr-FR', // Fransa - Fransızca 'GA' => 'fr-GA', // Gabon - Fransızca 'GM' => 'en-GM', // Gambiya - İngilizce 'GE' => 'ka-GE', // Gürcistan - Gürcüce 'DE' => 'de-DE', // Almanya - Almanca 'GH' => 'en-GH', // Gana - İngilizce 'GR' => 'el-GR', // Yunanistan - Yunanca 'GD' => 'en-GD', // Grenada - İngilizce 'GT' => 'es-GT', // Guatemala - İspanyolca 'GN' => 'fr-GN', // Gine - Fransızca 'GW' => 'pt-GW', // Gine-Bissau - Portekizce 'GY' => 'en-GY', // Guyana - İngilizce 'HT' => 'ht-HT', // Haiti - Haiti Kreolü 'HN' => 'es-HN', // Honduras - İspanyolca 'HU' => 'hu-HU', // Macaristan - Macarca 'IS' => 'is-IS', // İzlanda - İzlandaca 'IN' => 'hi-IN', // Hindistan - Hintçe 'ID' => 'id-ID', // Endonezya - Endonezce 'IR' => 'fa-IR', // İran - Farsça 'IQ' => 'ar-IQ', // Irak - Arapça 'IE' => 'en-IE', // İrlanda - İngilizce 'IL' => 'he-IL', // İsrail - İbranice 'IT' => 'it-IT', // İtalya - İtalyanca 'JM' => 'en-JM', // Jamaika - İngilizce 'JP' => 'ja-JP', // Japonya - Japonca 'JO' => 'ar-JO', // Ürdün - Arapça 'KZ' => 'kk-KZ', // Kazakistan - Kazakça 'KE' => 'sw-KE', // Kenya - Svahili 'KI' => 'en-KI', // Kiribati - İngilizce 'KP' => 'ko-KP', // Kuzey Kore - Korece 'KR' => 'ko-KR', // Güney Kore - Korece 'KW' => 'ar-KW', // Kuveyt - Arapça 'KG' => 'ky-KG', // Kırgızistan - Kırgızca 'LA' => 'lo-LA', // Laos - Lao 'LV' => 'lv-LV', // Letonya - Letonca 'LB' => 'ar-LB', // Lübnan - Arapça 'LS' => 'en-LS', // Lesotho - İngilizce 'LR' => 'en-LR', // Liberya - İngilizce 'LY' => 'ar-LY', // Libya - Arapça 'LI' => 'de-LI', // Lihtenştayn - Almanca 'LT' => 'lt-LT', // Litvanya - Litvanca 'LU' => 'lb-LU', // Lüksemburg - Lüksemburgca 'MK' => 'mk-MK', // Kuzey Makedonya - Makedonca 'MG' => 'fr-MG', // Madagaskar - Fransızca 'MW' => 'en-MW', // Malavi - İngilizce 'MY' => 'ta-MY', // Malezya - Malayca 'MV' => 'dv-MV', // Maldivler - Divehi 'ML' => 'fr-ML', // Mali - Fransızca 'MT' => 'mt-MT', // Malta - Maltaca 'MH' => 'en-MH', // Marshall Adaları - İngilizce 'MR' => 'ar-MR', // Moritanya - Arapça 'MU' => 'en-MU', // Mauritius - İngilizce 'MX' => 'es-MX', // Meksika - İspanyolca 'FM' => 'en-FM', // Mikronezya - İngilizce 'MD' => 'ro-MD', // Moldova - Rumence 'MC' => 'fr-MC', // Monako - Fransızca 'MN' => 'mn-MN', // Moğolistan - Moğolca 'ME' => 'sr-ME', // Karadağ - Sırpça 'MA' => 'ar-MA', // Fas - Arapça 'MZ' => 'pt-MZ', // Mozambik - Portekizce 'MM' => 'my-MM', // Myanmar - Birmanca 'NA' => 'en-NA', // Namibya - İngilizce 'NR' => 'en-NR', // Nauru - İngilizce 'NP' => 'ne-NP', // Nepal - Nepali 'NL' => 'nl-NL', // Hollanda - Hollandaca 'NZ' => 'en-NZ', // Yeni Zelanda - İngilizce 'NI' => 'es-NI', // Nikaragua - İspanyolca 'NE' => 'fr-NE', // Nijer - Fransızca 'NG' => 'en-NG', // Nijerya - İngilizce 'NO' => 'no-NO', // Norveç - Norveççe 'OM' => 'ar-OM', // Umman - Arapça 'PK' => 'ur-PK', // Pakistan - Urduca 'PW' => 'en-PW', // Palau - İngilizce 'PA' => 'es-PA', // Panama - İspanyolca 'PG' => 'en-PG', // Papua Yeni Gine - İngilizce 'PY' => 'es-PY', // Paraguay - İspanyolca 'PE' => 'es-PE', // Peru - İspanyolca 'PH' => 'tl-PH', // Filipinler - Filipince 'PL' => 'pl-PL', // Polonya - Lehçe 'PT' => 'pt-PT', // Portekiz - Portekizce 'QA' => 'ar-QA', // Katar - Arapça 'RO' => 'ro-RO', // Romanya - Rumence 'RU' => 'ru-RU', // Rusya - Rusça 'RW' => 'rw-RW', // Ruanda - Ruandaca 'KN' => 'en-KN', // Saint Kitts ve Nevis - İngilizce 'LC' => 'en-LC', // Saint Lucia - İngilizce 'VC' => 'en-VC', // Saint Vincent ve Grenadinler - İngilizce 'WS' => 'sm-WS', // Samoa - Samoaca 'SM' => 'it-SM', // San Marino - İtalyanca 'ST' => 'pt-ST', // São Tomé ve Príncipe - Portekizce 'SA' => 'ar-SA', // Suudi Arabistan - Arapça 'SN' => 'fr-SN', // Senegal - Fransızca 'RS' => 'sr-RS', // Sırbistan - Sırpça 'SC' => 'fr-SC', // Seyşeller - Fransızca 'SL' => 'en-SL', // Sierra Leone - İngilizce 'SG' => 'en-SG', // Singapur - İngilizce 'SK' => 'sk-SK', // Slovakya - Slovakça 'SI' => 'sl-SI', // Slovenya - Slovence 'SB' => 'en-SB', // Solomon Adaları - İngilizce 'SO' => 'so-SO', // Somali - Somalice 'ZA' => 'en-ZA', // Güney Afrika - İngilizce 'SS' => 'en-SS', // Güney Sudan - İngilizce 'ES' => 'es-ES', // İspanya - İspanyolca 'LK' => 'si-LK', // Sri Lanka - Sinhala 'SD' => 'ar-SD', // Sudan - Arapça 'SR' => 'nl-SR', // Surinam - Hollandaca 'SE' => 'sv-SE', // İsveç - İsveççe 'CH' => 'de-CH', // İsviçre - Almanca 'SY' => 'ar-SY', // Suriye - Arapça 'TW' => 'zh-TW', // Tayvan - Çince 'TJ' => 'tg-TJ', // Tacikistan - Tacikçe 'TZ' => 'sw-TZ', // Tanzanya - Svahili 'TH' => 'th-TH', // Tayland - Tayca 'TL' => 'pt-TL', // Doğu Timor - Portekizce 'TG' => 'fr-TG', // Togo - Fransızca 'TO' => 'en-TO', // Tonga - İngilizce 'TT' => 'en-TT', // Trinidad ve Tobago - İngilizce 'TN' => 'ar-TN', // Tunus - Arapça 'TR' => 'tr-TR', // Türkiye - Türkçe 'TM' => 'tk-TM', // Türkmenistan - Türkmence 'TV' => 'en-TV', // Tuvalu - İngilizce 'UG' => 'en-UG', // Uganda - İngilizce 'UA' => 'uk-UA', // Ukrayna - Ukraynaca 'AE' => 'ar-AE', // Birleşik Arap Emirlikleri - Arapça 'GB' => 'en-GB', // Birleşik Krallık - İngilizce 'US' => 'en-US', // Amerika Birleşik Devletleri - İngilizce 'UY' => 'es-UY', // Uruguay - İspanyolca 'UZ' => 'uz-UZ', // Özbekistan - Özbekçe 'VU' => 'bi-VU', // Vanuatu - Bislama 'VE' => 'es-VE', // Venezuela - İspanyolca 'VN' => 'vi-VN', // Vietnam - Vietnamca 'YE' => 'ar-YE', // Yemen - Arapça 'ZM' => 'en-ZM', // Zambiya - İngilizce 'ZW' => 'en-ZW', // Zimbabve - İngilizce ]; $countryCode = strtoupper($countryCode); if (isset($countryToLanguageMap[$countryCode])) { return $countryToLanguageMap[$countryCode]; } return 'en'; } public static function createJsonData($siteLang, $siteUrl) { $jsonData = "var jsonData = {\n"; $jsonData .= " \"siteUrl\": \"$siteUrl\",\n"; foreach ($siteLang as $key => $value) { $escapedValue = addslashes($value); $jsonData .= " \"$key\": \"$escapedValue\",\n"; } $jsonData = rtrim($jsonData, ",\n") . "\n};"; return $jsonData; } public static function loadLanguage($default = 'en') { // URL'deki 'lang' parametresini al ve temizle $lang = isset($_GET['lang']) ? htmlspecialchars($_GET['lang']) : $default; // Desteklenen diller listesini oluştur $supportedLanguages = ['en', 'es', 'pt', 'ru', 'de', 'fr', 'it', 'nl', 'pl', 'id', 'ar', 'th', 'vi', 'tr', 'ja', 'ko', 'zh-hant', 'zh-hans']; // Geçerli bir dil seçildi mi kontrol et, yoksa varsayılan dili kullan if (!in_array($lang, $supportedLanguages)) { $lang = $default; } // Dil dosyasını yükle $languageFile = __DIR__ . "/../pages/languages/{$lang}.php"; // Dosya mevcutsa dili yükle, yoksa varsayılan dili yükle if (file_exists($languageFile)) { return include $languageFile; } else { // Dil dosyası bulunamazsa, hata mesajı yerine varsayılan dili yükle // error_log("Language file not found: {$languageFile}, loading default language."); return include __DIR__ . "/../pages/languages/en.php"; } } public static function langPage() { $lang = isset($_GET['lang']) ? htmlspecialchars(strip_tags($_GET['lang'])) : ''; $supportedLanguages = ['es', 'pt', 'ru', 'de', 'fr', 'it', 'nl', 'pl', 'id', 'ar', 'th', 'vi', 'tr', 'ja', 'ko', 'zh-hant', 'zh-hans']; if (in_array($lang, $supportedLanguages)) { return "/{$lang}"; } } } class RedisCache { private Redis $redis; public function __construct() { $this->redis = new Redis(); $this->redis->connect('127.0.0.1', 6379); } public function getCachedData($key) { if (!$this->redis->exists($key)) { return NULL; } return unserialize($this->redis->get($key)); } public function cacheData($key, $data, $expiration = 420) { $data = serialize($data); $this->redis->set($key, $data, $expiration); } public function getUsers() { $random_pair = $this->redis->sRandMember('auth_secret_set'); list($random_auth_token, $random_secret) = explode('|', $random_pair); if (empty($random_auth_token) || empty($random_secret)) { exit(); } return array($random_auth_token, $random_secret); } public function execute($command, $command_val, $query): void { $this->redis->$command($command_val, $query); } public function deleteCache($key) { $this->redis->del($key); } } class MongoDBConnection { private static $instance; private $connection; private function __construct() { $this->connection = new MongoDB\Client('mongodb://arrowd:ZFiMvL3MB77gno0@localhost:27017/twstalker'); } public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self(); } return self::$instance->connection; } } function secure_input($input): string { // Trim whitespace from the beginning and end of the input $input = trim($input); // Remove HTML and PHP tags from the input $input = strip_tags($input); // Convert special characters to HTML entities to prevent XSS $input = htmlspecialchars($input, ENT_QUOTES, 'UTF-8'); return $input; }