mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 02:46:30 +00:00
Use SSL for links in RSS feed if appropriate
Add support for multiple forums with public voters Use geoip function Add support for neutral leech in Sphinx
This commit is contained in:
parent
dcaa536e58
commit
edaabc385b
@ -1,5 +1,7 @@
|
||||
<?
|
||||
class FEED {
|
||||
var $UseSSL = false; // If we're using SSL for blog and news links
|
||||
|
||||
function open_feed() {
|
||||
header("Content-type: application/xml; charset=UTF-8");
|
||||
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n","<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n\t<channel>\n";
|
||||
@ -8,11 +10,12 @@ function close_feed() {
|
||||
echo "\t</channel>\n</rss>";
|
||||
}
|
||||
function channel($Title, $Description, $Section='') {
|
||||
echo "\t\t<title>", $Title, " :: ", SITE_NAME, "</title>\n";
|
||||
echo "\t\t<link>http://", SITE_URL, "/", $Section, "</link>\n";
|
||||
echo "\t\t<description>", $Description, "</description>\n";
|
||||
$Site = $this->UseSSL ? 'https://'.SSL_SITE_URL : 'http://'.NONSSL_SITE_URL;
|
||||
echo "\t\t<title>$Title :: ". SITE_NAME. "</title>\n";
|
||||
echo "\t\t<link>$Site/$Section</link>\n";
|
||||
echo "\t\t<description>$Description</description>\n";
|
||||
echo "\t\t<language>en-us</language>\n";
|
||||
echo "\t\t<lastBuildDate>", date('r'), "</lastBuildDate>\n";
|
||||
echo "\t\t<lastBuildDate>". date('r'). "</lastBuildDate>\n";
|
||||
echo "\t\t<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
|
||||
echo "\t\t<generator>Gazelle Feed Class</generator>\n\n";
|
||||
}
|
||||
@ -22,15 +25,15 @@ function item($Title, $Description, $Page, $Creator, $Comments='', $Category='',
|
||||
} else {
|
||||
$Date = date("r",strtotime($Date));
|
||||
}
|
||||
$Site = NONSSL_SITE_URL;
|
||||
$Site = $this->UseSSL ? 'https://'.SSL_SITE_URL : 'http://'.NONSSL_SITE_URL;
|
||||
$Item = "\t\t<item>\n";
|
||||
$Item .= "\t\t\t<title><![CDATA[$Title]]></title>\n";
|
||||
$Item .= "\t\t\t<description><![CDATA[$Description]]></description>\n";
|
||||
$Item .= "\t\t\t<pubDate>$Date</pubDate>\n";
|
||||
$Item .= "\t\t\t<link>http://$Site/$Page</link>\n";
|
||||
$Item .= "\t\t\t<guid>http://$Site/$Page</guid>\n";
|
||||
$Item .= "\t\t\t<link>$Site/$Page</link>\n";
|
||||
$Item .= "\t\t\t<guid>$Site/$Page</guid>\n";
|
||||
if ($Comments != '') {
|
||||
$Item .= "\t\t\t<comments>http://$Site/$Comments</comments>\n";
|
||||
$Item .= "\t\t\t<comments>$Site/$Comments</comments>\n";
|
||||
}
|
||||
if ($Category != '') {
|
||||
$Item .= "\t\t\t<category><![CDATA[$Category]]></category>\n";
|
||||
|
@ -108,6 +108,8 @@ define('STATUS_CHAN', '#');
|
||||
|
||||
// Miscellaneous values
|
||||
|
||||
$ForumsRevealVoters = array();
|
||||
|
||||
$Categories = array('Music', 'Applications', 'E-Books', 'Audiobooks', 'E-Learning Videos', 'Comedy', 'Comics');
|
||||
$CategoryIcons = array('music.png', 'apps.png', 'ebook.png', 'audiobook.png', 'elearning.png', 'comedy.png', 'comics.png');
|
||||
|
||||
|
@ -193,7 +193,6 @@
|
||||
// Update LastUpdate every 10 minutes
|
||||
if(strtotime($UserSessions[$SessionID]['LastUpdate'])+600<time()) {
|
||||
$DB->query("UPDATE users_main SET LastAccess='".sqltime()."' WHERE ID='$LoggedUser[ID]'");
|
||||
|
||||
$DB->query("UPDATE users_sessions SET IP='".$_SERVER['REMOTE_ADDR']."', Browser='".$Browser."', OperatingSystem='".$OperatingSystem."', LastUpdate='".sqltime()."' WHERE UserID='$LoggedUser[ID]' AND SessionID='".db_string($SessionID)."'");
|
||||
$Cache->begin_transaction('users_sessions_'.$UserID);
|
||||
$Cache->delete_row($SessionID);
|
||||
@ -1224,7 +1223,7 @@ function update_hash($GroupID) {
|
||||
MAX(t.Scene) AS Scene,
|
||||
MAX(t.HasLog) AS HasLog,
|
||||
MAX(t.HasCue) AS HasCue,
|
||||
MAX(t.FreeTorrent) AS FreeTorrent,
|
||||
BIT_OR(t.FreeTorrent-1) AS FreeTorrent,
|
||||
GROUP_CONCAT(DISTINCT t.Media SEPARATOR ' ') AS Media,
|
||||
GROUP_CONCAT(DISTINCT t.Format SEPARATOR ' ') AS Format,
|
||||
GROUP_CONCAT(DISTINCT t.Encoding SEPARATOR ' ') AS Encoding,
|
||||
|
@ -87,4 +87,5 @@ function display_array($Array, $Escape = array()) {
|
||||
header('Expires: '.date('D, d M Y H:i:s', time()+(2*60*60)).' GMT');
|
||||
header('Last-Modified: '.date('D, d M Y H:i:s').' GMT');
|
||||
|
||||
$Feed->UseSSL = (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443);
|
||||
require(SERVER_ROOT.'/sections/feeds/index.php');
|
||||
|
@ -168,13 +168,14 @@
|
||||
$MaxVotes = 0;
|
||||
}
|
||||
|
||||
$RevealVoters = in_array($ForumID, $ForumsRevealVoters);
|
||||
//Polls lose the you voted arrow thingy
|
||||
$DB->query("SELECT Vote FROM forums_polls_votes WHERE UserID='".$LoggedUser['ID']."' AND TopicID='$ThreadID'");
|
||||
list($UserResponse) = $DB->next_record();
|
||||
if (!empty($UserResponse) && $UserResponse != 0) {
|
||||
$Answers[$UserResponse] = '» '.$Answers[$UserResponse];
|
||||
} else {
|
||||
if(!empty($UserResponse) && $ForumID == STAFF_FORUM) {
|
||||
if(!empty($UserResponse) && $RevealVoters) {
|
||||
$Answers[$UserResponse] = '» '.$Answers[$UserResponse];
|
||||
}
|
||||
}
|
||||
@ -187,7 +188,7 @@
|
||||
<? if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || $LoggedUser['Class'] < $Forums[$ForumID]['MinClassWrite']) { ?>
|
||||
<ul class="poll nobullet">
|
||||
<?
|
||||
if($ForumID != STAFF_FORUM) {
|
||||
if(!$RevealVoters) {
|
||||
foreach($Answers as $i => $Answer) {
|
||||
if (!empty($Votes[$i]) && $TotalVotes > 0) {
|
||||
$Ratio = $Votes[$i]/$MaxVotes;
|
||||
@ -253,11 +254,17 @@
|
||||
<? } ?>
|
||||
<li><a href="forums.php?action=change_vote&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=0">Blank</a> - <?=$StaffVotes[0]?> (<?=number_format(((float) $Votes[0]/$TotalVotes)*100, 2)?>%)</li>
|
||||
</ul>
|
||||
<?
|
||||
if($ForumID == STAFF_FORUM) {
|
||||
?>
|
||||
<br />
|
||||
<strong>Votes:</strong> <?=number_format($TotalVotes)?> / <?=$StaffCount ?>
|
||||
<br />
|
||||
<strong>Missing Votes:</strong> <?=implode(", ", $StaffNames)?>
|
||||
<br /><br />
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<a href="#" onclick="AddPollOption(<?=$ThreadID?>); return false;">[+]</a>
|
||||
<?
|
||||
}
|
||||
@ -292,7 +299,7 @@
|
||||
</form>
|
||||
</div>
|
||||
<? } ?>
|
||||
<? if(check_perms('forums_polls_moderate') && $ForumID != STAFF_FORUM) { ?>
|
||||
<? if(check_perms('forums_polls_moderate') && !$RevealVoters) { ?>
|
||||
<? if (!$Featured || $Featured == '0000-00-00 00:00:00') { ?>
|
||||
<form action="forums.php" method="post">
|
||||
<input type="hidden" name="action" value="poll_mod"/>
|
||||
|
@ -432,7 +432,7 @@ function next_hour() {
|
||||
foreach($Passkeys as $Passkey) {
|
||||
update_tracker('update_user', array('passkey' => $Passkey, 'can_leech' => '1'));
|
||||
}
|
||||
/*
|
||||
|
||||
|
||||
// Put user on ratio watch if he doesn't meet the standards
|
||||
sleep(10);
|
||||
@ -440,6 +440,7 @@ function next_hour() {
|
||||
WHERE m.Uploaded/m.Downloaded < m.RequiredRatio
|
||||
AND i.RatioWatchEnds='0000-00-00 00:00:00'
|
||||
AND m.Enabled='1'
|
||||
AND m.Downloaded > 100<<30
|
||||
AND m.can_leech='1'");
|
||||
$OnRatioWatch = $DB->collect('ID');
|
||||
|
||||
@ -458,7 +459,7 @@ function next_hour() {
|
||||
send_pm($UserID, 0, db_string("You have been put on Ratio Watch"), db_string("This happens when your ratio falls below the requirements we have outlined in the rules located [url=http://".NONSSL_SITE_URL."/rules.php?p=ratio]here[/url].\n For information about ratio watch, click the link above."), '');
|
||||
echo "Ratio watch on: $UserID\n";
|
||||
}
|
||||
*/
|
||||
|
||||
sleep(5);
|
||||
|
||||
//------------- Rescore 0.95 logs of disabled users
|
||||
|
@ -13,7 +13,4 @@
|
||||
die("Invalid IP");
|
||||
}
|
||||
|
||||
$DB->query("SELECT Code FROM geoip_country WHERE ".ip2long($_GET['ip'])." BETWEEN StartIP AND EndIP LIMIT 1");
|
||||
list($CC) = $DB->next_record();
|
||||
die($CC);
|
||||
|
||||
die(geoip($_GET['ip']));
|
||||
|
@ -240,7 +240,16 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
|
||||
foreach(array('hascue','scene','freetorrent','releasetype') as $Search) {
|
||||
if(isset($_GET[$Search]) && $_GET[$Search]!=='') {
|
||||
$SS->set_filter($Search, array($_GET[$Search]));
|
||||
if($Search == 'freetorrent') {
|
||||
switch($_GET[$Search]) {
|
||||
case 0: $SS->set_filter($Search, array(0)); break;
|
||||
case 1: $SS->set_filter($Search, array(1)); break;
|
||||
case 2: $SS->set_filter($Search, array(2)); break;
|
||||
case 3: $SS->set_filter($Search, array(0), true); break;
|
||||
}
|
||||
} else {
|
||||
$SS->set_filter($Search, array($_GET[$Search]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -479,9 +488,11 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
<option value="0" <?selected('scene',0)?>>No</option>
|
||||
</select>
|
||||
<select name="freetorrent">
|
||||
<option value="">Freeleech</option>
|
||||
<option value="1" <?selected('freetorrent',1)?>>Yes</option>
|
||||
<option value="0" <?selected('freetorrent',0)?>>No</option>
|
||||
<option value="">Leech Status</option>
|
||||
<option value="1" <?selected('freetorrent',1)?>>Freeleech</option>
|
||||
<option value="2" <?selected('freetorrent',2)?>>Neutral Leech</option>
|
||||
<option value="3" <?selected('freetorrent',3)?>>Either</option>
|
||||
<option value="0" <?selected('freetorrent',0)?>>Normal</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@ -784,7 +795,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
}
|
||||
if(isset($_GET['freetorrent']) && $_GET['freetorrent']!=='') {
|
||||
$Filter = true;
|
||||
if((int)$Data['FreeTorrent']==$_GET['freetorrent']) {
|
||||
if((int)$Data['FreeTorrent'] & $_GET['freetorrent'] || (int)$Data['FreeTorrent'] == $_GET['freetorrent']) {
|
||||
$Pass = true;
|
||||
}
|
||||
}
|
||||
|
@ -229,9 +229,7 @@
|
||||
$UpdateSet[]="PermissionID='$Class'";
|
||||
$EditSummary[]="class changed to ".make_class_string($Class);
|
||||
$LightUpdates['PermissionID']=$Class;
|
||||
if ($Class == 6) {
|
||||
$DB->query("UPDATE users_info SET RestrictedForums = CONCAT('30,', RestrictedForums) WHERE UserID = ".$UserID);
|
||||
}
|
||||
|
||||
$DB->query("SELECT DISTINCT DisplayStaff FROM permissions WHERE ID = $Class OR ID = ".$ClassLevels[$Cur['Class']]['ID']);
|
||||
if($DB->record_count() == 2) {
|
||||
if($Classes[$Class]['Level'] < $Cur['Class']) {
|
||||
|
@ -23,7 +23,7 @@ source torrents {
|
||||
g.CatalogueNumber, g.CategoryID, UNIX_TIMESTAMP(g.Time) AS Time, g.ReleaseType, \
|
||||
MAX(CEIL(t.Size/1024)) AS Size, SUM(t.Snatched) AS Snatched, SUM(t.Seeders) AS Seeders, \
|
||||
SUM(t.Leechers) AS Leechers, MAX(t.LogScore) AS LogScore, MAX(t.Scene) AS Scene, \
|
||||
MAX(t.HasLog) AS HasLog, MAX(t.HasCue) AS HasCue, MAX(t.FreeTorrent) AS FreeTorrent, \
|
||||
MAX(t.HasLog) AS HasLog, MAX(t.HasCue) AS HasCue, BIT_OR(t.FreeTorrent-1) AS FreeTorrent, \
|
||||
GROUP_CONCAT(DISTINCT t.Media SEPARATOR ' ') AS Media, \
|
||||
GROUP_CONCAT(DISTINCT t.Format SEPARATOR ' ') AS Format, \
|
||||
GROUP_CONCAT(DISTINCT t.Encoding SEPARATOR ' ') AS Encoding, \
|
||||
@ -68,7 +68,7 @@ source torrents {
|
||||
sql_attr_bool = scene
|
||||
sql_attr_bool = haslog
|
||||
sql_attr_bool = hascue
|
||||
sql_attr_bool = freetorrent
|
||||
sql_attr_uint = freetorrent
|
||||
|
||||
sql_query_info = SELECT ID, GroupName, ArtistName, TagList, Filelist FROM sphinx_hash WHERE ID = $id
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user