// Queries database to get track count for navigational functions // $trackResult = $dbHandle->query($trackQuery); $totalTracks = $trackResult->num_rows; mysqli_free_result($trackResult); // Reconstructs a query for section and page information that may or may not be provided // $trackQuery = "SELECT * FROM track_list WHERE " . getSectionCriteria("track_name"); if (!$noInput) { if (!$albumInfo || !$artistInfo) { $trackQuery .= " AND album_id=0"; $valid = false; } else { $valid = true; $trackQuery .= " AND album_id=\"" . $albumInfo['album_id'] . "\""; } } $trackQuery .= " " . getSortCriteria("track_name") . " " . getPageCriteria($totalTracks, $MAX_ITEMS_PER_PAGE, true); $trackResult = $dbHandle->query($trackQuery); ?> <a id="topofpage"></a> <div id="content"> <div id="breadcrumb"> <?php // Constructs the breadcrumb using global locationinfo // if (!$valid && !$noInput) { ?> <a href="<?php echo $LOCATIONINFO['music'][1]; ?> "><?php echo $LOCATIONINFO['music'][0];
/** * Go to a assigned path, and send the array of file objects with JSON format to client. * @param unknown_type $path */ function gotoPath($path) { setCurrentPath($path); $file = @scandir($path); $files = array(); $dotPattern = '/^(\\.){1,2}$/i'; $suffixPattern = '/^[^\\.]\\S*(?<=\\.)(\\S+)$|^\\.\\S+(?<=\\.)(\\S+)$/i'; //Add all files in the current path to the array $files foreach ($file as $val) { if (!preg_match($dotPattern, $val)) { $fullName = $path . '/' . $val; $f = new file(); $f->name = $val; $f->type = filetype($fullName); $f->fileSize = filesize($fullName); $f->accessTime = fileatime($fullName); $f->modifyTime = filemtime($fullName); $matches = array(); preg_match($suffixPattern, $val, $matches); $f->suffix = @$matches[count($matches) - 1]; unset($matches); $files[] = $f; } } //filters //Search filter $fk = getSearchKeyword(); $caseInsensitive = 'true' == $fk[1] ? true : false; $files = filtrateFileNameByKeyword($files, $fk[0], $caseInsensitive); //Sort filter $sc = getSortCriteria(); $asc = 'true' == $sc[1] ? true : false; sortFiles($files, $sc[0], $asc); //Suffix and invisible filter $f = getFilter(); $invisible = 'true' == $f[1] ? true : false; if (!$invisible) { $files = filtrateHidden($files); } $files = filtrateSuffix($files, $f[0]); //Send the file list to the client echo json_encode($files); }
$noInput = true; } else { $noInput = false; } // Gets the artist info // if (!$noInput) { $artistInfo = getSingleRow($dbHandle, "artist_list", "artist_name", $artistName); $artResult = $dbHandle->query("SELECT * FROM artist_artwork_list WHERE artist_id='" . $artistInfo['artist_id'] . "' AND image_size='" . $IMAGE_SIZE5 . "'"); $artReturn = $artResult->fetch_array(MYSQLI_BOTH); } // Constructs the query to get both album info and artwork // $albumQuery = "SELECT * FROM " . getJoinTable("album_list", "album_artwork_list") . " \n WHERE " . getJoinMatch("album_list", "album_artwork_list", "album_id") . " \n AND " . getImageType($IMAGE_SIZE3) . " \n AND " . getSectionCriteria("album_title"); if (!$noInput) { $albumQuery .= " AND album_list.artist_id='" . $artistInfo['artist_id'] . "'"; } $albumQuery .= " " . getSortCriteria("album_title"); // Gets the number of albums // $totalResult = $dbHandle->query($albumQuery); $totalCount = $totalResult->num_rows; mysqli_free_result($totalResult); $albumQuery .= " " . getPageCriteria($totalCount, $MAX_ITEMS_PER_PAGE, true); $albumResult = $dbHandle->query($albumQuery); ?> <a id="topofpage"></a> <div id="content"> <div id="breadcrumb"> <?php // Constructs the breadcrumb using global locationinfo // if ($noInput) {