break; case "playlist": // Now let's set the clip mode setGlobal('CLIP_MODE', $_GET['clips']); writeLogData("messages", "Index: Generating playlists"); if ($jzUSER->getSetting('stream') === false && $jzUSER->getSetting('lofi') === false && $jzUSER->getSetting('jukebox_queue') === false) { exit; } if (isset($_GET['type']) && $_GET['type'] == "playlist") { // TODO: could pass the ID as a paramater and not automatically update the session variable. $pid = false; if (isset($_GET['jz_pl_id'])) { $pid = $_GET['jz_pl_id']; } if (isset($_GET['plowner'])) { $u = new jzUser(false, $_GET['plowner']); $pl = $u->loadPlaylist($pid); } else { $pl = $jzUSER->loadPlaylist($pid); } if ($_GET['mode'] == "random") { $pl = $pl->getSmartPlaylist(); } $pl->play(); } else { if (isset($_GET['type']) && $_GET['type'] == "track") { // send file directly if method == direct. // otherwise send a playlist. // TODO: if method = direct, do things like update playcount. // and also validate user (pass username / md5(password) in URL) $el =& new jzMediaTrack($_GET['jz_path']);
$url_array['subaction'] = "handleuser"; if (!isset($_POST['user_to_edit'])) { $url_array['usermethod'] = "add"; $edit_guest = false; $mid = $jzUSER->lookupUID(NOBODY); } else { $url_array['usermethod'] = "update"; if ($_POST['user_to_edit'] == $jzUSER->lookupUID(NOBODY)) { $edit_guest = true; $mid = $_POST['user_to_edit']; } else { $edit_guest = false; $mid = $_POST['user_to_edit']; } } $jzUSER2 = new jzUser(false, $mid); if ($_GET['subaction'] == "adduser") { // set some settings manually. $jzUSER2->settings['view'] = true; $jzUSER2->settings['stream'] = true; $jzUSER2->settings['lofi'] = true; } echo '<form action="' . urlize($url_array) . '" method="POST">'; if (isset($_POST['user_to_edit'])) { echo '<input type="hidden" name="user_to_edit" value="' . $_POST['user_to_edit'] . '">'; } ?> <input type="hidden" name="update_settings" value="true"> <table width="100%" cellpadding="3"> <?php if ($edit_guest === false) {
$cms_mode = "false"; $backend = ""; $jz_lang_file = ""; $skin = ""; $my_frontend = ""; include_once 'system.php'; include_once 'settings.php'; include_once 'backend/backend.php'; include_once 'playlists/playlists.php'; include_once 'lib/general.lib.php'; include_once 'lib/jzcomp.lib.php'; include_once 'services/class.php'; include_once 'frontend/display.php'; $this_page = setThisPage(); // Let's create our user object for later $jzUSER = new jzUser(); if (isset($_GET['user']) && isset($_GET['pass'])) { $store_cookie = true; // Are they ok? if ($jzUSER->login($_GET['user'], $_GET['pass'], $store_cookie, false) === false) { echo "login failed"; exit; } } // Let's make sure this user has the right permissions if ($jzUSER->getSetting("view") === false) { echo "must log in (user=x&pass=y)"; exit; } // Let's create our services object // This object lets us do things like get metadata, resize images, get lyrics, etc
function userAuthenticate($username) { global $this_site, $web_root, $root_dir, $media_dir, $cms_user_access, $default_access, $include_path, $jzUSER; // Now let's authenticate this user $jzUSER = new jzUser(); if ($username == "anonymous") { $username = NOBODY; } return $jzUSER->login($username, "cms-user", false); }
foreach ($vArr as $item) { // Now let's split that out $iArr = explode("=", $item); // Now let's set the variables $_GET[$iArr[0]] = $iArr[1]; } } // Let's clean up the get vars $_GET = unurlize($_GET); // Let's get the user ID $uid = isset($_GET['jz_user']) ? $_GET['jz_user'] : false; if (false === $uid || $uid == "") { exit; } // Let's setup the new user $jzUSER = new jzUser(false, $uid); // ACTIONS: // play [for on-the-fly, basic playlist generation] // -path // -limit (default max_playlist_length) // -type (specify the type of the path: track|node|playlist; default is to assume node.) // -resample (NOT IMPLEMENTED) // // download [downloading tracks/nodes/playlist] (NOT IMPLEMENTED) // -path // -type (is this a track or a node? default: assume node.) // -playlist (if this is set, ignore path) // // image [for displaying images; this makes it possible for images to not be in the webroot] // -path (image path) //
/** * Universal Constructor for a jzMediaElement * * @author Ben Dodson * @version 5/13/04 * @since 5/13/04 */ function _constructor($arg = array(), $mode) { global $backend, $include_path, $jzUSER; if (!isset($jzUSER)) { $jzUSER = new jzUser(false); $remove_user = true; } else { $remove_user = false; } $this->data_dir = $include_path . "data/{$backend}"; if ($mode == "filename") { $arg = $this->filenameToPath($arg); } else { if ($mode != "path") { $arg = $this->idToPath($arg); } } if (is_string($arg)) { // make sure it's well formatted. if ($arg != "") { if ($arg[0] == "/") { $arg = substr($arg, 1); } if ($arg[strlen($arg) - 1] == "/") { $arg = substr($arg, 0, strlen($arg) - 1); } } // root? if ($arg == "") { $dir = $jzUSER->getSetting('home_dir'); if ($dir === false || $jzUSER->getSetting('home_read') === false) { $this->path = array(); $this->name = ""; } else { $this->path = explode("/", $dir); $this->name = $this->path[sizeof($this->path) - 1]; } } else { $arrayize = explode("/", $arg); $this->path = $arrayize; $this->name = $arrayize[sizeof($arrayize) - 1]; } } else { if ($arg == array()) { $dir = $jzUSER->getSetting('home_dir'); if ($dir === false || $jzUSER->getSetting('home_read') === false) { $this->path = array(); $this->name = ""; } else { $this->path = explode("/", $dir); $this->name = $this->path[sizeof($this->path) - 1]; } } else { $this->name = $arg[sizeof($arg) - 1]; $this->path = $arg; } } if ($remove_user) { unset($jzUSER); } }
$classes = array(); $settings = array(); $settings['ratingweight'] = 1; $settings['stream'] = "true"; $settings['view'] = "true"; $settings['lofi'] = "true"; $settings['download'] = "true"; $settings['discuss'] = "true"; $settings['powersearch'] = "true"; $settings['edit_prefs'] = "true"; $settings['frontend'] = $_POST['frontend']; $settings['theme'] = $_POST['style']; $settings['language'] = $_POST['jz_lang_file']; $classes[word('Standard')] = $settings; $be->storeData('userclasses', $classes); $jzUSER = new jzUser(false); $ausr = stripSlashes($_POST['admin_user']); $apass = stripSlashes($_POST['admin_pass']); if (($id = $jzUSER->lookupUID('NOBODY')) !== false) { $settings = array(); $settings['edit_prefs'] = "false"; switch ($_POST['default_access']) { case "noaccess": $settings['ratingweight'] = 0; $settings['stream'] = "false"; $settings['view'] = "false"; $settings['lofi'] = "false"; $settings['download'] = "false"; break; case "viewonly": $settings['ratingweight'] = 0;
$skin = "slick"; $image_dir = $root_dir . "/style/{$skin}/"; include_once 'frontend/display.php'; include_once 'frontend/blocks.php'; include_once 'frontend/icons.lib.php'; include_once 'frontend/frontends/slick/blocks.php'; include_once 'frontend/frontends/slick/settings.php'; $this_page = setThisPage(); $enable_page_caching = "false"; url_alias(); // see this method for persistent vars $api_page = get_base_url(); // Clean up input variables $_REQUEST = unurlize($_REQUEST); // Let's create our user object for later $jzUSER = new jzUser(); // Let's create our services object // This object lets us do things like get metadata, resize images, get lyrics, etc $jzSERVICES = new jzServices(); $jzSERVICES->loadStandardServices(); $blocks = new jzBlocks(); $display = new jzDisplay(); $jz_path = $_REQUEST['jz_path']; $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 0; $params = array(); $params['limit'] = $limit; if (empty($_REQUEST['request']) && (isset($_REQUEST['query']) || isset($_REQUEST['search']))) { $_REQUEST['request'] = 'search'; } // Non authenticated API requests. switch ($_REQUEST['request']) {
$mid = $_POST['user_to_edit']; } else { $edit_guest = false; $mid = $_POST['user_to_edit']; } } if (isset($http_auth_enable) && $http_auth_enable == "true") { $edit_pwd = false; } else { if ($cms_mode == "false") { $edit_pwd = true; } else { $edit_pwd = false; } } $jzUSER2 = new jzUser(false, $mid); if ($_GET['subaction'] == "adduser") { // set some settings manually. $jzUSER2->settings['view'] = true; $jzUSER2->settings['stream'] = true; $jzUSER2->settings['lofi'] = true; } echo '<form action="' . urlize($url_array) . '" method="POST">'; if (isset($_POST['user_to_edit'])) { echo '<input type="hidden" name="user_to_edit" value="' . $_POST['user_to_edit'] . '">'; } ?> <input type="hidden" name="update_settings" value="true"> <table width="100%" cellpadding="3"> <?php if ($edit_guest === false) {
/** * Draws the registration page * * @author Ben Dodson <*****@*****.**> * @version 3/11/05 * @since 3/11/05 */ function registrationPage() { $display =& new jzDisplay(); $be = new jzBackend(); $display->preHeader('Register', $this->width, $this->align); $urla = array(); if (isset($_POST['field5'])) { $user = new jzUser(false); if (strlen($_POST['field1']) == 0 || strlen($_POST['field2']) == 0 || strlen($_POST['field3']) == 0 || strlen($_POST['field4']) == 0 || strlen($_POST['field5']) == 0) { echo "All fields are required.<br>"; } else { if ($_POST['field2'] != $_POST['field3']) { echo "The passwords do not match.<br>"; } else { if (($id = $user->addUser($_POST['field1'], $_POST['field2'])) === false) { echo "Sorry, this username already exists.<br>"; } else { // success! $stuff = $be->loadData('registration'); $classes = $be->loadData('userclasses'); $settings = $classes[$stuff['classname']]; $settings['fullname'] = $_POST['field4']; $settings['email'] = $_POST['field5']; $un = $_POST['field1']; $settings['home_dir'] = str_replace('USERNAME', $un, $settings['home_dir']); $user->setSettings($settings, $id); echo "Your account has been created. Click <a href=\"" . urlize($urla); echo "\">here</a> to login."; $this->footer(); return; } } } } ?> <form method="POST" action="<?php echo urlize($urla); ?> "> <input type="hidden" name="<?php echo jz_encode('action'); ?> " value="<?php echo jz_encode('login'); ?> "> <input type="hidden" name="<?php echo jz_encode('self_register'); ?> " value="<?php echo jz_encode('true'); ?> "> <table width="100%" cellpadding="5" style="padding:5px;" cellspacing="0" border="0"> <tr> <td width="50%" align="right"><font size="2"> <?php echo word("Username"); ?> </font></td><td width="50%"> <input type="text" class="jz_input" name="field1" value="<?php echo $_POST['field1']; ?> "> </td></tr> <tr><td width="50%" align="right"><font size="2"> <?php echo word("Password"); ?> </font></td> <td width="50%"> <input type="password" class="jz_input" name="field2" value="<?php echo $_POST['field2']; ?> "></td></tr> <tr><td width="50%" align="right"><font size="2"> </td> <td width="50%"> <input type="password" class="jz_input" name="field3" value="<?php echo $_POST['field3']; ?> "></td></tr> <tr><td width="50%" align="right"><font size="2"> <?php echo word("Full name"); ?> </font></td><td width="50%"> <input type="text" class="jz_input" name="field4" value="<?php echo $_POST['field4']; ?> "> </td></tr> <tr><td width="50%" align="right"><font size="2"> <?php echo word("Email"); ?> </font></td><td width="50%"> <input type="text" class="jz_input" name="field5" value="<?php echo $_POST['field5']; ?> "> </td></tr> <tr><td width="100%" colspan="2" align="center"> <input class="jz_submit" type="submit" name="<?php echo jz_encode('submit_login'); ?> " value="<?php echo word("Register"); ?> "> </td></tr></table><br> </form> <?php $this->footer(); }