Hoang030720055

Untitled

Mar 28th, 2023
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.28 KB | None | 0 0
  1. <?php
  2.  
  3. if (!defined('IN_SITE')) {
  4. die('The Request Not Found');
  5. }
  6.  
  7.  
  8. function buy_API_4($domain, $token, $id_product, $amount){
  9. $curl = curl_init();
  10. curl_setopt_array($curl, array(
  11. CURLOPT_URL => $domain.'v1/user/partnerbuy',
  12. CURLOPT_RETURNTRANSFER => true,
  13. CURLOPT_ENCODING => '',
  14. CURLOPT_MAXREDIRS => 10,
  15. CURLOPT_TIMEOUT => 0,
  16. CURLOPT_FOLLOWLOCATION => true,
  17. CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  18. CURLOPT_CUSTOMREQUEST => 'POST',
  19. CURLOPT_POSTFIELDS => array('amount' => $amount, 'categoryId' => $id_product),
  20. CURLOPT_HTTPHEADER => array(
  21. 'authorization: '.$token
  22. ),
  23. ));
  24. $response = curl_exec($curl);
  25. curl_close($curl);
  26. return $response;
  27.  
  28. }
  29. function balance_API_4($domain, $username, $password){
  30. $curl = curl_init();
  31. curl_setopt_array($curl, array(
  32. CURLOPT_URL => $domain.'v1/user/login',
  33. CURLOPT_RETURNTRANSFER => true,
  34. CURLOPT_ENCODING => '',
  35. CURLOPT_MAXREDIRS => 10,
  36. CURLOPT_TIMEOUT => 0,
  37. CURLOPT_FOLLOWLOCATION => true,
  38. CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  39. CURLOPT_CUSTOMREQUEST => 'POST',
  40. CURLOPT_POSTFIELDS => array(
  41. 'username' => $username,
  42. 'password' => $password
  43. ),
  44. ));
  45. $response = curl_exec($curl);
  46. curl_close($curl);
  47. return $response;
  48. }
  49. function balance_API_1($domain, $token){
  50. $curl = curl_init();
  51. curl_setopt_array($curl, array(
  52. CURLOPT_URL => $domain.'api/v1/balance',
  53. CURLOPT_RETURNTRANSFER => true,
  54. CURLOPT_ENCODING => '',
  55. CURLOPT_MAXREDIRS => 10,
  56. CURLOPT_TIMEOUT => 0,
  57. CURLOPT_FOLLOWLOCATION => true,
  58. CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  59. CURLOPT_CUSTOMREQUEST => 'POST',
  60. CURLOPT_POSTFIELDS => array('api_key' => $token),
  61. ));
  62. $response = curl_exec($curl);
  63. curl_close($curl);
  64. return $response;
  65. }
  66. function buy_API_1($domain, $dataPost){
  67. $curl = curl_init();
  68. curl_setopt_array($curl, array(
  69. CURLOPT_URL => $domain."api/v1/buy",
  70. CURLOPT_RETURNTRANSFER => true,
  71. CURLOPT_ENCODING => "",
  72. CURLOPT_MAXREDIRS => 10,
  73. CURLOPT_TIMEOUT => 0,
  74. CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  75. CURLOPT_CUSTOMREQUEST => "POST",
  76. CURLOPT_POSTFIELDS => $dataPost,
  77. ));
  78. $response = curl_exec($curl);
  79. curl_close($curl);
  80. return $response;
  81. }
  82. function order_API_1($domain, $token, $order_id){
  83. $curl = curl_init();
  84. curl_setopt_array($curl, array(
  85. CURLOPT_URL => $domain.'api/v1/order',
  86. CURLOPT_RETURNTRANSFER => true,
  87. CURLOPT_ENCODING => '',
  88. CURLOPT_MAXREDIRS => 10,
  89. CURLOPT_TIMEOUT => 0,
  90. CURLOPT_FOLLOWLOCATION => true,
  91. CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  92. CURLOPT_CUSTOMREQUEST => 'POST',
  93. CURLOPT_POSTFIELDS => array('api_key' => $token,'order_id' => $order_id),
  94. ));
  95. $response = curl_exec($curl);
  96. curl_close($curl);
  97. return $response;
  98. }
  99.  
  100. function addRef($user_id, $price, $note = ''){
  101. $CMSNT = new DB;
  102. if($CMSNT->site('status_ref') != 1){
  103. return false;
  104. }
  105. $getUser = $CMSNT->get_row(" SELECT * FROM `users` WHERE `id` = '$user_id' ");
  106. if($getUser['ref_id'] != 0){
  107. $price = $price * $CMSNT->site('ck_ref') / 100;
  108. $CMSNT->cong('users', 'ref_money', $price, " `id` = '".$getUser['ref_id']."' ");
  109. $CMSNT->cong('users', 'ref_total_money', $price, " `id` = '".$getUser['ref_id']."' ");
  110. $CMSNT->cong('users', 'ref_amount', $price, " `id` = '".$getUser['id']."' ");
  111. $CMSNT->insert('log_ref', [
  112. 'user_id' => $getUser['ref_id'],
  113. 'reason' => $note,
  114. 'sotientruoc' => getRowRealtime('users', $getUser['ref_id'], 'ref_money') - $price,
  115. 'sotienthaydoi' => $price,
  116. 'sotienhientai' => getRowRealtime('users', $getUser['ref_id'], 'ref_money')
  117. ]);
  118. return true;
  119. }
  120. return false;
  121. }
  122. function sendMessAdmin($my_text){
  123. $CMSNT = new DB;
  124. if(checkAddon(112246) == true){
  125. if($CMSNT->site('type_notification') == 'telegram'){
  126. return sendMessTelegram($my_text);
  127. }
  128. return false;
  129. }
  130. return false;
  131. }
  132. function sendMessTelegram($my_text){
  133. $CMSNT = new DB;
  134. if($CMSNT->site('token_telegram') != '' && $CMSNT->site('chat_id_telegram') != ''){
  135. return curl_get("https://api.telegram.org/bot".$CMSNT->site('token_telegram')."/sendMessage?chat_id=".$CMSNT->site('chat_id_telegram')."&text=".$my_text);
  136. }
  137. return true;
  138. }
  139. function getFlag($flag){
  140.  
  141. if(empty($flag)){
  142. return '';
  143. }
  144. return '<img width="30px;" src="https://flagicons.lipis.dev/flags/4x3/'.$flag.'.svg">';
  145. }
  146. function checkPromotion($amount){
  147. $CMSNT = new DB();
  148. foreach($CMSNT->get_list("SELECT * FROM `promotions` WHERE `amount` <= '$amount' AND `status` = 1 ORDER by `amount` DESC ") as $promotion){
  149. $received = $amount + $amount * $promotion['discount'] / 100;
  150. return $received;
  151. }
  152. return $amount;
  153. }
  154. function claimSpin($user_id, $trans_id, $total_money)
  155. {
  156. $CMSNT = new DB();
  157. $USER = new users();
  158. if ($CMSNT->site('status_spin') == 1) {
  159. if ($total_money >= $CMSNT->site('condition_spin')) {
  160. $USER->AddSpin($user_id, 1, 'Nhập 1 SPIN từ đơn hàng #'.$trans_id);
  161. }
  162. }
  163. }
  164. function getRandomWeightedElement(array $weightedValues)
  165. {
  166. $Rand = mt_Rand(1, (int) array_sum($weightedValues));
  167. foreach ($weightedValues as $key => $value) {
  168. $Rand -= $value;
  169. if ($Rand <= 0) {
  170. return $key;
  171. }
  172. }
  173. }
  174. function checkFormatCard($type, $seri, $pin)
  175. {
  176. $seri = strlen($seri);
  177. $pin = strlen($pin);
  178. $data = [];
  179. if ($type == 'Viettel' || $type == "viettel" || $type == "VT" || $type == "VIETTEL") {
  180. if ($seri != 11 && $seri != 14) {
  181. $data = [
  182. 'status' => false,
  183. 'msg' => 'Độ dài seri không phù hợp'
  184. ];
  185. return $data;
  186. }
  187. if ($pin != 13 && $pin != 15) {
  188. $data = [
  189. 'status' => false,
  190. 'msg' => 'Độ dài mã thẻ không phù hợp'
  191. ];
  192. return $data;
  193. }
  194. }
  195. if ($type == 'Mobifone' || $type == "mobifone" || $type == "Mobi" || $type == "MOBIFONE") {
  196. if ($seri != 15) {
  197. $data = [
  198. 'status' => false,
  199. 'msg' => 'Độ dài seri không phù hợp'
  200. ];
  201. return $data;
  202. }
  203. if ($pin != 12) {
  204. $data = [
  205. 'status' => false,
  206. 'msg' => 'Độ dài mã thẻ không phù hợp'
  207. ];
  208. return $data;
  209. }
  210. }
  211. if ($type == 'VNMB' || $type == "Vnmb" || $type == "VNM" || $type == "VNMOBI") {
  212. if ($seri != 16) {
  213. $data = [
  214. 'status' => false,
  215. 'msg' => 'Độ dài seri không phù hợp'
  216. ];
  217. return $data;
  218. }
  219. if ($pin != 12) {
  220. $data = [
  221. 'status' => false,
  222. 'msg' => 'Độ dài mã thẻ không phù hợp'
  223. ];
  224. return $data;
  225. }
  226. }
  227. if ($type == 'Vinaphone' || $type == "vinaphone" || $type == "Vina" || $type == "VINAPHONE") {
  228. if ($seri != 14) {
  229. $data = [
  230. 'status' => false,
  231. 'msg' => 'Độ dài seri không phù hợp'
  232. ];
  233. return $data;
  234. }
  235. if ($pin != 14) {
  236. $data = [
  237. 'status' => false,
  238. 'msg' => 'Độ dài mã thẻ không phù hợp'
  239. ];
  240. return $data;
  241. }
  242. }
  243. if ($type == 'Garena' || $type == "garena") {
  244. if ($seri != 9) {
  245. $data = [
  246. 'status' => false,
  247. 'msg' => 'Độ dài seri không phù hợp'
  248. ];
  249. return $data;
  250. }
  251. if ($pin != 16) {
  252. $data = [
  253. 'status' => false,
  254. 'msg' => 'Độ dài mã thẻ không phù hợp'
  255. ];
  256. return $data;
  257. }
  258. }
  259. if ($type == 'Zing' || $type == "zing" || $type == "ZING") {
  260. if ($seri != 12) {
  261. $data = [
  262. 'status' => false,
  263. 'msg' => 'Độ dài seri không phù hợp'
  264. ];
  265. return $data;
  266. }
  267. if ($pin != 9) {
  268. $data = [
  269. 'status' => false,
  270. 'msg' => 'Độ dài mã thẻ không phù hợp'
  271. ];
  272. return $data;
  273. }
  274. }
  275. if ($type == 'Vcoin' || $type == "VTC") {
  276. if ($seri != 12) {
  277. $data = [
  278. 'status' => false,
  279. 'msg' => 'Độ dài seri không phù hợp'
  280. ];
  281. return $data;
  282. }
  283. if ($pin != 12) {
  284. $data = [
  285. 'status' => false,
  286. 'msg' => 'Độ dài mã thẻ không phù hợp'
  287. ];
  288. return $data;
  289. }
  290. }
  291. $data = [
  292. 'status' => true,
  293. 'msg' => 'Success'
  294. ];
  295. return $data;
  296. }
  297. function checkCoupon($coupon, $user_id, $total_money)
  298. {
  299. global $CMSNT;
  300. // check coupon có tồn tại hay không
  301. if ($coupon = $CMSNT->get_row("SELECT * FROM `coupons` WHERE `code` = '".check_string($coupon)."' AND `min` <= $total_money AND `max` >= $total_money AND `used` < `amount` ")) {
  302. // chek số lượng còn hay không
  303. if ($coupon['used'] < $coupon['amount']) {
  304. // check đã dùng hay chưa
  305. if (!$CMSNT->get_row("SELECT * FROM `coupon_used` WHERE `coupon_id` = '".$coupon['id']."' AND `user_id` = '".$user_id."' ")) {
  306. return $coupon['discount'];
  307. }
  308. return false;
  309. }
  310. return false;
  311. }
  312. return false;
  313. }
  314. function active_sidebar_client($action)
  315. {
  316. foreach ($action as $row) {
  317. $row2 = explode('/', $row);
  318. if(isset($row2[1])){
  319. if(isset($_GET['shop']) && $_GET['shop'] == $row2[1]){
  320. return 'active';
  321. }
  322. }
  323. if (isset($_GET['action']) && $_GET['action'] == $row) {
  324. return 'active';
  325. }
  326. }
  327. return '';
  328. }
  329. function show_sidebar_client($action)
  330. {
  331. foreach ($action as $row) {
  332. if (isset($_GET['action']) && $_GET['action'] == $row) {
  333. return 'show';
  334. }
  335. }
  336. return '';
  337. }
  338. function parse_order_id($des, $MEMO_PREFIX)
  339. {
  340. $re = '/'.$MEMO_PREFIX.'\d+/im';
  341. preg_match_all($re, $des, $matches, PREG_SET_ORDER, 0);
  342. if (count($matches) == 0) {
  343. return null;
  344. }
  345. // Print the entire match result
  346. $orderCode = $matches[0][0];
  347. $prefixLength = strlen($MEMO_PREFIX);
  348. $orderId = intval(substr($orderCode, $prefixLength));
  349. return $orderId ;
  350. }
  351. function display_status_crypto($status)
  352. {
  353. if ($status == 'waiting') {
  354. return '<b style="color:#db7e06;">'.__('Waiting').'</b>';
  355. } elseif ($status == 'confirming') {
  356. return '<b style="color:blue;">'.__('Confirming').'</b>';
  357. } elseif ($status == 'confirmed') {
  358. return '<b style="color:green;">'.__('Confirmed').'</b>';
  359. } elseif ($status == 'refunded') {
  360. return '<b style="color:pink;">'.__('Refunded').'</b>';
  361. } elseif ($status == 'expired') {
  362. return '<b style="color:red;">'.__('Expired').'</b>';
  363. } elseif ($status == 'failed') {
  364. return '<b style="color:red;">'.__('Failed').'</b>';
  365. } elseif ($status == 'partially_paid') {
  366. return '<b style="color:green;">'.__('Partially Paid').'</b>';
  367. } elseif ($status == 'finished') {
  368. return '<b style="color:green;">'.__('Finished').'</b>';
  369. }
  370. }
  371. function display_service($status)
  372. {
  373. if ($status == 0) {
  374. return '<b style="color:blue;">Đang chờ xử lý</b>';
  375. } elseif ($status == 1) {
  376. return '<b style="color:green;">Hoàn tất</b>';
  377. } elseif ($status == 2) {
  378. return '<b style="color:red;">Huỷ</b>';
  379. } else {
  380. return '<b style="color:yellow;">Khác</b>';
  381. }
  382. }
  383. function display_card($status)
  384. {
  385. if ($status == 0) {
  386. return '<p class="mb-0 text-info font-weight-bold d-flex justify-content-start align-items-center">'.__('Đang chờ xử lý').'</p>';
  387. } elseif ($status == 1) {
  388. return '<p class="mb-0 text-success font-weight-bold d-flex justify-content-start align-items-center">'.__('Thành công').'</p>';
  389. } elseif ($status == 2) {
  390. return '<p class="mb-0 text-danger font-weight-bold d-flex justify-content-start align-items-center">'.__('Thất bại').'</p>';
  391. } else {
  392. return '<b style="color:yellow;">Khác</b>';
  393. }
  394. }
  395. // display hoá đơn
  396. function display_invoice($status)
  397. {
  398. if ($status == 0) {
  399. return '<p class="mb-0 text-warning font-weight-bold d-flex justify-content-start align-items-center">'.__('Đang chờ thanh toán').'</p>';
  400. } elseif ($status == 1) {
  401. return '<p class="mb-0 text-success font-weight-bold d-flex justify-content-start align-items-center">'.__('Đã thanh toán').'</p>';
  402. } elseif ($status == 2) {
  403. return '<p class="mb-0 text-danger font-weight-bold d-flex justify-content-start align-items-center">'.__('Huỷ bỏ').'</p>';
  404. } else {
  405. return '<b style="color:yellow;">Khác</b>';
  406. }
  407. }
  408. function display_invoice_text($status)
  409. {
  410. if ($status == 0) {
  411. return __('Đang chờ thanh toán');
  412. } elseif ($status == 1) {
  413. return __('Đã thanh toán');
  414. } elseif ($status == 2) {
  415. return __('Huỷ bỏ');
  416. } else {
  417. return __('Khác');
  418. }
  419. }
  420. // lấy dữ liệu theo thời gian thực
  421. function getRowRealtime($table, $id, $row)
  422. {
  423. global $CMSNT;
  424. return $CMSNT->get_row("SELECT * FROM `$table` WHERE `id` = '$id' ")[$row];
  425. }
  426.  
  427. function get_url(){
  428. if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'){
  429. $url = "https://";
  430. }else {
  431. $url = "http://";
  432. }
  433. $url.= $_SERVER['HTTP_HOST'];
  434. $url.= $_SERVER['REQUEST_URI'];
  435. return $url;
  436. }
  437. // Hàm tạo URL
  438. function base_url($url = '')
  439. {
  440. global $domain_block;
  441. $a = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"];
  442. if ($a == 'http://localhost') {
  443. $a = 'http://localhost/CMSNT.CO/SHOPCLONE6';
  444. }
  445. // foreach($domain_block as $domain){
  446. // if($domain == $_SERVER['HTTP_HOST']){
  447. // return redirect(base64_decode('aHR0cHM6Ly93d3cuY21zbnQuY28v'));
  448. // }
  449. // }
  450. return $a.'/'.$url;
  451. }
  452. function base_url_admin($url = '')
  453. {
  454. $a = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"];
  455. if ($a == 'http://localhost') {
  456. $a = 'http://localhost/CMSNT.CO/SHOPCLONE6';
  457. }
  458. return $a.'/admin/'.$url;
  459. }
  460. // mã hoá password
  461. function TypePassword($password)
  462. {
  463. $CMSNT = new DB();
  464. if ($CMSNT->site('type_password') == 'md5') {
  465. return md5($password);
  466. }
  467. if ($CMSNT->site('type_password') == 'bcrypt') {
  468. return password_hash($password, PASSWORD_BCRYPT);
  469. }
  470. if ($CMSNT->site('type_password') == 'sha1') {
  471. return sha1($password);
  472. }
  473. return $password;
  474. }
  475. // lấy thông tin user theo id
  476. function getUser($id, $row)
  477. {
  478. $CMSNT = new DB();
  479. return $CMSNT->get_row("SELECT * FROM `users` WHERE `id` = '$id' ")[$row];
  480. }
  481. // check định dạng email
  482. function check_email($data)
  483. {
  484. if (preg_match('/^.+@.+$/', $data, $matches)) {
  485. return true;
  486. } else {
  487. return false;
  488. }
  489. }
  490. // check định dạng số điện thoại
  491. function check_phone($data)
  492. {
  493. if (preg_match('/^\+?(\d.*){3,}$/', $data, $matches)) {
  494. return true;
  495. } else {
  496. return false;
  497. }
  498. }
  499. // get datatime
  500. function gettime()
  501. {
  502. return date('Y/m/d H:i:s', time());
  503. }
  504. //format money
  505. function format_currency($amount)
  506. {
  507. $CMSNT = new DB();
  508. $currency = $CMSNT->site('currency');
  509. if ($currency == 'USD') {
  510. return '$'.number_format($amount / $CMSNT->site('usd_rate'), 2, '.', '');
  511. } elseif ($currency == 'VND') {
  512. return format_cash($amount).'đ';
  513. } elseif ($currency == 'THB') {
  514. return format_cash($amount / 645.36).' THB';
  515. }
  516. }
  517. //show ip
  518. function myip()
  519. {
  520. if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
  521. $ip_address = $_SERVER['HTTP_CLIENT_IP'];
  522. } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
  523. $ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
  524. } else {
  525. $ip_address = $_SERVER['REMOTE_ADDR'];
  526. }
  527. if(isset(explode(',', $ip_address)[1])){
  528. return explode(',', $ip_address)[0];
  529. }
  530. return check_string($ip_address);
  531. }
  532. // lọc input
  533. function check_string($data)
  534. {
  535. return trim(htmlspecialchars(addslashes($data)));
  536. //return str_replace(array('<',"'",'>','?','/',"\\",'--','eval(','<php'),array('','','','','','','','',''),htmlspecialchars(addslashes(strip_tags($data))));
  537. }
  538. // định dạng tiền tệ
  539. function format_cash($number, $suffix = '')
  540. {
  541. return number_format($number, 0, ',', '.') . "{$suffix}";
  542. }
  543. function create_slug($string)
  544. {
  545. $search = array(
  546. '#(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)#',
  547. '#(è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ)#',
  548. '#(ì|í|ị|ỉ|ĩ)#',
  549. '#(ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)#',
  550. '#(ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)#',
  551. '#(ỳ|ý|ỵ|ỷ|ỹ)#',
  552. '#(đ)#',
  553. '#(À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)#',
  554. '#(È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ)#',
  555. '#(Ì|Í|Ị|Ỉ|Ĩ)#',
  556. '#(Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)#',
  557. '#(Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)#',
  558. '#(Ỳ|Ý|Ỵ|Ỷ|Ỹ)#',
  559. '#(Đ)#',
  560. "/[^a-zA-Z0-9\-\_]/",
  561. );
  562. $replace = array(
  563. 'a',
  564. 'e',
  565. 'i',
  566. 'o',
  567. 'u',
  568. 'y',
  569. 'd',
  570. 'A',
  571. 'E',
  572. 'I',
  573. 'O',
  574. 'U',
  575. 'Y',
  576. 'D',
  577. '-',
  578. );
  579. $string = preg_replace($search, $replace, $string);
  580. $string = preg_replace('/(-)+/', '-', $string);
  581. $string = strtolower($string);
  582. return $string;
  583. }
  584. function checkAddon($id_addon){
  585. $CMSNT = new DB();
  586. $domain = str_replace('www.', '', $_SERVER['HTTP_HOST']);
  587. if($CMSNT->get_row("SELECT * FROM `addons` WHERE `id` = '$id_addon' ")['purchase_key'] == md5($domain.'|'.$id_addon)){
  588. return true;
  589. }
  590. return false;
  591. }
  592. // curl get
  593. function curl_get($url)
  594. {
  595. $ch = curl_init();
  596. curl_setopt($ch, CURLOPT_URL, $url);
  597. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  598. $data = curl_exec($ch);
  599. curl_close($ch);
  600. return $data;
  601. }
  602. function curl_post($url, $method, $postinfo, $cookie_file_path)
  603. {
  604. $ch = curl_init();
  605. curl_setopt($ch, CURLOPT_HEADER, true);
  606. curl_setopt($ch, CURLOPT_NOBODY, false);
  607. curl_setopt($ch, CURLOPT_URL, $url);
  608. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  609. curl_setopt($ch, CURLOPT_COOKIE, $cookie_file_path);
  610. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
  611. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
  612. curl_setopt(
  613. $ch,
  614. CURLOPT_USERAGENT,
  615. "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7"
  616. );
  617. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  618. curl_setopt($ch, CURLOPT_REFERER, $_SERVER['REQUEST_URI']);
  619. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  620. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  621.  
  622. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
  623. if ($method=='POST') {
  624. curl_setopt($ch, CURLOPT_POST, 1);
  625. curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo);
  626. }
  627. $html = curl_exec($ch);
  628. curl_close($ch);
  629. return $html;
  630. }
  631. function convertTokenToCookie($token)
  632. {
  633. $html = json_decode(file_get_contents("https://api.facebook.com/method/auth.getSessionforApp?access_token=$token&format=json&new_app_id=350685531728&generate_session_cookies=1"), true);
  634. $cookie = $html['session_cookies'][0]['name']."=".$html['session_cookies'][0]['value'].";".$html['session_cookies'][1]['name']."=".$html['session_cookies'][1]['value'].";".$html['session_cookies'][2]['name']."=".$html['session_cookies'][2]['value'].";".$html['session_cookies'][3]['name']."=".$html['session_cookies'][3]['value'];
  635. return $cookie;
  636. }
  637. function senInboxCSM($cookie, $noiDungTinNhan, $idAnh, $idNguoiNhan)
  638. {
  639. //lấy id người gửi
  640. preg_match("/c_user=([0-9]+);/", $cookie, $idNguoiGui);
  641. $idNguoiGui = $idNguoiGui[1];
  642. //lấy dtsg
  643. $html = curl_post('https://m.facebook.com', 'GET', "", $cookie);
  644. $re = "/<input type=\"hidden\" name=\"fb_dtsg\" value=\"(.*?)\" autocomplete=\"off\" \\/>/";
  645. preg_match($re, $html, $dtsg);
  646. $dtsg = $dtsg[1];
  647. //tách chuỗi thành vòng lặp, lấy từng người nhận ra
  648. $ex = explode("|", $idNguoiNhan);
  649. foreach ($ex as $idNguoiNhan) {
  650. // echo ".$idNguoiNhan.";
  651. //lấy tids
  652. $html1 = curl_post("https://m.facebook.com/messages/read/?fbid=$idNguoiNhan&_rdr", 'GET', '', $cookie);
  653. $re = "/tids=(.*?)\&/";
  654. preg_match($re, $html1, $tid);
  655. if (isset($tid[1])) {
  656. $tid=urldecode($tid[1]); //encode mã tids lại
  657. $data = array("fb_dtsg" => "$dtsg",
  658. "body" => "$noiDungTinNhan",
  659. "send" => "Gá»­i",
  660. "photo_ids[$idanh]" => "$idAnh",
  661. "tids" => "$tid",
  662. "referrer" => "",
  663. "ctype" => "",
  664. "cver" => "legacy");
  665. } else {
  666. $data = array("fb_dtsg" => "$dtsg",
  667. "body" => "$noiDungTinNhan",
  668. "Send" => "Gá»­i",
  669. "ids[0]" => "$idNguoiNhan",
  670. "photo" => "",
  671. "waterfall_source" => "message");
  672. }
  673. //Gửi tin nhắn
  674. $html = curl_post('https://m.facebook.com/messages/send/?icm=1&refid=12', 'POST', http_build_query($data), $cookie);
  675. $re = preg_match("/send_success/", $html, $rep); //bắt kết quả trả về
  676. if (isset($rep[0])) {
  677. return true;
  678. ob_flush();
  679. flush();
  680. } else {
  681. return false;
  682. ob_flush();
  683. flush();
  684. }
  685. }
  686. }
  687.  
  688. // hàm tạo string random
  689. function random($string, $int)
  690. {
  691. return substr(str_shuffle($string), 0, $int);
  692. }
  693. // Hàm redirect
  694. function redirect($url)
  695. {
  696. header("Location: {$url}");
  697. exit();
  698. }
  699.  
  700. // show active sidebar AdminLTE3
  701. function active_sidebar($action)
  702. {
  703. foreach ($action as $row) {
  704. if (isset($_GET['action']) && $_GET['action'] == $row) {
  705. return 'active';
  706. }
  707. }
  708. return '';
  709. }
  710. function menuopen_sidebar($action)
  711. {
  712. foreach ($action as $row) {
  713. if (isset($_GET['action']) && $_GET['action'] == $row) {
  714. return 'menu-open';
  715. }
  716. }
  717. return '';
  718. }
  719.  
  720. // Hàm lấy value từ $_POST
  721. function input_post($key)
  722. {
  723. return isset($_POST[$key]) ? trim($_POST[$key]) : false;
  724. }
  725.  
  726. // Hàm lấy value từ $_GET
  727. function input_get($key)
  728. {
  729. return isset($_GET[$key]) ? trim($_GET[$key]) : false;
  730. }
  731.  
  732. // Hàm kiểm tra submit
  733. function is_submit($key)
  734. {
  735. return (isset($_POST['request_name']) && $_POST['request_name'] == $key);
  736. }
  737.  
  738. function display_mark($data)
  739. {
  740. if ($data == 1) {
  741. $show = '<span class="badge badge-success">Có</span>';
  742. } elseif ($data == 0) {
  743. $show = '<span class="badge badge-danger">Không</span>';
  744. }
  745. return $show;
  746. }
  747. // display banned
  748. function display_banned($banned)
  749. {
  750. if ($banned != 1) {
  751. return '<span class="badge badge-success">Active</span>';
  752. } else {
  753. return '<span class="badge badge-danger">Banned</span>';
  754. }
  755. }
  756. // display online
  757. function display_online($time)
  758. {
  759. if (time() - $time <= 300) {
  760. return '<span class="badge badge-success">Online</span>';
  761. } else {
  762. return '<span class="badge badge-danger">Offline</span>';
  763. }
  764. }
  765. // hiển thị cờ quốc gia
  766. function display_flag($data)
  767. {
  768. return '<img src="https://flagcdn.com/40x30/'.$data.'.png" >';
  769. }
  770. function display_live($data)
  771. {
  772. if ($data == 'LIVE') {
  773. $show = '<span class="badge badge-success">LIVE</span>';
  774. } elseif ($data == 'DIE') {
  775. $show = '<span class="badge badge-danger">DIE</span>';
  776. }
  777. return $show;
  778. }
  779. function display_checklive($data)
  780. {
  781. if ($data == 1) {
  782. $show = '<span class="badge badge-success">Có</span>';
  783. } elseif ($data == 0) {
  784. $show = '<span class="badge badge-danger">Không</span>';
  785. }
  786. return $show;
  787. }
  788. function card24h($telco, $amount, $serial, $pin, $trans_id){
  789. global $CMSNT;
  790. $partner_id = $CMSNT->site('partner_id_card');
  791. $partner_key = $CMSNT->site('partner_key_card');
  792. $url ="https://doithe1s.vn/chargingws/v2?sign=".md5($partner_key.$pin.$serial).'&telco='.$telco.'&code='.$pin.'&serial='.$serial.'&amount='.$amount.'&request_id='.$trans_id.'&partner_id='.$partner_id.'&command=charging';
  793. $ch = curl_init();
  794. curl_setopt($ch, CURLOPT_URL, $url);
  795. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  796. $data = curl_exec($ch);
  797. curl_close($ch);
  798. return json_decode($data, true);
  799. }
  800. function display_autofb($data){
  801. if ($data == 1) {
  802. $show = '<span class="badge badge-success">'.__('Hoàn thành').'</span>';
  803. } elseif ($data == 0) {
  804. $show = '<span class="badge badge-warning">'.__('Đang xử lý').'</span>';
  805. } elseif ($data == 2) {
  806. $show = '<span class="badge badge-danger">'.__('Huỷ').'</span>';
  807. }
  808. return $show;
  809. }
  810. // hiển thị trạng thái hiển thị
  811. function display_status_product($data)
  812. {
  813. if ($data == 1) {
  814. $show = '<span class="badge badge-success">Hiển thị</span>';
  815. } elseif ($data == 0) {
  816. $show = '<span class="badge badge-danger">Ẩn</span>';
  817. }
  818. return $show;
  819. }
  820. //display rank admin
  821. function display_role($data)
  822. {
  823. if ($data == 1) {
  824. $show = '<span class="badge badge-danger">Admin</span>';
  825. } elseif ($data == 0) {
  826. $show = '<span class="badge badge-info">Member</span>';
  827. }
  828. return $show;
  829. }
  830. // Hàm show msg
  831. function msg_success($text, $url, $time)
  832. {
  833. return die('<script type="text/javascript">swal("Thành Công", "'.$text.'","success");
  834. setTimeout(function(){ location.href = "'.$url.'" },'.$time.');</script>');
  835. }
  836. function msg_error($text, $url, $time)
  837. {
  838. return die('<script type="text/javascript">swal("Thất Bại", "'.$text.'","error");
  839. setTimeout(function(){ location.href = "'.$url.'" },'.$time.');</script>');
  840. }
  841. function msg_warning($text, $url, $time)
  842. {
  843. return die('<script type="text/javascript">swal("Thông Báo", "'.$text.'","warning");
  844. setTimeout(function(){ location.href = "'.$url.'" },'.$time.');</script>');
  845. }
  846. //paginationBoostrap
  847. function paginationBoostrap($url, $start, $total, $kmess)
  848. {
  849. $out[] = '<ul class="pagination">';
  850. $neighbors = 2;
  851. if ($start >= $total) {
  852. $start = max(0, $total - (($total % $kmess) == 0 ? $kmess : ($total % $kmess)));
  853. } else {
  854. $start = max(0, (int)$start - ((int)$start % (int)$kmess));
  855. }
  856. $base_link = '<li class="page-item"><a class="page-link" href="' . strtr($url, array('%' => '%%')) . 'page=%d' . '">%s</a></li>';
  857. $out[] = $start == 0 ? '' : sprintf($base_link, $start / $kmess, '<i class="far fa-hand-point-left"></i>');
  858. if ($start > $kmess * $neighbors) {
  859. $out[] = sprintf($base_link, 1, '1');
  860. }
  861. if ($start > $kmess * ($neighbors + 1)) {
  862. $out[] = '<li class="page-item"><a class="page-link">...</a></li>';
  863. }
  864. for ($nCont = $neighbors;$nCont >= 1;$nCont--) {
  865. if ($start >= $kmess * $nCont) {
  866. $tmpStart = $start - $kmess * $nCont;
  867. $out[] = sprintf($base_link, $tmpStart / $kmess + 1, $tmpStart / $kmess + 1);
  868. }
  869. }
  870. $out[] = '<li class="page-item active"><a class="page-link">' . ($start / $kmess + 1) . '</a></li>';
  871. $tmpMaxPages = (int)(($total - 1) / $kmess) * $kmess;
  872. for ($nCont = 1;$nCont <= $neighbors;$nCont++) {
  873. if ($start + $kmess * $nCont <= $tmpMaxPages) {
  874. $tmpStart = $start + $kmess * $nCont;
  875. $out[] = sprintf($base_link, $tmpStart / $kmess + 1, $tmpStart / $kmess + 1);
  876. }
  877. }
  878. if ($start + $kmess * ($neighbors + 1) < $tmpMaxPages) {
  879. $out[] = '<li class="page-item"><a class="page-link">...</a></li>';
  880. }
  881. if ($start + $kmess * $neighbors < $tmpMaxPages) {
  882. $out[] = sprintf($base_link, $tmpMaxPages / $kmess + 1, $tmpMaxPages / $kmess + 1);
  883. }
  884. if ($start + $kmess < $total) {
  885. $display_page = ($start + $kmess) > $total ? $total : ($start / $kmess + 2);
  886. $out[] = sprintf($base_link, $display_page, '<i class="far fa-hand-point-right"></i>
  887. ');
  888. }
  889. $out[] = '</ul>';
  890. return implode('', $out);
  891. }
  892. function check_img($img)
  893. {
  894. $filename = $_FILES[$img]['name'];
  895. $ext = explode(".", $filename);
  896. $ext = end($ext);
  897. $valid_ext = array("png","jpeg","jpg","PNG","JPEG","JPG","gif","GIF");
  898. if (in_array($ext, $valid_ext)) {
  899. return true;
  900. }
  901. }
  902. function timeAgo($time_ago)
  903. {
  904. $time_ago = empty($time_ago) ? 0 : $time_ago;
  905. if ($time_ago == 0) {
  906. return '--';
  907. }
  908. $time_ago = date("Y-m-d H:i:s", $time_ago);
  909. $time_ago = strtotime($time_ago);
  910. $cur_time = time();
  911. $time_elapsed = $cur_time - $time_ago;
  912. $seconds = $time_elapsed ;
  913. $minutes = round($time_elapsed / 60);
  914. $hours = round($time_elapsed / 3600);
  915. $days = round($time_elapsed / 86400);
  916. $weeks = round($time_elapsed / 604800);
  917. $months = round($time_elapsed / 2600640);
  918. $years = round($time_elapsed / 31207680);
  919. // Seconds
  920. if ($seconds <= 60) {
  921. return "$seconds ".__('giây trước');
  922. }
  923. //Minutes
  924. elseif ($minutes <= 60) {
  925. return "$minutes ".__('phút trước');
  926. }
  927. //Hours
  928. elseif ($hours <= 24) {
  929. return "$hours ".__('tiếng trước');
  930. }
  931. //Days
  932. elseif ($days <= 7) {
  933. if ($days == 1) {
  934. return __('Hôm qua');
  935. } else {
  936. return "$days ".__('ngày trước');
  937. }
  938. }
  939. //Weeks
  940. elseif ($weeks <= 4.3) {
  941. return "$weeks ".__('tuần trước');
  942. }
  943. //Months
  944. elseif ($months <=12) {
  945. return "$months ".__('tháng trước');
  946. }
  947. //Years
  948. else {
  949. return "$years ".__('năm trước');
  950. }
  951. }
  952. function timeAgo2($time_ago)
  953. {
  954. $time_ago = date("Y-m-d H:i:s", $time_ago);
  955. $time_ago = strtotime($time_ago);
  956. $time_elapsed = $time_ago;
  957. $seconds = $time_elapsed ;
  958. $minutes = round($time_elapsed / 60);
  959. $hours = round($time_elapsed / 3600);
  960. $days = round($time_elapsed / 86400);
  961. $weeks = round($time_elapsed / 604800);
  962. $months = round($time_elapsed / 2600640);
  963. $years = round($time_elapsed / 31207680);
  964. // Seconds
  965. if ($seconds <= 60) {
  966. return "$seconds giây";
  967. }
  968. //Minutes
  969. elseif ($minutes <= 60) {
  970. return "$minutes phút";
  971. }
  972. //Hours
  973. elseif ($hours <= 24) {
  974. return "$hours tiếng";
  975. }
  976. //Days
  977. elseif ($days <= 7) {
  978. if ($days == 1) {
  979. return "$days ngày";
  980. } else {
  981. return "$days ngày";
  982. }
  983. }
  984. //Weeks
  985. elseif ($weeks <= 4.3) {
  986. return "$weeks tuần";
  987. }
  988. //Months
  989. elseif ($months <=12) {
  990. return "$months tháng";
  991. }
  992. //Years
  993. else {
  994. return "$years năm";
  995. }
  996. }
  997. function CheckLiveClone($uid){
  998. //$json = json_decode(curl_get("https://graph.facebook.com/".$uid."/picture?redirect=false"), true);
  999. $json = json_decode(curl_get("https://graph2.facebook.com/v3.3/".$uid."/picture?redirect=0"), true);
  1000. if ($json['data']) {
  1001. if (empty($json['data']['height']) && empty($json['data']['width'])) {
  1002. return 'DIE';
  1003. } else {
  1004. return 'LIVE';
  1005. }
  1006. }
  1007. // else if($json['error']){
  1008. // return 'DIE';
  1009. // }
  1010. else{
  1011. return 'LIVE';
  1012. }
  1013. }
  1014. function dirToArray($dir)
  1015. {
  1016. $result = array();
  1017.  
  1018. $cdir = scandir($dir);
  1019. foreach ($cdir as $key => $value) {
  1020. if (!in_array($value, array(".",".."))) {
  1021. if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {
  1022. $result[$value] = dirToArray($dir . DIRECTORY_SEPARATOR . $value);
  1023. } else {
  1024. $result[] = $value;
  1025. }
  1026. }
  1027. }
  1028.  
  1029. return $result;
  1030. }
  1031.  
  1032. function realFileSize($path)
  1033. {
  1034. if (!file_exists($path)) {
  1035. return false;
  1036. }
  1037.  
  1038. $size = filesize($path);
  1039.  
  1040. if (!($file = fopen($path, 'rb'))) {
  1041. return false;
  1042. }
  1043.  
  1044. if ($size >= 0) {//Check if it really is a small file (< 2 GB)
  1045. if (fseek($file, 0, SEEK_END) === 0) {//It really is a small file
  1046. fclose($file);
  1047. return $size;
  1048. }
  1049. }
  1050.  
  1051. //Quickly jump the first 2 GB with fseek. After that fseek is not working on 32 bit php (it uses int internally)
  1052. $size = PHP_INT_MAX - 1;
  1053. if (fseek($file, PHP_INT_MAX - 1) !== 0) {
  1054. fclose($file);
  1055. return false;
  1056. }
  1057.  
  1058. $length = 1024 * 1024;
  1059. while (!feof($file)) {//Read the file until end
  1060. $read = fread($file, $length);
  1061. $size = bcadd($size, $length);
  1062. }
  1063. $size = bcsub($size, $length);
  1064. $size = bcadd($size, strlen($read));
  1065.  
  1066. fclose($file);
  1067. return $size;
  1068. }
  1069. function FileSizeConvert($bytes)
  1070. {
  1071. $bytes = floatval($bytes);
  1072. $arBytes = array(
  1073. 0 => array(
  1074. "UNIT" => "TB",
  1075. "VALUE" => pow(1024, 4)
  1076. ),
  1077. 1 => array(
  1078. "UNIT" => "GB",
  1079. "VALUE" => pow(1024, 3)
  1080. ),
  1081. 2 => array(
  1082. "UNIT" => "MB",
  1083. "VALUE" => pow(1024, 2)
  1084. ),
  1085. 3 => array(
  1086. "UNIT" => "KB",
  1087. "VALUE" => 1024
  1088. ),
  1089. 4 => array(
  1090. "UNIT" => "B",
  1091. "VALUE" => 1
  1092. ),
  1093. );
  1094.  
  1095. foreach ($arBytes as $arItem) {
  1096. if ($bytes >= $arItem["VALUE"]) {
  1097. $result = $bytes / $arItem["VALUE"];
  1098. $result = str_replace(".", ",", strval(round($result, 2)))." ".$arItem["UNIT"];
  1099. break;
  1100. }
  1101. }
  1102. return $result;
  1103. }
  1104. function GetCorrectMTime($filePath)
  1105. {
  1106. $time = filemtime($filePath);
  1107.  
  1108. $isDST = (date('I', $time) == 1);
  1109. $systemDST = (date('I') == 1);
  1110.  
  1111. $adjustment = 0;
  1112.  
  1113. if ($isDST == false && $systemDST == true) {
  1114. $adjustment = 3600;
  1115. } elseif ($isDST == true && $systemDST == false) {
  1116. $adjustment = -3600;
  1117. } else {
  1118. $adjustment = 0;
  1119. }
  1120.  
  1121. return ($time + $adjustment);
  1122. }
  1123. function DownloadFile($file)
  1124. { // $file = include path
  1125. if (file_exists($file)) {
  1126. header('Content-Description: File Transfer');
  1127. header('Content-Type: application/octet-stream');
  1128. header('Content-Disposition: attachment; filename='.basename($file));
  1129. header('Content-Transfer-Encoding: binary');
  1130. header('Expires: 0');
  1131. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  1132. header('Pragma: public');
  1133. header('Content-Length: ' . filesize($file));
  1134. ob_clean();
  1135. flush();
  1136. readfile($file);
  1137. exit;
  1138. }
  1139. }
  1140. function getFileType(string $url): string
  1141. {
  1142. $filename=explode('.', $url);
  1143. $extension=end($filename);
  1144.  
  1145. switch ($extension) {
  1146. case 'pdf':
  1147. $type=$extension;
  1148. break;
  1149. case 'docx':
  1150. case 'doc':
  1151. $type='word';
  1152. break;
  1153. case 'xls':
  1154. case 'xlsx':
  1155. $type='excel';
  1156. break;
  1157. case 'mp3':
  1158. case 'ogg':
  1159. case 'wav':
  1160. $type='audio';
  1161. break;
  1162. case 'mp4':
  1163. case 'mov':
  1164. $type='video';
  1165. break;
  1166. case 'zip':
  1167. case '7z':
  1168. case 'rar':
  1169. $type='archive';
  1170. break;
  1171. case 'jpg':
  1172. case 'jpeg':
  1173. case 'png':
  1174. $type='image';
  1175. break;
  1176. default:
  1177. $type='alt';
  1178. }
  1179.  
  1180. return $type;
  1181. }
  1182.  
  1183. function getLocation($ip)
  1184. {
  1185. if($ip = '::1'){
  1186. $data = [
  1187. 'country' => 'VN'
  1188. ];
  1189. return $data;
  1190. }
  1191. $url = "http://ipinfo.io/" . $ip;
  1192. $location = json_decode(file_get_contents($url), true);
  1193. return $location;
  1194. }
  1195.  
  1196. function pagination($url, $start, $total, $kmess)
  1197. {
  1198. $out[] = ' <div class="paging_simple_numbers"><ul class="pagination">';
  1199. $neighbors = 2;
  1200. if ($start >= $total) $start = max(0, $total - (($total % $kmess) == 0 ? $kmess : ($total % $kmess)));
  1201. else $start = max(0, (int)$start - ((int)$start % (int)$kmess));
  1202. $base_link = '<li class="paginate_button page-item previous "><a class="page-link" href="' . strtr($url, array('%' => '%%')) . 'page=%d' . '">%s</a></li>';
  1203. $out[] = $start == 0 ? '' : sprintf($base_link, $start / $kmess, 'Previous');
  1204. if ($start > $kmess * $neighbors) $out[] = sprintf($base_link, 1, '1');
  1205. if ($start > $kmess * ($neighbors + 1)) $out[] = '<li class="paginate_button page-item previous disabled"><a class="page-link">...</a></li>';
  1206. for ($nCont = $neighbors;$nCont >= 1;$nCont--) if ($start >= $kmess * $nCont) {
  1207. $tmpStart = $start - $kmess * $nCont;
  1208. $out[] = sprintf($base_link, $tmpStart / $kmess + 1, $tmpStart / $kmess + 1);
  1209. }
  1210. $out[] = '<li class="paginate_button page-item previous active"><a class="page-link">' . ($start / $kmess + 1) . '</a></li>';
  1211. $tmpMaxPages = (int)(($total - 1) / $kmess) * $kmess;
  1212. for ($nCont = 1;$nCont <= $neighbors;$nCont++) if ($start + $kmess * $nCont <= $tmpMaxPages) {
  1213. $tmpStart = $start + $kmess * $nCont;
  1214. $out[] = sprintf($base_link, $tmpStart / $kmess + 1, $tmpStart / $kmess + 1);
  1215. }
  1216. if ($start + $kmess * ($neighbors + 1) < $tmpMaxPages) $out[] = '<li class="paginate_button page-item previous disabled"><a class="page-link">...</a></li>';
  1217. if ($start + $kmess * $neighbors < $tmpMaxPages) $out[] = sprintf($base_link, $tmpMaxPages / $kmess + 1, $tmpMaxPages / $kmess + 1);
  1218. if ($start + $kmess < $total)
  1219. {
  1220. $display_page = ($start + $kmess) > $total ? $total : ($start / $kmess + 2);
  1221. $out[] = sprintf($base_link, $display_page, 'Next');
  1222. }
  1223. $out[] = '</ul></div>';
  1224. return implode('', $out);
  1225. }
Add Comment
Please, Sign In to add comment