Changeset 10701

Show
Ignore:
Timestamp:
12/11/10 18:09:00 (2 years ago)
Author:
mbrevda
Message:

re #4566 - merge forward

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/bootstrap

    • Property svnmerge-integrated changed from /freepbx/trunk:1-10368,10370-10678 /freepbx/branches/2.8:1-10284 to /freepbx/branches/2.8:1-10284 /freepbx/trunk:1-10368,10370-10699
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/libraries/config.functions.php

    r10678 r10701  
    1717  'ARI_ADMIN_PASSWORD' => array('std' , 'ari_password'), 
    1818  'TCINTERVAL      '=> array('std' , '60'), 
     19        'CFRINGTIMERDEFAULT' => array('std' , '0'), 
    1920 
    2021  'ASTETCDIR'      => array('dir' , '/etc/asterisk'), 
  • freepbx/branches/bootstrap/amp_conf/htdocs/admin/libraries/module.functions.php

    r10671 r10701  
    832832  } 
    833833   
    834   if (!preg_match('/\.(tar\.gz|tgz)$/', $uploaded_file['name'])) { 
    835     $errors[] = _("File must be in tar+gzip (.tgz or .tar.gz) format"); 
     834  if (!preg_match('/\.(tar\.gz|tgz|tar)$/', $uploaded_file['name'])) { 
     835    $errors[] = _("File must be in tar or tar+gzip (.tar, .tgz or .tar.gz) format"); 
    836836    return $errors; 
    837837  } 
    838838   
    839   if (!preg_match('/^([A-Za-z][A-Za-z0-9_]+)\-([0-9a-zA-Z]+(\.[0-9a-zA-Z]+)*)\.(tar\.gz|tgz)$/', $uploaded_file['name'], $matches)) { 
    840     $errors[] = _("Filename not in correct format: must be modulename-version.tar.gz (eg. custommodule-0.1.tar.gz)"); 
     839  if (!preg_match('/^([A-Za-z][A-Za-z0-9_]+)\-([0-9a-zA-Z]+(\.[0-9a-zA-Z]+)*)\.(tar\.gz|tgz|tar)$/', $uploaded_file['name'], $matches)) { 
     840    $errors[] = _("Filename not in correct format: must be modulename-version.[tar|tar.gz|tgz] (eg. custommodule-0.1.tgz)"); 
    841841    return $errors; 
    842842  } else { 
     
    853853  move_uploaded_file($uploaded_file['tmp_name'], $filename); 
    854854   
    855   exec("tar ztf ".escapeshellarg($filename), $output, $exitcode); 
     855  $tar_z_arg = substr($uploaded_file['name'],-4) == '.tar' ? '' : 'z'; 
     856  exec("tar ".$tar_z_arg."tf ".escapeshellarg($filename), $output, $exitcode); 
    856857  if ($exitcode != 0) { 
    857     $errors[] = _("Error untaring uploaded file. Must be a tar+gzip file"); 
     858    $errors[] = _("Error untaring uploaded file. Must be a tar or tar+gzip file"); 
    858859    return $errors; 
    859860  } 
     
    879880    return array(sprintf(_('Could not remove %s to install new version'), $amp_conf['AMPWEBROOT'].'/admin/modules/_cache/'.$modulenam)); 
    880881  } 
    881   exec("tar zxf ".escapeshellarg($filename)." -C ".escapeshellarg($amp_conf['AMPWEBROOT'].'/admin/modules/_cache/'), $output, $exitcode); 
     882  exec("tar ".$tar_z_arg."xf ".escapeshellarg($filename)." -C ".escapeshellarg($amp_conf['AMPWEBROOT'].'/admin/modules/_cache/'), $output, $exitcode); 
    882883  if ($exitcode != 0) { 
    883884    return array(sprintf(_('Could not untar %s to %s'), $filename, $amp_conf['AMPWEBROOT'].'/admin/modules/_cache')); 
  • freepbx/branches/bootstrap/amp_conf/htdocs/recordings/modules/phonefeatures.module

    r10317 r10701  
    4646        $this->storePhoneSetting( $args, $exten, 'do_not_disturb', 'DND', 'YES'); 
    4747        $this->storeCallScreen( $args, $exten); 
     48        $this->storeRingtimer($args, $exten, 'ringtimer'); 
     49        $this->storeRingtimer($args, $exten, 'cfringtimer'); 
    4850      } 
    4951    } 
     
    99101      $dnd_cw_text.=  $this->displayPhoneControls( $exten, 'do_not_disturb', 'DND', _("Do Not Disturb")); 
    100102      $dnd_cw_text.=  $this->displayCallScreenControls( $exten); 
     103       
     104      $dnd_cw_text.=  $this->displayRingTimerControls($exten, 'ringtimer'); 
     105      $dnd_cw_text.=  $this->displayRingTimerControls($exten, 'cfringtimer'); 
    101106       
    102107      $dnd_cw_text .= "</table>"; 
     
    431436  } 
    432437 
     438//***************************************************************************** 
     439  function storeRingtimer($args, $exten, $type) { 
     440 
     441    global $astman; 
     442     
     443    $ringtimer = (int) getArgument( $args, $type); 
     444     
     445    if ($ringtimer > 120) 
     446      $ringtimer = 120; 
     447       
     448    switch($type){ 
     449      case 'cfringtimer': 
     450        if ($ringtimer < -1) 
     451          $ringtimer = -1; 
     452           
     453        $astman->database_put("AMPUSER", $exten . '/cfringtimer', $ringtimer); 
     454        break; 
     455      case 'ringtimer': 
     456        if ($ringtimer < 0) 
     457          $ringtimer = 0; 
     458           
     459        $astman->database_put("AMPUSER", $exten . '/ringtimer', $ringtimer); 
     460        break; 
     461    } 
     462  } 
     463 
     464//***************************************************************************** 
     465  function getRingTimer($exten, $type) { 
     466 
     467    global $astman; 
     468 
     469    $ringtimer = (int) $astman->database_get("AMPUSER", $exten . '/' . $type); 
     470 
     471    return $ringtimer; 
     472  } 
     473 
     474//***************************************************************************** 
     475  function displayRingTimerControls($exten, $type) 
     476  { 
     477 
     478    $ringtimer = $this->getRingTimer($exten, $type); 
     479 
     480    $ret = "\n<tr>"; 
     481    if($type == 'cfringtimer') 
     482      $ret.= "<td><a href='#' class='info'>" . _("CallForward Ringtimer:") . "<span>" . _("Number of seconds to ring prior to going to voicemail or other fail over destinations that may be setup by an administrator on this account. The Always setting will ring the call forward destinaiton until answered or the caller hangs up. The Default setting will use the value set in Ring Time. Your setting here will be forced to Always if there is no Voicemail or alternartive fail over destination for a call to go to.") . " </span></a></td>"; 
     483    else 
     484      $ret.= "<td><a href='#' class='info'>" . _("Ringtimer:") . "<span>" . _("Number of seconds to ring prior to going to voicemail or ringing other numbers that may be configured such as a Call Forward Unavailabe or an Unavailable destination that may be configured by your administrator. The Default setting will use the value set for the PBX.") . " </span></a></td>"; 
     485    $ret .= "<td>"; 
     486    $ret .= "<select name='$type'>"; 
     487    $ret .=  '<option value="0" ' . (0 == $ringtimer ? 'selected' : '') . '>' . _("Default") . '</option>'; 
     488    if($type == 'cfringtimer') 
     489      $ret .=  '<option value="-1" ' . (-1 == $ringtimer ? 'selected' : '') . '>' . _("Always") . '</option>'; 
     490    for ($i=1; $i <= 120; $i++) { 
     491      $ret .=  '<option value="' . $i . '" ' . ($i == $ringtimer ? 'selected' : '') . '>' . $i . '</option>'; 
     492    } 
     493    $ret .= "</select>"; 
     494    $ret .= "</td>"; 
     495    $ret .= "</tr>\n"; 
     496     
     497    return $ret; 
     498  } 
    433499} // class 
    434500?>