mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 01:34:55 +02:00
* moved admin pages to twig
* edited account.management.html.twig to fit modern templates, tibiacom have its own template * sample characters are now assigned to admin account and have group_id 4 to not be shown on highscores * fixed database pages loading * added require.database plugin option, which will prove if DATABASE_VERSION is enough
This commit is contained in:
@@ -64,7 +64,7 @@ $errors = array();
|
||||
else
|
||||
{
|
||||
if($config['generate_new_reckey'] && $config['mail_enabled'])
|
||||
$account_registered = '<b><font color="green">Yes ( <a href="?subtopic=accountmanagement&action=registernew"> Buy new Recovery Key </a> )</font></b>';
|
||||
$account_registered = '<b><font color="green">Yes ( <a href="' . getLink('account/register/new') . '"> Buy new Recovery Key </a> )</font></b>';
|
||||
else
|
||||
$account_registered = '<b><font color="green">Yes</font></b>';
|
||||
}
|
||||
@@ -105,18 +105,6 @@ $errors = array();
|
||||
$players = array();
|
||||
$account_players = $account_logged->getPlayersList();
|
||||
$account_players->orderBy('id');
|
||||
//show list of players on account
|
||||
foreach($account_players as $player)
|
||||
{
|
||||
$players[] = array(
|
||||
'name' => $player->getName(),
|
||||
'name_encoded' => urlencode($player->getName()),
|
||||
'deleted' => $player->isDeleted(),
|
||||
'level' => $player->getLevel(),
|
||||
'vocation' => $config['vocations'][$player->getVocation()],
|
||||
'online' => $player->isOnline()
|
||||
);
|
||||
}
|
||||
|
||||
echo $twig->render('account.management.html.twig', array(
|
||||
'welcome_message' => $welcome_message,
|
||||
@@ -133,7 +121,7 @@ $errors = array();
|
||||
'account_rlname' => $account_rlname,
|
||||
'account_location' => $account_location,
|
||||
'actions' => $actions,
|
||||
'players' => $players
|
||||
'players' => $account_players
|
||||
));
|
||||
}
|
||||
//########### CHANGE PASSWORD ##########
|
||||
@@ -147,31 +135,31 @@ $errors = array();
|
||||
else
|
||||
{
|
||||
if(empty($new_password) || empty($new_password2) || empty($old_password)){
|
||||
$show_msgs[] = "Please fill in form.";
|
||||
$errors[] = "Please fill in form.";
|
||||
}
|
||||
$password_strlen = strlen($new_password);
|
||||
if($new_password != $new_password2) {
|
||||
$show_msgs[] = "The new passwords do not match!";
|
||||
$errors[] = "The new passwords do not match!";
|
||||
}
|
||||
else if($password_strlen < 8) {
|
||||
$show_msgs[] = "New password minimal length is 8 characters.";
|
||||
$errors[] = "New password minimal length is 8 characters.";
|
||||
}
|
||||
else if($password_strlen > 32) {
|
||||
$show_msgs[] = "New password maximal length is 32 characters.";
|
||||
$errors[] = "New password maximal length is 32 characters.";
|
||||
}
|
||||
|
||||
if(empty($show_msgs)) {
|
||||
if(empty($errors)) {
|
||||
if(!check_password($new_password)) {
|
||||
$show_msgs[] = "New password contains illegal chars (a-z, A-Z and 0-9 only!). Minimum password length is 7 characters and maximum 32.";
|
||||
$errors[] = "New password contains illegal chars (a-z, A-Z and 0-9 only!). Minimum password length is 7 characters and maximum 32.";
|
||||
}
|
||||
$old_password = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $old_password);
|
||||
if($old_password != $account_logged->getPassword()) {
|
||||
$show_msgs[] = "Current password is incorrect!";
|
||||
$errors[] = "Current password is incorrect!";
|
||||
}
|
||||
}
|
||||
if(!empty($show_msgs)){
|
||||
if(!empty($errors)){
|
||||
//show errors
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $show_msg));
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
|
||||
//show form
|
||||
echo $twig->render('account.change_password.html.twig');
|
||||
|
@@ -26,7 +26,7 @@ $access = 0;
|
||||
if(!empty($action))
|
||||
{
|
||||
if($action == 'delete' || $action == 'edit' || $action == 'hide')
|
||||
$id = $_REQUEST['id'];
|
||||
$id = $_REQUEST['id'];
|
||||
|
||||
if(isset($_REQUEST['name']))
|
||||
$name = $_REQUEST['name'];
|
||||
@@ -83,147 +83,35 @@ if(!empty($action))
|
||||
if(!empty($errors))
|
||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
$use_tinymce = false;
|
||||
//if($action != 'edit' || !$php)
|
||||
// $use_tinymce = true;
|
||||
|
||||
if($use_tinymce): ?>
|
||||
<script type="text/javascript" src="tools/tiny_mce/jquery.tinymce.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('#news-body').tinymce({
|
||||
script_url : 'tools/tiny_mce/tiny_mce.js',
|
||||
forced_root_block : false,
|
||||
|
||||
theme : "advanced",
|
||||
plugins: "safari,advimage,emotions,insertdatetime,preview,wordcount",
|
||||
|
||||
theme_advanced_buttons3_add : "emotions,insertdate,inserttime,preview,|,forecolor,backcolor",
|
||||
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_statusbar_location : "bottom",
|
||||
theme_advanced_resizing : true,
|
||||
});
|
||||
|
||||
<?php /*if($action != 'edit'): ?>
|
||||
$("#page-edit-table").hide();
|
||||
$("#page-button").click(function() {
|
||||
$("#page-edit-table").toggle();
|
||||
return false;
|
||||
});
|
||||
<?php endif; */ ?>
|
||||
});
|
||||
</script>
|
||||
<!--script type="text/javascript">
|
||||
tinyMCE.init({
|
||||
forced_root_block : false,
|
||||
|
||||
mode : "textareas",
|
||||
theme : "advanced",
|
||||
plugins: "safari,advimage,emotions,insertdatetime,preview,wordcount",
|
||||
|
||||
theme_advanced_buttons3_add : "emotions,insertdate,inserttime,preview,|,forecolor,backcolor",
|
||||
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_statusbar_location : "bottom",
|
||||
theme_advanced_resizing : true,
|
||||
});
|
||||
</script-->
|
||||
<?php endif; ?>
|
||||
<form method="post" action="?p=pages&action=<?php echo ($action == 'edit' ? 'edit' : 'add'); ?>">
|
||||
<?php if($action == 'edit'): ?>
|
||||
<input type="hidden" name="id" value="<?php echo $id; ?>" />
|
||||
<?php endif; ?>
|
||||
<table class="table" id="page-edit-table" width="100%" border="0" cellspacing="1" cellpadding="4">
|
||||
<tr>
|
||||
<th><b><?php echo ($action == 'edit' ? 'Edit' : 'Add'); ?> page</b></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" cellpadding="1">
|
||||
<tr>
|
||||
<td>Link/name:</td>
|
||||
<td><input name="name" value="<?php echo $name; ?>" size="29" maxlength="29"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Title:</td>
|
||||
<td><input name="title" value="<?php echo $p_title; ?>" size="29" maxlength="29"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PHP:</td>
|
||||
<td><input type="checkbox" id="news-checkbox" name="php" title="Check if page should be executed as PHP" value="1" <?php if($php) echo 'checked="true"'; ?>/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Content:</td>
|
||||
<td>
|
||||
<textarea id="news-body" name="body" maxlength="65000" <?php /*if($use_tinymce) echo 'class="tinymce"';*/ ?> cols="50" rows="5"><?php echo htmlentities(isset($body) ? $body : '', ENT_COMPAT, 'UTF-8'); ?></textarea>
|
||||
<?php if($use_tinymce): ?>
|
||||
<br/>
|
||||
<a href="javascript:;" onmousedown="$('#news-body').tinymce().hide();">[Hide]</a>
|
||||
<a href="javascript:;" onmousedown="$('#news-body').tinymce().show();">[Show]</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<tr/>
|
||||
<tr>
|
||||
<td>Access:</td>
|
||||
<td>
|
||||
<select name="access">
|
||||
<?php foreach($groups->getGroups() as $id => $group): ?>
|
||||
<option value="<?php echo $group->getAccess(); ?>" <?php echo ($access == $group->getAccess() ? 'selected' : ''); ?>><?php echo $group->getName(); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><input type="submit" class="button" value="Save"/></td>
|
||||
<td align="left">
|
||||
<input type="button" onclick="window.location = '<?php echo getLink(PAGE) . ($config['friendly_urls'] ? '?' : '&'); ?>p=pages';" class="button" value="Cancel"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<table class="table" width="100%" cellspacing="1" cellpadding="4">
|
||||
<tr>
|
||||
<th><b>Name</b></th>
|
||||
<th><b>Title</b></th>
|
||||
<th><b>Options</b></th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$pages =
|
||||
$query =
|
||||
$db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'pages'));
|
||||
|
||||
$i = 0;
|
||||
foreach($pages as $_page): ?>
|
||||
<tr>
|
||||
<td><?php echo getFullLink($_page['name'], $_page['name']); ?></td>
|
||||
<td><i><?php echo substr($_page['title'], 0, 20); ?></i></td>
|
||||
<td>
|
||||
<a href="?p=pages&action=edit&id=<?php echo $_page['id']; ?>" class="ico" title="Edit">
|
||||
<img src="<?php echo BASE_URL; ?>images/edit.png"/>
|
||||
Edit
|
||||
</a>
|
||||
<a href="<?php echo ADMIN_URL; ?>?p=pages&action=delete&id=<?php echo $_page['id']; ?>" class="ico" onclick="return confirm('Are you sure?');" title="Delete">
|
||||
<img src="<?php echo BASE_URL; ?>images/del.png"/>
|
||||
Delete
|
||||
</a>
|
||||
<a href="?p=pages&action=hide&id=<?php echo $_page['id']; ?>" class="ico" title="<?php echo ($_page['hidden'] != 1 ? 'Hide' : 'Show'); ?>">
|
||||
<img src="<?php echo BASE_URL; ?>images/<?php echo ($_page['hidden'] != 1 ? 'success' : 'error'); ?>.png"/>
|
||||
<?php echo ($_page['hidden'] != 1 ? 'Hide' : 'Show'); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
$pages = array();
|
||||
foreach($query as $_page) {
|
||||
$pages[] = array(
|
||||
'link' => getFullLink($_page['name'], $_page['name']),
|
||||
'title' => substr($_page['title'], 0, 20),
|
||||
'id' => $_page['id'],
|
||||
'hidden' => $_page['hidden']
|
||||
);
|
||||
}
|
||||
|
||||
echo $twig->render('admin.pages.form.html.twig', array(
|
||||
'action' => $action,
|
||||
'id' => $action == 'edit' ? $id : null,
|
||||
'name' => $name,
|
||||
'title' => $p_title,
|
||||
'php' => $php,
|
||||
'body' => isset($body) ? htmlentities($body, ENT_COMPAT, 'UTF-8') : '',
|
||||
'groups' => $groups->getGroups(),
|
||||
'access' => $access
|
||||
));
|
||||
|
||||
echo $twig->render('admin.pages.html.twig', array(
|
||||
'pages' => $pages
|
||||
));
|
||||
|
||||
<?php
|
||||
class Pages
|
||||
{
|
||||
static public function get($id)
|
||||
@@ -243,7 +131,7 @@ class Pages
|
||||
{
|
||||
$query = $db->select(TABLE_PREFIX . 'pages', array('name' => $name));
|
||||
if($query === false)
|
||||
$db->insert(TABLE_PREFIX . 'pages', array('name' => $name, 'title' => $title, 'body' => $body, 'player_id' => $player_id, 'php' => $php, 'access' => $access));
|
||||
$db->insert(TABLE_PREFIX . 'pages', array('name' => $name, 'title' => $title, 'body' => $body, 'player_id' => $player_id, 'php' => $php ? '1' : '0', 'access' => $access));
|
||||
else
|
||||
$errors[] = 'Page with this words already exists.';
|
||||
}
|
||||
|
@@ -132,21 +132,29 @@ else if(isset($_FILES["plugin"]["name"]))
|
||||
|
||||
if(isset($plugin['require'])) {
|
||||
$require = $plugin['require'];
|
||||
$require_myaac = $require['myaac'];
|
||||
if(isset($require_myaac)) {
|
||||
if(isset($require['myaac'])) {
|
||||
$require_myaac = $require['myaac'];
|
||||
if(version_compare(MYAAC_VERSION, $require_myaac, '<')) {
|
||||
warning("This plugin requires MyAAC version " . $require_myaac . ", you're using version " . MYAAC_VERSION . " - please update.");
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
|
||||
$require_php = $require['php'];
|
||||
if(isset($require_php)) {
|
||||
if(isset($require['php'])) {
|
||||
$require_php = $require['php'];
|
||||
if(version_compare(phpversion(), $require_php, '<')) {
|
||||
warning("This plugin requires PHP version " . $require_php . ", you're using version " . phpversion() . " - please update.");
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($require['database'])) {
|
||||
$require_database = $require['database'];
|
||||
if($require_database < DATABASE_VERSION) {
|
||||
warning("This plugin requires database version " . $require_database . ", you're using version " . DATABASE_VERSION . " - please update.");
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($continue) {
|
||||
|
Reference in New Issue
Block a user