Skip to content

Commit

Permalink
[488] Simple admin panel. At this moment access to this panel has onl…
Browse files Browse the repository at this point in the history
…y server administrators (GMLevel 3).
  • Loading branch information
Shadez committed Mar 19, 2011
1 parent 7b25de3 commit 774d10d
Show file tree
Hide file tree
Showing 115 changed files with 10,345 additions and 62 deletions.
6 changes: 5 additions & 1 deletion 3DViewer_info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ You can find textures archive on filekeeper.org:
http://filekeeper.org/download/browser.php?path=shadez1%2Fwowarmory/
Direct link:
http://filekeeper.org/download/shadez1/wowarmory/3dviewer_textures_448.7z
Mirror link (user's server, can't guarantee anything):
http://files.alein.org/wow/armory/

-----------------------

Expand All @@ -51,4 +53,6 @@ http://getmangos.com/community/topic/12096/world-of-warcraft-armory/
Архив с текстурами можно найти на filekeeper.org:
http://filekeeper.org/download/browser.php?path=shadez1%2Fwowarmory/
Прямая ссылка:
http://filekeeper.org/download/shadez1/wowarmory/3dviewer_textures_448.7z
http://filekeeper.org/download/shadez1/wowarmory/3dviewer_textures_448.7z
Зеркало (пользовательский сервер, гарантий нет):
http://files.alein.org/wow/armory/
128 changes: 128 additions & 0 deletions admin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?php

/**
* @package World of Warcraft Armory
* @version Release 4.50
* @revision 467
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**/

define('__ARMORY__', true);
define('ADMIN_PAGE', true);
if(!@include('../includes/armory_loader.php')) {
die('<b>Fatal error:</b> unable to load system files.');
}
if(isset($_GET['logout'])) {
Admin::PerformLogout();
header('Location: .');
exit;
}
if(isset($_POST['username']) && isset($_POST['password'])) {
$username = $_POST['username']; // No SQL Injection
$password = $_POST['password']; // No SQL Injection
Admin::PerformLogin($username, $password);
}
Template::SetPageData('action', isset($_GET['action']) ? $_GET['action'] : 'index');
Template::SetPageData('subaction', isset($_GET['subaction']) ? $_GET['subaction'] : null);
switch(Template::GetPageData('action')) {
case 'news':
switch(Template::GetPageData('subaction')) {
case 'edit':
if(isset($_POST['date'])) {
$_POST['id'] = $_POST['newsid'];
Template::SetPageData('news_result', Utils::AddNewsItem($_POST, true));
}
else {
if(isset($_GET['itemid'])) {
Template::SetPageData('news_item', Utils::GetArmoryNews(false, $_GET['itemid']));
}
}
break;
case 'add':
if(isset($_POST['date'])) {
$_POST['id'] = $_POST['newsid'];
Template::SetPageData('news_result', Utils::AddNewsItem($_POST));
}
else {
Template::SetPageData('news_item', Utils::GetArmoryNews(0, 0, true));
}
break;
}
break;
case 'config':
switch(Template::GetPageData('subaction')) {
case 'edit':
if(isset($_POST['subm'])) {
Admin::UpdateConfigFile($_POST);
header('Location: ?action=config');
exit;
}
break;
case 'addrealm':
if(isset($_POST['subm'])) {
Admin::AddNewRealm($_POST);
}
break;
}
break;
case 'accounts':
Template::SetPageData('page', isset($_GET['page']) ? (int) $_GET['page'] : 1);
switch(Template::GetPageData('subaction')) {
default:
Template::SetPageData('sortby', isset($_GET['sortby']) ? in_array($_GET['sortby'], array('id', 'username', 'gmlevel')) ? $_GET['sortby'] : 'username' : 'username');
Template::SetPageData('sorttype', isset($_GET['sorttype']) ? in_array(strtoupper($_GET['sorttype']), array('ASC', 'DESC')) ? $_GET['sorttype'] : 'ASC' : 'ASC');
if(isset($_POST['searchAccount'])) {
$searchAccount = $_POST['searchAccount'];
}
else {
$searchAccount = null;
}
switch(Template::GetPageData('sortby')) {
case 'username':
case 'gmlevel':
Template::SetPageData('accounts_list', Admin::GetAccountsList(Template::GetPageData('page'), Template::GetPageData('sortby'), Template::GetPageData('sorttype'), $searchAccount));
break;
}
break;
case 'edit':
Template::SetPageData('accountid', isset($_GET['accountid']) ? $_GET['accountid'] : 0);
if(isset($_POST['subm'])) {
Admin::UpdateAccount($_POST);
}
break;
case 'delete':
if(!isset($_GET['accountid'])) {
$accid = 0;
}
else {
$accid = (int) $_GET['accountid'];
}
Admin::DeleteAccount($accid);
header('Location: ?action=accounts');
exit;
break;
}
break;
}
if(!Admin::IsLoggedIn()) {
Template::LoadTemplate('page_login');
}
else {
Template::LoadTemplate('page_index');
}
?>
76 changes: 76 additions & 0 deletions admin/template/content_account_edit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!-- CONTENT START -->
<div class="grid_16" id="content">
<!-- CONTENT TITLE -->
<div class="grid_9">
<h1 class="content_edit">Edit Account</h1>
</div>
<!-- TEXT CONTENT OR ANY OTHER CONTENT START -->
<div class="grid_15" id="textcontent">
<a href="?action=accounts">Go back</a>

