Changeset 1406
- Timestamp:
- 04/09/06 00:06:32 (7 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/htdocs/admin/modules/music/page.music.php
r1201 r1406 15 15 <?php 16 16 $action = isset($_REQUEST['action'])?$_REQUEST['action']:''; 17 $randon = isset($_REQUEST['randon'])?$_REQUEST['randon']:''; 18 $randoff = isset($_REQUEST['randoff'])?$_REQUEST['randoff']:''; 17 19 $category = strtr(isset($_REQUEST['category'])?$_REQUEST['category']:''," ", "-"); 18 20 if ($category == null) $category = 'Default'; … … 24 26 $path_to_dir = "/var/lib/asterisk/mohmp3/$category"; //path to directory u want to read. 25 27 28 if (strlen($randon)) { 29 touch($path_to_dir."/.random"); 30 createmusicconf(); 31 } 32 if (strlen($randoff)) { 33 unlink($path_to_dir."/.random"); 34 createmusicconf(); 35 } 26 36 switch ($action) { 27 37 case "addednew": … … 68 78 $tresults = music_list("/var/lib/asterisk/mohmp3"); 69 79 if (isset($tresults)) { 70 foreach ($tresults as $tresult) 71 $File_Write.="[{$tresult}]\nmode=files\ndirectory=/var/lib/asterisk/mohmp3/{$tresult}\n"; 72 } 73 74 $handle = fopen("/etc/asterisk/musiconhold_additional.conf", "w"); 75 76 if (fwrite($handle, $File_Write) === FALSE) 77 { 78 echo _("Cannot write to file")." ($tmpfname)"; 79 exit; 80 } 81 82 fclose($handle); 83 84 85 } 80 foreach ($tresults as $tresult) { 81 $dir = "/var/lib/asterisk/mohmp3/{$tresult}/"; 82 if (file_exists("{$dir}.random")) { 83 $File_Write.="[{$tresult}]\nmode=files\ndirectory={$dir}\nrandom=yes\n"; 84 } else { 85 $File_Write.="[{$tresult}]\nmode=files\ndirectory={$dir}{$tresult}\n"; 86 } 87 } 88 } 89 90 $handle = fopen("/etc/asterisk/musiconhold_additional.conf", "w"); 91 92 if (fwrite($handle, $File_Write) === FALSE) { 93 echo _("Cannot write to file")." ($tmpfname)"; 94 exit; 95 } 96 97 fclose($handle); 98 99 needreload(); 100 } 101 86 102 function makemusiccategory($category) 87 103 { … … 227 243 <input type="button" value="<?php echo _("Upload")?>" onclick="document.upload.submit(upload);alert('<?php echo _("Please wait until the page loads. Your file is being processed.")?>');"/> 228 244 </form> 229 230 245 <br /> 246 <form name="randomon" action="<?php $_SERVER['PHP_SELF'] ?>" method="post"> 247 <?php 248 if ($category != "Default") { 249 if (file_exists("{$path_to_dir}/.random")) { 250 ?> <input type="submit" name="randoff" value="Disable Random Play"> <?php 251 } else { 252 ?> <input type="submit" name="randon" value="Enable Random Play"> <?php 253 } 254 } 255 ?> 256 </form> 257 <br /> 231 258 <?php 232 259 … … 265 292 } 266 293 ?> 294
