function audiobook_form(){ $Torrent = $this->Torrent; ?> <table cellpadding="3" cellspacing="1" border="0" class="border slice" width="100%"> <tr id="title_tr"> <td class="label">Artist - Title</td> <td> <input type="text" id="title" name="title" size="60" value="<?php echo display_str($Torrent['Title']); ?> " /> <p class="min_padding">Should only include the artist if applicable</p> </td> </tr> <tr id="year_tr"> <td class="label">Year</td> <td> <input type="text" id="year" name="year" size="5" value="<?php echo display_str($Torrent['Year']); ?> " /> </td> </tr> <tr> <td class="label">Format</td> <td> <select name="format" onchange="Format()"> <option>---</option> <? foreach(display_array($this->Formats) as $Format){ echo "<option value='$Format'"; if($Format == $Torrent['Format']){ echo " selected='selected'"; } echo ">"; echo $Format; echo "</option>\n"; } ?> </select> </td> </tr> <tr> <td class="label">Bitrate</td> <td> <select id="bitrate" name="bitrate" onchange="Bitrate()"> <option>---</option> <? if($Torrent['Bitrate'] && array_search($Torrent['Bitrate'], $this->Bitrates) != false){ $OtherBitrate = true; } else { $OtherBitrate = false; } foreach(display_array($this->Bitrates) as $Bitrate){ echo "<option value='$Bitrate'"; if($Bitrate == $Torrent['Bitrate']){ echo " selected='selected'"; } echo ">"; echo $Bitrate; echo "</option>\n"; } ?> </select> <span id="other_bitrate_span"<? if(!$OtherBitrate){ echo ' class="hidden"'; } ?> > <input type="text" name="other_bitrate" size="5" id="other_bitrate"<? if($OtherBitrate){ echo " value='".display_str($Torrent['Encoding'])."'";} ?> onchange="AltBitrate()" /> <? if($this->NewTorrent){ ?> <input type="checkbox" id="vbr" name="vbr" /> (VBR) <? } ?> </span> </td> </tr> <? if($this->NewTorrent){ ?> <tr> <td class="label">Tags</td> <td> <input type="text" id="tags" name="tags" size="60" value="<?php echo display_str($Torrent['TagList']); ?> " /> </td> </tr> <tr> <td class="label">Description</td> <td> <textarea name="album_desc" id="album_desc" cols="60" rows="8"><?php echo display_str($Torrent['GroupDescription']); ?> </textarea> <p class="min_padding">Contains information like the track listing, and maybe a review.</p> </td> </tr> <? }?> <tr> <td class="label">Release Description (optional)</td> <td> <textarea name="release_desc" id="release_desc" cols="60" rows="8"><?php echo display_str($Torrent['TorrentDescription']); ?> </textarea> <p class="min_padding">Contains information like encoder settings, and/or a log of the ripping process.</p> </td> </tr> </table> <? }//function audiobook_form
t.Encoding, t.Size, t.HasLog, t.LogScore, t.UserID AS UploaderID, uploader.Username FROM torrents AS t LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1' LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID WHERE t.ID='$ExtraID' GROUP BY tg.ID"); list($ExtraGroupName, $ExtraGroupID, $ExtraArtistID, $ExtraArtistName, $ExtraYear, $ExtraTime, $ExtraRemastered, $ExtraRemasterTitle, $ExtraRemasterYear, $ExtraMedia, $ExtraFormat, $ExtraEncoding, $ExtraSize, $ExtraHasLog, $ExtraLogScore, $ExtraUploaderID, $ExtraUploaderName) = display_array($DB->next_record()); if($ExtraGroupName) { if ($ArtistID == 0 && empty($ArtistName)) { $ExtraLinkName = "<a href='torrents.php?id=$ExtraGroupID'>$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")."</a> <a href='torrents.php?torrentid=$ExtraID'> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : "")."</a> ".($ExtraHasLog == '1' ? " <a href='torrents.php?action=viewlog&torrentid=$ExtraID&groupid=$ExtraGroupID'>(Log: $ExtraLogScore %)</a>" : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)"; } elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') { $ExtraLinkName = "Various Artists - <a href='torrents.php?id=$ExtraGroupID'>$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")."</a> <a href='torrents.php?torrentid=$ExtraID'> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : "")."</a> ".($ExtraHasLog == '1' ? " <a href='torrents.php?action=viewlog&torrentid=$ExtraID&groupid=$ExtraGroupID'>(Log: $ExtraLogScore %)</a>" : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)"; } else { $ExtraLinkName = "<a href='artist.php?id=$ExtraArtistID'>$ExtraArtistName</a> - <a href='torrents.php?id=$ExtraGroupID'>$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")."</a> <a href='torrents.php?torrentid=$ExtraID'> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : "")."</a> ".($ExtraHasLog == '1' ? " <a href='torrents.php?action=viewlog&torrentid=$ExtraID&groupid=$ExtraGroupID'>(Log: $ExtraLogScore %)</a>" : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)"; } ?> <?php echo $First ? "" : "<br />"; ?> <?php
</tr> <? } ?> <tr> <td class="label">Tags</td> <td> <? $GenreTags = $Cache->get_value('genre_tags'); if(!$GenreTags) { $DB->query('SELECT Name FROM tags WHERE TagType=\'genre\' ORDER BY Name'); $GenreTags = $DB->collect('Name'); $Cache->cache_value('genre_tags', $GenreTags, 3600*6); } ?> <select id="genre_tags" name="genre_tags" onchange="add_tag();return false;" > <option>---</option> <? foreach(display_array($GenreTags) as $Genre){ ?> <option value="<?php echo $Genre; ?> "><?php echo $Genre; ?> </option> <? } ?> </select> <input type="text" id="tags" name="tags" size="45" value="<?php echo !empty($Tags) ? display_str($Tags) : ''; ?> " /> <br /> Tags should be comma separated, and you should use a period ('.') to separate words inside a tag - eg. '<strong style="color:green;">hip.hop</strong>'.
function to_array($Key = false, $Type = MYSQLI_BOTH, $Escape = true) { $Return = array(); while ($Row = mysqli_fetch_array($this->QueryID, $Type)) { if ($Escape !== FALSE) { $Row = display_array($Row, $Escape); } if ($Key) { $Return[$Row[$Key]] = $Row; } else { $Return[] = $Row; } } mysqli_data_seek($this->QueryID, 0); return $Return; }
function display_array($sarray = array(), $count = 0) { $colours = array(1 => '00FFFF', '00FF00', 'FFFF00', 'FF00FF', 'FF0000', 'FF9900', '0099FF', '00B0B0', '00B000', 'B0B000', 'B000CC', 'B00000', '994400', '006BB3', 'FFFFFF', 'B0B0B0', '0000FF', 'AABBEE', '9A5BEE', '0000B0'); $count++; $out = ''; $spacer = ''; for ($i = 1; $i <= $count * 10; $i++) { $spacer .= ' '; } if ($count == 1) { $out .= '<tr class="trlight"><td style="color: #' . $colours[$count] . '">array(' . count($sarray) . ')<br />{</td></tr>' . "\r\n"; } else { $out .= '<br /><span style="color: #' . $colours[$count] . '">' . $spacer . 'array(' . count($sarray) . ')<br />' . $spacer . '{</span></td></tr>' . "\r\n"; } if (is_array($sarray)) { foreach ($sarray as $key => $value) { $out .= '<tr class="trlight"><td style="color: #' . $colours[$count] . '">' . $spacer . '\'' . $key . '\' = ' . (is_array($value) ? display_array($value, $count) : "'" . stripslashes($value) . "'</td></tr>" . "\r\n"); } } $out .= '<tr class="trlight"><td style="color: #' . $colours[$count] . '">' . ($count == 1 ? '' : $spacer) . '}</td></tr>' . "\r\n"; return $out; }
/** * Displays a value in one line * * @param mixed $value * @param int $precision * @param bool $null_as_string * @return string */ function display_value_inline($value, $precision = null, $null_as_string = false) { if (is_array($value)) { $displayed = display_array($value); } else { if ($value === true) { $displayed = 'true'; } else { if ($value === false) { $displayed = 'false'; } else { if ($value === null) { $displayed = $null_as_string ? 'null' : null; } else { if (is_float($value)) { $displayed = $precision !== null ? round($value, $precision) : $value; } else { $displayed = display_string($value); } } } } } return $displayed; }
<option value="view">View</option> <option value="clear">Clear</option> </select> <input type="submit" value="key" class="submit" /> </td> </tr> </table> </form> <? if(!empty($_GET['key']) && $_GET['type'] == "view") { $Value = $Cache->get_value($_GET['key']); if(is_array($Value)) { ?> <div><?php echo display_array($Value); ?> </div> <? } else if(!empty($Value)) { ?> <div><?php echo display_str($Value); ?> </div> <? } else { ?> <div>Empty key or not found!</div> <? }
function display_array($array, $array_index = 0) { //create a global variable to hold our variable //during the recursion global $array_tree; $display = ""; //loop through the size of the array for ($i = 0; $i < $array_index; $i++) { //increse our space so as to display //the array in a tree display $display .= " "; } //check to make sure we're dealing with an array if (gettype($array) == "array") { //increment our index $array_index++; //now we ill use list to loop while each item //in our list matches items in our array while (list($key, $value) = each($array)) { //tack the value to our global variable $array_tree .= $display . "{$key} => {$value}\n"; //call function to recurse through the array display_array($value, $array_index); } } }
function display_array($your_array) { foreach ($your_array as $key => $value) { if (is_array($value)) { display_array($value); } else { echo "Key: {$key}; Value: {$value}<br />\n"; } } }