@@ -332,11 +332,37 @@ function getAdminKeys(){
332332 [['text ' =>$ buttonValues ['discount_settings ' ],'callback_data ' =>"discount_codes " ],['text ' =>$ buttonValues ['main_button_settings ' ],'callback_data ' =>"mainMenuButtons " ]],
333333 [['text ' =>$ buttonValues ['gateways_settings ' ],'callback_data ' =>"gateWays_Channels " ],['text ' =>$ buttonValues ['bot_settings ' ],'callback_data ' =>'botSettings ' ]],
334334 [['text ' =>$ buttonValues ['tickets_list ' ],'callback_data ' =>"ticketsList " ],['text ' =>$ buttonValues ['message_to_all ' ],'callback_data ' =>"message2All " ]],
335- [['text ' =>$ buttonValues ['agent_list ' ],'callback_data ' =>"agentsList " ]],
335+ [
336+ ['text ' =>$ buttonValues ['agent_list ' ],'callback_data ' =>"agentsList " ],
337+ ['text ' =>$ buttonValues ['rejected_agent_list ' ],'callback_data ' =>"rejectedAgentList " ]
338+ ],
336339 [['text ' =>$ buttonValues ['back_to_main ' ],'callback_data ' =>"mainMenu " ]],
337340 ]]);
338341
339342}
343+ function getRejectedAgentList (){
344+ global $ connection , $ mainValues , $ buttonValues ;
345+
346+ $ stmt = $ connection ->prepare ("SELECT * FROM `users` WHERE `is_agent` = -1 " );
347+ $ stmt ->execute ();
348+ $ list = $ stmt ->get_result ();
349+ $ stmt ->close ();
350+
351+ if ($ list ->num_rows >0 ){
352+ $ keys = array ();
353+ $ keys [] = [['text ' =>"آزاد ساختن " ,'callback_data ' =>"wizwizch " ],['text ' =>"اسم کاربر " ,'callback_data ' =>'wizwizch ' ],['text ' =>"آیدی عددی " ,'callback_data ' =>"wizwizch " ]];
354+ while ($ row = $ list ->fetch_assoc ()){
355+ $ userId = $ row ['userid ' ];
356+
357+ $ userDetail = bot ('getChat ' ,['chat_id ' =>$ userId ])->result ;
358+ $ fullName = $ userDetail ->first_name . " " . $ userDetail ->last_name ;
359+
360+ $ keys [] = [['text ' =>"✅ " ,'callback_data ' =>"releaseRejectedAgent " . $ userId ],['text ' =>$ fullName ,'callback_data ' =>"wizwizch " ],['text ' =>$ userId ,'callback_data ' =>"wizwizch " ]];
361+ }
362+ $ keys [] = [['text ' =>$ buttonValues ['back_button ' ],'callback_data ' =>"managePanel " ]];
363+ return json_encode (['inline_keyboard ' =>$ keys ]);
364+ }else return null ;
365+ }
340366function getAgentDetails ($ userId ){
341367 global $ connection , $ mainVAlues , $ buttonValues ;
342368
@@ -1489,7 +1515,7 @@ function getUserOrderDetailKeys($id){
14891515 $ server_info = $ stmt ->get_result ()->fetch_assoc ();
14901516 $ stmt ->close ();
14911517
1492- $ subLink = $ botUrl . "settings/subLink.php?token= " . $ token ;
1518+ $ subLink = $ botState [ ' subLinkState ' ]== " on " ? " <code> " . $ botUrl . "settings/subLink.php?token= " . $ token . " </code> " : "" ;
14931519
14941520 $ msg = str_replace (['NAME ' ,'CONNECT-LINK ' , 'SUB-LINK ' ], [$ remark , $ configLinks , $ subLink ], $ mainValues ['config_details_message ' ]);
14951521
@@ -1812,14 +1838,15 @@ function getOrderDetailKeys($from_id, $id){
18121838 $ server_info = $ stmt ->get_result ()->fetch_assoc ();
18131839 $ stmt ->close ();
18141840
1815- $ subLink = $ botUrl . "settings/subLink.php?token= " . $ token ;
1841+ $ subLink = $ botState [ ' subLinkState ' ]== " on " ? " <code> " . $ botUrl . "settings/subLink.php?token= " . $ token . " </code> " : "" ;
18161842
18171843 $ msg = str_replace (['NAME ' ,'CONNECT-LINK ' , 'SUB-LINK ' ], [$ remark , $ configLinks , $ subLink ], $ mainValues ['config_details_message ' ]);
18181844
18191845 $ extrakey = [];
1820- if ($ botState ['increaseVolumeState ' ]=="on " && $ price != 0 ) $ extrakey [] = ['text ' => $ buttonValues ['increase_config_volume ' ], 'callback_data ' => "increaseAVolume {$ server_id } _ { $ inbound_id } _ { $ remark }" ];
1821- if ($ botState ['increaseTimeState ' ]=="on " && $ price != 0 ) $ extrakey [] = ['text ' => $ buttonValues ['increase_config_days ' ], 'callback_data ' => "increaseADay {$ server_id } _ { $ inbound_id } _ { $ remark }" ];
1846+ if ($ botState ['increaseVolumeState ' ]=="on " && $ price != 0 ) $ extrakey [] = ['text ' => $ buttonValues ['increase_config_volume ' ], 'callback_data ' => "increaseAVolume {$ id }" ];
1847+ if ($ botState ['increaseTimeState ' ]=="on " && $ price != 0 ) $ extrakey [] = ['text ' => $ buttonValues ['increase_config_days ' ], 'callback_data ' => "increaseADay {$ id }" ];
18221848 $ keyboard [] = $ extrakey ;
1849+
18231850
18241851 if ($ botState ['renewConfigLinkState ' ] == "on " && $ botState ['updateConfigLinkState ' ] == "on " ) $ keyboard [] = [['text ' =>$ buttonValues ['renew_connection_link ' ],'callback_data ' =>'changAccountConnectionLink ' . $ id ],['text ' =>$ buttonValues ['update_config_connection ' ],'callback_data ' =>'updateConfigConnectionLink ' . $ id ]];
18251852 elseif ($ botState ['renewConfigLinkState ' ] == "on " ) $ keyboard [] = [['text ' =>$ buttonValues ['renew_connection_link ' ],'callback_data ' =>'changAccountConnectionLink ' . $ id ]];
@@ -1919,26 +1946,16 @@ function addBorderImage($add){
19191946 imageCopyResized ($ newimage , $ im , $ border , $ border , 0 , 0 , $ width , $ height , $ width , $ height );
19201947 ImagePNG ($ newimage , $ add , 5 );
19211948}
1922- // function sumerize($amount){
1923- // $gb = $amount / (1024 * 1024 * 1024);
1924- // if($gb > 1){
1925- // return round($gb,2) . " گیگابایت";
1926- // }
1927- // else{
1928- // $gb *= 1024;
1929- // return round($gb,2) . " مگابایت";
1930- // }
1931-
1932- // }
19331949function sumerize ($ amount ){
19341950 $ gb = $ amount / (1024 * 1024 * 1024 );
1935- // if($gb > 1){
1936- return round ($ gb ,2 );
1937- // }
1938- // else{
1939- // $gb *= 1024;
1940- // return round($gb,2) . " مگابایت";
1941- // }
1951+ if ($ gb > 1 ){
1952+ return round ($ gb ,2 ) . " گیگابایت " ;
1953+ }
1954+ else {
1955+ $ gb *= 1024 ;
1956+ return round ($ gb ,2 ) . " مگابایت " ;
1957+ }
1958+
19421959}
19431960function deleteClient ($ server_id , $ inbound_id , $ remark , $ delete = 0 ){
19441961 global $ connection ;
@@ -2854,11 +2871,9 @@ function resetClientTraffic($server_id, $remark, $inboundId = null){
28542871 return $ loginResponse ;
28552872 }
28562873 $ phost = str_ireplace ('https:// ' ,'' ,str_ireplace ('http:// ' ,'' ,$ panel_url ));
2857-
28582874 if ($ serverType == "sanaei " ) $ url = "$ panel_url/panel/inbound/ $ inboundId/resetClientTraffic/ " . urlencode ($ remark );
28592875 elseif ($ inboundId == null ) $ url = "$ panel_url/xui/inbound/resetClientTraffic/ " . urlencode ($ remark );
28602876 else $ url = "$ panel_url/xui/inbound/ $ inboundId/resetClientTraffic/ " . urlencode ($ remark );
2861-
28622877 curl_setopt_array ($ curl , array (
28632878 CURLOPT_URL => $ url ,
28642879 CURLOPT_RETURNTRANSFER => true ,
@@ -2925,7 +2940,8 @@ function addInboundAccount($server_id, $client_id, $inbound_id, $expiryTime, $re
29252940 "limitIp " => $ limitip ,
29262941 "flow " => $ flow ,
29272942 "totalGB " => $ volume ,
2928- "expiryTime " => $ expiryTime
2943+ "expiryTime " => $ expiryTime ,
2944+ "subId " => RandomString (16 )
29292945 ];
29302946 }else {
29312947 $ newClient = [
@@ -2934,7 +2950,8 @@ function addInboundAccount($server_id, $client_id, $inbound_id, $expiryTime, $re
29342950 "email " => $ remark ,
29352951 "limitIp " => $ limitip ,
29362952 "totalGB " => $ volume ,
2937- "expiryTime " => $ expiryTime
2953+ "expiryTime " => $ expiryTime ,
2954+ "subId " => RandomString (16 )
29382955 ];
29392956 }
29402957 }else {
@@ -3538,7 +3555,8 @@ function editInbound($server_id, $uniqid, $remark, $protocol, $netType = 'tcp',
35383555 "email": " ' . $ remark . '",
35393556 "limitIp": 0,
35403557 "totalGB": 0,
3541- "expiryTime": 0
3558+ "expiryTime": 0,
3559+ "subId": " ' . RandomString (16 ) . '"
35423560 }
35433561 ],
35443562 "decryption": "none",
@@ -3614,7 +3632,8 @@ function editInbound($server_id, $uniqid, $remark, $protocol, $netType = 'tcp',
36143632 "email": " ' . $ remark . '",
36153633 "limitIp": 0,
36163634 "totalGB": 0,
3617- "expiryTime": 0
3635+ "expiryTime": 0,
3636+ "subId": " ' . RandomString (16 ) . '"
36183637 }
36193638 ],
36203639 "fallbacks": []
@@ -3695,6 +3714,7 @@ function editInbound($server_id, $uniqid, $remark, $protocol, $netType = 'tcp',
36953714 "limitIp": 0,
36963715 "totalGB": 0,
36973716 "expiryTime": 0
3717+ "subId": " ' . RandomString (16 ) . '"
36983718 }
36993719 ],
37003720 "decryption": "none",
@@ -3741,7 +3761,8 @@ function editInbound($server_id, $uniqid, $remark, $protocol, $netType = 'tcp',
37413761 "email": " ' . $ remark . '",
37423762 "limitIp": 0,
37433763 "totalGB": 0,
3744- "expiryTime": 0
3764+ "expiryTime": 0,
3765+ "subId": " ' . RandomString (16 ) . '"
37453766 }
37463767 ],
37473768 "decryption": "none",
@@ -3787,7 +3808,8 @@ function editInbound($server_id, $uniqid, $remark, $protocol, $netType = 'tcp',
37873808 "email": " ' . $ remark . '",
37883809 "limitIp": 0,
37893810 "totalGB": 0,
3790- "expiryTime": 0
3811+ "expiryTime": 0,
3812+ "subId": " ' . RandomString (16 ) . '"
37913813 }
37923814 ],
37933815 "decryption": "none",
@@ -3831,7 +3853,8 @@ function editInbound($server_id, $uniqid, $remark, $protocol, $netType = 'tcp',
38313853 "email": " ' . $ remark . '",
38323854 "limitIp": 0,
38333855 "totalGB": 0,
3834- "expiryTime": 0
3856+ "expiryTime": 0,
3857+ "subId": " ' . RandomString (16 ) . '"
38353858 }
38363859 ],
38373860 "decryption": "none",
@@ -4099,7 +4122,8 @@ function addUser($server_id, $client_id, $protocol, $port, $expiryTime, $remark,
40994122 "email": " ' . $ remark . '",
41004123 "limitIp": 0,
41014124 "totalGB": 0,
4102- "expiryTime": 0
4125+ "expiryTime": 0,
4126+ "subId": " ' . RandomString (16 ) . '"
41034127 }
41044128 ],
41054129 "decryption": "none",
@@ -4175,7 +4199,8 @@ function addUser($server_id, $client_id, $protocol, $port, $expiryTime, $remark,
41754199 "email": " ' . $ remark . '",
41764200 "limitIp": 0,
41774201 "totalGB": 0,
4178- "expiryTime": 0
4202+ "expiryTime": 0,
4203+ "subId": " ' . RandomString (16 ) . '"
41794204 }
41804205 ],
41814206 "fallbacks": []
@@ -4264,7 +4289,8 @@ function addUser($server_id, $client_id, $protocol, $port, $expiryTime, $remark,
42644289 "email": " ' . $ remark . '",
42654290 "limitIp": 0,
42664291 "totalGB": 0,
4267- "expiryTime": 0
4292+ "expiryTime": 0,
4293+ "subId": " ' . RandomString (16 ) . '"
42684294 }
42694295 ],
42704296 "decryption": "none",
@@ -4310,7 +4336,8 @@ function addUser($server_id, $client_id, $protocol, $port, $expiryTime, $remark,
43104336 "email": " ' . $ remark . '",
43114337 "limitIp": 0,
43124338 "totalGB": 0,
4313- "expiryTime": 0
4339+ "expiryTime": 0,
4340+ "subId": " ' . RandomString (16 ) . '"
43144341 }
43154342 ],
43164343 "disableInsecureEncryption": false
@@ -4378,7 +4405,8 @@ function addUser($server_id, $client_id, $protocol, $port, $expiryTime, $remark,
43784405 "email": " ' . $ remark . '",
43794406 "limitIp": 0,
43804407 "totalGB": 0,
4381- "expiryTime": 0
4408+ "expiryTime": 0,
4409+ "subId": " ' . RandomString (16 ) . '"
43824410 }
43834411 ],
43844412 "decryption": "none",
@@ -4491,7 +4519,8 @@ function addUser($server_id, $client_id, $protocol, $port, $expiryTime, $remark,
44914519 "flow": " ' . $ flow .'",
44924520 "limitIp": 0,
44934521 "totalGB": 0,
4494- "expiryTime": 0
4522+ "expiryTime": 0,
4523+ "subId": " ' . RandomString (16 ) . '"
44954524 }
44964525 ],
44974526 "decryption": "none",
@@ -4507,7 +4536,8 @@ function addUser($server_id, $client_id, $protocol, $port, $expiryTime, $remark,
45074536 "email": " ' . $ remark . '",
45084537 "limitIp": 0,
45094538 "totalGB": 0,
4510- "expiryTime": 0
4539+ "expiryTime": 0,
4540+ "subId": " ' . RandomString (16 ) . '"
45114541 }
45124542 ],
45134543 "decryption": "none",
0 commit comments