Empty commit

This commit is contained in:
Git 2012-12-11 08:00:18 +00:00
parent 5625f727e8
commit 0ade9fcc52
5 changed files with 114 additions and 35 deletions

View File

@ -35,7 +35,7 @@ function to_id($Alias) {
return $ArticleID;
}
*/
function article($ArticleID) {
function article($ArticleID, $Error = true) {
global $Cache, $DB;
$Contents = $Cache->get_value('wiki_article_'.$ArticleID);
if(!$Contents){
@ -55,7 +55,7 @@ function article($ArticleID) {
LEFT JOIN users_main AS u ON u.ID=w.Author
WHERE w.ID='$ArticleID'
GROUP BY w.ID");
if(!$DB->record_count()) { error(404); }
if(!$DB->record_count() && $Error) { error(404); }
$Contents = $DB->to_array();
$Cache->cache_value('wiki_article_'.$ArticleID, $Contents, 3600*24*14);
}

View File

@ -12,11 +12,11 @@
header('Content-Type: application/json; charset=utf-8');
switch ($_GET['action']){
switch ($_GET['action']) {
// things that (may be) used on the site
case 'upload_section':
// Gets one of the upload forms
require(SERVER_ROOT.'/sections/ajax/upload.php');
require(SERVER_ROOT . '/sections/ajax/upload.php');
break;
case 'preview':
require('preview.php');
@ -31,7 +31,7 @@
require('grab_report.php');
break;
case 'stats':
require(SERVER_ROOT.'/sections/ajax/stats.php');
require(SERVER_ROOT . '/sections/ajax/stats.php');
break;
case 'checkprivate':
@ -42,78 +42,82 @@
require('torrentgroup.php');
break;
case 'tcomments':
require(SERVER_ROOT.'/sections/ajax/tcomments.php');
require(SERVER_ROOT . '/sections/ajax/tcomments.php');
break;
case 'user':
require(SERVER_ROOT.'/sections/ajax/user.php');
require(SERVER_ROOT . '/sections/ajax/user.php');
break;
case 'forum':
require(SERVER_ROOT.'/sections/ajax/forum/index.php');
require(SERVER_ROOT . '/sections/ajax/forum/index.php');
break;
case 'top10':
require(SERVER_ROOT.'/sections/ajax/top10/index.php');
require(SERVER_ROOT . '/sections/ajax/top10/index.php');
break;
case 'browse':
require(SERVER_ROOT.'/sections/ajax/browse.php');
require(SERVER_ROOT . '/sections/ajax/browse.php');
break;
case 'usersearch':
require(SERVER_ROOT.'/sections/ajax/usersearch.php');
require(SERVER_ROOT . '/sections/ajax/usersearch.php');
break;
case 'requests':
require(SERVER_ROOT.'/sections/ajax/requests.php');
require(SERVER_ROOT . '/sections/ajax/requests.php');
break;
case 'artist':
require(SERVER_ROOT.'/sections/ajax/artist.php');
require(SERVER_ROOT . '/sections/ajax/artist.php');
break;
case 'inbox':
require(SERVER_ROOT.'/sections/ajax/inbox/index.php');
require(SERVER_ROOT . '/sections/ajax/inbox/index.php');
break;
case 'subscriptions':
require(SERVER_ROOT.'/sections/ajax/subscriptions.php');
require(SERVER_ROOT . '/sections/ajax/subscriptions.php');
break;
case 'index':
require(SERVER_ROOT.'/sections/ajax/info.php');
require(SERVER_ROOT . '/sections/ajax/info.php');
break;
case 'bookmarks':
require(SERVER_ROOT.'/sections/ajax/bookmarks/index.php');
require(SERVER_ROOT . '/sections/ajax/bookmarks/index.php');
break;
case 'announcements':
require(SERVER_ROOT.'/sections/ajax/announcements.php');
require(SERVER_ROOT . '/sections/ajax/announcements.php');
break;
case 'notifications':
require(SERVER_ROOT.'/sections/ajax/notifications.php');
require(SERVER_ROOT . '/sections/ajax/notifications.php');
break;
case 'request':
require(SERVER_ROOT.'/sections/ajax/request.php');
require(SERVER_ROOT . '/sections/ajax/request.php');
break;
case 'loadavg':
require(SERVER_ROOT.'/sections/ajax/loadavg.php');
require(SERVER_ROOT . '/sections/ajax/loadavg.php');
break;
case 'better':
require(SERVER_ROOT.'/sections/ajax/better/index.php');
require(SERVER_ROOT . '/sections/ajax/better/index.php');
break;
case 'password_validate':
require(SERVER_ROOT.'/sections/ajax/password_validate.php');
require(SERVER_ROOT . '/sections/ajax/password_validate.php');
break;
case 'similar_artists':
require(SERVER_ROOT.'/sections/ajax/similar_artists.php');
require(SERVER_ROOT . '/sections/ajax/similar_artists.php');
break;
case 'userhistory':
require(SERVER_ROOT.'/sections/ajax/userhistory/index.php');
require(SERVER_ROOT . '/sections/ajax/userhistory/index.php');
break;
case 'votefavorite':
require(SERVER_ROOT.'/sections/ajax/takevote.php');
require(SERVER_ROOT . '/sections/ajax/takevote.php');
break;
case 'wiki':
require(SERVER_ROOT . '/sections/ajax/wiki.php');
break;
default:
// If they're screwing around with the query string
print json_encode(array('status' => 'failure'));
}
function pullmediainfo($Array) {
function pullmediainfo($Array)
{
$NewArray = array();
foreach ($Array as $Item) {
$NewArray[] = array(
'id' => (int) $Item['id'],
'id' => (int)$Item['id'],
'name' => $Item['name']
);
}

65
sections/ajax/wiki.php Normal file
View File

@ -0,0 +1,65 @@
<?
include(SERVER_ROOT . '/classes/class_text.php');
include(SERVER_ROOT . '/classes/class_alias.php');
$Text = new TEXT(true);
$Alias = new ALIAS;
if (!empty($_GET['id']) && is_number($_GET['id'])) { //Visiting article via ID
$ArticleID = $_GET['id'];
} elseif ($_GET['name'] != '') { //Retrieve article ID via alias.
$ArticleID = $Alias->to_id($_GET['name']);
} else {
print json_encode(
array(
'status' => 'error',
)
);
die();
}
if (!$ArticleID) { //No article found
print json_encode(
array(
'status' => 'not found',
)
);
die();
}
$Article = $Alias->article($ArticleID, false);
if (!$Article) {
print json_encode(
array(
'status' => 'not found',
)
);
die();
}
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName, $Aliases, $UserIDs) = array_shift($Article);
if ($Read > $LoggedUser['EffectiveClass']) {
print json_encode(
array(
'status' => 'You must be a higher user class to view this wiki article',
)
);
die();
}
$TextBody = $Text->full_format($Body, false);
print json_encode(
array(
'status' => 'success',
'response' => array(
'title' => $Title,
'bbBody' => $Body,
'body' => $TextBody,
'aliases' => $Aliases,
'authorID' => (int)$AuthorID,
'authorName' => $AuthorName,
'date' => $Date,
'revision' => (int)$Revision
)
));
?>

View File

@ -210,7 +210,7 @@
<tr>
<td colspan="2">
<? if ($ClaimerID) { ?>
Claimed by <?=Users::format_username($ClaimerID, false, false, false, false)?>
<span id="claimed_<?=$ReportID?>">Claimed by <?=Users::format_username($ClaimerID, false, false, false, false)?></span>
<? } else { ?>
<a href="#" id="claim_<?=$ReportID?>" onclick="claim(<?=$ReportID?>); return false;"; return false;">Claim</a>
<? } ?>
@ -231,7 +231,7 @@
<input type="hidden" name="reportid" value="<?=$ReportID?>"/>
<input type="hidden" name="action" value="takeresolve"/>
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>"/>
<input type="submit" name="submit" value="Resolve"/>
<input type="submit" onclick="return resolve(<?=$ReportID?>)" name="submit" value="Resolve"/>
</td>
</tr>
<? } ?>

View File

@ -35,3 +35,13 @@ function claim(id) {
});
}
function resolve(id) {
if ($('#claimed_' + id).raw()) {
var answer = confirm("This is a claimed report, are you sure you want to resolve it?");
if (answer)
return true;
else
return false;
}
return true;
}