mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 19:06:27 +00:00
Empty commit
This commit is contained in:
parent
13b30d96c8
commit
eccff40de5
@ -470,7 +470,7 @@ public static function filelist_delim() {
|
||||
* Create a string that contains file info in a format that's easy to use for Sphinx
|
||||
*
|
||||
* @param array $File (File size, File name)
|
||||
* @return formatted string with the format .EXT sSIZEs NAME DELIMITER
|
||||
* @return string with the format .EXT sSIZEs NAME DELIMITER
|
||||
*/
|
||||
public static function filelist_format_file($File) {
|
||||
list($Size, $Name) = $File;
|
||||
@ -481,6 +481,17 @@ public static function filelist_format_file($File) {
|
||||
return sprintf("%s s%ds %s %s", ".$Ext", $Size, $Name, self::filelist_delim());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a string that contains file info in the old format for the API
|
||||
*
|
||||
* @param string $File string with the format .EXT sSIZEs NAME DELIMITER
|
||||
* @return string with the format NAME{{{SIZE}}}
|
||||
*/
|
||||
public static function filelist_old_format($File) {
|
||||
$File = self::filelist_get_file($File);
|
||||
return $File['name'] . '{{{' . $File['size'] . '}}}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate a formatted file info string into a more useful array structure
|
||||
*
|
||||
|
@ -57,6 +57,13 @@
|
||||
|
||||
$JsonTorrentList = array();
|
||||
foreach ($TorrentList as $Torrent) {
|
||||
// Convert file list back to the old format
|
||||
$FileList = explode("\n", $Torrent['FileList']);
|
||||
foreach ($FileList as &$File) {
|
||||
$File = Torrents::filelist_old_format($File);
|
||||
}
|
||||
unset($File);
|
||||
$FileList = implode('|||', $FileList);
|
||||
$Userinfo = Users::user_info($Torrent['UserID']);
|
||||
$JsonTorrentList[] = array(
|
||||
'id' => (int) $Torrent['ID'],
|
||||
@ -80,7 +87,7 @@
|
||||
'freeTorrent' => $Torrent['FreeTorrent'] == 1,
|
||||
'time' => $Torrent['Time'],
|
||||
'description' => $Torrent['Description'],
|
||||
'fileList' => $Torrent['FileList'],
|
||||
'fileList' => $FileList,
|
||||
'filePath' => $Torrent['FilePath'],
|
||||
'userId' => (int) $Torrent['UserID'],
|
||||
'username' => $Userinfo['Username']
|
||||
|
@ -182,7 +182,12 @@
|
||||
// Delete thread info cache (eg. number of pages)
|
||||
$Cache->delete('request_comments_'.$GroupID);
|
||||
break;
|
||||
|
||||
case 'warn' :
|
||||
include(SERVER_ROOT.'/sections/requests/warn.php');
|
||||
break;
|
||||
case 'take_warn' :
|
||||
include(SERVER_ROOT.'/sections/requests/take_warn.php');
|
||||
break;
|
||||
default:
|
||||
error(0);
|
||||
}
|
||||
|
@ -540,7 +540,21 @@
|
||||
</div>
|
||||
<div id="bar<?=$PostID?>" style="float:right;">
|
||||
<a href="reports.php?action=report&type=requests_comment&id=<?=$PostID?>" class="brackets">Report</a>
|
||||
|
||||
<? if (check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
|
||||
$AuthorInfo = Users::user_info($AuthorID);
|
||||
if ($LoggedUser['Class'] >= $AuthorInfo['Class']) {
|
||||
?>
|
||||
<form class="manage_form hidden" name="user" id="warn<?=$PostID?>" action="" method="post">
|
||||
<input type="hidden" name="action" value="warn" />
|
||||
<input type="hidden" name="groupid" value="<?=$RequestID?>" />
|
||||
<input type="hidden" name="postid" value="<?=$PostID?>" />
|
||||
<input type="hidden" name="userid" value="<?=$AuthorID?>" />
|
||||
<input type="hidden" name="key" value="<?=$Key?>" />
|
||||
</form>
|
||||
- <a href="#" onclick="$('#warn<?=$PostID?>').raw().submit(); return false;">[Warn]</a>
|
||||
<? }
|
||||
}
|
||||
?>
|
||||
<a href="#">↑</a>
|
||||
</div>
|
||||
</td>
|
||||
|
82
sections/requests/take_warn.php
Normal file
82
sections/requests/take_warn.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
if (!check_perms('users_warn')) {
|
||||
error(404);
|
||||
}
|
||||
Misc::assert_isset_request($_POST, array('reason', 'privatemessage', 'body', 'length', 'groupid', 'postid', 'userid'));
|
||||
|
||||
$Reason = db_string($_POST['reason']);
|
||||
$PrivateMessage = db_string($_POST['privatemessage']);
|
||||
$Body = db_string($_POST['body']);
|
||||
$Length = $_POST['length'];
|
||||
$GroupID = (int) $_POST['groupid'];
|
||||
$PostID = (int) $_POST['postid'];
|
||||
$UserID = (int) $_POST['userid'];
|
||||
$Key = (int) $_POST['key'];
|
||||
$SQLTime = sqltime();
|
||||
$UserInfo = Users::user_info($UserID);
|
||||
if ($UserInfo['Class'] > $LoggedUser['Class']) {
|
||||
error(403);
|
||||
}
|
||||
$URL = "https://" . SSL_SITE_URL . "/requests.php?action=view&id=$GroupID&postid=$PostID#post$PostID";
|
||||
if ($Length != 'verbal') {
|
||||
$Time = ((int) $Length) * (7 * 24 * 60 * 60);
|
||||
Tools::warn_user($UserID, $Time, "$URL - " . $Reason);
|
||||
$Subject = "You have received a warning";
|
||||
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
||||
$WarnTime = time_plus($Time);
|
||||
$AdminComment = date("Y-m-d") . ' - Warned until ' . $WarnTime . ' by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
|
||||
} else {
|
||||
$Subject = "You have received a verbal warning";
|
||||
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
||||
$AdminComment = date("Y-m-d") . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
|
||||
}
|
||||
$DB->query("INSERT INTO users_warnings_forums (UserID, Comment) VALUES('$UserID', '" . db_string($AdminComment)
|
||||
. "')
|
||||
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
|
||||
Tools::update_user_notes($UserID, $AdminComment);
|
||||
Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
|
||||
|
||||
$DB->query("SELECT
|
||||
rc.Body,
|
||||
rc.AuthorID,
|
||||
rc.RequestID,
|
||||
rc.AddedTime
|
||||
FROM requests_comments AS rc
|
||||
WHERE rc.ID='".db_string($_POST['post'])."'");
|
||||
list($OldBody, $AuthorID,$RequestID,$AddedTime)=$DB->next_record();
|
||||
|
||||
$DB->query("SELECT ceil(COUNT(ID) / ".POSTS_PER_PAGE.") AS Page FROM requests_comments WHERE RequestID = $GroupID AND ID <= $PostID");
|
||||
list($Page) = $DB->next_record();
|
||||
|
||||
if ($LoggedUser['ID']!=$AuthorID && !check_perms('site_moderate_forums')) { error(404); }
|
||||
if ($DB->record_count()==0) { error(404); }
|
||||
|
||||
// Perform the update
|
||||
$DB->query("UPDATE requests_comments SET
|
||||
Body = '".$Body."',
|
||||
EditedUserID = '".$LoggedUser['ID']."',
|
||||
EditedTime = '".sqltime()."'
|
||||
WHERE ID='".$PostID."'");
|
||||
|
||||
// Update the cache
|
||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||
$Cache->begin_transaction('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID);
|
||||
|
||||
$Cache->update_row($Key, array(
|
||||
'ID'=>$PostID,
|
||||
'AuthorID'=>$AuthorID,
|
||||
'AddedTime'=>$AddedTime,
|
||||
'Body'=>$_POST['body'],
|
||||
'EditedUserID'=>db_string($LoggedUser['ID']),
|
||||
'EditedTime'=>sqltime(),
|
||||
'Username'=>$LoggedUser['Username']
|
||||
));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
|
||||
VALUES ('requests', ".$PostID.", ".db_string($LoggedUser['ID']).", '".sqltime()."', '".db_string($OldBody)."')");
|
||||
|
||||
|
||||
header("Location: requests.php?id=$GroupID&postid=$PostID#post$PostID");
|
||||
?>
|
||||
;
|
71
sections/requests/warn.php
Normal file
71
sections/requests/warn.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
if (!check_perms('users_warn')) { error(404);}
|
||||
Misc::assert_isset_request($_POST, array('groupid', 'postid', 'userid', 'key'));
|
||||
|
||||
$GroupID = (int) $_POST['groupid'];
|
||||
$PostID = (int) $_POST['postid'];
|
||||
$UserID = (int) $_POST['userid'];
|
||||
$Key = (int) $_POST['key'];
|
||||
$UserInfo = Users::user_info($UserID);
|
||||
$DB->query("SELECT
|
||||
rc.Body,
|
||||
rc.AuthorID,
|
||||
rc.RequestID,
|
||||
rc.AddedTime
|
||||
FROM requests_comments AS rc
|
||||
WHERE rc.ID='$PostID'");
|
||||
list($PostBody) = $DB -> next_record();
|
||||
|
||||
View::show_header('Warn User');
|
||||
?>
|
||||
|
||||
<div class="thin">
|
||||
<div class="header">
|
||||
<h2>Warning <a href="user.php?id=<?=$UserID?>"><?=$UserInfo['Username']?></a></h2>
|
||||
</div>
|
||||
<div class="thin box pad">
|
||||
<form class="create_form" name="warning" action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post">
|
||||
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
|
||||
<input type="hidden" name="postid" value="<?=$PostID?>" />
|
||||
<input type="hidden" name="userid" value="<?=$UserID?>" />
|
||||
<input type="hidden" name="key" value="<?=$Key?>" />
|
||||
<input type="hidden" name="action" value="take_warn" />
|
||||
<table class="layout" align="center">
|
||||
<tr>
|
||||
<td class="label">Reason:</td>
|
||||
<td>
|
||||
<input type="text" name="reason" size="30" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Length:</td>
|
||||
<td>
|
||||
<select name="length">
|
||||
<option value="verbal">Verbal</option>
|
||||
<option value="1">1 week</option>
|
||||
<option value="2">2 weeks</option>
|
||||
<option value="4">4 weeks</option>
|
||||
<? if(check_perms("users_mod")) { ?>
|
||||
<option value="8">8 weeks</option>
|
||||
<? } ?>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Private Message:</td>
|
||||
<td>
|
||||
<textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Edit Post:</td>
|
||||
<td>
|
||||
<textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea>
|
||||
<br />
|
||||
<input type="submit" id="submit_button" value="Warn User" tabindex="1" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<? View::show_footer(); ?>
|
@ -25,7 +25,7 @@
|
||||
// File list and size
|
||||
list($ExtraTotalSize, $ExtraFileList) = $ExtraTor->file_list();
|
||||
$ExtraTorrentsInsert[$Name]['TotalSize'] = $ExtraTotalSize;
|
||||
$ExtraDirName = $ExtraTor->get_name();
|
||||
$ExtraDirName = isset($ExtraTor->Val['info']->Val['files']) ? Format::make_utf8($ExtraTor->get_name()) : "";
|
||||
|
||||
$ExtraTmpFileList = array();
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
// To be stored in the database
|
||||
$ExtraFilePath = isset($ExtraTor->Val['info']->Val['files']) ? db_string(Format::make_utf8($ExtraDirName)) : "";
|
||||
$ExtraFilePath = db_string($ExtraDirName);
|
||||
$ExtraTorrentsInsert[$Name]['FilePath'] = $ExtraFilePath;
|
||||
$ExtraFileString = db_string(implode("\n", $ExtraTmpFileList));
|
||||
$ExtraTorrentsInsert[$Name]['FileString'] = $ExtraFileString;
|
||||
|
@ -365,7 +365,7 @@
|
||||
|
||||
// File list and size
|
||||
list($TotalSize, $FileList) = $Tor->file_list();
|
||||
$DirName = $Tor->get_name();
|
||||
$DirName = isset($Tor->Val['info']->Val['files']) ? Format::make_utf8($Tor->get_name()) : "";
|
||||
|
||||
$TmpFileList = array();
|
||||
$HasLog = "'0'";
|
||||
@ -403,7 +403,7 @@
|
||||
}
|
||||
|
||||
// To be stored in the database
|
||||
$FilePath = isset($Tor->Val['info']->Val['files']) ? db_string(Format::make_utf8($DirName)) : "";
|
||||
$FilePath = db_string($DirName);
|
||||
|
||||
$FileString = db_string(implode("\n", $TmpFileList));
|
||||
|
||||
|
@ -4,36 +4,23 @@
|
||||
$(document).ready(function() {
|
||||
if($("#pushservice").val() > 0) {
|
||||
$('#pushsettings').show();
|
||||
if($("#pushservice").val() == PUSHOVER) {
|
||||
$('#pushsettings_username').show();
|
||||
}
|
||||
}
|
||||
$("#pushservice").change(function() {
|
||||
if($(this).val() > 0) {
|
||||
$('#pushsettings').show(500);
|
||||
if($(this).val() == PUSHOVER) {
|
||||
$('#pushsettings_username').show();
|
||||
}
|
||||
else {
|
||||
$('#pushsettings_username').hide();
|
||||
}
|
||||
|
||||
if($(this).val() == TOASTY) {
|
||||
$('#pushservice_title').text("Device ID");
|
||||
$('#pushusername_title').text("Username");
|
||||
}
|
||||
else if($(this).val() == PUSHOVER) {
|
||||
$('#pushservice_title').text("Token");
|
||||
$('#pushusername_title').text("User Key");
|
||||
$('#pushservice_title').text("User Key");
|
||||
}
|
||||
else {
|
||||
$('#pushservice_title').text("API Key");
|
||||
$('#pushusername_title').text("Username");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('#pushsettings').hide(500);
|
||||
$('#pushsettings_username').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user