Advertisement
Guest User

ubershmekel

a guest
Dec 26th, 2008
814
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.90 KB | None | 0 0
  1. <h3>The recordings from the Yehuda Eder class...</h3>
  2.  
  3. Things to know:<UL><LI>Quality isn't amazing</LI><LI>I missed a few songs</LI><LI>The list is in chronological order (i think)</LI>
  4. </UL>
  5.  
  6. <script type="text/javascript" language="javascript" src="/utils/nifty/niftyplayer.js"></script>
  7.  
  8. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="165" height="38" id="niftyPlayer1" align="">
  9.   <param name=movie value="/utils/nifty/niftyplayer.swf?file=http://www.basementphilosophy.com/utils/nifty/betty.mp3">
  10.   <param name=quality value=high>
  11.   <param name=bgcolor value=#EEEEFF>
  12.   <embed src="/utils/nifty/niftyplayer.swf?file=http://www.basementphilosophy.com/utils/nifty/betty.mp3" quality=high bgcolor=#EEEEFF width="165" height="38" name="niftyPlayer1" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
  13.   </embed>
  14. </object>
  15.  
  16. <?php
  17.   //$MY_ROOT = "..";
  18.   define("MY_ROOT", "/home/content/u/b/e/ubershmekel/html");
  19.   define("MY_WEB_ROOT", "http://www.basementphilosophy.com");
  20.  
  21.   function local_to_web($fname) {
  22.     // removes the MY_ROOT and sticks the web root in it
  23.     return str_replace(MY_ROOT, MY_WEB_ROOT, $fname);
  24.   }
  25.  
  26.   function handle_dir($dir) {
  27.     echo "<br/><h3>$dir</h3>";
  28.   }
  29.  
  30.   function handle_file($file) {
  31.     // Show a link and a flash player for the file
  32.     $file_name = basename($file);
  33.     $wpath = local_to_web($file);
  34.     $my_string = <<<ML_STRING
  35.     <br />
  36.     $file_name <a title="$file_name" href="$wpath">[download mp3]</a> <a title="play" href="javascript:niftyplayer('niftyPlayer1').loadAndPlay('$wpath')">[play]</a> <a href="javascript:niftyplayer('niftyPlayer1').playToggle()">[pause]</a>
  37. ML_STRING;
  38.    
  39.     echo $my_string;
  40.   }
  41.  
  42.   /**
  43.    * Return the number of files that resides under a directory.
  44.    *
  45.    * @return integer
  46.    * @param    string (required)   The directory you want to start in
  47.    * @param    boolean (optional)  Recursive counting. Default to FALSE.
  48.    */
  49.   function num_files($dir, $recursive=false) {
  50.     static $counter;
  51.     if(is_dir($dir)) {
  52.       handle_dir($dir);
  53.      
  54.       if($dh = opendir($dir)) {
  55.         while(($file = readdir($dh)) !== false) {
  56.           if($file != "." && $file != "..") {
  57.             $fpath = $dir."/".$file;
  58.             if(is_dir($fpath) && $recursive == true) {
  59.               $counter = $counter + num_files($dir."/".$file, $recursive);
  60.             }
  61.             else {
  62.               //echo "$file";
  63.               handle_file($fpath);
  64.               $counter = $counter + 1;
  65.             }
  66.           }
  67.         }
  68.         closedir($dh);
  69.       }
  70.     }
  71.     return $counter;
  72.   }
  73.  
  74.   // Usage:
  75.   $nfiles = num_files(MY_ROOT."/files/rimon", true);
  76.   //echo "whatever... $nfiles";
  77.   //$nfiles = num_files("../files/rimon");
  78.  
  79. ?>
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement