<commit_before><?php

// Make sure we are called from index.php
if (!defined('SECURITY'))
  die('Hacking attempt');

if (!$_SESSION['AUTHENTICATED']) {
  header('Location: index.php?page=home');
}

if ( ! $user->checkPin($_SESSION['USERDATA']['id'], $_POST['authPin']) && $_POST['do']) {
  $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid PIN','TYPE' => 'errormsg');
} else {
  switch ($_POST['do']) {
  case 'cashOut':
    $continue = true;
    $dBalance = $transaction->getBalance($_SESSION['USERDATA']['id']);
    $sCoinAddress = $user->getCoinAddress($_SESSION['USERDATA']['id']);
    // Ensure we can cover the potential transaction fee of 0.1 LTC with the balance
    if ($dBalance > 0.1) {
      if ($bitcoin->can_connect() === true) {
        try {
          $bitcoin->validateaddress($sCoinAddress);
        } catch (BitcoinClientException $e) {
          $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid payment address: ' . $sUserSendAddress, 'TYPE' => 'errormsg');
          $continue = false;
        }
        if ($continue == true) {
          // Send balance to address, mind 0.1 fee for transaction!
          try {
            if ($setting->getValue('auto_payout_active') == 0) {
              $bitcoin->sendtoaddress($sCoinAddress, $dBalance);
            } else {
              $_SESSION['POPUP'][] = array('CONTENT' => 'Auto-payout active, please contact site support immidiately to revoke invalid transactions.', 'TYPE' => 'errormsg');
              $continue = false;
            }
          } catch (BitcoinClientException $e) {
            $_SESSION['POPUP'][] = array('CONTENT' => 'Failed to send LTC, please contact site support immidiately', 'TYPE' => 'errormsg');
//            $continue = false;
          }
        }
        // Set balance to 0, add to paid out, insert to ledger
        if ($continue == true && $transaction->addTransaction($_SESSION['USERDATA']['id'], $dBalance, 'Debit_MP', NULL, $sCoinAddress)) {
          $_SESSION['POPUP'][] = array('CONTENT' => 'Transaction completed', 'TYPE' => 'success');
          $aMailData['email'] = $user->getUserEmail($user->getUserName($_SESSION['USERDATA']['id']));
          $aMailData['amount'] = $dBalance;
          $aMailData['subject'] = 'Manual Payout Completed';
          $notification->sendNotification($_SESSION['USERDATA']['id'], 'manual_payout', $aMailData);
      }
      } else {
        $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to litecoind RPC service', 'TYPE' => 'errormsg');
      }
    } else {
      $_SESSION['POPUP'][] = array('CONTENT' => 'Insufficient funds, you need more than 0.1 LTC to cover transaction fees', 'TYPE' => 'errormsg');
    }<commit_msg>Update edit.inc.php<commit_after><?php

// Make sure we are called from index.php
if (!defined('SECURITY'))
  die('Hacking attempt');

if (!$_SESSION['AUTHENTICATED']) {
  header('Location: index.php?page=home');
}

if ( ! $user->checkPin($_SESSION['USERDATA']['id'], $_POST['authPin']) && $_POST['do']) {
  $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid PIN','TYPE' => 'errormsg');
} else {
  switch ($_POST['do']) {
  case 'cashOut':
    $continue = true;
    $dBalance = $transaction->getBalance($_SESSION['USERDATA']['id']);
    $sCoinAddress = $user->getCoinAddress($_SESSION['USERDATA']['id']);
    // Ensure we can cover the potential transaction fee of 0.1 LTC with the balance
    if ($dBalance > 0.1) {
      if ($bitcoin->can_connect() === true) {
        try {
          $bitcoin->validateaddress($sCoinAddress);
        } catch (BitcoinClientException $e) {
          $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid payment address: ' . $sUserSendAddress, 'TYPE' => 'errormsg');
          $continue = false;
        }
        if ($continue == true) {
          // Send balance to address, mind 0.1 fee for transaction!
          try {
            if ($setting->getValue('auto_payout_active') == 0) {
              $bitcoin->sendtoaddress($sCoinAddress, $dBalance);
            } else {
              $_SESSION['POPUP'][] = array('CONTENT' => 'Auto-payout active, please contact site support immidiately to revoke invalid transactions.', 'TYPE' => 'errormsg');
              $continue = false;
            }
          } catch (BitcoinClientException $e) {
            $_SESSION['POPUP'][] = array('CONTENT' => 'Failed to send LTC, please contact site support immidiately', 'TYPE' => 'errormsg');
            $continue = false;
          }
        }
        // Set balance to 0, add to paid out, insert to ledger
        if ($continue == true && $transaction->addTransaction($_SESSION['USERDATA']['id'], $dBalance, 'Debit_MP', NULL, $sCoinAddress)) {
          $_SESSION['POPUP'][] = array('CONTENT' => 'Transaction completed', 'TYPE' => 'success');
          $aMailData['email'] = $user->getUserEmail($user->getUserName($_SESSION['USERDATA']['id']));
          $aMailData['amount'] = $dBalance;
          $aMailData['subject'] = 'Manual Payout Completed';
          $notification->sendNotification($_SESSION['USERDATA']['id'], 'manual_payout', $aMailData);
      }
      } else {
        $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to litecoind RPC service', 'TYPE' => 'errormsg');
      }
    } else {
      $_SESSION['POPUP'][] = array('CONTENT' => 'Insufficient funds, you need more than 0.1 LTC to cover transaction fees', 'TYPE' => 'errormsg');
    }
{'fraction_non_alphanumeric': 0.18185198958720714, 'fraction_numerical': 0.003718854592785422, 'mean_word_length': 3.125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3507939', 'n_tokens_mistral': 1617, 'n_tokens_neox': 1613, 'n_words': 381}