Changeset 6832

Show
Ignore:
Timestamp:
09/22/08 07:09:56 (2 years ago)
Author:
sasargen
Message:

manual merge of ARI fixes up to r6831 from 2.5 branch to ari_changes branch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/bootstrap.php

    r4993 r6832  
    9898 */ 
    9999function getFiles($path,$filter,$recursive_max,$recursive_count) { 
     100        global $SETTINGS_MAX_FILES; 
     101        $SETTINGS_MAX_FILES = isset($SETTINGS_MAX_FILES) ? $SETTINGS_MAX_FILES : 3000; 
    100102 
    101103  $files = array(); 
     
    110112 
    111113        $fileCount++; 
    112         if ($fileCount>3000) { 
     114        if ($fileCount>$SETTINGS_MAX_FILES) { 
    113115          $_SESSION['ari_error']  
    114116            .= _("To many files in $msg_path Not all files processed") . "<br>"; 
  • freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/display.php

    r1395 r6832  
    171171  function displayNavigationBlock($m,$q,$url_opts,$start,$span,$total) { 
    172172 
    173     $start = $start=='' ? 0 : $start
    174     $span = $span=='' ? 15 : $span
     173    $start = ($start=='' || !ctype_digit($start)) ? 0 : $start
     174    $span = ($span=='' || !ctype_digit($span)) ? 15 : $span
    175175 
    176176    $total_pages = ceil($total/$span); 
  • freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/login.php

    r6419 r6832  
    336336        $_SESSION['ari_user']['default_page'] = $default_page; 
    337337 
    338         // force the session data saved 
    339         session_write_close(); 
     338                                // Make sure nothing stale is here: 
     339                                // 
     340                                unset($_SESSION['ari_user']['recfiles']); 
     341 
     342        // don't force the session data saved, there may be voicemail or callmonitor files still 
    340343      }  
    341344    } 
  • freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/main.conf.php

    r4993 r6832  
    6868 
    6969# 
    70 # Admin only account 
     70# Admin only account - change defaults to prevent unauthorized access to call recordings 
    7171# 
    7272$ARI_ADMIN_USERNAME = "admin"; 
     
    8181# Authentication password to unlock cookie password 
    8282#   This must be all continuous and only letters and numbers 
     83#   Change this password to prevent unauthorized access to cookie contents 
    8384# 
    8485$ARI_CRYPT_PASSWORD = "z1Mc6KRxA7Nw90dGjY5qLXhtrPgJOfeCaUmHvQT3yW8nDsI2VkEpiS4blFoBuZ"; 
     
    263264$ASTERISK_PROTOCOLS['sip']['config_files'] = "/etc/asterisk/sip.conf;/etc/asterisk/sip_additional.conf"; 
    264265$ASTERISK_PROTOCOLS['zap']['table'] = "zap"; 
    265 $ASTERISK_PROTOCOLS['zap']['config_files'] = "/etc/asterisk/zapata.conf;/etc/asterisk/zapata_additional.conf"; 
     266$ASTERISK_PROTOCOLS['zap']['config_files'] = "/etc/asterisk/zapata.conf;/etc/asterisk/zapata_additional.conf;/etc/asterisk/chan_dahdi.conf;/etc/asterisk/chan_dahdi_additional.conf"; 
    266267 
    267268# Settings for Follow-Me Select Boxes in seconds 
     
    326327$SETTINGS_ALLOW_PHONE_SETTINGS = 1; 
    327328 
    328  
     329
     330# Maximum number of sound files that will be read before an error is generated indicating issues since 
     331# too many files can be create problems but on some systems this may need to be increased. 
     332
     333$SETTINGS_MAX_FILES=3000; 
    329334 
    330335?> 
  • freepbx/branches/ari_changes/amp_conf/htdocs/recordings/misc/audio.php

    r6459 r6832  
    77 
    88 
    9  
    10 if (isset($_GET['recording'])) { 
     9if (isset($_GET['recindex'])) { 
    1110 
    1211  chdir(".."); 
    1312  include_once("./includes/bootstrap.php"); 
    1413 
    15   global $ARI_CRYPT_PASSWORD
     14       $path = $_SESSION['ari_user']['recfiles'][$_GET['recindex']]
    1615 
    17   $crypt = new Crypt(); 
    18  
    19   $path = $crypt->decrypt($_GET['recording'],$ARI_CRYPT_PASSWORD); 
    20  
    21   // strip ".." from path for security 
    22   $path = preg_replace('/\.\./','',$path); 
    23    
    2416  // See if the file exists 
    2517  if (!is_file($path)) { die("<b>404 File not found!</b>"); } 
  • freepbx/branches/ari_changes/amp_conf/htdocs/recordings/modules/callmonitor.module

    r6476 r6832  
    6060    $files = array(); 
    6161    foreach($_REQUEST as $key => $value) { 
    62       if (preg_match('/selected/',$key)) { 
    63         array_push($files, $value); 
     62      if (preg_match('/selected/',$key) && isset($_SESSION['ari_user']['recfiles'][$value])) { 
     63        array_push($files, $_SESSION['ari_user']['recfiles'][$value]); 
    6464      } 
    6565    } 
    6666 
    6767    if ($a=='delete') { 
    68       $this->deleteRecData($files); 
    69     } 
     68      if (count($files) > 0) { 
     69        $this->deleteRecData($files); 
     70      } else { 
     71        $_SESSION['ari_error'] 
     72          = _("One or more messages must be selected before clicking delete."); 
     73      } 
     74    } 
     75 
    7076 
    7177    if ($a=='ignore') { 
     
    100106    global $CALLMONITOR_ALLOW_DELETE; 
    101107    global $AJAX_PAGE_REFRESH_ENABLE; 
    102     global $ARI_CRYPT_PASSWORD; 
    103108 
    104109    $display = new DisplaySearch(); 
    105     $crypt = new Crypt(); 
    106110 
    107111    // get the search string 
     
    115119    $duration_filter = getArgument($args,'duration_filter'); 
    116120 
    117     $start = $start=='' ? 0 : $start; 
    118     $span = $span=='' ? 15 : $span; 
     121    $start = ($start=='' || !ctype_digit($start)) ? 0 : $start; 
     122    $span = ($span=='' || !ctype_digit($span)) ? 15 : $span; 
    119123    $order = $order=='' ? 'calldate' : $order; 
    120     $sort = $sort=='' ? 'desc' : $sort
     124    $sort = ($sort=='' || strtolower($sort) == 'desc') ? 'desc' : 'asc'
    121125 
    122126    $displayname = $_SESSION['ari_user']['displayname']; 
     
    138142    // build controls 
    139143    if ($CALLMONITOR_ALLOW_DELETE) { 
     144      if (count($recordings) > 0) { 
     145        $controls .= "<button "; 
     146      } 
     147      else { 
     148        $controls .= "<button disabled='disabled' "; 
     149      } 
    140150      $controls .= " 
    141         <button class='infobar' type='submit' onclick=\"document.callmonitor_form.a.value='delete'\"> 
     151        class='infobar' type='submit' onclick=\"document.callmonitor_form.a.value='delete'\"> 
    142152        " . _("delete") . " 
    143153        </button> 
     
    204214 
    205215    // table body 
    206     $playbackRow = 2;   // Index to keep track of where playback control rows should be inserted. 
    207     foreach($data as $key=>$value) { 
     216    unset($_SESSION['ari_user']['recfiles']); 
     217    // Index to keep track of where playback control rows should be inserted. 
     218    $playbackRow = 2; 
     219    if (is_array($data)) foreach($data as $key=>$value) { 
     220      $i++; 
    208221 
    209222      // recording file 
    210223      $recording = $recordings[$value['uniqueid'] . $value['calldate']]; 
    211       $fileCrypt = $crypt->encrypt($recording,$ARI_CRYPT_PASSWORD); 
    212       $recordingCrypt = urlencode($fileCrypt); 
    213224 
    214225      // date and time 
     
    217228      $time = $buf[1]; 
    218229 
    219       // recording delete checkbox 
    220       if ($CALLMONITOR_ALLOW_DELETE) { 
    221         $recording_delete_checkbox = "<td class='checkbox'><input type=checkbox name='selected" . ++$i . "' value=" . $fileCrypt . "></td>"; 
    222       } 
    223  
    224230      $recordingLink = ''; 
    225231      $downloadLink = ''; 
    226       if (is_file($recordings[$value['uniqueid'] . $value['calldate']])) { 
    227         $recordingLink = "<a href='#' onClick=\"javascript:play($playbackRow, 'misc/play_page.php?recording=" . $recordingCrypt . "'); return false;\"><img src='theme/images/sound.png' title=" . _("Play") . "></img></a>"; 
    228         $downloadLink = "<a href=/recordings/misc/audio.php?recording='" . $recordingCrypt . "'><img src='theme/images/drive_go.png' title=" . _("Download") . "></img></a>"; 
     232      if (is_file($recording)) { 
     233        $_SESSION['ari_user']['recfiles'][$i] = $recording; 
     234        $recordingLink = "<a href='#' onClick=\"javascript:play($playbackRow, 'misc/play_page.php?recindex=" . $i . "'); return false;\"><img src='theme/images/sound.png' title=" . _("Play") . "></img></a>"; 
     235        $downloadLink = "<a href=/recordings/misc/audio.php?recindex=" . $i . "><img src='theme/images/drive_go.png' title=" . _("Download") . "></img></a>"; 
     236        if ($CALLMONITOR_ALLOW_DELETE) { 
     237          $recording_delete_checkbox = "<td class='checkbox'><input type=checkbox name='selected" . $i . "' value=" . $i . "></td>"; 
     238        } 
     239      } else { 
     240        if ($CALLMONITOR_ALLOW_DELETE) { 
     241                $recording_delete_checkbox = "<td class='checkbox'></td>"; 
     242        } 
    229243      } 
    230244      $playbackRow++; 
     
    273287      $ret .= " 
    274288        <form  name='callmonitor_form' action='" . $_SESSION['ARI_ROOT'] . "' method='GET'> 
    275          <input type=hidden id='pb_load_inprogress' value='false'> 
     289          <input type=hidden id='pb_load_inprogress' value='false'> 
    276290          <input type=hidden name=m value=" . $m . ">    
    277291          <input type=hidden name=f value=recAction> 
     
    306320        newRow = cmTable.insertRow(row_num); 
    307321        newRow.id = playbackId; 
    308         cell_left = newRow.insertCell(0); 
     322       cell_left = newRow.insertCell(0); 
    309323        cell_left.colSpan = 9; 
    310324        cell_left.innerHTML = playback_src; 
     
    407421    } 
    408422 
    409     foreach($data as $data_key => $data_value) { 
     423    if (is_array($data)) foreach($data as $data_key => $data_value) { 
    410424 
    411425      $recording=''; 
     
    551565  function deleteRecData($files) { 
    552566 
    553     global $ARI_CRYPT_PASSWORD; 
    554  
    555     $crypt = new Crypt(); 
    556  
    557     foreach($files as $key => $fileCrypt) { 
    558       $file = $crypt->decrypt($fileCrypt,$ARI_CRYPT_PASSWORD); 
     567    foreach($files as $key => $file) { 
    559568      if (is_writable($file)) { 
    560569        unlink($file); 
     
    573582  function getSearchText($q,$duration_filter) { 
    574583 
     584    $duration_filter = ctype_digit($duration_filter) ? $duration_filter : 0; 
     585 
    575586    // search text 
    576587    if ($q!='*' && $q!=NULL) { 
     588 
     589      $dbh = $_SESSION['dbh_cdr']; 
    577590      $searchText .= "WHERE "; 
    578591      $tok = strtok($q," \n\t"); 
     592      $tok = $dbh->escapeSimple($tok); 
    579593      while ($tok) { 
    580594        $searchText .= " (calldate regexp '" . $tok . "' 
     
    590604                       )"; 
    591605        $tok = strtok(" \n\t"); 
     606        $tok = $dbh->escapeSimple($tok); 
    592607        if ($tok) { 
    593608          $searchText .= " AND"; 
     
    684699 
    685700    $dbh = $_SESSION['dbh_cdr']; 
     701    $order = $dbh->escapeSimple($order); 
    686702    $sql = "SELECT * 
    687703            FROM " . $ASTERISKCDR_DBTABLE . "  
  • freepbx/branches/ari_changes/amp_conf/htdocs/recordings/modules/followme.module

    r6029 r6832  
    655655 
    656656        if (isset($_SESSION['dbh_asterisk'])) { 
     657          $db = $_SESSION['dbh_asterisk']; 
    657658 
    658659          //format for SQL database 
     
    660661 
    661662          $sql = "UPDATE findmefollow SET grptime = '" . $follow_me_listring_time . "', grplist = '". 
    662                    str_replace("'", "''", trim($follow_me_list)) . "', pre_ring = '" . $follow_me_prering_time . 
     663                   $db->escapeSimple(trim($follow_me_list)) . "', pre_ring = '" . $follow_me_prering_time . 
    663664                   "', needsconf = '" . $follow_me_confirm . "' WHERE grpnum = $exten LIMIT 1"; 
    664665          $results = $_SESSION['dbh_asterisk']->query($sql); 
  • freepbx/branches/ari_changes/amp_conf/htdocs/recordings/modules/voicemail.module

    r6650 r6832  
    1111class Voicemail { 
    1212  var $callme_num = ""; 
     13 
    1314  /* 
    1415   * rank (for prioritizing modules) 
     
    2829    if (empty($this->callme_num)) { 
    2930        $this->callme_num = $extension;         // callme_num defaults to user's extension. 
     31        callme_setnum($extension, $extension); 
    3032    } 
    3133  } 
     
    154156    $files = array(); 
    155157    foreach($_REQUEST as $key => $value) { 
    156       if (preg_match('/selected/',$key)) { 
    157         array_push($files, $value); 
     158      if (preg_match('/selected/',$key) && isset($_SESSION['ari_user']['recfiles'][$value])) { 
     159        array_push($files, $_SESSION['ari_user']['recfiles'][$value]); 
    158160      } 
    159161    } 
    160162 
    161163    if ($a=='delete') { 
    162       $this->deleteVoicemailData($files); 
     164      if (count($files) > 0) { 
     165        $this->deleteVoicemailData($files); 
     166      } 
     167      else { 
     168        $_SESSION['ari_error']  
     169          = _("One or more messages must be selected before clicking delete.");         
     170      } 
    163171    } 
    164172    else if ($a=='move_to') { 
     
    168176          = _("A folder must be selected before the message can be moved."); 
    169177      } 
    170       else
     178      else if (count($files) > 0)
    171179        $context = $_SESSION['ari_user']['context']; 
    172180        $extension = $_SESSION['ari_user']['extension']; 
    173181        $this->moveVoicemailData($files, $context, $extension, $folder_rx); 
     182      } 
     183      else { 
     184        $_SESSION['ari_error']  
     185          = _("One or more messages must be selected before clicking move_to.");         
    174186      } 
    175187    }  
     
    182194          = _("An extension must be selected before the message can be forwarded."); 
    183195      } 
    184       else
     196      else if (count($files) > 0)
    185197        $folder_rx = $ASTERISK_VOICEMAIL_FOLDERS[0]['folder']; 
    186198        $this->moveVoicemailData($files, $context_rx, $extension_rx, $folder_rx, false); 
     199      } 
     200      else { 
     201        $_SESSION['ari_error']  
     202          = _("One or more messages must be selected before clicking forward_to.");         
    187203      } 
    188204    } 
     
    213229    global $ASTERISK_VOICEMAIL_FOLDERS; 
    214230    global $AJAX_PAGE_REFRESH_ENABLE; 
    215     global $ARI_CRYPT_PASSWORD; 
    216231 
    217232    $voicemail_audio_format = $_COOKIE['ari_voicemail_audio_format']; 
    218233 
    219234    $display = new DisplaySearch(); 
    220     $crypt = new Crypt(); 
    221235 
    222236    // args 
     
    392406    $download_header .= "<th>" . _("Download"). "</th>"; 
    393407    // table body 
     408    unset($_SESSION['ari_user']['recfiles']); 
    394409    if (isset($data)) { 
    395410      $playbackRow = 2; // Index for where playback control rows used by javascript playback() should appear in the table.   
    396411                        // First control row would appear below row 1 (hence $playbackRow starts at 2); control rows are inserted/deleted as needed. 
    397412      foreach($data as $file=>$value) { 
    398  
     413        $i++; 
    399414        // Playback links 
    400415        $voicemail_audio_format = $voicemail_audio_format=='' ? '.wav' : $voicemail_audio_format; 
     
    407422        $duration = $value[duration]; 
    408423        if (is_file($recording)) { 
    409           $recordingCrypt = urlencode($crypt->encrypt($recording,$ARI_CRYPT_PASSWORD)); 
    410           $recordingLink = "<a href='#' onClick=\"javascript:playback('play', $playbackRow, 'misc/play_page.php?recording=" . $recordingCrypt . "'); return false;\"><img src='theme/images/sound.png' title=" . _("Play") . "></img></a>"; 
    411           $msgFromCrypt         = urlencode($crypt->encrypt($extension,$ARI_CRYPT_PASSWORD)); 
    412           $callmenumCrypt       = urlencode($crypt->encrypt($this->callme_num,$ARI_CRYPT_PASSWORD)); 
    413           $callmePage           = "'misc/callme_page.php?recording=" . $recordingCrypt . "&callmenum=" . $callmenumCrypt . "&action=c&msgFrom=" . $msgFromCrypt . "'"; 
     424          $_SESSION['ari_user']['recfiles'][$i] = $recording; 
     425          $recordingLink = "<a href='#' onClick=\"javascript:playback('play', $playbackRow, 'misc/play_page.php?recindex=" . $i . "'); return false;\"><img src='theme/images/sound.png' title=" . _("Play") . "></img></a>"; 
     426          $callmePage           = "'misc/callme_page.php?recindex=" . $i . "&callmenum=" . $this->callme_num . "&action=c&msgFrom=" . $extension . "'"; 
    414427          $callme_tooltip       = _("Play message at: ") . $this->callme_num; 
    415428          $callmeLink = "<a href='#' onClick=\"javascript:playback('callme', $playbackRow, $callmePage); return false;\"><img src='theme/images/telephone.png' title='" . $callme_tooltip . "'></img></a>"; 
    416           $downloadLink = "<a href=/recordings/misc/audio.php?recording='" . $recordingCrypt . "'><img src='theme/images/drive_go.png' title=" . _("Download") . "></img></a>"; 
     429          $downloadLink = "<a href=/recordings/misc/audio.php?recindex=" . $i . "><img src='theme/images/drive_go.png' title=" . _("Download") . "></img></a>"; 
    417430        }  
    418431        else { 
     
    421434        } 
    422435 
    423         $fileCrypt = $crypt->encrypt($file,$ARI_CRYPT_PASSWORD); 
    424  
    425436        $tableText .= " 
    426437          <tr> 
    427             <td class='checkbox'><input type=checkbox name='selected" . ++$i . "' value=" . $fileCrypt . "></td> 
     438            <td class='checkbox'><input type=checkbox name='selected" . $i . "' value=" . $i . "></td> 
    428439            <td width=68>" . $date . "</td> 
    429440            <td>" . $time . "</td> 
     
    433444            <td>" . $duration . " sec</td> 
    434445            <td>" . $recordingLink . "&nbsp;&nbsp;" . $callmeLink . "</td> 
    435            <td>" . $downloadLink . "</td> 
     446            <td>" . $downloadLink . "</td> 
    436447          </tr>"; 
    437448 
     
    481492    $ret .= " 
    482493      <form name='voicemail_form' action='" . $_SESSION['ARI_ROOT'] . "' method='GET'> 
    483        <input type=hidden id='pb_load_inprogress' value='false'> 
     494        <input type=hidden id='pb_load_inprogress' value='false'> 
    484495        <input type=hidden name=m value=" . $m . ">      
    485496        <input type=hidden name=f value=msgAction> 
     
    574585           " . $recording_delete_header . " 
    575586           " . $recording_header . " 
    576           " . $download_header . " 
     587           " . $download_header . " 
    577588        </tr> 
    578589        " . $tableText . " 
     
    680691  function deleteVoicemailData($files) { 
    681692 
    682     global $ARI_CRYPT_PASSWORD; 
    683  
    684     $crypt = new Crypt(); 
    685  
    686     foreach($files as $key => $pathCrypt) { 
    687  
    688       // decrypt path 
    689       $path = $crypt->decrypt($pathCrypt,$ARI_CRYPT_PASSWORD); 
     693    foreach($files as $key => $path) { 
    690694 
    691695      // get file parts for search 
     
    724728 
    725729    global $ASTERISK_VOICEMAIL_PATH; 
    726     global $ARI_CRYPT_PASSWORD; 
    727  
    728     $crypt = new Crypt(); 
    729730 
    730731    $perm = fileperms($ASTERISK_VOICEMAIL_PATH); 
     
    781782    } 
    782783 
    783     foreach($files as $key => $pathCrypt) { 
    784       // decrypt path 
    785       $pathPlain = $crypt->decrypt($pathCrypt,$ARI_CRYPT_PASSWORD); 
     784    foreach($files as $key => $pathPlain) { 
    786785      // add plain path to new array 
    787786      $filesPlain[] = $pathPlain; 
  • freepbx/branches/ari_changes/amp_conf/htdocs/recordings/version.php

    r6651 r6832  
    66 */ 
    77 
    8 $ARI_VERSION = 'FreePBX 2.5 with Call Me'; 
     8$ARI_VERSION = 'FreePBX 2.5'; 
    99 
    1010?>