/** * Rotates an image * * @author Ross Carlson * @version 4/16/05 * @since 4/15/05 * @param $image string the FULL path to the image to rotate */ function SERVICE_ROTATE_IMAGE_gd2($image, $node) { global $allow_filesystem_modify, $include_path; // Let's make sure they have GD installed if (gd_version() < 2) { return false; } // Well since we can't rotate an ID3 image let's see if it's ID3 if (stristr($image, "ID3:")) { // Now let's make a file out of this data $jzSERVICES = new jzServices(); $jzSERVICES->loadStandardServices(); // Now let's fix the path $path = substr($image, 4); $meta = $jzSERVICES->getTagData($path); // Now let's create a file $file = $include_path . 'data/images/' . str_replace("/", "--", $path); $handle = fopen($file, "wb"); fwrite($handle, $meta['pic_data']); fclose($handle); // Now let's make this the image for the node $node->addMainArt($file); // Now let's update the name so we can rotate $image = $file; } // First we have to delete any resized versions of this $files = readDirInfo($include_path . 'data/images', "file"); foreach ($files as $file) { if (stristr($file, str_replace($include_path . 'data/images/', "", substr($image, 0, -4)))) { @unlink($file); } } // Now let's set our images $source = @imagecreatefromjpeg($image); $rotate = @imagerotate($source, 90, 0); @imagejpeg($rotate, $image); }
if (isset($_POST['edit_download_' . $i])) { // Ok, we got it, now we need to write this out $image = $_POST['edit_image_' . $i]; $imageData = file_get_contents($image); // now let's set the path for the image if (stristr($backend, "id3") or $allow_filesystem_modify == "false") { $imgFile = $include_path . "data/images/" . str_replace("/", "--", $node->getPath("String")) . "--" . $node->getName() . ".jpg"; } else { $imgFile = $node->getDataPath() . "/" . $node->getName() . ".jpg"; } // Now let's delete it if it already exists if (is_file($imgFile)) { unlink($imgFile); } // Now we need to see if any resized versions of it exist $retArray = readDirInfo($include_path . "data/images", "file"); foreach ($retArray as $file) { if (stristr($file, str_replace("/", "--", $node->getPath("String")) . "--" . $node->getName())) { // Ok, let's wack it @unlink($include_path . "data/images/" . $file); } } // Now let's get the data and add it to the node $handle = fopen($imgFile, "w"); if (fwrite($handle, $imageData)) { // Ok, let's write it to the backend $node->addMainArt($imgFile); } fclose($handle); // now let's close out $this->closeWindow(true);
$track = new jzMediaTrack($node->getPath('String')); } else { // Now we need to grab the first track as a sample $tracks = $node->getSubNodes("tracks", -1); $track = $tracks[0]; } // Now let's pull the meta data $meta = $track->getMeta(); // Ok, now based on the input file let's create the beginning of the command $extArr = explode(".", $node->getPath('String')); $ext = $extArr[count($extArr) - 1]; // Did they submit the form? if (isset($_POST['edit_dlformat'])) { // Ok, first we need to get ALL the files in the cache dir // And see how big it all is to see if we need to do some cleanup first $retArray = readDirInfo($include_path . "data/resampled", "file"); $size = 0; foreach ($retArray as $track) { // Let's get the total size first $size = $size + round(filesize($include_path . "data/resampled/" . $track) / 1024000); flushdisplay(); } // Now are we too big? if ($size > $resample_cache_size) { // Ok, we'll have to loop through and delete until we get small enough foreach ($retArray as $track) { $size = $size - round(filesize($include_path . "data/resampled/" . $track) / 1024000); @unlink($include_path . "data/resampled/" . $track); flushdisplay(); if ($size < $resample_cache_size) { break;
function userManSettings($purpose, $settings = false, $subaction = false, $post = false) { global $jzSERVICES, $resampleRates, $include_path; $be = new jzBackend(); $display = new jzDisplay(); $url_array = array(); $url_array['action'] = "popup"; $url_array['ptype'] = "usermanager"; if ($subaction === false) { $url_array['subaction'] = "handleclass"; } else { $url_array['subaction'] = $subaction; } // Why PHP pisses me off. foreach ($settings as $k => $v) { if ($v == "true") { $settings[$k] = true; } else { if ($v == "false") { $settings[$k] = false; } else { $settings[$k] = $v; } } } ?> <form method="POST" action="<?php echo urlize($url_array); ?> "> <input type="hidden" name="update_settings" value="true"> <?php if (is_array($post)) { foreach ($post as $p => $v) { echo '<input type="hidden" name="' . $p . '" value="' . $v . '">'; } } ?> <table> <?php if ($purpose != "custom") { ?> <tr><td width="30%" valign="top" align="right"> <?php echo word("Template:"); ?> </td><td width="70%"> <?php if ($purpose == "new") { ?> <input name="classname" class="jz_input"> <?php } else { if ($purpose == "update") { echo '<input type="hidden" name="classname" class="jz_input" value="' . $_POST['classname'] . '">'; echo $_POST['classname']; } } ?> </td></tr><tr><td> </td><td> </td></tr> <?php } ?> <tr> <td width="30%" valign="top" align="right"> <?php echo word("Interface"); ?> : </td> <td width="70%"> <?php $overCode = $display->returnToolTip(word("INTERFACE_NOTE"), word("Default Interface")); ?> <select <?php echo $overCode; ?> name="usr_interface" class="jz_select" style="width:135px;"> <?php // Let's get all the interfaces $retArray = readDirInfo($include_path . "frontend/frontends", "dir"); sort($retArray); for ($i = 0; $i < count($retArray); $i++) { echo '<option '; if ($settings['frontend'] == $retArray[$i]) { echo 'selected '; } echo 'value="' . $retArray[$i] . '">' . $retArray[$i] . '</option>' . "\n"; } ?> </select> </td> </tr> <tr> <td width="30%" valign="top" align="right"> <?php echo word("Theme"); ?> : </td> <td width="70%"> <?php $overCode = $display->returnToolTip(word("THEME_NOTE"), word("Default Theme")); ?> <select <?php echo $overCode; ?> name="usr_theme" class="jz_select" style="width:135px;"> <?php // Let's get all the interfaces $retArray = readDirInfo($include_path . "style", "dir"); sort($retArray); for ($i = 0; $i < count($retArray); $i++) { if ($retArray[$i] == "images") { continue; } echo '<option '; if ($settings['theme'] == $retArray[$i]) { echo 'selected '; } echo 'value="' . $retArray[$i] . '">' . $retArray[$i] . '</option>' . "\n"; } ?> </select> </td> </tr> <tr> <td width="30%" valign="top" align="right"> <?php echo word("Language"); ?> : </td> <td width="70%"> <?php $overCode = $display->returnToolTip(word("LANGUAGE_NOTE"), word("Default Language")); ?> <select <?php echo $overCode; ?> name="usr_language" class="jz_select" style="width:135px;"> <?php // Let's get all the interfaces $languages = getLanguageList(); for ($i = 0; $i < count($languages); $i++) { echo '<option '; if ($languages[$i] == $settings['language']) { echo ' selected '; } echo 'value="' . $languages[$i] . '">' . $languages[$i] . '</option>' . "\n"; } ?> </select> </td> </tr> <tr> <td width="30%" valign="top" align="right"> <?php echo word("Home Directory"); ?> : </td> <td width="70%"> <?php $overCode = $display->returnToolTip(word("HOMEDIR_NOTE"), word("User Home Directory")); ?> <input <?php echo $overCode; ?> type="input" name="home_dir" class="jz_input" value="<?php echo $settings['home_dir']; ?> "> </td> </tr> <tr> <td width="30%" valign="middle" align="right"> <?php echo word("Home Permissions"); ?> : </td> <td width="70%"> <br> <?php $overCode = $display->returnToolTip(word("HOMEREAD_NOTE"), word("Read Home Directory")); $overCode2 = $display->returnToolTip(word("HOMEADMIN_NOTE"), word("Admin Home Directory")); $overCode3 = $display->returnToolTip(word("HOMEUPLOAD_NOTE"), word("Home Directory Upload")); ?> <input <?php echo $overCode; ?> type="checkbox" name="home_read" class="jz_input" <?php if ($settings['home_read'] == true) { echo 'CHECKED'; } ?> > Read only from home directory<br> <input <?php echo $overCode2; ?> type="checkbox" name="home_admin" class="jz_input" <?php if ($settings['home_admin'] == true) { echo 'CHECKED'; } ?> > Home directory admin<br> <input <?php echo $overCode3; ?> type="checkbox" name="home_upload" class="jz_input" <?php if ($settings['home_upload'] == true) { echo 'CHECKED'; } ?> > Upload to home directory <br><br> </td> </tr> <tr> <td width="30%" valign="middle" align="right"> <?php echo word("User Rights"); ?> : </td> <td width="70%"> <?php $overCode = $display->returnToolTip(word("VIEW_NOTE"), word("User can view media")); $overCode2 = $display->returnToolTip(word("STREAM_NOTE"), word("User can stream media")); $overCode3 = $display->returnToolTip(word("LOFI_NOTE"), word("User can access lo-fi tracks")); $overCode4 = $display->returnToolTip(word("DOWNLOAD_NOTE"), word("User can download")); $overCode5 = $display->returnToolTip(word("POWERSEARCH_NOTE"), word("User can power search")); $overCode6 = $display->returnToolTip(word("JUKEBOXQ_NOTE"), word("User can queue jukebox")); $overCode7 = $display->returnToolTip(word("JUKEBOXADMIN_NOTE"), word("User can admin jukebox")); $overCode8 = $display->returnToolTip(word("SITE_NOTE"), word("Site Admin")); $overCode9 = $display->returnToolTip(word("EDIT_NOTE"), word("Edit Preferences")); $overCode10 = $display->returnToolTip(word("FORCE_CLIPS_NOTE"), word("Force clip mode")); ?> <input <?php echo $overCode; ?> type="checkbox" name="view" class="jz_input" <?php if ($settings['view'] == true) { echo 'CHECKED'; } ?> > View <input <?php echo $overCode2; ?> type="checkbox" name="stream" class="jz_input" <?php if ($settings['stream'] == true) { echo 'CHECKED'; } ?> > Stream <input <?php echo $overCode3; ?> type="checkbox" name="lofi" class="jz_input" <?php if ($settings['lofi'] == true) { echo 'CHECKED'; } ?> > Lo-Fi<br> <input <?php echo $overCode4; ?> type="checkbox" name="download" class="jz_input" <?php if ($settings['download'] == true) { echo 'CHECKED'; } ?> > Download <input <?php echo $overCode5; ?> type="checkbox" name="powersearch" class="jz_input" <?php if ($settings['powersearch'] == true) { echo 'CHECKED'; } ?> > Power Search<br> <input <?php echo $overCode6; ?> type="checkbox" name="jukebox_queue" class="jz_input" <?php if ($settings['jukebox_queue'] == true) { echo 'CHECKED'; } ?> > Jukebox Queue <input <?php echo $overCode7; ?> type="checkbox" name="jukebox_admin" class="jz_input" <?php if ($settings['jukebox_admin'] == true) { echo 'CHECKED'; } ?> > Jukebox Admin<br> <input <?php echo $overCode8; ?> type="checkbox" name="admin" class="jz_input" <?php if ($settings['admin'] == true) { echo 'CHECKED'; } ?> > Site Admin <input <?php echo $overCode9; ?> type="checkbox" name="edit_prefs" class="jz_input" <?php if ($settings['edit_prefs'] == true) { echo 'CHECKED'; } ?> > Edit Prefs <input <?php echo $overCode10; ?> type="checkbox" name="force_clips" class="jz_input" <?php if ($settings['force_clips'] == true) { echo 'CHECKED'; } ?> > Clips Only <br><br> </td> </tr> <tr> <td width="30%" valign="top" align="right"> <?php echo word("Playlist Type"); ?> : </td><td width="70%"> <?php $overCode = $display->returnToolTip(word("PLAYLIST_NOTE"), word("Playlist Type")); ?> <select <?php echo $overCode; ?> name="pltype" class="jz_select" style="width:135px;"> <?php $list = $jzSERVICES->getPLTypes(); foreach ($list as $p => $desc) { echo '<option value="' . $p . '"'; if ($p == $settings['playlist_type']) { echo ' selected'; } echo '>' . $desc . '</option>'; } ?> </select></td></tr> <tr> <td width="30%" valign="top" align="right"> <?php echo word("Resample Rate"); ?> : </td> <td width="70%"> <?php $overCode = $display->returnToolTip(word("RESAMPLE_NOTE"), word("Resample Rate")); $overCode2 = $display->returnToolTip(word("LOCK_NOTE"), word("Resample Rate Lock")); ?> <select <?php echo $overCode; ?> name="resample" class="jz_select" style="width:50px;"> <option value="">-</option> <?php // Now let's create all the items based on their settings $reArr = explode("|", $resampleRates); for ($i = 0; $i < count($reArr); $i++) { echo '<option value="' . $reArr[$i] . '"'; if ($settings['resample_rate'] == $reArr[$i]) { echo ' selected'; } echo '>' . $reArr[$i] . '</option>' . "\n"; } ?> </select> <input <?php echo $overCode2; ?> type="checkbox" name="lockresample" class="jz_input" <?php if ($settings['resample_lock'] == true) { echo 'CHECKED'; } ?> > <?php echo word('Locked'); ?> </td> </tr> <tr> <td width="30%" valign="top" align="right"> <?php echo word("External Player"); ?> : </td> <td width="70%"> <?php $overCode = $display->returnToolTip(word("PLAYER_NOTE"), word("External Player")); ?> <select <?php echo $overCode; ?> name="player" class="jz_select" style="width:135px;"> <option value=""> - </option> <?php // Let's get all the interfaces $retArray = readDirInfo($include_path . "services/services/players", "file"); sort($retArray); for ($i = 0; $i < count($retArray); $i++) { if (!stristr($retArray[$i], ".php") and !stristr($retArray[$i], "qt.")) { continue; } $val = substr($retArray[$i], 0, -4); echo '<option value="' . $val . '"'; if ($settings['player'] == $val) { echo ' selected'; } echo '>' . $val . '</option>' . "\n"; } ?> </select> </td> </tr> <tr> <td width="30%" valign="top" align="right"> <?php echo word("Playback Limit"); ?> : </td> <td width="70%"><td></tr><tr><td></td><td> <table><tr><td> <?php echo word("Limit:"); echo '</td><td>'; $overCode = $display->returnToolTip(word("Sets a streaming limit for users based on the size or number of songs played."), word("Playback Limit")); $cap_limit = $settings['cap_limit']; if (isNothing($cap_limit)) { $cap_limit = 0; } ?> <input <?php echo $overCode; ?> name="cap_limit" class="jz_select" style="width:35px;" value="<?php echo $cap_limit; ?> "> </td></tr> <tr><td> <?php echo word("Method:"); echo '</td><td>'; $overCode = $display->returnToolTip(word("Sets the method for limiting playback"), word("Limiting method")); $cap_method = $settings['cap_method']; ?> <select name="cap_method" class="jz_select" <?php echo $overCode; ?> > <option value="size"<?php if ($cap_method == "size") { echo ' selected'; } ?> ><?php echo word('Size (MB)'); ?> </option> <option value="number"<?php if ($cap_method == "number") { echo ' selected'; } ?> ><?php echo word('Number'); ?> </option> </td></tr> <tr><td> <?php echo word("Duration:"); echo '</td><td>'; $overCode = $display->returnToolTip(word("How long the limit lasts, in days."), word("Limit duration")); $cap_duration = $settings['cap_duration']; if (isNothing($cap_duration)) { $cap_duration = 30; } ?> <input <?php echo $overCode; ?> name="cap_duration" class="jz_select" style="width:35px;" value="<?php echo $cap_duration; ?> "> </td></tr> </table> </tr> <tr> <td width="30%" valign="top"> </td> <td width="70%"> <input type="submit" name="handlUpdate" value="<?php echo word("Save"); ?> " class="jz_submit"> </td> </tr> </table> <?php }
?> </select> </td> </tr> <tr> <td width="30%" valign="top" align="right"> <?php echo word("Theme"); ?> : </td> <td width="70%"> <select name="def_theme" class="jz_select" style="width:135px;"> <?php // Let's get all the interfaces $retArray = readDirInfo($include_path . "style", "dir"); sort($retArray); for ($i = 0; $i < count($retArray); $i++) { if ($retArray[$i] == "images") { continue; } echo '<option '; if ($retArray[$i] == $jzUSER->getSetting('theme')) { echo ' selected '; } echo 'value="' . $retArray[$i] . '">' . $retArray[$i] . '</option>' . "\n"; } ?> </select> </td> </tr>
/** * Returns a list of available languages * * @author Ben Dodson, Ross Carlson * @since 11/5/05 * */ function getLanguageList() { global $include_path; $lang_dir = $include_path . "lang"; $retArray = readDirInfo($lang_dir, "file"); sort($retArray); $languages = array(); for ($c = 0; $c < count($retArray); $c++) { $entry = $retArray[$c]; // Let's make sure this isn't the local directory we're looking at if ($entry == "." || $entry == ".." || $entry == "master.php") { continue; } if (!stristr($entry, "-setup") and !stristr($entry, ".html")) { if (strrpos($entry, '-') !== false) { $languages[substr($entry, 0, strrpos($entry, '-'))] = true; } else { $languages[$entry] = true; } } } return array_keys($languages); }
//unset($page_array['subpage']); $this->closeBlock(); return; } if ($_GET['subpage'] == "frontend" && !isset($page_array['set_fe'])) { ?> <form method="POST" action="<?php echo urlize($page_array); ?> "> <select class="jz_select" name="<?php echo jz_encode('set_fe'); ?> ">Frontend: <?php $arr = readDirInfo($include_path . 'frontend/frontends', "dir"); foreach ($arr as $a) { if (file_exists($include_path . "frontend/frontends/{$a}/settings.php")) { echo "<option value=\"" . jz_encode($a) . "\""; if ($a == $my_frontend) { echo ' selected'; } echo ">{$a}</option>"; } } ?> </select> <input type="submit" class="jz_submit" value="<?php echo word('Go'); ?> ">
} if ($allow_player_choice == "true") { ?> <tr> <td width="30%" valign="top" align="right"> <?php echo word("External Player"); ?> : </td> <td width="70%"> <select name="def_player" class="jz_select" style="width:135px;"> <option value=""> - </option> <?php // Let's get all the players $retArray = readDirInfo($include_path . "services/services/players", "file"); sort($retArray); for ($i = 0; $i < count($retArray); $i++) { if (stripos(strrev($retArray[$i]), "php.") !== 0) { continue; } $val = substr($retArray[$i], 0, -4); if ($val == "qt") { continue; } echo '<option '; if ($val == $jzUSER->getSetting('player')) { echo 'selected '; } echo 'value="' . $val . '">' . $val . "</option>\n"; }
if ($dataArray[$i]['name'] != "") { $albumDispName = str_replace("'", "", $dataArray[$i]['name']); $album = $dataArray[$i]['name']; if ($sort_by_year == "true") { if ($dataArray[$i]['year'] != "") { $albumDispName .= " (" . $dataArray[$i]['year'] . ")"; } } $rate_url = $root_dir . '/popup.php?type=discuss&info=' . base64_encode(urlencode($genre) . "/" . urlencode($artist) . "/" . urlencode($album)) . '&cur_theme=' . $_SESSION['cur_theme']; // Now let's see if there is an album image, and if so display it $image = '<img src="' . $image_dir . "discuss.gif" . '">'; if (is_file($web_root . $root_dir . $media_dir . "/" . $genre . "/" . $artist . "/" . $album . "/" . $album . ".jpg") and $show_thumbnails_in_menu == "true") { $image = '<img width="30" src="' . str_replace("%2F", "/", rawurlencode($root_dir . $media_dir . "/" . $genre . "/" . $artist . "/" . $album . "/" . $album . ".jpg")) . '">'; } else { // Now let's see if there is art with a different name $retArray = readDirInfo($web_root . $root_dir . $media_dir . "/" . $genre . "/" . $artist . "/" . $album, "file"); for ($e = 0; $e < count($retArray); $e++) { if (preg_match("/\\.({$ext_graphic})\$/i", $retArray[$e])) { $image = '<img width="30" src="' . str_replace("%2F", "/", rawurlencode($root_dir . $media_dir . "/" . $genre . "/" . $artist . "/" . $album . "/" . $retArray[$e])) . '">'; } } } ?> [_cmNoAction,'<td class="jzMenuItemLeft"><?php echo $image; ?> </td><td class="jzMenuItem"> <em><a target="_blank" onclick="openPopup(this,500,400); return false;" style="font-size: 11px; text-decoration: none;" href="<?php echo $rate_url; ?> "><em><?php echo $albumDispName;
/** * The dropdown for the style selector. * * @author Ben Dodson * @since 3/17/05 * @version 3/17/05 * **/ function styleDropdown() { global $this_page, $root_dir, $web_root, $include_path, $cms_mode; // Not in CMS mode... if ($cms_mode == "true") { return; } ?> <form action="<?php echo $this_page; ?> " method="GET" name="style"> <?php $this->hiddenVariableField('jz_path'); $this->hiddenPageVars(); $this->hiddenVariableField('frontend'); ?> <select class="jz_select" name="<?php echo jz_encode("set_theme"); ?> " style="width:125px" onChange="submit()"> <option value=""><?php echo word("Style"); ?> </option> <?php // Now let's get all the possibles $lang_dir = $web_root . $root_dir . "/style"; $retArray = readDirInfo($lang_dir, "dir"); sort($retArray); for ($c = 0; $c < count($retArray); $c++) { $entry = $retArray[$c]; // Let's make sure this isn't the local directory we're looking at if ($entry == "." || $entry == "..") { continue; } if (!stristr($entry, "images") and !stristr($entry, "cms-theme") and !stristr($entry, "CVS")) { echo '<option value="' . jz_encode(str_replace(".php", "", $entry)) . '">' . str_replace(".php", "", $entry) . '</option>' . "\n"; } } ?> </select> </form> <?php return; ?> <script> function setActiveStyleSheet(title) { var i, a, main; for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { a.disabled = true; if(a.getAttribute("title") == title) a.disabled = false; } } } function selectStyle (vCookieName, vSelection) { //WRITE COOKIE //makeCookie(vCookieName, vSelection, 90, '/'); //ACTIVE SELECTED ALTERNAT STYLE SHEET setActiveStyleSheet(vSelection) } if (document.cookie.indexOf('layout=')!=-1) { css = readCookie('layout'); //ACTIVATE SELECTED STYLE SHEET setActiveStyleSheet(css) } </script> <select class="jz_select" onchange="var v=this.options[this.selectedIndex].value; if (v != '') selectStyle('style', v);" style="width:125px" > <option value=""><?php echo word("Style"); ?> </option> <?php $styles = readDirInfo($include_path . "style", "dir"); foreach ($styles as $style) { echo '<option value="' . $style . '">' . ucwords($style) . '</option>'; } ?> </select> <?php }
echo $form_action; ?> " name="setup2" method="post"> Please select a language to use during installation. You can change to another language once the installer is finished. <br><br> <table width="100%" cellspacing="0" cellpadding="3" border="0"> <tr> <td width="20%" align="left" class="td"> Language: </td> <td width="1"> </td> <td width="80%" align="left"> <?php // Let's get all the possible language files $lang_dir = $include_path . "install/lang/"; $retArray = readDirInfo($lang_dir, "dir"); sort($retArray); $languages = array(); for ($c = 0; $c < count($retArray); $c++) { $entry = $retArray[$c]; // Let's make sure this isn't the local directory we're looking at if ($entry == "." || $entry == ".." || $entry == "master.php") { continue; } if (!stristr($entry, "-setup") and !stristr($entry, ".html")) { if (strrpos($entry, '-') !== false) { $languages[substr($entry, 0, strrpos($entry, '-'))] = true; } else { $languages[$entry] = true; } }