<?php
$account = Admin::GetAccount(Template::GetPageData('accountid'));
if(is_array($account)) {
$gm_levelInfo = null;
if(!isset($account['gmlevel'])) {
// trinity.
$gmlevels = Armory::$rDB->select("SELECT * FROM `account_access` WHERE `id` = %d", $account['id']);
if(is_array($gmlevels)) {
foreach($gmlevels as $gmlevel) {
$gm_levelInfo .= sprintf('<label>RealmID: "%d"</label><input type="text" name="gmlevel_%d" value="%d" />', $gmlevel['RealmID'], $gmlevel['RealmID'], $gmlevel['gmlevel']);
}
}
}
else {
$gm_levelInfo = sprintf('<input type="text" name="gmlevel" value="%d" />', $account['gmlevel']);
}
echo sprintf('<form id="edit" name="edit" action="?action=accounts&subaction=edit&accountid=%d" method="post">
<label>User ID (do not change!):</label>
<input type="text" name="id" value="%d" />
<label>User Name:</label>
<input type="text" name="username" value="%s" />
<label>Sha1 Hash:</label>
<input type="text" name="sha_pass_hash" value="%s" size="40" />
<label>GM Level:</label>
%s
<label>E-Mail:</label>
<input type="text" name="email" value="%s" />
<label>Join Date:</label>
<input type="text" name="joindate" value="%s" />
<label>Last IP:</label>
<input type="text" name="last_ip" value="%s" />
<label>Locked:</label>
<input type="radio" name="locked" value="1"%s /> Yes
<input type="radio" name="locked" value="0"%s /> No
<label>Last Login:</label>
<input type="text" name="last_login" value="%s" />
<label>Expansion:</label>
<select name="expansion">
<option value="2"%s>Wrath of the Lich King</option>
<option value="1"%s>The Burning Crusade</option>
<option value="0"%s>World of Warcraft Classic</option>
</select>
<br />
<br />
<input type="submit" name="subm" value="Update Account" />
</form>', $account['id'],
$account['id'],
$account['username'],
$account['sha_pass_hash'],
$gm_levelInfo,
$account['email'],
$account['joindate'],
$account['last_ip'],
$account['locked'] == 1 ? ' checked' : null,
$account['locked'] == 0 ? ' checked' : null,
$account['last_login'],
$account['expansion'] == 2 ? ' selected' : null,
$account['expansion'] == 1 ? ' selected' : null,
$account['expansion'] == 0 ? ' selected' : null);
}
?>

