mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-30 03:09:22 +02:00
Improved player reports, adding changelog system.
This commit is contained in:
parent
5e0170a264
commit
d6cff8692b
@ -72,7 +72,7 @@ if (empty($_POST) === false) {
|
|||||||
if ($action === 's') {
|
if ($action === 's') {
|
||||||
echo '<font color="green"><b>News successfully updated!</b></font>';
|
echo '<font color="green"><b>News successfully updated!</b></font>';
|
||||||
list($title, $text) = array(mysql_znote_escape_string($_POST['title']), mysql_znote_escape_string($_POST['text']));
|
list($title, $text) = array(mysql_znote_escape_string($_POST['title']), mysql_znote_escape_string($_POST['text']));
|
||||||
mysql_update("UPDATE `znote_news` SET `title`='$title',`text`='$text' WHERE `id`='$id';") or die("FUCK!");
|
mysql_update("UPDATE `znote_news` SET `title`='$title',`text`='$text' WHERE `id`='$id';");
|
||||||
$cache = new Cache('engine/cache/news');
|
$cache = new Cache('engine/cache/news');
|
||||||
$news = fetchAllNews();
|
$news = fetchAllNews();
|
||||||
$cache->setContent($news);
|
$cache->setContent($news);
|
||||||
|
@ -12,6 +12,9 @@ $statusTypes = array(
|
|||||||
4 => '<font color="grey">Rejected</font>',
|
4 => '<font color="grey">Rejected</font>',
|
||||||
5 => '<font color="green"><b>Fixed</b></font>'
|
5 => '<font color="green"><b>Fixed</b></font>'
|
||||||
);
|
);
|
||||||
|
// Which status IDs should give option to add to changelog?
|
||||||
|
$statusChangeLog = array(0,5);
|
||||||
|
|
||||||
// Autohide rows that have these status IDs:
|
// Autohide rows that have these status IDs:
|
||||||
$hideStatus = array(3, 4, 5);
|
$hideStatus = array(3, 4, 5);
|
||||||
|
|
||||||
@ -37,10 +40,16 @@ if (!empty($_POST)) {
|
|||||||
$customPoints = getValue($_POST['customPoints']);
|
$customPoints = getValue($_POST['customPoints']);
|
||||||
$reportId = getValue($_POST['id']);
|
$reportId = getValue($_POST['id']);
|
||||||
|
|
||||||
|
$changelogReportId = getValue($_POST['changelogReportId']);
|
||||||
|
$changelogValue = getValue($_POST['changelogValue']);
|
||||||
|
$changelogText = getValue($_POST['changelogText']);
|
||||||
|
$changelogStatus = ($changelogReportId !== false && $changelogValue === '2' && $changelogText !== false) ? true : false;
|
||||||
|
|
||||||
if ($customPoints !== false) $price = (int)($price + $customPoints);
|
if ($customPoints !== false) $price = (int)($price + $customPoints);
|
||||||
|
|
||||||
// Update SQL
|
// Update SQL
|
||||||
mysql_update("UPDATE `znote_player_reports` SET `status`='$status' WHERE `id`='$reportId' LIMIT 1;");
|
mysql_update("UPDATE `znote_player_reports` SET `status`='$status' WHERE `id`='$reportId' LIMIT 1;");
|
||||||
|
echo "<h1>Report status updated to ".$statusTypes[(int)$status] ."!</h1>";
|
||||||
// Update local array representation
|
// Update local array representation
|
||||||
foreach ($reports as $sid => $sa)
|
foreach ($reports as $sid => $sa)
|
||||||
foreach ($sa as $rid => $ra)
|
foreach ($sa as $rid => $ra)
|
||||||
@ -50,6 +59,24 @@ if (!empty($_POST)) {
|
|||||||
unset($reports[$sid][$rid]);
|
unset($reports[$sid][$rid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we should do anything with changelog:
|
||||||
|
if ($changelogStatus) {
|
||||||
|
$time = time();
|
||||||
|
// Check if changelog exist (`id`, `text`, `time`, `report_id`, `status`)
|
||||||
|
$changelog = mysql_select_single("SELECT * FROM `znote_changelog` WHERE `report_id`='$changelogReportId' LIMIT 1;");
|
||||||
|
// If changelog exist
|
||||||
|
if ($changelog !== false) {
|
||||||
|
// Update it
|
||||||
|
mysql_update("UPDATE `znote_changelog` SET `text`='$changelogText', `time`='$time' WHERE `id`='".$changelog['id']."' LIMIT 1;");
|
||||||
|
echo "<h2>Changelog message updated!</h2>";
|
||||||
|
} else {
|
||||||
|
// Create it
|
||||||
|
mysql_insert("INSERT INTO `znote_changelog` (`text`, `time`, `report_id`, `status`)
|
||||||
|
VALUES ('$changelogText', '$time', '$changelogReportId', '$status');");
|
||||||
|
echo "<h2>Changelog message created!</h2>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
// If we should give user price
|
// If we should give user price
|
||||||
if ($price > 0) {
|
if ($price > 0) {
|
||||||
$account = mysql_select_single("SELECT `a`.`id`, `a`.`email` FROM `accounts` AS `a`
|
$account = mysql_select_single("SELECT `a`.`id`, `a`.`email` FROM `accounts` AS `a`
|
||||||
@ -104,7 +131,21 @@ if (!empty($_POST)) {
|
|||||||
echo "<option value='$price'>$price</option>";
|
echo "<option value='$price'>$price</option>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select> + <input name="customPoints" type="text" style="width: 50px;" placeholder="0"><br><br>
|
</select> + <input name="customPoints" type="text" style="width: 50px;" placeholder="0"><br>
|
||||||
|
<?php
|
||||||
|
if (in_array($report['status'], $statusChangeLog)) {
|
||||||
|
?>
|
||||||
|
<br>
|
||||||
|
<input type="hidden" name="changelogReportId" value="<?php echo $report['id']; ?>">
|
||||||
|
Add / update changelog message? <select name="changelogValue">
|
||||||
|
<option value="1">No</option>
|
||||||
|
<option value="2">Yes</option>
|
||||||
|
</select><br>
|
||||||
|
<textarea rows="7" cols="40" maxlength="254" name="changelogText"></textarea>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<br>
|
||||||
<input type="submit" value="Update Report" style="width: 100%;">
|
<input type="submit" value="Update Report" style="width: 100%;">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
28
changelog.php
Normal file
28
changelog.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
|
||||||
|
|
||||||
|
<h1>Changelog</h1>
|
||||||
|
<?php
|
||||||
|
$changelogs = mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;");
|
||||||
|
if ($changelogs !== false) {
|
||||||
|
?>
|
||||||
|
<table>
|
||||||
|
<tr class="yellow">
|
||||||
|
<td>Changelogs</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
foreach ($changelogs as $changelog) {
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><b><?php echo getClock($changelog['time'], true, true); ?></b><br><?php echo $changelog['text']; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
include 'layout/overall/footer.php'; ?>
|
@ -107,6 +107,15 @@ CREATE TABLE IF NOT EXISTS `znote_player_reports` (
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `znote_changelog` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`text` VARCHAR(255) NOT NULL,
|
||||||
|
`time` INT(11) NOT NULL,
|
||||||
|
`report_id` INT(11) NOT NULL,
|
||||||
|
`status` TINYINT(3) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `znote_shop` (
|
CREATE TABLE IF NOT EXISTS `znote_shop` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`type` int(11) NOT NULL,
|
`type` int(11) NOT NULL,
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
<li><a href="forum.php">Community</a>
|
<li><a href="forum.php">Community</a>
|
||||||
<ul> <!-- (sub)dropdown COMMUNITY -->
|
<ul> <!-- (sub)dropdown COMMUNITY -->
|
||||||
|
<li><a href="market.php">Item Market</a></li>
|
||||||
<li><a href="gallery.php">Gallery</a></li>
|
<li><a href="gallery.php">Gallery</a></li>
|
||||||
<li><a href="support.php">Support</a></li>
|
<li><a href="support.php">Support</a></li>
|
||||||
<li><a href="houses.php">Houses</a></li>
|
<li><a href="houses.php">Houses</a></li>
|
||||||
@ -27,5 +28,5 @@
|
|||||||
<li><a href="guildwar.php">Guild Wars</a></li>
|
<li><a href="guildwar.php">Guild Wars</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<?php } ?></li>
|
<?php } ?></li>
|
||||||
|
<li><a href="changelog.php">Changelog</a></li>
|
||||||
</ul>
|
</ul>
|
@ -14,7 +14,8 @@ if ($array) {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
foreach ($array as $value) {
|
foreach ($array as $value) {
|
||||||
echo '<tr>';
|
$url = url("characterprofile.php?name=". $value['name']);
|
||||||
|
echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">';
|
||||||
echo '<td><a href="characterprofile.php?name='. $value['name'] .'">'. $value['name'] .'</a></td>';
|
echo '<td><a href="characterprofile.php?name='. $value['name'] .'">'. $value['name'] .'</a></td>';
|
||||||
echo '<td>'. $value['level'] .'</td>';
|
echo '<td>'. $value['level'] .'</td>';
|
||||||
echo '<td>'. vocation_id_to_name($value['vocation']) .'</td>';
|
echo '<td>'. vocation_id_to_name($value['vocation']) .'</td>';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user