<form name="info">
<?php
  echo "   <input type='hidden' name='Type' value=$Type>\n";
  echo "   <input type='hidden' name='Sous_Type' value=$Sous_Type>\n";
?>
<input type="hidden" name="send_mode" value="1" />
<table>
<tr>
<th>No</th>
<td><input name="No" type="text" /></td>
</tr>
<tr>
<th>Message custom</th>
<td><textarea rows="5" cols="20" name="Text"></textarea></td>
</tr>
</table>
<button type="button" onclick="submit();" class="long_button">Custom message</button>
<button type="button" onclick="document.forms['info'].send_mode.value=2;submit();" class="long_button">Commande reçue</button><br /><br />
<button type="button" onclick="document.forms['info'].send_mode.value=3;submit();" class="long_button">Commande reçue montage sans rdv</button>
<button type="button" onclick="document.forms['info'].send_mode.value=4;submit();" class="long_button">Pièces reçues pour rdv atelier</button>
</form>
<script language="JavaScript">
this.document.forms['info'].No.focus();
</script>
<?php

if(isset($_REQUEST['send_mode'])) $send_mode=filter_var($_REQUEST['send_mode'], FILTER_SANITIZE_STRING); else $send_mode='0';

function get_sms_commande_recue()
{
  return Config::getSMSCommandeRecue();
}
function get_sms_commande_recue_montage_sans_rdv_atelier()
{
  return Config::getSMSCommandeRecueMontangeSansRDV();
}
function get_sms_pieces_recues_pour_rdv_atelier()
{
  return Config::getSMSPieceRecuPourRDV();
}
function get_voip()
{
  return Config::getVOIP();
}
if ($send_mode >= 1)
{
  $telephone = $No;
  $values = array(".", " ", "/", ",", "-");
  $telephone = str_replace($values,"",$telephone);
  if (strlen($telephone) < 10)
  {
    $send_mode = 0;
    echo "No telephone trop court";
  }
  else if (substr($telephone,0,2)=="07")
  {
    $telephone = "+41".substr($telephone,1);
  }
  else if (substr($telephone,0,4)=="+417")
  {
    
  }
  else if (substr($telephone,0,4)=="+336")
  {
    
  }
  else if (substr($telephone,0,5)=="00336")
  {
    
  }
  else if (substr($telephone,0,4)=="+337")
  {
    
  }
  else if (substr($telephone,0,5)=="00337")
  {
    
  }
  else if (substr($telephone,0,5)=="00417")
  {
    
  }
  else 
  {
    $send_mode = 0;
    echo "No telephone inconnu";
  }
}
$smsconfig = get_config("SMS_CONFIG"); 
if (strlen($smsconfig) != 0)
{
switch ($send_mode)
{
  case 1:
    if (strlen($Text)!=0)
    {
      $result=file_get_contents(sprintf($smsconfig,urlencode($telephone),urlencode($Text)),false);
    }
    else 
    {
      echo "Pas de message";
    }
    break;
  case 2:
    $result=file_get_contents(sprintf($smsconfig,urlencode($telephone),urlencode(get_sms_commande_recue())),false);
    break;
  case 3:
    $result=file_get_contents(sprintf($smsconfig,urlencode($telephone),urlencode(get_sms_commande_recue_montage_sans_rdv_atelier())),false);
    break;
  case 4:
    $result=file_get_contents(sprintf($smsconfig,urlencode($telephone),urlencode(get_sms_pieces_recues_pour_rdv_atelier())),false);
    break;
}
	
}
else
{
switch ($send_mode)
{
  case 1:
    if (strlen($Text)!=0)
    {
      $result=file_get_contents("https://www.voipbuster.com/myaccount/sendsms.php?".get_voip()."&to=".urlencode($telephone)."&text=".urlencode($Text),false);
    }
    else 
    {
      echo "Pas de message";
    }
    break;
  case 2:
    $result=file_get_contents("https://www.voipbuster.com/myaccount/sendsms.php?".get_voip()."&to=".urlencode($telephone)."&text=".urlencode(get_sms_commande_recue()),false);
    break;
  case 3:
    $result=file_get_contents("https://www.voipbuster.com/myaccount/sendsms.php?".get_voip()."&to=".urlencode($telephone)."&text=".urlencode(get_sms_commande_recue_montage_sans_rdv_atelier()),false);
    break;
  case 4:
    $result=file_get_contents("https://www.voipbuster.com/myaccount/sendsms.php?".get_voip()."&to=".urlencode($telephone)."&text=".urlencode(get_sms_pieces_recues_pour_rdv_atelier()),false);
    break;
}
}
?>