<div class="clear"></div><br />
</div>
<div class="clear"> </div>
<!-- END CONTENT-->
84 changes: 84 additions & 0 deletions admin/template/content_accounts_list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<!-- CONTENT START -->
<div class="grid_16" id="content">
<div class="grid_9">
<h1 class="content_edit">Accounts</h1>
</div>
<div class="clear">
</div>
<div id="portlets">
<div class="clear"></div>
<div class="portlet">
<div class="portlet-header fixed"><img src="template/images/icons/user.gif" width="16" height="16" alt="Accounts List" title="Accounts List" />Accounts List</div>
<form id="edit" name="edit" action="?action=accounts" method="post">
<input type="text" name="searchAccount" value="<?php echo isset($_POST['searchAccount']) ? $_POST['searchAccount'] : null; ?>" />
<input type="submit" name="subm" value="Search" />
</form>
<br />
<div class="portlet-content nopadding">
<form action="" method="post">
<table width="100%" cellpadding="0" cellspacing="0" id="box-table-a" summary="">
<thead>
<tr>
<th width="34" scope="col"><input type="checkbox" name="allbox" id="allbox" onclick="checkAll()" /></th>
<th width="136" scope="col"><a href="?action=accounts&sortby=username&sorttype=<?php echo isset($_GET['sorttype']) ? $_GET['sorttype'] == 'ASC' ? 'DESC' : 'ASC' : 'ASC'; ?>">Username</a></th>
<th width="102" scope="col">Hash</th>
<th width="109" scope="col"><a href="?action=accounts&sortby=gmlevel&sorttype=<?php echo isset($_GET['sorttype']) ? $_GET['sorttype'] == 'ASC' ? 'DESC' : 'ASC' : 'ASC'; ?>">GM Level</a></th>
<th width="129" scope="col">E-Mail</th>
<th width="171" scope="col">IP Address</th>
<th width="123" scope="col">Last Login</th>
<th width="90" scope="col">Actions</th>
</tr>
</thead>
<tbody>
<?php
$accounts_list = Template::GetPageData('accounts_list');
if(is_array($accounts_list)) {
foreach($accounts_list as $account) {
echo sprintf('<tr>
<td width="34"><label>
<input type="checkbox" name="checkbox" id="checkbox" />
</label></td>
<td>%s</td>
<td>%s</td>
<td>%d</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td width="90"><a href="?action=accounts&subaction=edit&accountid=%d" class="edit_icon" title="Edit"></a> <a href="?action=accounts&subaction=delete&accountid=%d" class="delete_icon" title="Delete"></a></td>
</tr>', $account['username'], $account['sha_pass_hash'], $account['gmlevel'], $account['email'], $account['last_ip'], $account['last_login'], $account['id'], $account['id']);
}
}
?>

<tr class="footer">
<td colspan="4">&nbsp;</td>
<td align="right">&nbsp;</td>
<td colspan="3" align="right">
<!-- PAGINATION START -->
<div class="pagination">
<?php
$page_count = round(Armory::$rDB->selectCell("SELECT COUNT(*) FROM `account`") / 20)+1;
if($page_count < 1) {
$page_count = 1;
}
for($iter = 1; $iter < $page_count; ++$iter) {
if($iter == Template::GetPageData('page')) {
echo sprintf('<span class="active">%d</span>', $iter);
}
else {
echo sprintf('<a href="?action=accounts&page=%d">%d</a>', $iter, $iter);
}
}
?>
</div>
<!-- PAGINATION END -->
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
<div class="clear"> </div>
<!-- END CONTENT-->
14 changes: 14 additions & 0 deletions admin/template/content_configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- CONTENT START -->
<div class="grid_16" id="content">
<!-- CONTENT TITLE -->
<div class="grid_9">
<h1 class="content_edit">Configuration</h1>
</div>
<!-- TEXT CONTENT OR ANY OTHER CONTENT START -->
<div class="grid_15" id="textcontent">
<a href="?action=config&subaction=edit">Edit configuration</a><br />
<a href="?action=config&subaction=addrealm">Add new realm</a>
<div class="clear"></div><br />
</div>
<div class="clear"> </div>
<!-- END CONTENT-->
49 changes: 49 additions & 0 deletions admin/template/content_configuration_addrealm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!-- CONTENT START -->
<div class="grid_16" id="content">
<!-- CONTENT TITLE -->
<div class="grid_9">
<h1 class="content_edit">Add Realm</h1>
</div>
<!-- TEXT CONTENT OR ANY OTHER CONTENT START -->
<div class="grid_15" id="textcontent">
<a href="?action=config">Go back</a>
<form id="edit" name="edit" action="?action=config&subaction=addrealm" method="post">
<label>Realm ID (do not change!):</label>
<input type="text" name="realmID" value="<?php echo count(Armory::$realmData) + 1; ?>" />
<label>Realm Name:</label>
<input type="text" name="realmName" value="" />
<label>Realm Type:</label>
<select name="realmType">
<option value="1">MaNGOS</option>
<option value="2">Trinity Core</option>
</select>
<br />
<br />
<label>Characters MySQL DB host:</label>
<input type="text" name="realmCharsHost" value="<?php echo Armory::$mysqlconfig['host_armory']; ?>" />
<label>Characters MySQL DB user:</label>
<input type="text" name="realmCharsUser" value="<?php echo Armory::$mysqlconfig['user_armory']; ?>" />
<label>Characters MySQL DB user password:</label>
<input type="text" name="realmCharsPassword" value="<?php echo Armory::$mysqlconfig['pass_armory']; ?>" />
<label>Characters MySQL DB name:</label>
<input type="text" name="realmCharsName" />
<label>Characters MySQL DB charset:</label>
<input type="text" name="realmCharsCharset" value="UTF8" />
<br />
<label>World MySQL DB host:</label>
<input type="text" name="realmWorldHost" value="<?php echo Armory::$mysqlconfig['host_armory']; ?>" />
<label>World MySQL DB user:</label>
<input type="text" name="realmWorldUser" value="<?php echo Armory::$mysqlconfig['user_armory']; ?>" />
<label>World MySQL DB user password:</label>
<input type="text" name="realmWorldPassword" value="<?php echo Armory::$mysqlconfig['pass_armory']; ?>" />
<label>World MySQL DB name:</label>
<input type="text" name="realmWorldName" />
<label>World MySQL DB charset:</label>
<input type="text" name="realmWorldCharset" value="UTF8" />
<br />
<input type="submit" name="subm" value="Submit" />
</form>
<div class="clear"></div><br />
</div>
<div class="clear"> </div>
<!-- END CONTENT-->
Loading

0 comments on commit 774d10d

Please sign in to comment.