function printHeadingImage($randomImage) { global $_zp_themeroot; $id = getAlbumId(); echo '<div id="randomhead">'; if (is_null($randomImage) || checkforPassword(true)) { echo '<img src="' . $_zp_themeroot . '/images/zen-logo.jpg" alt="' . gettext('There were no images from which to select the random heading.') . '" />'; } else { $randomAlbum = $randomImage->getAlbum(); $randomAlt1 = $randomAlbum->getTitle(); if ($randomAlbum->getAlbumId() != $id) { $randomAlbum = $randomAlbum->getParent(); while (!is_null($randomAlbum) && $randomAlbum->getAlbumId() != $id) { $randomAlt1 = $randomAlbum->getTitle() . ":\n" . $randomAlt1; $randomAlbum = $randomAlbum->getParent(); } } $randomImageURL = htmlspecialchars(getURL($randomImage)); if (getOption('allow_upscale')) { $wide = 620; $high = 180; } else { $wide = min(620, $randomImage->getWidth()); $high = min(180, $randomImage->getHeight()); } echo "<a href='" . $randomImageURL . "' title='" . gettext('Random picture...') . "'><img src='" . htmlspecialchars($randomImage->getCustomImage(NULL, $wide, $high, $wide, $high, NULL, NULL, !getOption('Watermark_head_image'))) . "' width={$wide} height={$high} alt=" . '"' . htmlspecialchars($randomAlt1, ENT_QUOTES) . ":\n" . htmlspecialchars($randomImage->getTitle(), ENT_QUOTES) . '" /></a>'; } echo '</div>'; }
function printHeadingImage($randomImage) { global $_zp_themeroot; $id = getAlbumId(); echo '<div id="randomhead">'; if (is_null($randomImage)) { echo '<img src="' . $_zp_themeroot . '/images/zen-logo.jpg" alt="' . gettext('There were no images from which to select the random heading.') . '" />'; } else { $randomAlbum = $randomImage->getAlbum(); $randomAlt1 = $randomAlbum->getTitle(); if ($randomAlbum->getAlbumId() != $id) { $randomAlbum = $randomAlbum->getParent(); while (!is_null($randomAlbum) && $randomAlbum->getAlbumId() != $id) { $randomAlt1 = $randomAlbum->getTitle() . ":\n" . $randomAlt1; $randomAlbum = $randomAlbum->getParent(); } } $randomImageURL = html_encode(getURL($randomImage)); if (getOption('allow_upscale')) { $wide = 620; $high = 180; } else { $wide = min(620, $randomImage->getWidth()); $high = min(180, $randomImage->getHeight()); } echo "<a href='" . $randomImageURL . "' title='" . gettext('Random picture...') . "'>"; $html = "<img src='" . html_encode($randomImage->getCustomImage(NULL, $wide, $high, $wide, $high, NULL, NULL, !getOption('Watermark_head_image'))) . "' width='{$wide}' height='{$high}' alt=" . '"' . html_encode($randomAlt1) . ":\n" . html_encode($randomImage->getTitle()) . '" />'; $html = zp_apply_filter('custom_image_html', $html, false); echo $html; echo '</a>'; } echo '</div>'; }
function getAlbumsTable() { $albums = getAlbumId(); $artists = getArtistsTable(); $newAlbumList = array(); for ($x = 0; $x < count($albums); $x++) { $albumArtist = $albums[$x]["artist"]; $albumId = $albums[$x]["albumId"]; $albumName = $albums[$x]["album"]; //echo "<br>songArtist: $songArtist <br>"; foreach ($artists as $artistIdEntry) { $artist = $artistIdEntry["artist"]; $id = $artistIdEntry["id"]; if ($albumArtist == $artist) { //echo "Match<Br>"; $song[$x]["artist"] = $id; //echo $song["artist"] . "<Br>"; $updatedAlbum = array("albumId" => $albumId, "album" => $albumName, "artist" => $id); array_push($newAlbumList, $updatedAlbum); } } } return $newAlbumList; }
$imageExtension = strtolower(substr($image['name'], strpos($image['name'], '.') + 1)); $imageLocation = '../lyricsAlbum/' . $albumName . '.' . $imageExtension; //validating the image if (!empty($image) && ($imageExtension == 'jpeg' || $imageExtension == 'jpg' || $imageExtension == 'png') && ($image['type'] == 'image/jpeg' || $image['type'] == 'image/png')) { //save image into images/astrologers/ if (move_uploaded_file($image['tmp_name'], $imageLocation)) { //image saved } } else { $errorMessageAddAlbum = 'Image must be jpg or png.'; } } //if image is uploaded successsfully the insert info to database if ($errorMessageAddAlbum == '') { if (insertIntoAlbum($albumName, 'lyricsAlbum/' . $albumName . '.' . $imageExtension)) { $errorMessageAddAlbum = 'Data Inserted Successfully. Albums ID is : ' . getAlbumId('lyricsAlbum/' . $albumName . '.' . $imageExtension); } else { $errorMessageAddAlbum = 'Error Occured, while connecting server!'; } } } ?> <br> <center> <div class="label label-danger" id="errorMessageAddAlbum"><?php echo $errorMessageAddAlbum;
function FileUpload($resourceType, $currentFolder, $sCommand) { dbConn(); $email = getEmailFCK(); $thumb_widthpx = 160; if (!isset($_FILES)) { global $_FILES; } $sErrorNumber = '0'; $sFileName = ''; if (isset($_FILES['NewFile']) && !is_null($_FILES['NewFile']['tmp_name']) && $email != "") { global $Config; $oFile = $_FILES['NewFile']; // Map the virtual path to the local server path. //$sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ; $s = GetRootPath() . $Config['UserTempPath'] . $currentFolder . "/"; $s = str_replace("\\", "/", $s); $sServerDir = $s; $f = fopen("log2.txt", "a"); fwrite($f, "\r\n s = {$s} \r\n"); // Get the uploaded file name. $sFileName = $oFile['name']; $sFileName = SanitizeFileName($sFileName); $sOriginalFileName = $sFileName; // Get the extension. $sExtension = substr($sFileName, strrpos($sFileName, '.') + 1); $sExtension = strtolower($sExtension); if (isset($Config['SecureImageUploads'])) { if (($isImageValid = IsImageValid($oFile['tmp_name'], $sExtension)) === false) { $sErrorNumber = '202'; } } if (isset($Config['HtmlExtensions'])) { if (!IsHtmlExtension($sExtension, $Config['HtmlExtensions']) && ($detectHtml = DetectHtml($oFile['tmp_name'])) === true) { $sErrorNumber = '202'; } } // Check if it is an allowed extension. if (!$sErrorNumber && IsAllowedExt($sExtension, $resourceType)) { $iCounter = 0; while (true) { $sFilePath = $sServerDir . "/" . $sFileName; //fwrite($f, "\r\n sFilePath = $sFilePath \r\n"); //fwrite($f, "\nsServerDir = $sServerDir\n"); if (is_file($sFilePath)) { $iCounter++; $sFileName = RemoveExtension($sOriginalFileName) . '(' . $iCounter . ').' . $sExtension; $sErrorNumber = '201'; } else { move_uploaded_file($oFile['tmp_name'], $sFilePath); if (is_file($sFilePath)) { $ftype = $_FILES['NewFile']['type']; $file_size = $_FILES['NewFile']['size']; $originalpic = file_get_contents($sFilePath); list($width, $height) = getimagesize($sFilePath); if ($width > $thumb_widthpx) { $count = 1; $p = str_replace($sFileName, "", $sFilePath, $count); //fwrite($f, "\r\nfpath: $sFilePath\r\n"); $thumbpic = getThumbImage($p, $thumb_widthpx, $sFileName); } else { $thumbpic = $originalpic; unlink($sFilePath); } $album_id = getAlbumId($email); $table = 'user_imgs'; $fields = array('id', 'user_email', 'large_image', 'thumb_image', 'file_type', 'stat', 'file_name', 'file_size', 'album_id', 'admin_perm', 'view_count', 'rating'); $values = array(null, $email, $originalpic, $thumbpic, $ftype, 1, $sFileName, $file_size, $album_id, 1, 0, 0); $rs = insertData($table, $fields, $values); if (is_string($rs) || $rs == false) { //$sErrorNumber = '202' ; //file_put_contents("$sFileName", $thumbpic); } else { //fwrite($f, "is inserted = true"); } if (isset($Config['ChmodOnUpload']) && !$Config['ChmodOnUpload']) { break; } $permissions = 0777; if (isset($Config['ChmodOnUpload']) && $Config['ChmodOnUpload']) { $permissions = $Config['ChmodOnUpload']; } $oldumask = umask(0); chmod($sFilePath, $permissions); umask($oldumask); } break; } } if (file_exists($sFilePath)) { //previous checks failed, try once again if (isset($isImageValid) && $isImageValid === -1 && IsImageValid($sFilePath, $sExtension) === false) { @unlink($sFilePath); $sErrorNumber = '202'; } else { if (isset($detectHtml) && $detectHtml === -1 && DetectHtml($sFilePath) === true) { @unlink($sFilePath); $sErrorNumber = '202'; } } } } else { $sErrorNumber = '202'; } } else { $sErrorNumber = '202'; } $sFileUrl = CombinePaths(GetResourceTypePath($resourceType, $sCommand), $currentFolder); $sFileUrl = CombinePaths($sFileUrl, $sFileName); SendUploadResults($sErrorNumber, $sFileUrl, $sFileName); exit; }
} else { $sql[0] = "INSERT INTO album_list (artist_id, album_title, time_added) VALUES ('" . $artistId . "', '" . addslashes($albumInfo['name']) . "', '" . getRandom() . "')"; $sql[1] = "SELECT * FROM album_list WHERE artist_id='" . $artistId . "' AND `album_title`='" . addslashes($albumInfo['name']) . "'"; if (!insertQuery($dbHandle, $sql)) { fprintf($fp, "Unable to add album to database\n"); fclose($fp); echo "Failed adding album"; exit; } if (!albumExist($dbHandle, $artistId, addslashes($albumInfo['name']))) { fprintf($fp, "Unable to retrieve album from database\n"); fclose($fp); echo "Failed getting album info"; exit; } if (!($albumId = getAlbumId($dbHandle, $artistId, addslashes($albumInfo['name'])))) { fprintf($fp, "Unable to getting album id\n"); fclose($fp); echo "Failed getting album id"; exit; } // Track // $dataDump = uwe_file_get_contents("http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=" . $LASTFM_API_KEY . "&artist=" . urlencode($artist->name) . "&album=" . urlencode($albumInfo['name']) . "&format=json"); $trackList = json_decode($dataDump)->album; $trackLength = getTrackLength($trackList); $imageLength = getImageListLength($trackList->image); insertImageUrl($dbHandle, $trackList->image, $imageLength, 0, $albumId, $ALBUM_ARTWORK_FLAG, array(0 => $ARTIST_ARTWORK_FLAG, 1 => $ALBUM_ARTWORK_FLAG), $MAX_IMAGE_COUNT); saveBio($albumId . "-album_bio.txt", $trackList->wiki->content, $fp, $DATABASE_SCRIPT_DIR, $DS_ALBUM_REVIEW_DIR, $DS_LOGS_DIR); $sql[0] = "UPDATE album_list SET `review_file`='" . $albumId . "-album_bio.txt' WHERE artist_id='" . $artistId . "' AND `album_title`='" . addslashes($albumInfo['name']) . "'"; $sql[1] = "SELECT * FROM album_list WHERE artist_id='" . $artistId . "' AND `album_title`='" . addslashes($albumInfo['name']) . "'"; if (!updateQuery($dbHandle, $sql)) {