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

View File

@ -12,11 +12,11 @@
header('Content-Type: application/json; charset=utf-8'); header('Content-Type: application/json; charset=utf-8');
switch ($_GET['action']){ switch ($_GET['action']) {
// things that (may be) used on the site // things that (may be) used on the site
case 'upload_section': case 'upload_section':
// Gets one of the upload forms // Gets one of the upload forms
require(SERVER_ROOT.'/sections/ajax/upload.php'); require(SERVER_ROOT . '/sections/ajax/upload.php');
break; break;
case 'preview': case 'preview':
require('preview.php'); require('preview.php');
@ -31,7 +31,7 @@
require('grab_report.php'); require('grab_report.php');
break; break;
case 'stats': case 'stats':
require(SERVER_ROOT.'/sections/ajax/stats.php'); require(SERVER_ROOT . '/sections/ajax/stats.php');
break; break;
case 'checkprivate': case 'checkprivate':
@ -42,78 +42,82 @@
require('torrentgroup.php'); require('torrentgroup.php');
break; break;
case 'tcomments': case 'tcomments':
require(SERVER_ROOT.'/sections/ajax/tcomments.php'); require(SERVER_ROOT . '/sections/ajax/tcomments.php');
break; break;
case 'user': case 'user':
require(SERVER_ROOT.'/sections/ajax/user.php'); require(SERVER_ROOT . '/sections/ajax/user.php');
break; break;
case 'forum': case 'forum':
require(SERVER_ROOT.'/sections/ajax/forum/index.php'); require(SERVER_ROOT . '/sections/ajax/forum/index.php');
break; break;
case 'top10': case 'top10':
require(SERVER_ROOT.'/sections/ajax/top10/index.php'); require(SERVER_ROOT . '/sections/ajax/top10/index.php');
break; break;
case 'browse': case 'browse':
require(SERVER_ROOT.'/sections/ajax/browse.php'); require(SERVER_ROOT . '/sections/ajax/browse.php');
break; break;
case 'usersearch': case 'usersearch':
require(SERVER_ROOT.'/sections/ajax/usersearch.php'); require(SERVER_ROOT . '/sections/ajax/usersearch.php');
break; break;
case 'requests': case 'requests':
require(SERVER_ROOT.'/sections/ajax/requests.php'); require(SERVER_ROOT . '/sections/ajax/requests.php');
break; break;
case 'artist': case 'artist':
require(SERVER_ROOT.'/sections/ajax/artist.php'); require(SERVER_ROOT . '/sections/ajax/artist.php');
break; break;
case 'inbox': case 'inbox':
require(SERVER_ROOT.'/sections/ajax/inbox/index.php'); require(SERVER_ROOT . '/sections/ajax/inbox/index.php');
break; break;
case 'subscriptions': case 'subscriptions':
require(SERVER_ROOT.'/sections/ajax/subscriptions.php'); require(SERVER_ROOT . '/sections/ajax/subscriptions.php');
break; break;
case 'index': case 'index':
require(SERVER_ROOT.'/sections/ajax/info.php'); require(SERVER_ROOT . '/sections/ajax/info.php');
break; break;
case 'bookmarks': case 'bookmarks':
require(SERVER_ROOT.'/sections/ajax/bookmarks/index.php'); require(SERVER_ROOT . '/sections/ajax/bookmarks/index.php');
break; break;
case 'announcements': case 'announcements':
require(SERVER_ROOT.'/sections/ajax/announcements.php'); require(SERVER_ROOT . '/sections/ajax/announcements.php');
break; break;
case 'notifications': case 'notifications':
require(SERVER_ROOT.'/sections/ajax/notifications.php'); require(SERVER_ROOT . '/sections/ajax/notifications.php');
break; break;
case 'request': case 'request':
require(SERVER_ROOT.'/sections/ajax/request.php'); require(SERVER_ROOT . '/sections/ajax/request.php');
break; break;
case 'loadavg': case 'loadavg':
require(SERVER_ROOT.'/sections/ajax/loadavg.php'); require(SERVER_ROOT . '/sections/ajax/loadavg.php');
break; break;
case 'better': case 'better':
require(SERVER_ROOT.'/sections/ajax/better/index.php'); require(SERVER_ROOT . '/sections/ajax/better/index.php');
break; break;
case 'password_validate': case 'password_validate':
require(SERVER_ROOT.'/sections/ajax/password_validate.php'); require(SERVER_ROOT . '/sections/ajax/password_validate.php');
break; break;
case 'similar_artists': case 'similar_artists':
require(SERVER_ROOT.'/sections/ajax/similar_artists.php'); require(SERVER_ROOT . '/sections/ajax/similar_artists.php');
break; break;
case 'userhistory': case 'userhistory':
require(SERVER_ROOT.'/sections/ajax/userhistory/index.php'); require(SERVER_ROOT . '/sections/ajax/userhistory/index.php');
break; break;
case 'votefavorite': 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; break;
default: default:
// If they're screwing around with the query string // If they're screwing around with the query string
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
} }
function pullmediainfo($Array) { function pullmediainfo($Array)
{
$NewArray = array(); $NewArray = array();
foreach ($Array as $Item) { foreach ($Array as $Item) {
$NewArray[] = array( $NewArray[] = array(
'id' => (int) $Item['id'], 'id' => (int)$Item['id'],
'name' => $Item['name'] '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> <tr>
<td colspan="2"> <td colspan="2">
<? if ($ClaimerID) { ?> <? 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 { ?> <? } else { ?>
<a href="#" id="claim_<?=$ReportID?>" onclick="claim(<?=$ReportID?>); return false;"; return false;">Claim</a> <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="reportid" value="<?=$ReportID?>"/>
<input type="hidden" name="action" value="takeresolve"/> <input type="hidden" name="action" value="takeresolve"/>
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>"/> <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> </td>
</tr> </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;
}