Changeset 7564

Show
Ignore:
Timestamp:
03/31/09 02:58:51 (4 years ago)
Author:
xrobau
Message:

GUI is complete, also fixed a bug in the install script that was using the old extensions table when it shouldn't have been. Still need to move outbound routes out of there.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • contributed_modules/modules/routepermissions/install.php

    r7560 r7564  
    4747// If there's not, propogate all extensions and all trunks with YES permissions 
    4848 
    49 $sql = "SELECT DISTINCT extension FROM extensions WHERE context='ext-local';"; 
     49$sql = "SELECT extension FROM users ORDER BY extension"; 
    5050     $extns = $db->getAll($sql); 
    5151$sql = "SELECT DISTINCT context FROM extensions WHERE context LIKE 'outrt%';"; 
  • contributed_modules/modules/routepermissions/page.routepermissions.php

    r7563 r7564  
    8080 
    8181function rp_allow($route, $range) { 
    82   print "I have a range of ".rp_range($range)."<br>\n"; 
     82  $rangearray = rp_range($range); 
     83  $extens = rp_get_extens(); 
     84  foreach ($rangearray as $r) { 
     85    if ($extens[$r] == "ok") { 
     86      rp_do($route, $r, "YES"); 
     87    } 
     88  } 
    8389} 
    8490 
    8591function rp_deny($route, $range) { 
    86   print "I have a range of ".rp_range($range)."<br>\n"; 
     92  $rangearray = rp_range($range); 
     93  $extens = rp_get_extens(); 
     94  foreach ($rangearray as $r) { 
     95    if ($extens[$r] === "ok") { 
     96      rp_do($route, $r, "NO"); 
     97    } 
     98  } 
     99
     100 
     101function rp_do($route, $ext, $perm) { 
     102  global $db; 
     103  $Sext = mysql_real_escape_string($ext); 
     104  $Sroute = mysql_real_escape_string($route); 
     105  sql("DELETE FROM routepermissions WHERE exten='$Sext' AND routename='$Sroute'"); 
     106  sql("INSERT INTO routepermissions (exten, routename, allowed) VALUES ('$Sext', '$Sroute', '$perm')"); 
    87107} 
    88108 
     
    114134    } 
    115135  } 
    116   return implode(",", $range_out); 
     136  return $range_out; 
     137
     138 
     139function rp_get_extens() { 
     140  global $db; 
     141      $extens = core_users_list(); 
     142  foreach ($extens as $e) { 
     143    $ret[$e[0]]="ok"; 
     144  } 
     145  return $ret; 
    117146} 
    118147?>