<commit_before><?php
/*Created by Akanksha
  Desc: Used to send bulk sms using Twilio API. Use in Circle of Trust
*/   
    require "Services/Twilio.php";
    include 'loadComradeNumbers.php';
    $toNos = array();//comrade numbers will be added here
    $empty = 0;
    $filled = 0;

    foreach ($dbphnos as $num)//$dbphnos come from loadComradeNumbers.php
    {
      if($num!=NULL)
      {
         array_push($toNos,$num);
         $filled++;
      }
      else
        $empty++;
    }

    foreach ($toNos as &$value) {
    $value = '+'.$value; //Add + to make it a valid number
   }
   unset($value);

    if( $_REQUEST["msg"] ){ //getting the body of the msg from twilio-sms.js

      $msg = $_REQUEST['msg'];
    }

    //set AccountSid and AuthToken from www.twilio.com/user/account
    $AccountSid = "";
    $AuthToken = "";

    // avoid tinyhttp exception
    $http = new Services_Twilio_TinyHttp('https://api.twilio.com', array('curlopts' => array(
    CURLOPT_SSL_VERIFYPEER => false
    )));

    //instantiate a new Twilio Rest Client
    $client = new Services_Twilio($AccountSid, $AuthToken, '2010-04-01', $http);

    //Loop over all comrades. $number is a phone number above, and 
    // $name is the name next to it
    try {
      foreach ($toNos as $number) {

         $sms = $client->account->messages->sendMessage(
         // Change the 'From' number below to be a valid Twilio number 
         // that you've purchased, or the (deprecated) Sandbox number
            "", 
            // the number we are sending to - Any phone number
            $number,
            // the sms body
            $msg
         );
         // Send a valid response back to circleOfTrustMessage.js
         $success = 1;
         if($empty==6)
            $success==0;
         else
            $success == $filled;
         echo $success;
      }
    }
    catch(\Services_Twilio_RestException $e){
        $error = $e->getMessage();
        echo $error;
    }
    
    /*do not close php using ?> here*/
        
    <commit_msg>Bug fix (wrong comrade numbers in message popup)<commit_after><?php
/*Created by Akanksha
  Desc: Used to send bulk sms using Twilio API. Use in Circle of Trust
*/   
    require "Services/Twilio.php";
    include 'loadComradeNumbers.php';
    $toNos = array();//comrade numbers will be added here
    $empty = 0;
    $filled = 0;

    foreach ($dbphnos as $num)//$dbphnos come from loadComradeNumbers.php
    {
      if($num!=NULL)
      {
         array_push($toNos,$num);
         $filled++;
      }
      else
        $empty++;
    }

    foreach ($toNos as &$value) {
    $value = '+'.$value; //Add + to make it a valid number
   }
   unset($value);

    if( $_REQUEST["msg"] ){ //getting the body of the msg from twilio-sms.js

      $msg = $_REQUEST['msg'];
    }

    //set AccountSid and AuthToken from www.twilio.com/user/account
    $AccountSid = "<KEY>";
    $AuthToken = "<KEY>";

    // avoid tinyhttp exception
    $http = new Services_Twilio_TinyHttp('https://api.twilio.com', array('curlopts' => array(
    CURLOPT_SSL_VERIFYPEER => false
    )));

    //instantiate a new Twilio Rest Client
    $client = new Services_Twilio($AccountSid, $AuthToken, '2010-04-01', $http);

    //Loop over all comrades. $number is a phone number above, and 
    // $name is the name next to it
    try {
        $sent = 0;
        foreach ($toNos as $number) {
           
         $sms = $client->account->messages->sendMessage(
         // Change the 'From' number below to be a valid Twilio number 
         // that you've purchased, or the (deprecated) Sandbox number
            "+12056240076", 
            // the number we are sending to - Any phone number
            $number,
            // the sms body
            $msg
         );
         
        $sent = $sent + 1;
      }
      echo $sent;//count of messages successfull is sent to circleOfTrustMessage.js 
    }
    catch(\Services_Twilio_RestException $e){
        $error = $e->getMessage();
        echo $error;
    }
    
    /*do not close php using ?> here*/
        
    
{'fraction_non_alphanumeric': 0.12582619339045287, 'fraction_numerical': 0.008812729498164015, 'mean_word_length': 1.9934065934065934, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '3975622', 'n_tokens_mistral': 1301, 'n_tokens_neox': 1226, 'n_words': 382}