mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-31 02:21:36 +00:00
Empty commit
This commit is contained in:
parent
8f5fb0f429
commit
4b99416cdf
@ -1,5 +1,8 @@
|
||||
CHANGELOG
|
||||
|
||||
2013-07-13 by draculesti
|
||||
Ability to quote locked and trashed threads
|
||||
|
||||
2013-07-08 by alderaan
|
||||
Add "has_results()" function for MySQL class to replace "record_count() === 0" conditional checks
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
/* AJAX_LIMIT = array(x,y) = 'x' requests every 'y' seconds.
|
||||
e.g. array(5,10) = 5 requests every 10 seconds */
|
||||
$AJAX_LIMIT = array(5,10);
|
||||
$LimitedPages = array('tcomments','user','forum','top10','browse','usersearch','requests','artist','inbox','subscriptions','bookmarks','announcements','notifications','request','better','similar_artists','userhistory','votefavorite','wiki','torrentgroup','news_ajax','user_recents', 'collage');
|
||||
$LimitedPages = array('tcomments','user','forum','top10','browse','usersearch','requests','artist','inbox','subscriptions','bookmarks','announcements','notifications','request','better','similar_artists','userhistory','votefavorite','wiki','torrentgroup','news_ajax','user_recents', 'collage', 'raw_bbcode');
|
||||
|
||||
// These users aren't rate limited.
|
||||
// This array should contain user IDs.
|
||||
@ -161,6 +161,9 @@
|
||||
case 'collage':
|
||||
require(SERVER_ROOT . '/sections/ajax/collage.php');
|
||||
break;
|
||||
case 'raw_bbcode':
|
||||
require(SERVER_ROOT . '/sections/ajax/raw_bbcode.php');
|
||||
break;
|
||||
default:
|
||||
// If they're screwing around with the query string
|
||||
json_die("failure");
|
||||
|
31
sections/ajax/raw_bbcode.php
Normal file
31
sections/ajax/raw_bbcode.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?
|
||||
|
||||
include(SERVER_ROOT . "/sections/forums/functions.php");
|
||||
|
||||
$PostID = (int) $_POST['postid'];
|
||||
|
||||
if (empty($PostID)) {
|
||||
json_die("error", "empty postid");
|
||||
}
|
||||
|
||||
$DB->query("
|
||||
SELECT
|
||||
t.ForumID, p.Body
|
||||
FROM forums_posts AS p
|
||||
JOIN forums_topics AS t
|
||||
ON p.TopicID = t.ID
|
||||
WHERE p.ID = '$PostID'");
|
||||
|
||||
if (!$DB->has_results()) {
|
||||
json_die("error", "no results");
|
||||
}
|
||||
|
||||
list($ForumID, $Body) = $DB->next_record();
|
||||
$Forums = get_forums();
|
||||
if (!check_forumperm($ForumID)) {
|
||||
json_die("error", "assholes");
|
||||
}
|
||||
|
||||
json_die("success", array("body" => nl2br($Body)));
|
||||
|
||||
?>
|
@ -94,3 +94,48 @@ function get_forum_info($ForumID) {
|
||||
}
|
||||
return $Forum;
|
||||
}
|
||||
|
||||
function get_forums() {
|
||||
global $DB, $Cache;
|
||||
if (!$Forums = $Cache->get_value('forums_list')) {
|
||||
$DB->query('
|
||||
SELECT
|
||||
f.ID,
|
||||
f.CategoryID,
|
||||
f.Name,
|
||||
f.Description,
|
||||
f.MinClassRead,
|
||||
f.MinClassWrite,
|
||||
f.MinClassCreate,
|
||||
f.NumTopics,
|
||||
f.NumPosts,
|
||||
f.LastPostID,
|
||||
f.LastPostAuthorID,
|
||||
f.LastPostTopicID,
|
||||
f.LastPostTime,
|
||||
COUNT(sr.ThreadID) AS SpecificRules,
|
||||
t.Title,
|
||||
t.IsLocked,
|
||||
t.IsSticky
|
||||
FROM forums AS f
|
||||
JOIN forums_categories AS fc ON fc.ID = f.CategoryID
|
||||
LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID
|
||||
LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID
|
||||
GROUP BY f.ID
|
||||
ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort');
|
||||
$Forums = $DB->to_array('ID', MYSQLI_ASSOC, false);
|
||||
foreach ($Forums as $ForumID => $Forum) {
|
||||
if (count($Forum['SpecificRules'])) {
|
||||
$DB->query("
|
||||
SELECT ThreadID
|
||||
FROM forums_specific_rules
|
||||
WHERE ForumID = $ForumID");
|
||||
$ThreadIDs = $DB->collect('ThreadID');
|
||||
$Forums[$ForumID]['SpecificRules'] = $ThreadIDs;
|
||||
}
|
||||
}
|
||||
unset($ForumID, $Forum);
|
||||
$Cache->cache_value('forums_list', $Forums, 0); //Inf cache.
|
||||
}
|
||||
return $Forums;
|
||||
}
|
||||
|
@ -22,47 +22,7 @@
|
||||
$Cache->cache_value('forums_categories', $ForumCats, 0); //Inf cache.
|
||||
}
|
||||
|
||||
//This variable contains all our lovely forum data
|
||||
if (!$Forums = $Cache->get_value('forums_list')) {
|
||||
$DB->query('
|
||||
SELECT
|
||||
f.ID,
|
||||
f.CategoryID,
|
||||
f.Name,
|
||||
f.Description,
|
||||
f.MinClassRead,
|
||||
f.MinClassWrite,
|
||||
f.MinClassCreate,
|
||||
f.NumTopics,
|
||||
f.NumPosts,
|
||||
f.LastPostID,
|
||||
f.LastPostAuthorID,
|
||||
f.LastPostTopicID,
|
||||
f.LastPostTime,
|
||||
COUNT(sr.ThreadID) AS SpecificRules,
|
||||
t.Title,
|
||||
t.IsLocked,
|
||||
t.IsSticky
|
||||
FROM forums AS f
|
||||
JOIN forums_categories AS fc ON fc.ID = f.CategoryID
|
||||
LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID
|
||||
LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID
|
||||
GROUP BY f.ID
|
||||
ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort');
|
||||
$Forums = $DB->to_array('ID', MYSQLI_ASSOC, false);
|
||||
foreach ($Forums as $ForumID => $Forum) {
|
||||
if (count($Forum['SpecificRules'])) {
|
||||
$DB->query("
|
||||
SELECT ThreadID
|
||||
FROM forums_specific_rules
|
||||
WHERE ForumID = $ForumID");
|
||||
$ThreadIDs = $DB->collect('ThreadID');
|
||||
$Forums[$ForumID]['SpecificRules'] = $ThreadIDs;
|
||||
}
|
||||
}
|
||||
unset($ForumID, $Forum);
|
||||
$Cache->cache_value('forums_list', $Forums, 0); //Inf cache.
|
||||
}
|
||||
$Forums = get_forums();
|
||||
|
||||
if (!empty($_POST['action'])) {
|
||||
switch ($_POST['action']) {
|
||||
|
@ -455,10 +455,8 @@
|
||||
<div style="float: left;"><a class="post_id" href="forums.php?action=viewthread&threadid=<?=$ThreadID?>&postid=<?=$PostID?>#post<?=$PostID?>">#<?=$PostID?></a>
|
||||
<?=Users::format_username($AuthorID, true, true, true, true, true)?>
|
||||
<?=time_diff($AddedTime,2)?>
|
||||
<? if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) { ?>
|
||||
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>', true);" class="brackets">Quote</a>
|
||||
<? }
|
||||
if ((!$ThreadInfo['IsLocked'] && check_forumperm($ForumID, 'Write') && $AuthorID == $LoggedUser['ID']) || check_perms('site_moderate_forums')) { ?>
|
||||
- <a href="#quickpost" id="quote_<?=$PostID?>" onclick="Quote('<?=$PostID?>','<?=$Username?>', true);" class="brackets">Quote</a>
|
||||
<? if ((!$ThreadInfo['IsLocked'] && check_forumperm($ForumID, 'Write') && $AuthorID == $LoggedUser['ID']) || check_perms('site_moderate_forums')) { ?>
|
||||
- <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');" class="brackets">Edit</a>
|
||||
<? }
|
||||
if (check_perms('site_admin_forums') && $ThreadInfo['Posts'] > 1) { ?>
|
||||
|
@ -169,7 +169,7 @@
|
||||
foreach ($ArtistForm as $Importance => $ArtistNames) {
|
||||
foreach ($ArtistNames as $Artist) {
|
||||
?>
|
||||
<input type="text" id="artist" name="artists[]" size="45" value="<?=display_str($Artist['name']) ?>" />
|
||||
<input type="text" id="artist" name="artists[]" <? Users::has_autocomplete_enabled('other'); ?> size="45" value="<?=display_str($Artist['name']) ?>" />
|
||||
<select id="importance" name="importance[]" >
|
||||
<option value="1"<?=($Importance === '1' ? ' selected="selected"' : '')?>>Main</option>
|
||||
<option value="2"<?=($Importance === '2' ? ' selected="selected"' : '')?>>Guest</option>
|
||||
@ -184,7 +184,7 @@
|
||||
<? }
|
||||
}
|
||||
} else {
|
||||
?> <input type="text" id="artist" name="artists[]" size="45" onblur="CheckVA();" />
|
||||
?> <input type="text" id="artist" name="artists[]" <? Users::has_autocomplete_enabled('other'); ?>size="45" onblur="CheckVA();" />
|
||||
<select id="importance" name="importance[]" >
|
||||
<option value="1">Main</option>
|
||||
<option value="2">Guest</option>
|
||||
|
@ -11,7 +11,7 @@ $(document).ready(function() {
|
||||
},
|
||||
});
|
||||
|
||||
if (url.path == 'torrents' || url.path == 'upload' || url.path == 'artist') {
|
||||
if (url.path == 'torrents' || url.path == 'upload' || url.path == 'artist' || (url.path == 'requests' && url.query['action'] == 'new')) {
|
||||
$("#artist" + SELECTOR).autocomplete({
|
||||
serviceUrl : ARTIST_AUTOCOMPLETE_URL
|
||||
});
|
||||
|
@ -19,9 +19,31 @@ function Quote(post, user) {
|
||||
Quote(post, user, false)
|
||||
}
|
||||
|
||||
var original_post;
|
||||
function Quote(post, user, link) {
|
||||
username = user;
|
||||
postid = post;
|
||||
if(!$('#reply_box').length) {
|
||||
if ($("#quote_" + postid).text() == "Quote") {
|
||||
original_post = $("#content" + postid).html();
|
||||
$("#quote_" + postid).text("Unquote");
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url: "ajax.php?action=raw_bbcode",
|
||||
dataType: "json",
|
||||
data : {
|
||||
"postid" : postid
|
||||
}
|
||||
}).done(function(response) {
|
||||
$("#content" + postid).html(response['response']['body']);
|
||||
select_all($("#content" + postid).get(0));
|
||||
});
|
||||
} else {
|
||||
document.getSelection().removeAllRanges();
|
||||
$("#content" + postid).html(original_post);
|
||||
$("#quote_" + postid).text("Quote");
|
||||
}
|
||||
} else {
|
||||
ajax.get("?action=get_post&post=" + postid, function(response) {
|
||||
if ($('#quickpost').raw().value !== '') {
|
||||
$('#quickpost').raw().value = $('#quickpost').raw().value + "\n\n";
|
||||
@ -32,6 +54,7 @@ function Quote(post, user, link) {
|
||||
+ "[/quote]";
|
||||
resize('quickpost');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function Edit_Form(post,key) {
|
||||
|
@ -126,3 +126,19 @@ function remove_selection(index) {
|
||||
function Stats(stat) {
|
||||
ajax.get("ajax.php?action=stats&stat=" + stat);
|
||||
}
|
||||
|
||||
// Thank you http://stackoverflow.com/questions/4578398/selecting-all-text-within-a-div-on-a-single-left-click-with-javascript
|
||||
function select_all(el) {
|
||||
if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") {
|
||||
var range = document.createRange();
|
||||
range.selectNodeContents(el);
|
||||
var sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
} else if (typeof document.selection != "undefined" && typeof document.body.createTextRange != "undefined") {
|
||||
var textRange = document.body.createTextRange();
|
||||
textRange.moveToElementText(el);
|
||||
textRange.select();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,15 @@ function AddArtistField() {
|
||||
x.appendChild(ArtistField);
|
||||
x.appendChild(document.createTextNode('\n'));
|
||||
x.appendChild(ImportanceField);
|
||||
|
||||
if ($("#artist").data("gazelle-autocomplete")) {
|
||||
$(ArtistField).live('focus', function() {
|
||||
$(ArtistField).autocomplete({
|
||||
serviceUrl : 'artist.php?action=autocomplete'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
ArtistCount++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user