Changeset 9218

Show
Ignore:
Timestamp:
03/15/10 14:14:58 (3 years ago)
Author:
p_lindheimer
Message:

add check for TEMPNOTAVAIL return message so that module properly reports that the server is not available vs. an invalid key

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.8/sipstation/page.sipstation.php

    r9124 r9218  
    3838  default: 
    3939} 
    40 $status = sipstation_check_key(); // nokey, valid, invalid, noserver 
     40$status = sipstation_check_key(); // nokey, valid, invalid, noserver, tempnotavail 
    4141?> 
    4242</div> 
     
    9393  case 'invalid': // nokey 
    9494  case 'noserver': 
     95  case 'tempnotavail': 
    9596?> 
    9697  <tr class="account_access_section"> 
     
    116117        <ul> 
    117118<?php 
    118   if ($status == 'invalid') { 
     119  switch ($status) { 
     120  case 'invalid': 
    119121    echo _("Your key is no longer valid. Click below to remove the current key. To obtain a new key and use this module, visit the portal at https://store.freepbx.com and log into your account."); 
    120   } else { 
     122    break; 
     123  case 'tempnotavail': 
     124    echo _("The server is currenlty unavailable and we can not process you request. Please check back with us later. We apologize for the inconvenience."); 
     125    break; 
     126  default: 
    121127    echo _("The server is currently not responding. It is either unavailable or access is being blocked. If the server is unavailable, please try again later."); 
    122128  } 
  • modules/branches/2.8/sipstation/sipstation.utility.php

    r9122 r9218  
    146146      case 'SUCCESS': 
    147147        return 'valid'; 
     148      case 'TEMPNOTAVAIL': 
     149        return 'tempnotavail'; 
    148150      case 'BADKEY': 
    149151        sipstation_remove_key(); 
     
    159161  global $db; 
    160162  $status = sipstation_confirm_key($key); 
    161   if ($status == 'valid') { 
     163  if ($status == 'valid' || $status == 'tempnotavail') { 
    162164    $data4sql = $db->escapeSimple($key); 
    163165    sql("DELETE FROM `module_xml` WHERE `id` = 'sipstation_key'"); 
     
    259261  // freepbx_debug(curl_getinfo($ch)); 
    260262 
    261   // TODO: if ($xml === false) { handle it, retry, etc.  
     263  // TODO: if ($xml === false) handle it, retry, etc.  
    262264  // TODO: or at least toss in some error xml response 
    263265  curl_close ($ch);