function i18n($key) { global $sys; $translate_query = $sys->db->query("SELECT * FROM translations WHERE lang='" . $sys->allowed_langs['lang'] . "' AND key_string='" . $key . "'"); $translate = $sys->db->fetch_array($translate_query); if ($translate['value']) { $translate = $translate['value']; } else { $translate_query = $sys->db->query("SELECT * FROM translations WHERE lang='" . getSystemSetting('standard_lang') . "' AND key_string='" . $key . "'"); $translate = $sys->db->fetch_array($translate_query); $translate = $translate['value']; } return htmlentities($translate); }
function art_query($artist, $album) { $amazon_api_id = getSystemSetting("amazonid"); if (!empty($amazon_api_id)) { $album = preg_replace('!\\(.+\\)!', '', $album); $theq = "{$artist}, {$album}"; $query = urlencode($theq); $file = "http://xml.amazon.com/onca/xml3?t=blah&dev-t="; $file .= $amazon_api_id; $file .= "&mode=music&type=lite&page=1&f=xml&KeywordSearch="; $file .= $query; $fp = fopen($file, "r"); $contentStart = fread($fp, 200000); $content = ereg_replace("<?xml.*\">.*<ProductInfo.*\">", "", $contentStart); $items = explode("</Details>", $content); $maxlinks2 = "1"; for ($i = 0; $i < $maxlinks2; $i++) { //$artSmall = ereg_replace(".*<ImageUrlSmall>","",$items[$i]); //$artSmall = ereg_replace("</ImageUrlSmall>.*","",$artSmall); $artMedium = ereg_replace(".*<ImageUrlMedium>", "", $items[$i]); $artMedium = ereg_replace("</ImageUrlMedium>.*", "", $artMedium); //$artLarge = ereg_replace(".*<ImageUrlLarge>","",$items[$i]); //$artLarge = ereg_replace("</ImageUrlLarge>.*","",$artLarge); if (strstr($artMedium, "amazon.com") == true) { //$small_size = getimagesize($artSmall); //if($small_size[0] > 2) { $small_okay = "yes"; } else { $small_okay = "no"; } /* $medium_size = getimagesize($artMedium); if($medium_size[0] > 2) { $medium_okay = "yes"; } else { $medium_okay = "no"; } $large_size = getimagesize($artLarge); if($large_size[0] > 2) { $large_okay = "yes"; } else { $large_okay = "no"; } */ //return $artSmall; return $artMedium; } else { return ''; } } } else { return ''; } }
} exec(getSystemSetting("phpbin") . " includes/play.php 3 {$id} > /dev/null 2>&1 &"); } elseif ($_SERVER['argv'][1] == 2) { $query = "SELECT song_id,filename FROM mp3act_songs WHERE album_id=" . $_SERVER['argv'][3] . " ORDER BY track"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { updateNumPlays($row['song_id'], 0, $_SERVER['argv'][2]); setCurrentSong($row['song_id'], 0); playLocal($row['filename']); } $query = "DELETE FROM mp3act_currentsong"; mysql_query($query); if (file_exists("/tmp/mp3act")) { unlink("/tmp/mp3act"); } exec(getSystemSetting("phpbin") . " includes/play.php 3 {$id} > /dev/null 2>&1 &"); } elseif ($_SERVER['argv'][1] == 3) { $pl_id = $_SERVER['argv'][2]; $where = ''; $query = "SELECT mp3act_songs.filename,mp3act_playlist.* FROM mp3act_playlist,mp3act_songs WHERE mp3act_songs.song_id=mp3act_playlist.song_id AND mp3act_playlist.private=0"; $query2 = " ORDER BY mp3act_playlist.pl_id LIMIT 1"; while (1) { if ($pl_id != '' && $pl_id != 0) { $where = " AND mp3act_playlist.pl_id>{$pl_id}"; } $newquery = $query . $where . $query2; $result = mysql_query($newquery); if (mysql_num_rows($result) == 0) { $query = "DELETE FROM mp3act_currentsong"; mysql_query($query); if (file_exists("/tmp/mp3act")) {
/* USER-CLASS */ require_once INC . 'class_user.php'; $user = new User(); $sys->user =& $user; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //include core-functions require INC . 'functions.php'; include TPL_PLUGIN_DIR . 'functions_' . THIS_SCRIPT . '.php'; //Translation: $cookie = $sys->db->escape_string($_COOKIE['locale']); if (isset($cookie)) { $cookiequery = $sys->db->query("SELECT * FROM locales WHERE locale='" . $cookie . "'"); $cookie_num = $sys->db->num_rows($cookiequery); if ($cookie_num > 0) { $sys->allowed_langs =& $sys->db->fetch_array($cookiequery); setlocale(LC_ALL, $sys->allowed_langs['locale']); } } else { $langs = getBrowserLangs(); foreach ($langs as $i => $lang) { $langquery = $sys->db->query("SELECT * FROM locales WHERE lang='" . $lang . "'"); $sys->allowed_langs =& $sys->db->fetch_array($langquery); if ($sys->allowed_langs) { setlocale(LC_ALL, $sys->allowed_langs['locale']); break; } } } if (!$sys->allowed_langs) { $sys->allowed_langs = array('locale' => getSystemSetting('standard_locale')); }
function stream($id, $rate = 0, $stereo = "s", $user = '', $ip = '') { grammafone_connect(); // check to see if IP is in the verified IP DB for that user if (verifyIP($user, $ip)) { //$query="SELECT filename,size,length FROM grammafone_songs WHERE song_id=$id"; $query = "SELECT grammafone_artists.artist_name, \n\t\tgrammafone_songs.name,\n\t\tgrammafone_songs.bitrate, \n\t\tgrammafone_songs.length as length, \n\t\tgrammafone_songs.filename as filename, \n\t\tgrammafone_songs.size as size \n\t\tFROM grammafone_songs,grammafone_artists \n\t\tWHERE grammafone_songs.song_id={$id} \n\t\tAND grammafone_artists.artist_id=grammafone_songs.artist_id"; $result = mysql_query($query); $row = mysql_fetch_array($result); fb($row); updateNumPlays($id, 0, $user, 'player'); clearstatcache(); // flush buffer $file['name'] = basename($row['filename']); $mp3out = ''; if (getSystemSetting("lamebin") != "" && $rate != 0) { $row['size'] = ($row['length'] + 1) * $rate * 1000 / 8; $mp3out = getSystemSetting("lamebin") . " -b {$rate} -s {$stereo} --silent --nores --mp3input -h \"" . addslashes($row['filename']) . "\" -"; } else { $mp3out = stripslashes($row['filename']); } $size = $row['size']; $mode = getSystemSetting("sample_mode"); if ($mode == 1) { $size = floor($row['size'] / 4); } header("Content-Type: audio/mpeg"); header("Content-Length: {$size}"); header("Content-Disposition: filename={$row['artist_name']} - {$row['name']}"); header('X-Pad: avoid browser bug'); header('Cache-Control: no-cache'); session_write_close(); // Run the command, and read back the results at the bitrate size + 1K. $blocksize = $row['bitrate'] * 1024 + 1024; $totaldata = 0; if ($rate != 0 && $mode == 1) { $temp = @popen($mp3out, "r"); while (($data = @fread($temp, $blocksize)) && $totaldata <= $size) { echo $data; $totaldata += $blocksize; } pclose($temp); } elseif ($rate != 0) { $temp = @popen($mp3out, "r"); while ($data = @fread($temp, $blocksize)) { echo $data; } pclose($temp); } elseif ($mode == 1) { $temp = @fopen($mp3out, "r"); while (!feof($temp) && $totaldata <= $size) { $data = @fread($temp, $blocksize); echo $data; $totaldata += $blocksize; } fclose($temp); } else { $temp = @fopen($mp3out, "r"); while (!feof($temp)) { $data = @fread($temp, $blocksize); echo $data; } fclose($temp); } } // end IF for verify IP exit; }
<script src="includes/effects.js" type="text/javascript"></script> <script src="includes/dragdrop.js" type="text/javascript"></script> <script src="includes/controls.js" type="text/javascript"></script> </head> <body> <div id="topinfo"> <div class="right">logged in as <?php echo "{$_SESSION['sess_firstname']} {$_SESSION['sess_lastname']}"; ?> [<a href="login.php?logout=1" title="Logout of mp[3]act">logout</a> | <a href="#" onclick="switchPage('prefs'); return false;" title="Set Your User Preferences">my account</a>]</div> <strong>mp3act music system v<?php echo getSystemSetting("version"); ?> </strong> <?php if (getSystemSetting("mp3bin") != "") { ?> [<a href="#" onclick="switchMode('streaming'); return false;" title="Switch to Streaming Mode">stream</a> | <a href="#" onclick="switchMode('jukebox'); return false;" title="Switch to Jukebox Mode">jukebox</a>]<?php } ?> </div> <div id="wrap"> <div id="header"> <div id="controls"> </div> <h1 id="pagetitle"></h1> <ul id="nav"> <li><a href="#" id="search" onclick="switchPage('search'); return false;" title="Search the Music Database">Search</a></li> <li><a href="#" id="browse" onclick="switchPage('browse'); return false;" title="Browse the Music Database" class="c">Browse</a></li>
</script> <script type="text/javascript" src="includes/mp3act_js.js"></script> <script type="text/javascript" src="includes/fat.js"></script> </head> <body> <div id="topinfo"> <div class="right">logged in as <?php echo "{$_SESSION['sess_firstname']} {$_SESSION['sess_lastname']}"; ?> [<a href="login.php?logout=1" title="Logout of mp[3]act">logout</a> | <a href="#" onclick="switchPage('prefs'); return false;" title="Set Your User Preferences">my account</a>]</div> <strong>mp3act music system v<?php echo getSystemSetting("version"); ?> </strong> <?php if ((getSystemSetting("mp3bin") != "" || getSystemSetting("jukemode") == "mpd") && accessLevel(7)) { ?> [<a href="#" onclick="switchMode('streaming'); return false;" title="Switch to Streaming Mode">stream</a> | <a href="#" onclick="switchMode('jukebox'); return false;" title="Switch to Jukebox Mode">jukebox</a>]<?php } ?> </div> <div id="wrap"> <div id="header"> <div id="controls"> </div> <h1 id="pagetitle"></h1> <ul id="nav"> <li><a href="#" id="search" onclick="switchPage('search'); return false;" title="Search the Music Database">Search</a></li> <li><a href="#" id="browse" onclick="switchPage('browse'); return false;" title="Browse the Music Database" class="c">Browse</a></li>
$query = "INSERT INTO mp3act_logins VALUES (NULL,{$userinfo['user_id']},\"{$time}\",\"{$md5time}\")"; mysql_query($query); } header("Location: index.php"); } else { $badlogin = 1; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title><?php echo $GLOBALS['server_title'] . " " . getSystemSetting("version"); ?> | Login</title> <link rel="Stylesheet" href="css/grammafone_css.php" type="text/css" /> </head> <body onload="document.login.username.focus()"> <div class="login"> <form name="login" action="login.php" method="post"> <div class="loginbox"> <div id="header"><h1>mp3act Login</h1>
function art_query($artist, $album) { $album = preg_replace('!\\(.+\\)!', '', $album); $theq = "{$artist}, {$album}"; $query = urlencode($theq); $amazonKey = getSystemSetting("amazonid"); $Operation = "ItemSearch"; $Version = "2007-07-16"; $ResponseGroup = "ItemAttributes,Images"; $request = "http://ecs.amazonaws.com/onca/xml" . "?Service=AWSECommerceService" . "&AWSAccessKeyId=" . $amazonKey . "&Operation=" . $Operation . "&Version=" . $Version . "&SearchIndex=Music" . "&Keywords=" . $query . "&ResponseGroup=" . $ResponseGroup; logger($request . "\n"); $response = file_get_the_contents($request); $parsed_xml = simplexml_load_string($response); if (isset($parsed_xml->OperationRequest->Errors->Error) || isset($parsed_xml->Items->Request->Errors)) { logger("Artwork lookup failed"); return null; } else { return $parsed_xml->Items->Item[0]->MediumImage->URL; } }
} */ if (empty($_POST['first_name']) || empty($_POST['last_name']) || empty($_POST['email']) || empty($_POST['email2']) || empty($_POST['password']) || $_POST['gender'] == "-1" || $_POST['birth_day'] == "-1" || $_POST['birth_month'] == "-1" || $_POST['birth_year'] == "-1") { $message = i18n('all_fields_required'); } if ($_POST['email'] != $_POST['email2']) { $message = i18n('email_adresses_not_equal'); } if (is_numeric($_POST['gender']) && is_numeric($_POST['birth_day']) && is_numeric($_POST['birth_month']) && is_numeric($_POST['birth_year'])) { $first_name = $sys->db->escape_string($_POST['first_name']); $last_name = $sys->db->escape_string($_POST['last_name']); $birth = $sys->db->escape_string($_POST['birth_year'] . "-" . $_POST['birth_month'] . "-" . $_POST['birth_day']); $locale = $sys->db->escape_string($sys->allowed_langs['locale']); $registered = time(); $email = $sys->db->escape_string($_POST['email']); $md5 = md5($_POST['password']); $usergroup = $sys->db->escape_string(getSystemSetting("standard_newuser_group")); $sys->db->query("INSERT INTO users (first_name, last_name, birth, locale, registered, email, md5, group_id) VALUES ('" . $first_name . "', '" . $last_name . "', '" . $birth . "', '" . $locale . "', '" . $registered . "', '" . $email . "', '" . $md5 . "', '" . $usergroup . "') "); } else { $message = i18n('your_registration_couldnt_be_processed'); } } //$publickey = "6LdB-80SAAAAAKwIc13Sfm1CptTWaPm3xAUMi0J-"; $sys->tpl->assign("first_name", i18n("first_name")); $sys->tpl->assign("new_password", i18n("new_password")); $sys->tpl->assign("last_name", i18n("last_name")); $sys->tpl->assign("your_email", i18n("your_email")); $sys->tpl->assign("re-enter_email", i18n("re-enter_email")); $sys->tpl->assign("i_am", i18n("i_am")); $sys->tpl->assign("birthday", i18n("birthday")); $sys->tpl->assign("register", i18n("register")); $sys->tpl->assign("male", i18n("male"));
document.getElementById("password").value = ""; document.getElementById("password2").value = ""; return false; } } </script> </head> <body> <?php $email = ''; if (isset($_POST['register']['email'])) { $email = $_POST['register']['email']; } $invite_mode = getSystemSetting("invite_mode"); if ($invite_mode == 1) { if (isset($_GET['invite'])) { $email = checkInviteCode($_GET['invite']); } } ?> <div class="login"> <form name="newuser" id="newuser" action="register.php" onsubmit="return validator()" method="post"> <div class="loginbox"> <div id="header"><h1>Register mp3act User</h1>
<?php session_start(); //defines which area this is; e.g. if this is the main-page or the admin-panel define('THIS_AREA', 'MainPanel'); //gets the current script-directory and defines a constant with them define('CWD', dirname(__FILE__)); //Set constant for our Includes-Dir to the absolute includes-path define('INC', CWD . '/include/'); //include the initialization-script require_once INC . 'init.php'; $sys->tpl->assign('title', getSystemSetting('title'));