function continueornot() { echo 'Continue? [y/N] '; switch (getline()) { case 'y': case 'Y': break; default: echon('Exiting ... '); die; } }
function doFileBrowse($path, $prefix) { global $connection, $prefs; debuglog("Browsing " . $path, "DIRBROWSER"); $parts = true; $foundfile = false; $filedata = array(); $dircount = 0; fputs($connection, 'lsinfo "' . format_for_mpd($path) . '"' . "\n"); while (!feof($connection) && $parts) { $parts = getline($connection); if (is_array($parts)) { $s = trim($parts[1]); if (substr($s, 0, 1) != ".") { switch ($parts[0]) { case "file": if (!$foundfile) { $foundfile = true; } else { if (!$prefs['ignore_unplayable'] || array_key_exists('Title', $filedata) && substr($filedata['Title'], 0, 12) != "[unplayable]") { printFileItem(getFormatName($filedata), $filedata['file'], $filedata['Time']); } $filedata = array(); } $filedata[$parts[0]] = $parts[1]; break; case "playlist": if ($path != "") { // Ignore playlists located at the root. This is cleaner and makes more sense printPlaylistItem(basename($parts[1]), $parts[1]); } break; case "directory": printDirectoryItem($parts[1], basename($parts[1]), $prefix, $dircount, false); $dircount++; break; case "Title": case "Time": case "Artist": case "Album": $filedata[$parts[0]] = $parts[1]; break; } } } } if (array_key_exists('file', $filedata)) { if (!$prefs['ignore_unplayable'] || array_key_exists('Title', $filedata) && substr($filedata['Title'], 0, 12) != "[unplayable]") { printFileItem(getFormatName($filedata), $filedata['file'], $filedata['Time']); } } }
print " <a href='$update_versions[$v]'>$v</a>"; } } */ print "</p>"; print "<form method='POST'>\n\t\t\t<input type='hidden' name='op' value='do'>\n\t\t\t<input type='submit' onclick='return confirmOP()' value='" . __("Perform updates") . "'>\n\t\t\t</form>"; } else { if ($op == "do") { print "<p>" . __("Performing updates...") . "</p>"; $num_updates = 0; foreach (array_keys($update_versions) as $v) { if ($v == $version + 1) { print "<p>" . T_sprintf("Updating to version %d...", $v) . "</p>"; $fp = fopen($update_versions[$v], "r"); if ($fp) { while (!feof($fp)) { $query = trim(getline($fp, ";")); if ($query != "") { print "<p class='query'>{$query}</p>"; db_query($link, $query); } } } fclose($fp); print "<p>" . __("Checking version... "); $result = db_query($link, "SELECT schema_version FROM ttirc_version"); $version = db_fetch_result($result, 0, "schema_version"); if ($version == $v) { print __("OK!"); } else { print "<b>" . __("ERROR!") . "</b>"; return;
function do_oauth_token($appkey) { echo <<<EOF In the next step, you'll have to grab the access_token generated by Baidu. You can check out this link for more information on this procedure. http://developer.baidu.com/wiki/index.php?title=docs/pcs/guide/usage_example Easy Guide: 1. Visit https://openapi.baidu.com/oauth/2.0/authorize?response_type=token&client_id={$appkey}&redirect_uri=oob&scope=netdisk 2. After the page is being redirected (it should show something like OAuth 2.0), copy the current URL to your favorite text editor. 3. Grab the access_token part, take only the part between "access_token=" and the next "&" symbol (without quotes). 4. Copy it and paste here, then press Enter. EOF; echo 'access_token[] : '; $access_token = getline(); return $access_token; }
)</font></p></TD> </TR></TABLE></TR></TABLE> <!-- Start --> <?php if (empty($page)) { $page = 1; } $start = ($page - 1) * $admin[page] + 1; if ($page != 1) { for ($i = 1; $i < $start; $i++) { $trash = fgets($data, 5000); } } $end = $start + $admin[page]; for ($i = $start; $i < $end; $i++) { $line = getline($data); if ($line != "") { output($line, $i); } } ?> <!-- ended --> <table border="0" width="100%" height="1" cellpadding="0"> <tr><td width="100%" height="1"><p align="center"><font color="#004080"> <br> 页数: <?php for ($i = 0; $i < $num / $admin[page]; $i++) { $j = $i + 1; echo "<a href={$PHP_SELF}?user={$user}&page={$j}><font color = #8080FF>["; echo $j; echo "]</font></a> ";
function getDirItems($path) { global $connection, $is_connected; debuglog("Getting Directory Items For " . $path, "GIBBONS", 5); $items = array(); $parts = true; $lines = array(); fputs($connection, 'lsinfo "' . format_for_mpd($path) . '"' . "\n"); // We have to read in the entire response then go through it // because we only have the one connection to mpd so this function // is not strictly re-entrant and recursing doesn't work unless we do this. while (!feof($connection) && $parts) { $parts = getline($connection); if ($parts === false) { debuglog("Got OK or ACK from MPD", "DIRBROWSER", 8); } else { $lines[] = $parts; } } foreach ($lines as $parts) { if (is_array($parts)) { $s = trim($parts[1]); if (substr($s, 0, 1) != ".") { $fullpath = ltrim($path . '/' . $s, '/'); switch ($parts[0]) { case "file": $items[] = $fullpath; break; case "directory": $items = array_merge($items, getDirItems($fullpath)); break; } } } } return $items; }