Changeset 6832
- Timestamp:
- 09/22/08 07:09:56 (2 years ago)
- Files:
-
- freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/bootstrap.php (modified) (2 diffs)
- freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/display.php (modified) (1 diff)
- freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/login.php (modified) (1 diff)
- freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/main.conf.php (modified) (4 diffs)
- freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/zh_TW (deleted)
- freepbx/branches/ari_changes/amp_conf/htdocs/recordings/misc/audio.php (modified) (1 diff)
- freepbx/branches/ari_changes/amp_conf/htdocs/recordings/modules/callmonitor.module (modified) (13 diffs)
- freepbx/branches/ari_changes/amp_conf/htdocs/recordings/modules/followme.module (modified) (2 diffs)
- freepbx/branches/ari_changes/amp_conf/htdocs/recordings/modules/voicemail.module (modified) (15 diffs)
- freepbx/branches/ari_changes/amp_conf/htdocs/recordings/version.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/bootstrap.php
r4993 r6832 98 98 */ 99 99 function getFiles($path,$filter,$recursive_max,$recursive_count) { 100 global $SETTINGS_MAX_FILES; 101 $SETTINGS_MAX_FILES = isset($SETTINGS_MAX_FILES) ? $SETTINGS_MAX_FILES : 3000; 100 102 101 103 $files = array(); … … 110 112 111 113 $fileCount++; 112 if ($fileCount> 3000) {114 if ($fileCount>$SETTINGS_MAX_FILES) { 113 115 $_SESSION['ari_error'] 114 116 .= _("To many files in $msg_path Not all files processed") . "<br>"; freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/display.php
r1395 r6832 171 171 function displayNavigationBlock($m,$q,$url_opts,$start,$span,$total) { 172 172 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; 175 175 176 176 $total_pages = ceil($total/$span); freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/login.php
r6419 r6832 336 336 $_SESSION['ari_user']['default_page'] = $default_page; 337 337 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 340 343 } 341 344 } freepbx/branches/ari_changes/amp_conf/htdocs/recordings/includes/main.conf.php
r4993 r6832 68 68 69 69 # 70 # Admin only account 70 # Admin only account - change defaults to prevent unauthorized access to call recordings 71 71 # 72 72 $ARI_ADMIN_USERNAME = "admin"; … … 81 81 # Authentication password to unlock cookie password 82 82 # This must be all continuous and only letters and numbers 83 # Change this password to prevent unauthorized access to cookie contents 83 84 # 84 85 $ARI_CRYPT_PASSWORD = "z1Mc6KRxA7Nw90dGjY5qLXhtrPgJOfeCaUmHvQT3yW8nDsI2VkEpiS4blFoBuZ"; … … 263 264 $ASTERISK_PROTOCOLS['sip']['config_files'] = "/etc/asterisk/sip.conf;/etc/asterisk/sip_additional.conf"; 264 265 $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"; 266 267 267 268 # Settings for Follow-Me Select Boxes in seconds … … 326 327 $SETTINGS_ALLOW_PHONE_SETTINGS = 1; 327 328 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; 329 334 330 335 ?> freepbx/branches/ari_changes/amp_conf/htdocs/recordings/misc/audio.php
r6459 r6832 7 7 8 8 9 10 if (isset($_GET['recording'])) { 9 if (isset($_GET['recindex'])) { 11 10 12 11 chdir(".."); 13 12 include_once("./includes/bootstrap.php"); 14 13 15 global $ARI_CRYPT_PASSWORD;14 $path = $_SESSION['ari_user']['recfiles'][$_GET['recindex']]; 16 15 17 $crypt = new Crypt();18 19 $path = $crypt->decrypt($_GET['recording'],$ARI_CRYPT_PASSWORD);20 21 // strip ".." from path for security22 $path = preg_replace('/\.\./','',$path);23 24 16 // See if the file exists 25 17 if (!is_file($path)) { die("<b>404 File not found!</b>"); } freepbx/branches/ari_changes/amp_conf/htdocs/recordings/modules/callmonitor.module
r6476 r6832 60 60 $files = array(); 61 61 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]); 64 64 } 65 65 } 66 66 67 67 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 70 76 71 77 if ($a=='ignore') { … … 100 106 global $CALLMONITOR_ALLOW_DELETE; 101 107 global $AJAX_PAGE_REFRESH_ENABLE; 102 global $ARI_CRYPT_PASSWORD;103 108 104 109 $display = new DisplaySearch(); 105 $crypt = new Crypt();106 110 107 111 // get the search string … … 115 119 $duration_filter = getArgument($args,'duration_filter'); 116 120 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; 119 123 $order = $order=='' ? 'calldate' : $order; 120 $sort = $sort=='' ? 'desc' : $sort;124 $sort = ($sort=='' || strtolower($sort) == 'desc') ? 'desc' : 'asc'; 121 125 122 126 $displayname = $_SESSION['ari_user']['displayname']; … … 138 142 // build controls 139 143 if ($CALLMONITOR_ALLOW_DELETE) { 144 if (count($recordings) > 0) { 145 $controls .= "<button "; 146 } 147 else { 148 $controls .= "<button disabled='disabled' "; 149 } 140 150 $controls .= " 141 <buttonclass='infobar' type='submit' onclick=\"document.callmonitor_form.a.value='delete'\">151 class='infobar' type='submit' onclick=\"document.callmonitor_form.a.value='delete'\"> 142 152 " . _("delete") . " 143 153 </button> … … 204 214 205 215 // 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++; 208 221 209 222 // recording file 210 223 $recording = $recordings[$value['uniqueid'] . $value['calldate']]; 211 $fileCrypt = $crypt->encrypt($recording,$ARI_CRYPT_PASSWORD);212 $recordingCrypt = urlencode($fileCrypt);213 224 214 225 // date and time … … 217 228 $time = $buf[1]; 218 229 219 // recording delete checkbox220 if ($CALLMONITOR_ALLOW_DELETE) {221 $recording_delete_checkbox = "<td class='checkbox'><input type=checkbox name='selected" . ++$i . "' value=" . $fileCrypt . "></td>";222 }223 224 230 $recordingLink = ''; 225 231 $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 } 229 243 } 230 244 $playbackRow++; … … 273 287 $ret .= " 274 288 <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'> 276 290 <input type=hidden name=m value=" . $m . "> 277 291 <input type=hidden name=f value=recAction> … … 306 320 newRow = cmTable.insertRow(row_num); 307 321 newRow.id = playbackId; 308 cell_left = newRow.insertCell(0);322 cell_left = newRow.insertCell(0); 309 323 cell_left.colSpan = 9; 310 324 cell_left.innerHTML = playback_src; … … 407 421 } 408 422 409 foreach($data as $data_key => $data_value) {423 if (is_array($data)) foreach($data as $data_key => $data_value) { 410 424 411 425 $recording=''; … … 551 565 function deleteRecData($files) { 552 566 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) { 559 568 if (is_writable($file)) { 560 569 unlink($file); … … 573 582 function getSearchText($q,$duration_filter) { 574 583 584 $duration_filter = ctype_digit($duration_filter) ? $duration_filter : 0; 585 575 586 // search text 576 587 if ($q!='*' && $q!=NULL) { 588 589 $dbh = $_SESSION['dbh_cdr']; 577 590 $searchText .= "WHERE "; 578 591 $tok = strtok($q," \n\t"); 592 $tok = $dbh->escapeSimple($tok); 579 593 while ($tok) { 580 594 $searchText .= " (calldate regexp '" . $tok . "' … … 590 604 )"; 591 605 $tok = strtok(" \n\t"); 606 $tok = $dbh->escapeSimple($tok); 592 607 if ($tok) { 593 608 $searchText .= " AND"; … … 684 699 685 700 $dbh = $_SESSION['dbh_cdr']; 701 $order = $dbh->escapeSimple($order); 686 702 $sql = "SELECT * 687 703 FROM " . $ASTERISKCDR_DBTABLE . " freepbx/branches/ari_changes/amp_conf/htdocs/recordings/modules/followme.module
r6029 r6832 655 655 656 656 if (isset($_SESSION['dbh_asterisk'])) { 657 $db = $_SESSION['dbh_asterisk']; 657 658 658 659 //format for SQL database … … 660 661 661 662 $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 . 663 664 "', needsconf = '" . $follow_me_confirm . "' WHERE grpnum = $exten LIMIT 1"; 664 665 $results = $_SESSION['dbh_asterisk']->query($sql); freepbx/branches/ari_changes/amp_conf/htdocs/recordings/modules/voicemail.module
r6650 r6832 11 11 class Voicemail { 12 12 var $callme_num = ""; 13 13 14 /* 14 15 * rank (for prioritizing modules) … … 28 29 if (empty($this->callme_num)) { 29 30 $this->callme_num = $extension; // callme_num defaults to user's extension. 31 callme_setnum($extension, $extension); 30 32 } 31 33 } … … 154 156 $files = array(); 155 157 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]); 158 160 } 159 161 } 160 162 161 163 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 } 163 171 } 164 172 else if ($a=='move_to') { … … 168 176 = _("A folder must be selected before the message can be moved."); 169 177 } 170 else {178 else if (count($files) > 0) { 171 179 $context = $_SESSION['ari_user']['context']; 172 180 $extension = $_SESSION['ari_user']['extension']; 173 181 $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."); 174 186 } 175 187 } … … 182 194 = _("An extension must be selected before the message can be forwarded."); 183 195 } 184 else {196 else if (count($files) > 0) { 185 197 $folder_rx = $ASTERISK_VOICEMAIL_FOLDERS[0]['folder']; 186 198 $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."); 187 203 } 188 204 } … … 213 229 global $ASTERISK_VOICEMAIL_FOLDERS; 214 230 global $AJAX_PAGE_REFRESH_ENABLE; 215 global $ARI_CRYPT_PASSWORD;216 231 217 232 $voicemail_audio_format = $_COOKIE['ari_voicemail_audio_format']; 218 233 219 234 $display = new DisplaySearch(); 220 $crypt = new Crypt();221 235 222 236 // args … … 392 406 $download_header .= "<th>" . _("Download"). "</th>"; 393 407 // table body 408 unset($_SESSION['ari_user']['recfiles']); 394 409 if (isset($data)) { 395 410 $playbackRow = 2; // Index for where playback control rows used by javascript playback() should appear in the table. 396 411 // First control row would appear below row 1 (hence $playbackRow starts at 2); control rows are inserted/deleted as needed. 397 412 foreach($data as $file=>$value) { 398 413 $i++; 399 414 // Playback links 400 415 $voicemail_audio_format = $voicemail_audio_format=='' ? '.wav' : $voicemail_audio_format; … … 407 422 $duration = $value[duration]; 408 423 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 . "'"; 414 427 $callme_tooltip = _("Play message at: ") . $this->callme_num; 415 428 $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?rec ording='" . $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>"; 417 430 } 418 431 else { … … 421 434 } 422 435 423 $fileCrypt = $crypt->encrypt($file,$ARI_CRYPT_PASSWORD);424 425 436 $tableText .= " 426 437 <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> 428 439 <td width=68>" . $date . "</td> 429 440 <td>" . $time . "</td> … … 433 444 <td>" . $duration . " sec</td> 434 445 <td>" . $recordingLink . " " . $callmeLink . "</td> 435 <td>" . $downloadLink . "</td>446 <td>" . $downloadLink . "</td> 436 447 </tr>"; 437 448 … … 481 492 $ret .= " 482 493 <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'> 484 495 <input type=hidden name=m value=" . $m . "> 485 496 <input type=hidden name=f value=msgAction> … … 574 585 " . $recording_delete_header . " 575 586 " . $recording_header . " 576 " . $download_header . "587 " . $download_header . " 577 588 </tr> 578 589 " . $tableText . " … … 680 691 function deleteVoicemailData($files) { 681 692 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) { 690 694 691 695 // get file parts for search … … 724 728 725 729 global $ASTERISK_VOICEMAIL_PATH; 726 global $ARI_CRYPT_PASSWORD;727 728 $crypt = new Crypt();729 730 730 731 $perm = fileperms($ASTERISK_VOICEMAIL_PATH); … … 781 782 } 782 783 783 foreach($files as $key => $pathCrypt) { 784 // decrypt path 785 $pathPlain = $crypt->decrypt($pathCrypt,$ARI_CRYPT_PASSWORD); 784 foreach($files as $key => $pathPlain) { 786 785 // add plain path to new array 787 786 $filesPlain[] = $pathPlain; freepbx/branches/ari_changes/amp_conf/htdocs/recordings/version.php
r6651 r6832 6 6 */ 7 7 8 $ARI_VERSION = 'FreePBX 2.5 with Call Me';8 $ARI_VERSION = 'FreePBX 2.5'; 9 9 10 10 ?>
