Changeset 12895

Show
Ignore:
Timestamp:
10/21/11 22:25:46 (2 years ago)
Author:
xrobau
Message:

Somehow a pile of spaces got in there. Fixed back to tabs.

Files:

Legend:

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

    r12379 r12895  
    2323// This MUST be "TheNameOfTheModule_configpageinit" as it's loaded automatically 
    2424function routepermissions_configpageinit($pagename) { 
    25         global $currentcomponent; 
    26  
    27         $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; 
    28         $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; 
    29         $extension = isset($_REQUEST['extension'])?$_REQUEST['extension']:null; 
    30         $tech_hardware = isset($_REQUEST['tech_hardware'])?$_REQUEST['tech_hardware']:null; 
    31         // We only want to hook 'users' or 'extensions' pages. 
    32         if ($pagename != 'users' && $pagename != 'extensions') 
    33                 return true; 
    34         // On a 'new' user, 'tech_hardware' is set, and there's no extension. Hook into the page. 
    35         if ($tech_hardware != null || $pagename == 'users') { 
    36                 rp_applyhooks(); 
    37                 $currentcomponent->addprocessfunc('rp_configprocess', 5); 
    38         } elseif ($action=="add") { 
    39                 // We don't need to display anything on an 'add', but we do need to handle returned data. 
    40                 $currentcomponent->addprocessfunc('rp_configprocess', 5); 
    41         } elseif ($extdisplay != '') { 
    42                 // We're now viewing an extension, so we need to display _and_ process. 
    43                 rp_applyhooks(); 
    44                 $currentcomponent->addprocessfunc('rp_configprocess', 5); 
    45        
     25 global $currentcomponent; 
     26 
     27 $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; 
     28 $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; 
     29 $extension = isset($_REQUEST['extension'])?$_REQUEST['extension']:null; 
     30 $tech_hardware = isset($_REQUEST['tech_hardware'])?$_REQUEST['tech_hardware']:null; 
     31 // We only want to hook 'users' or 'extensions' pages. 
     32 if ($pagename != 'users' && $pagename != 'extensions') 
     33   return true; 
     34 // On a 'new' user, 'tech_hardware' is set, and there's no extension. Hook into the page. 
     35 if ($tech_hardware != null || $pagename == 'users') { 
     36   rp_applyhooks(); 
     37   $currentcomponent->addprocessfunc('rp_configprocess', 5); 
     38 } elseif ($action=="add") { 
     39   // We don't need to display anything on an 'add', but we do need to handle returned data. 
     40   $currentcomponent->addprocessfunc('rp_configprocess', 5); 
     41 } elseif ($extdisplay != '') { 
     42   // We're now viewing an extension, so we need to display _and_ process. 
     43   rp_applyhooks(); 
     44   $currentcomponent->addprocessfunc('rp_configprocess', 5); 
     45
    4646} 
    4747 
     
    5656      $ext->add($context, 'barred', '', new ext_noop('Route administratively banned for this user.')); 
    5757      $ext->add($context, 'reroute', '', new ext_goto('1','${ARG2}','from-internal')); 
    58        
     58 
    5959      $context="macro-dialout-dundi"; 
    6060      $ext->splice($context, 's', 1 ,new ext_agi('checkperms.agi')); 
     
    8383          $ext->splice($context, $extension, 1, new ext_setvar('__ROUTENAME',$routename)); 
    8484        } 
    85       }             
    86       break; 
     85      } 
     86   break; 
    8787  } 
    8888} 
    8989 
    9090function rp_applyhooks() { 
    91         global $currentcomponent; 
    92  
    93         // Add Allow/Deny options 
    94         $currentcomponent->addoptlistitem('rpyn', 'YES', _('yes')); 
    95         $currentcomponent->addoptlistitem('rpyn', 'NO', _('no')); 
    96         $currentcomponent->setoptlistopts('rpyn', 'sort', false); 
    97  
    98         // Add the 'process' function 
    99         $currentcomponent->addguifunc('rp_configpageload'); 
     91 global $currentcomponent; 
     92 
     93 // Add Allow/Deny options 
     94 $currentcomponent->addoptlistitem('rpyn', 'YES', _('yes')); 
     95 $currentcomponent->addoptlistitem('rpyn', 'NO', _('no')); 
     96 $currentcomponent->setoptlistopts('rpyn', 'sort', false); 
     97 
     98 // Add the 'process' function 
     99 $currentcomponent->addguifunc('rp_configpageload'); 
    100100} 
    101101 
    102102function rp_configpageload() { 
    103         global $currentcomponent; 
    104  
    105         // Init vars from $_REQUEST[] 
    106         $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; 
    107         $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; 
    108  
    109         // Don't display if this is a 'This xtn has been deleted' page. 
    110         if ($action != 'del') { 
    111                 $section = _('Outbound Route Permssions'); 
     103 global $currentcomponent; 
     104 
     105 // Init vars from $_REQUEST[] 
     106 $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; 
     107 $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; 
     108 
     109 // Don't display if this is a 'This xtn has been deleted' page. 
     110 if ($action != 'del') { 
     111   $section = _('Outbound Route Permssions'); 
    112112    $routes = rp_get_routes(); 
    113113    foreach ($routes as $route) { 
     
    120120function rp_configprocess() { 
    121121  // Extract any variables from $REQUEST that start with rp_ 
    122         $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; 
    123         $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; 
    124         if(isset($_REQUEST['extension'])){ 
    125           $extdisplay=$_REQUEST['extension']; 
    126        
     122 $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; 
     123 $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; 
     124 if(isset($_REQUEST['extension']) ){ 
     125 $extdisplay=$_REQUEST['extension']; 
     126
    127127  $rps = array(); 
    128128  $redir = array(); 
     
    136136    } 
    137137  } 
    138         //if submitting form, update database 
    139         switch ($action) { 
    140                 case "add": 
    141                 case "edit": 
     138 //if submitting form, update database 
     139 switch ($action) { 
     140   case "add": 
     141   case "edit": 
    142142    rp_purge_ext($extdisplay); 
    143143    rp_set_perm($extdisplay, $rps); 
    144144    rp_set_redir($extdisplay, $redir); 
    145                 break; 
    146                 case "del": 
     145   break; 
     146   case "del": 
    147147    rp_purge_ext($extdisplay); 
    148                 break; 
    149        
     148   break; 
     149
    150150} 
    151151 
     
    220220  return $arr; 
    221221} 
    222    
    223 ?>