mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 12:11:36 +00:00
Empty commit
This commit is contained in:
parent
a678bedeb4
commit
6d60a39a89
@ -852,8 +852,8 @@ CREATE TABLE `stylesheets` (
|
||||
|
||||
CREATE TABLE `subscribed_forums` (
|
||||
`ForumID` int(10) NOT NULL,
|
||||
`SubscriberID` int(10) NOT NULL,
|
||||
PRIMARY KEY (`ForumID`,`SubscriberID`)
|
||||
`UserID` int(10) NOT NULL,
|
||||
PRIMARY KEY (`ForumID`,`UserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
CREATE TABLE `subscribed_users` (
|
||||
|
@ -57,7 +57,7 @@
|
||||
$permalink = "artist.php?id=$ArtistID&postid=$PostID#post$PostID";
|
||||
$postheader = " on " . "<a href=\"artist.php?id=$ArtistID\">$ArtistName</a>";
|
||||
|
||||
comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $EditedTime);
|
||||
comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime);
|
||||
|
||||
} /* end while loop*/ ?>
|
||||
<div class="linkbox"><?= $Pages; ?></div>
|
||||
|
@ -63,6 +63,23 @@
|
||||
$ForumName = display_str($Forums[$ForumID]['Name']);
|
||||
if($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { error(403); }
|
||||
|
||||
$SubscribedForumIDs = $Cache->get("subscribed_forum_ids_".$LoggedUser['ID']);
|
||||
if(empty($SubscribedForumIDs)) {
|
||||
$SubscribedForumIDs = array();
|
||||
$DB->query("SELECT ForumID FROM subscribed_forums WHERE UserID = $LoggedUser[ID]");
|
||||
if($DB->record_count() > 0) {
|
||||
$SubscribedForumIDs = $DB->collect('ForumID');
|
||||
}
|
||||
$Cache->cache_value("subscribed_forum_ids_".$LoggedUser['ID'], $SubscribedForumIDs, 0);
|
||||
}
|
||||
$ForumSubscribeAction = "add";
|
||||
$ForumSubscribeActionText = "Subscribe";
|
||||
if(in_array($ForumID, $SubscribedForumIDs)) {
|
||||
$ForumSubscribeAction = "remove";
|
||||
$ForumSubscribeActionText = "Unsubscribe";
|
||||
|
||||
}
|
||||
|
||||
// Start printing
|
||||
View::show_header('Forums > '. $Forums[$ForumID]['Name']);
|
||||
?>
|
||||
@ -73,6 +90,9 @@
|
||||
[<a href="forums.php?action=new&forumid=<?=$ForumID?>">New Thread</a>]
|
||||
<? } ?>
|
||||
[<a href="#" onclick="$('#searchforum').toggle(); this.innerHTML = (this.innerHTML == 'Search this Forum'?'Hide Search':'Search this Forum'); return false;">Search this Forum</a>]
|
||||
<?if(check_perms("users_mod")) { ?>
|
||||
[<a href="forums.php?action=forum_subscribe&do=<?=$ForumSubscribeAction?>&forumid=<?=$ForumID?>"><?=$ForumSubscribeActionText?></a>]
|
||||
<? } ?>
|
||||
<div id="searchforum" class="hidden center">
|
||||
<div style="display: inline-block;">
|
||||
<h3>Search this forum:</h3>
|
||||
|
@ -1,14 +1,35 @@
|
||||
<?php
|
||||
|
||||
ini_set('display_errors', '1');authorize();
|
||||
|
||||
$ForumID = db_string($_GET['forumid']);
|
||||
if($_GET['perform'] == 'add') {
|
||||
$DB->query("INSERT IGNORE INTO subscribed_forums (ForumID, SubscriberID) VALUES ('$ForumID', '$LoggedUser[ID]')");
|
||||
$ForumID = (int) ($_GET['forumid']);
|
||||
if(empty($ForumID)) {
|
||||
error(403);
|
||||
}
|
||||
elseif($_GET['perform'] == 'remove') {
|
||||
$DB->query("DELETE FROM subscribed_forums WHERE ForumID = '$ForumID' AND SubscriberID = '$LoggedUser[ID]'");
|
||||
$SubscribedForumIDs = $Cache->get("subscribed_forum_ids_".$LoggedUser['ID']);
|
||||
if(empty($SubscribedForumIDs)) {
|
||||
$SubscribedForumIDs = array();
|
||||
$DB->query("SELECT ForumID FROM subscribed_forums WHERE UserID = $LoggedUser[ID]");
|
||||
if($DB->record_count() > 0) {
|
||||
$SubscribedForumIDs = $DB->collect('ForumID');
|
||||
}
|
||||
$Cache->cache_value("subscribed_forum_ids_".$LoggedUser['ID'], $SubscribedForumIDs, 0);
|
||||
}
|
||||
|
||||
if($_GET['do'] == 'add') {
|
||||
if(!in_array($ForumID, $SubscribedForumIDs)) {
|
||||
$SubscribedForumIDs[] = $ForumID;
|
||||
}
|
||||
|
||||
$DB->query("INSERT INTO subscribed_forums
|
||||
(ForumID, UserID)
|
||||
VALUES($ForumID, $LoggedUser[ID])");
|
||||
$Cache->replace_value("subscribed_forum_ids_".$LoggedUser['ID'], $SubscribedForumIDs, 0);
|
||||
}
|
||||
elseif($_GET['do'] == 'remove') {
|
||||
$SubscribedForumIDs = array_diff($SubscribedForumIDs, array($ForumID));
|
||||
if(count($SubscribedForumIDs) > 0) {
|
||||
$DB->query("DELETE FROM subscribed_forums WHERE UserID = $LoggedUser[ID] AND ForumID = $ForumID");
|
||||
$Cache->delete_value("subscribed_forum_ids_".$LoggedUser['ID']);
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: forums.php?action=viewforum&forumid=' . $ForumID);
|
||||
?>
|
||||
|
||||
|
@ -88,19 +88,17 @@
|
||||
}
|
||||
|
||||
//auto subscribe
|
||||
/*
|
||||
if(check_perms('users_mod')) {
|
||||
$DB->query("SELECT SubscriberID FROM subscribed_forums WHERE ForumID = '$ForumID' AND SubscriberID <> '$LoggedUser[ID]'");
|
||||
|
||||
$DB->query("SELECT UserID FROM subscribed_forums WHERE ForumID = '$ForumID' AND UserID <> '$LoggedUser[ID]'");
|
||||
while(list($SubscriberID) = $DB->next_record()) {
|
||||
$DB->query("INSERT INTO users_subscriptions VALUES ($SubscriberID, $TopicID)");
|
||||
// $DB->query("INSERT INTO forums_last_read_topics
|
||||
// (UserID, TopicID, PostID) VALUES
|
||||
// ('$SubscriberID', '".$TopicID ."', '".db_string($PostID)."')
|
||||
// ON DUPLICATE KEY UPDATE PostID='$LastPost'");
|
||||
// $DB->query("INSERT INTO forums_last_read_topics
|
||||
// (UserID, TopicID, PostID) VALUES
|
||||
// ('$SubscriberID', '".$TopicID ."', '".db_string($PostID)."')
|
||||
// ON DUPLICATE KEY UPDATE PostID='$LastPost'");
|
||||
$Cache->delete_value('subscriptions_user_'.$SubscriberID);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (empty($_POST['question']) || empty($_POST['answers']) || !check_perms('forums_polls_create')) {
|
||||
$NoPoll = 1;
|
||||
|
@ -7,12 +7,12 @@
|
||||
View::show_header();
|
||||
|
||||
//requires wget, unzip commands to be installed
|
||||
shell_exec('wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/GeoLiteCity_'.date('Ym').'04.zip');
|
||||
shell_exec('wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/GeoLiteCity_'.date('Ym').'01.zip');
|
||||
//shell_exec('wget http://debug.what.cd/GeoLiteCity_'.date('Ym').'01.zip');
|
||||
shell_exec('unzip GeoLiteCity_'.date('Ym').'04.zip');
|
||||
shell_exec('rm GeoLiteCity_'.date('Ym').'04.zip');
|
||||
shell_exec('unzip GeoLiteCity_'.date('Ym').'01.zip');
|
||||
shell_exec('rm GeoLiteCity_'.date('Ym').'01.zip');
|
||||
|
||||
if(($Locations = file("GeoLiteCity_".date('Ym')."04/GeoLiteCity-Location.csv", FILE_IGNORE_NEW_LINES)) === false) {
|
||||
if(($Locations = file("GeoLiteCity_".date('Ym')."01/GeoLiteCity-Location.csv", FILE_IGNORE_NEW_LINES)) === false) {
|
||||
error("Download or extraction of maxmind database failed");
|
||||
}
|
||||
array_shift($Locations);
|
||||
@ -31,7 +31,7 @@
|
||||
echo "There are ".count($CountryIDs)." CountryIDs";
|
||||
echo "<br />";
|
||||
|
||||
if(($Blocks = file("GeoLiteCity_".date('Ym')."04/GeoLiteCity-Blocks.csv", FILE_IGNORE_NEW_LINES)) === false) {
|
||||
if(($Blocks = file("GeoLiteCity_".date('Ym')."01/GeoLiteCity-Blocks.csv", FILE_IGNORE_NEW_LINES)) === false) {
|
||||
echo "Error";
|
||||
}
|
||||
array_shift($Blocks);
|
||||
|
@ -9,23 +9,23 @@
|
||||
<div class="box box_info box_lastfm">
|
||||
<div class="head colhead_dark">Last.fm</div>
|
||||
<ul class="stats nobullet">
|
||||
<li>
|
||||
<li class="lastfm_username">
|
||||
Username: <a id="lastfm_username" href="<?= $LastFMInfo['user']['url'] ?>" title="<?= $LastFMInfo['user']['name'] ?> on Last.fm: <?= $LastFMInfo['user']['playcount'] ?> plays, <?= $LastFMInfo['user']['playlists'] ?> playlists."><?= $LastFMInfo['user']['name'] ?></a>
|
||||
</li>
|
||||
<div id="lastfm_stats">
|
||||
<div id="lastfm_stats" <? if ($OwnProfile == true): ?>data-uid="<?= $OwnProfile ?>"<? endif; ?>>
|
||||
</div>
|
||||
<li id="lastfm_loading">
|
||||
Loading...
|
||||
</li>
|
||||
<?
|
||||
//Append the reload stats button only if allowed on the current user page.
|
||||
$Response = $Cache->get_value('lastfm_clear_cache_' . $LoggedUser . '_' . $_GET['id']);
|
||||
if (empty($Response)) :
|
||||
<li>
|
||||
[<a href="#" id="lastfm_expand" onclick="return false">Show more info</a>]
|
||||
<?
|
||||
//Append the reload stats button only if allowed on the current user page.
|
||||
$Response = $Cache->get_value('lastfm_clear_cache_' . $LoggedUser . '_' . $_GET['id']);
|
||||
if (empty($Response)) :
|
||||
?>
|
||||
<li id="lastfm_reload_container">
|
||||
<span id="lastfm_reload_container">
|
||||
[<a href="#" id="lastfm_reload" onclick="return false">Reload stats</a>]
|
||||
</li>
|
||||
<? endif; ?>
|
||||
</span>
|
||||
<? endif; ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -153,6 +153,9 @@
|
||||
<a href="forums.php?action=viewthread&threadid=<?=$TopicID?>" title="<?=display_str($ThreadTitle)?>"><?=Format::cut_string($ThreadTitle, 75)?></a>
|
||||
<? if($PostID<$LastPostID && !$Locked) { ?>
|
||||
<span class="new">(New!)</span>
|
||||
<? }
|
||||
if($LastPostID == $PostID && !$Locked) { ?>
|
||||
<span class="new">(New Thread!)</span>
|
||||
<? } ?>
|
||||
</span>
|
||||
<span style="float:left;" class="last_read" title="Jump to last read">
|
||||
|
@ -9,6 +9,7 @@
|
||||
var topArtists = "";
|
||||
var topAlbums = "";
|
||||
var topTracks = "";
|
||||
var expanded = false;
|
||||
// Failed request flag.
|
||||
var flag = 0;
|
||||
$(document).ready(function () {
|
||||
@ -43,6 +44,19 @@
|
||||
}
|
||||
updateDivContents(div);
|
||||
});
|
||||
// Allow expanding or collapsing the Last.fm data.
|
||||
$("#lastfm_expand").on('click', function () {
|
||||
if(expanded == false){
|
||||
expanded = true;
|
||||
$(this).html("Show less info");
|
||||
} else {
|
||||
expanded = false;
|
||||
$(this).html("Show more info");
|
||||
}
|
||||
updateDivContents(div);
|
||||
});
|
||||
// Hide the reload button until data is expanded.
|
||||
$("#lastfm_reload_container").addClass("hidden");
|
||||
// Allow reloading the data manually.
|
||||
$.urlParam = function(name){
|
||||
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
|
||||
@ -60,7 +74,8 @@
|
||||
topTracks = "";
|
||||
// Revert the sidebar box to its initial state.
|
||||
$("#lastfm_stats").html("");
|
||||
$(".box_lastfm").children("ul").append('<li id="lastfm_loading">Loading...</li>');
|
||||
//$(".box_lastfm").children("ul").append('<li id="lastfm_loading">Loading...</li>');
|
||||
$("#lastfm_stats").append('<li id="lastfm_loading">Loading...</li>');
|
||||
// Remove the stats reload button.
|
||||
$("#lastfm_reload_container").remove();
|
||||
getTasteometer(div);
|
||||
@ -81,7 +96,15 @@
|
||||
html += topArtists;
|
||||
html += topAlbums;
|
||||
html += topTracks;
|
||||
html += '<li id="lastfm_loading">Loading...</li>';
|
||||
div.html(html);
|
||||
// If the data isn't expanded hide most of the info.
|
||||
if( expanded == false ){
|
||||
$("#lastfm_stats").children(":not(.lastfm_essential)").addClass("hidden");
|
||||
$("#lastfm_reload_container").addClass("hidden");
|
||||
} else {
|
||||
$("#lastfm_reload_container").removeClass("hidden");
|
||||
}
|
||||
// Once all requests are completed, remove the loading message.
|
||||
if(tasteometer && lastPlayedTrack && sharedArtists && topArtists && topAlbums && topTracks){
|
||||
$('#lastfm_loading').remove();
|
||||
@ -97,70 +120,77 @@
|
||||
// Functions for fetching the required data are as follows.
|
||||
// Also gets the data for shared artists as they're bundled.
|
||||
function getTasteometer(div) {
|
||||
$.get('user.php?action=lastfm_compare&username=' + username, function (response) {
|
||||
// Two separate elements are received from one Last.fm API call.
|
||||
var tasteometerHtml = "";
|
||||
var sharedArtistsHtml = "";
|
||||
if ( response ){
|
||||
json = JSON.parse(response);
|
||||
if (json != null && json['error']) {
|
||||
console.log("Tasteometer: " + json['message']);
|
||||
// Specified non-existant username for Last.fm, remove Last.fm box from page.
|
||||
if (json['error'] == "7" ){
|
||||
if ($("#lastfm_stats").attr("data-uid")){
|
||||
//Own profile, don't show tasteometer and shared artists.
|
||||
tasteometer = " ";
|
||||
sharedArtists = " ";
|
||||
} else {
|
||||
$.get('user.php?action=lastfm_compare&username=' + username, function (response) {
|
||||
// Two separate elements are received from one Last.fm API call.
|
||||
var tasteometerHtml = "";
|
||||
var sharedArtistsHtml = "";
|
||||
if ( response ){
|
||||
json = JSON.parse(response);
|
||||
if (json != null && json['error']) {
|
||||
console.log("Tasteometer: " + json['message']);
|
||||
// Specified non-existant username for Last.fm, remove Last.fm box from page.
|
||||
if (json['error'] == "7" ){
|
||||
tasteometer = " ";
|
||||
sharedArtists = " ";
|
||||
}
|
||||
} else if (json == null) {
|
||||
// No Last.fm compare possible.
|
||||
tasteometer = " ";
|
||||
sharedArtists = " ";
|
||||
}
|
||||
} else if (json == null) {
|
||||
// No Last.fm compare possible.
|
||||
tasteometer = " ";
|
||||
sharedArtists = " ";
|
||||
} else {
|
||||
var j = json['comparison']['result'];
|
||||
var a = j['artists']['artist'];
|
||||
tasteometerHtml += "<li>Compatibility: ";
|
||||
var compatibility = Math.round(j['score'] * 100);
|
||||
var background;
|
||||
if (compatibility < 50){
|
||||
background = 'rgb(255, '+Math.floor(255*compatibility/50)+', 0)'
|
||||
} else {
|
||||
background = 'rgb('+Math.floor((1-(compatibility-50)/50)*255)+', 255, 0)'
|
||||
}
|
||||
tasteometerHtml += compatibility + '%\r\
|
||||
<li>\r\
|
||||
var j = json['comparison']['result'];
|
||||
var a = j['artists']['artist'];
|
||||
tasteometerHtml += '<li class="lastfm_essential">Compatibility: ';
|
||||
var compatibility = Math.round(j['score'] * 100);
|
||||
var background;
|
||||
if (compatibility < 50){
|
||||
background = 'rgb(255, '+Math.floor(255*compatibility/50)+', 0)'
|
||||
} else {
|
||||
background = 'rgb('+Math.floor((1-(compatibility-50)/50)*255)+', 255, 0)'
|
||||
}
|
||||
tasteometerHtml += compatibility + '%\r\
|
||||
<li class="lastfm_essential">\r\
|
||||
<div id="lastfm_compatibilitybar_container">\n\
|
||||
<div id="lastfm_compatibilitybar" style="width: '+compatibility+'%; background: '+background+';">\n\
|
||||
</div>\r\
|
||||
</div>\r\
|
||||
</li>';
|
||||
// Only print shared artists if there are any
|
||||
if (j['artists']['matches'] != 0){
|
||||
sharedArtistsHtml += '<li>Shared artists:</li><li><ul class="nobullet">';
|
||||
var k = initialCount;
|
||||
if (a.length < 3) k = a.length;
|
||||
for (var i = 0; i < k; i++) {
|
||||
sharedArtistsHtml += '<li><a href="artist.php?artistname=' + escapeAmp(a[i]['name']) + '">' + a[i]['name'] + '</a></li>'
|
||||
}
|
||||
if ( a.length > 3 ){
|
||||
for (i = 3; i < a.length; i++) {
|
||||
sharedArtistsHtml += '<li class="hidden"><a href="artist.php?artistname=' + escapeAmp(a[i]['name']) + '">' + a[i]['name'] + '</a></li>'
|
||||
// Only print shared artists if there are any
|
||||
if (j['artists']['matches'] != 0){
|
||||
sharedArtistsHtml += '<li>Shared artists:</li><li><ul class="nobullet">';
|
||||
var k = initialCount;
|
||||
if (a.length < 3) k = a.length;
|
||||
for (var i = 0; i < k; i++) {
|
||||
sharedArtistsHtml += '<li><a href="artist.php?artistname=' + escapeAmp(a[i]['name']) + '">' + a[i]['name'] + '</a></li>'
|
||||
}
|
||||
sharedArtistsHtml += '<li>[<a href="#sharedartists" id="lastfm_expand" onclick="return false">Expand</a>]</li>'
|
||||
if ( a.length > 3 ){
|
||||
for (i = 3; i < a.length; i++) {
|
||||
sharedArtistsHtml += '<li class="hidden"><a href="artist.php?artistname=' + escapeAmp(a[i]['name']) + '">' + a[i]['name'] + '</a></li>'
|
||||
}
|
||||
sharedArtistsHtml += '<li>[<a href="#sharedartists" id="lastfm_expand" onclick="return false">Expand</a>]</li>'
|
||||
}
|
||||
sharedArtistsHtml += '</ul></li>';
|
||||
sharedArtists = sharedArtistsHtml;
|
||||
} else {
|
||||
// Allow removing loading message regardless.
|
||||
sharedArtists = " ";
|
||||
sharedArtistsHtml += '<li class="lastfm_expand">[<a href="#sharedartists" id="lastfm_expand" onclick="return false">Expand</a>]</li>'
|
||||
}
|
||||
sharedArtistsHtml += '</ul></li>';
|
||||
sharedArtists = sharedArtistsHtml;
|
||||
} else {
|
||||
// Allow removing loading message regardless.
|
||||
sharedArtists = " ";
|
||||
tasteometerHtml += "</li>";
|
||||
tasteometer = tasteometerHtml;
|
||||
}
|
||||
tasteometerHtml += "</li>";
|
||||
tasteometer = tasteometerHtml;
|
||||
} else {
|
||||
sharedArtists = " ";
|
||||
tasteometer = " ";
|
||||
}
|
||||
} else {
|
||||
sharedArtists = " ";
|
||||
tasteometer = " ";
|
||||
}
|
||||
updateDivContents(div);
|
||||
});
|
||||
updateDivContents(div);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getLastPlayedTrack(div) {
|
||||
@ -176,11 +206,10 @@
|
||||
// No last played track available.
|
||||
// Allow removing the loading message regardless.
|
||||
lastPlayedTrack = " ";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Fix Last.fm API returning more than one entry despite limit on certain conditions.
|
||||
if ( typeof(json[0]) === "object" ) json = json[0];
|
||||
html += "<li>Last played: ";
|
||||
html += '<li class="lastfm_essential">Last played: ';
|
||||
html += '<a href="artist.php?artistname=' + escapeAmp(json['artist']['#text']) + '">' + json['artist']['#text'] + '</a> - <a href="torrents.php?searchstr=' + escapeAmp(json['name']) + '">' + json['name'] + '</a>';
|
||||
html += "</li>";
|
||||
lastPlayedTrack = html;
|
||||
|
Loading…
Reference in New Issue
Block a user