paristemi
[ class tree: paristemi ] [ index: paristemi ] [ all elements ]

Source for file index.php

Documentation is available at index.php

  1. <?php
  2. /**
  3. * <b>Worship Music</b><br />
  4. * The worship music section shows all of the information and downloading of worship music.<br />
  5. * Views available are:
  6. * - Album Listing
  7. * - Non-Album Listing (all songs not on a specific CD)
  8. * - All Songs
  9. * Every song has a mp3, m3u, lyric, and chord (all but mp3 are optional).<br />
  10. * This section is searchable.
  11. * @author Kristen O'Brien <kristen_paristemi-com>
  12. * @copyright Copyright 2004, Kristen O'Brien
  13. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  14. * @link http://www.paristemi.com Paristemi Main Site
  15. * @package paristemi
  16. * @subpackage paristemi_business_logic
  17. * @since Build 0.1
  18. * @version Build 0.7
  19. * @filesource
  20. */
  21. /**
  22. * Include the constants file and all of the files in the include list
  23. */
  24. if(ltrim(dirname($_SERVER['SCRIPT_FILENAME'])) == "" || !file_exists($_SERVER['DOCUMENT_ROOT']."/constants.php")) {
  25. if(!file_exists("../constants.php")) { require_once("../public_html/constants.php"); }
  26. else { require_once("../constants.php"); }
  27. }
  28. else { require_once($_SERVER['DOCUMENT_ROOT']."/constants.php"); }
  29. foreach($INCLUDE_LIST as $includefile) { require_once $includefile; }
  30.  
  31. $db = new Database();
  32. $db_music = $db->GetClass('music');
  33. $data =& $db_music->GetAllAlbums();
  34. $smarty = UtilSmarty::createSmarty();
  35.  
  36. $id="";$all="";$search="";$searchflg=false;$lyric_search="";
  37. if(getenv("QUERY_STRING")) {
  38. if(isset($HTTP_GET_VARS['id'])) {$id = $HTTP_GET_VARS['id'];}
  39. if(isset($HTTP_GET_VARS['all'])) {$all = $HTTP_GET_VARS['all'];}
  40. if(isset($HTTP_GET_VARS['SearchTerm'])) {
  41. $search = $HTTP_GET_VARS['SearchTerm'];
  42. $searchflg = true;
  43. }
  44. }
  45.  
  46. if($id != "") {
  47. $value =& $db_music->GetAlbumSongs($id);
  48. $pagesubtitle = $value[0]->ATitle;
  49. }
  50. else if($all != "") { $pagesubtitle = $S_ALL." ".$S_SONGS; }
  51. else if($search != "") { $pagesubtitle = $S_SEARCH." - ".ucwords(strtolower($search)); }
  52. else { $pagesubtitle = $S_MAIN; }
  53. require_once $HTTP_DOCUMENT_ROOT.$INCLUDE_PATH.$HEADER.
  54. "?pagetitle=".str_replace(" ","%20",htmlentities($S_WORSHIP_MUSIC)).
  55. "&pagesubtitle=".str_replace(" ","%20",htmlentities(stripslashes($pagesubtitle))).
  56. "&pagedesc=".str_replace(" ","%20",htmlentities($CHURCH_NAME." ".$S_DESC_MUSIC));
  57.  
  58. $sidesection = array();
  59. $sidesection['Title'] = $S_WORSHIP_MUSIC;
  60. $sidesection['Links'] = array();
  61. foreach ($data as $value) {
  62. if($value->Title != $S_OTHERS) {
  63. $sidesection['Links'][] = array('LinkPath'=>$MUSIC_FILE."?id=".$value->ID,'LinkText'=>$value->Title);
  64. }
  65. else {
  66. $other = $value;
  67. }
  68. }
  69. $sidesection['Links'][] = array('LinkPath'=>"",'LinkText'=>"break");
  70. $sidesection['Links'][] = array('LinkPath'=>$MUSIC_FILE."?id=".$other->ID,'LinkText'=>$other->Title);
  71. $sidesection['Links'][] = array('LinkPath'=>$MUSIC_FILE."?all=yes",'LinkText'=>$S_ALL." ".$S_SONGS);
  72. $smarty->assign('sidesections',array($sidesection));
  73. $smarty->assign('searchformname','lyricsearch');
  74. $smarty->assign('searchformfile',$MUSIC_FILE);
  75. $smarty->assign('searchsubmittitle',$S_LYRICS." ".$S_SEARCH);
  76. $icondescriptions = array();
  77. $icondescriptions[] = array('src'=>$HTTP_DOCUMENT_ROOT.$IMAGE_PATH.$MP3_IMG,
  78. 'alt'=>"MP3 ".$S_DOWNLOAD,'desc'=>"MP3 (".$S_DOWNLOAD.")");
  79. $icondescriptions[] = array('src'=>$HTTP_DOCUMENT_ROOT.$IMAGE_PATH.$MP3_IMG_STREAM,
  80. 'alt'=>"MP3 ".$S_STREAMING,'desc'=>"MP3 (".$S_STREAMING.")");
  81. $icondescriptions[] = array('src'=>$HTTP_DOCUMENT_ROOT.$IMAGE_PATH.$LYRICS_IMG,
  82. 'alt'=>$S_LYRICS,'desc'=>$S_LYRICS);
  83. $icondescriptions[] = array('src'=>$HTTP_DOCUMENT_ROOT.$IMAGE_PATH.$CHORDS_IMG,
  84. 'alt'=>$S_CHORDS,'desc'=>$S_CHORDS);
  85. $smarty->assign('icondescriptions',$icondescriptions);
  86.  
  87. if(getenv("QUERY_STRING")) {
  88. $tblarr = array();
  89. $tblclass = "tbl-listing";
  90. $tbltdclass = array("tbl-listing-track-number","tbl-listing-track-name",
  91. "tbl-listing-track-dl","tbl-listing-track-stream",
  92. "tbl-listing-track-lyric","tbl-listing-track-chord");
  93. $tblheader = "";
  94. if($searchflg) {
  95. if($search == "") { $lyric_search =& $db_music->GetAllSongs(); }
  96. else {
  97. $data =& $db_music->GetAllAlbums();
  98. foreach ($data as $value) {
  99. $data2 =& $db_music->GetAlbumSongs($value->ID);
  100. foreach ($data2 as $value2) {
  101. $file_name = $HTTP_DOCUMENT_ROOT.$MUSIC_PATH.$LYRICS_DIR.$value2->Lyrics;
  102. $file_content = trim(implode('',file($file_name,"r")));
  103. if(stristr($file_content,$search)) { $lyric_search[] = $value2; }
  104. else if(strcasecmp($value2->Title,$search)==0) { $lyric_search[] = $value2; }
  105. }
  106. }
  107. }
  108. if($lyric_search != null) {
  109. $tblheader = "<h2>".$S_SEARCH." ".$S_RESULTS." (".sizeof($lyric_search)." ".$S_TOTAL.")</h2>";
  110. $data = $lyric_search;
  111. }
  112. else {
  113. $tblheader = "<h2>".$N_SEARCH_NONE."</h2>";
  114. $data = null;
  115. }
  116. }
  117. else if($all == "yes") {
  118. $data =& $db_music->GetAllSongs();
  119. $tblheader = "<h2>".$S_ALL." ".$S_SONGS." (".sizeof($data)." ".$S_TOTAL.")</h2>";
  120. }
  121. else if($id != null && $all != "yes") {
  122. $data =& $db_music->GetAlbumSongs($id);
  123. $tblheader = "<h2>".$data[0]->ATitle."</h2>";
  124. }
  125. if($data != null) {
  126. foreach ($data as $value) {
  127. if($value->TNumber != 0 && $value->TNumber != "" && $lyric_search == null) {
  128. $tnumber = $value->TNumber;
  129. }
  130. else { $tnumber = "&nbsp;"; }
  131. $ttitle = $value->Title;
  132. if ($value->AULinkDownload && $value->AULinkDownload != "No Link") {
  133. $tdl = "<a href=\"".$value->AULinkDownload."\">".
  134. "<img src=\"".$HTTP_DOCUMENT_ROOT.$IMAGE_PATH.$MP3_IMG."\" ".
  135. "border=\"0\" alt=\"mp3\" id=\"mp3\" name=\"mp3\" align=\"middle\" /></a>".
  136. "<br /><span class=\"filesize\">".
  137. "(".UtilFiles::GetFilesize($value->AULinkDownload).")</span>";
  138. }
  139. else { $tdl = "&nbsp;"; }
  140. if ($value->AULinkStream) {
  141. $tstream = "<a href=\"".$value->AULinkStream."\">".
  142. "<img src=\"".$HTTP_DOCUMENT_ROOT.$IMAGE_PATH.$MP3_IMG_STREAM."\" ".
  143. "border=\"0\" alt=\"mp3 ".$S_STREAMING."\" id=\"mp3 Stream\" name=\"mp3 Stream\" align=\"middle\" /></a>";
  144. }
  145. else { $tstream = "&nbsp;"; }
  146. if ($value->Lyrics != null) {
  147. $tlyric = "<a href=\"".$HTTP_DOCUMENT_ROOT.$MUSIC_PATH.$LYRICS_DIR.$value->Lyrics."\">".
  148. "<img src=\"".$HTTP_DOCUMENT_ROOT.$IMAGE_PATH.$LYRICS_IMG."\" ".
  149. "border=\"0\" alt=\"".$S_LYRICS."\" id=\"lyrics\" name=\"lyrics\" align=\"middle\" /></a>";
  150. }
  151. else { $tlyric = "&nbsp;"; }
  152. if ($value->Chords != null) {
  153. $tchord = "<a href=\"".$HTTP_DOCUMENT_ROOT.$MUSIC_PATH.$CHORDS_DIR.$value->Chords."\">".
  154. "<img src=\"".$HTTP_DOCUMENT_ROOT.$IMAGE_PATH.$CHORDS_IMG."\" ".
  155. "border=\"0\" alt=\"".$S_CHORDS."\" id=\"chords\" name=\"chords\" align=\"middle\" /></a>";
  156. }
  157. else { $tchord = "&nbsp;"; }
  158. array_push($tblarr,array($tnumber,$ttitle,$tdl,$tstream,$tlyric,$tchord));
  159. }
  160. }
  161. $tblfooter = "";
  162. if($id != null) {
  163. if($data[0]->ADescription != null) {
  164. $tblfooter = $data[0]->ADescription;
  165. } }
  166. $smarty->assign('printtable',UtilHtml::createTable($tblarr,$tblheader,$tblclass,$tblfooter,"",$tbltdclass));
  167. }
  168. else {
  169. $smarty->assign('introstatements',array(array('Title'=>$S_WORSHIP_MUSIC,'Text'=>$MUSIC_INTRO)));
  170. }
  171. $smarty->assign('bottomnote',$S_NOTE_MUSIC);
  172. UtilSmarty::displaySectionPage($smarty);
  173. ?>
  174. <?php require_once $SERVER_DIRECTORY.$INCLUDE_PATH.$FOOTER; ?>

Documentation generated on Mon, 10 May 2004 12:10:30 -0700 by phpDocumentor 1.3.0RC3