[*] phpcmd и правка класса пользователя
This commit is contained in:
1 parent
9fea80faec
commit
4600647a7a
4 files changed
+131
-2
No files matched your search
@@ -9,7 +9,7 @@
|
|||||||
header('Location: login.php');
|
header('Location: login.php');
|
||||||
die();
|
die();
|
||||||
} elseif (!$USER->isAdmin()) {
|
} elseif (!$USER->isAdmin()) {
|
||||||
header('Location: ../index.php');
|
header('Location: ../');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -211,7 +211,7 @@
|
|||||||
<li><a href="/admin/users.php"><i class="fa fa-home"></i> <span>Список пользователей</span></a></li>
|
<li><a href="/admin/users.php"><i class="fa fa-home"></i> <span>Список пользователей</span></a></li>
|
||||||
<li><a href="/admin/groups.php"><i class="fa fa-home"></i> <span>Список ролей</span></a></li>
|
<li><a href="/admin/groups.php"><i class="fa fa-home"></i> <span>Список ролей</span></a></li>
|
||||||
<li><a href="/admin/cacheInfo.php"><i class="fa fa-home"></i> <span>Кэширование</span></a></li>
|
<li><a href="/admin/cacheInfo.php"><i class="fa fa-home"></i> <span>Кэширование</span></a></li>
|
||||||
<li><a href="index.html"><i class="fa fa-home"></i> <span>Dashboard</span></a></li>
|
<li><a href="/admin/phpcmd.php"><i class="fa fa-home"></i> <span>Командная PHP строка</span></a></li>
|
||||||
<li><a href="index.html"><i class="fa fa-home"></i> <span>Dashboard</span></a></li>
|
<li><a href="index.html"><i class="fa fa-home"></i> <span>Dashboard</span></a></li>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Models\{User, Roles};
|
||||||
|
|
||||||
|
require_once __DIR__ . '/inc/header.php';
|
||||||
|
?>
|
||||||
|
<div class="pageheader">
|
||||||
|
<div class="media">
|
||||||
|
<div class="pageicon pull-left">
|
||||||
|
<i class="fa fa-home"></i>
|
||||||
|
</div>
|
||||||
|
<div class="media-body">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
|
||||||
|
<li>Командная PHP строка</li>
|
||||||
|
</ul>
|
||||||
|
<h4>Командная PHP строка</h4>
|
||||||
|
</div>
|
||||||
|
</div><!-- media -->
|
||||||
|
</div><!-- pageheader -->
|
||||||
|
|
||||||
|
<div class="contentpanel">
|
||||||
|
<!-- table -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12r">
|
||||||
|
<!---->
|
||||||
|
|
||||||
|
<form action="" method="POST">
|
||||||
|
<input type="hidden" name="execute" value="Y">
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Models\\DB;');">DB</button>
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Models\\User;');">User</button>
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Cache;');">Cache</button>
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Log;');">Log</button>
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Files;');">Files</button>
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Mail;');">Mail</button>
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Pagination;');">Pagination
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Registry;');">Registry</button>
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\SystemFunctions;');">
|
||||||
|
SystemFunctions
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Helpers\\Zip;');">Zip</button>
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\CoreException;');">CoreException
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-primary" type="button" onClick="addUseSection(this, 'use Core\\Template;');">Template</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="query" class="form-label">Введите PHP код для выполнения</label>
|
||||||
|
<textarea class="form-control" rows="8" id="query"
|
||||||
|
name="query"><?php echo isset($_REQUEST['query']) ? $_REQUEST['query'] : ''; ?></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<input id="use_pre" type="checkbox" name="use_pre" value="Y" <?php if (isset($_REQUEST['use_pre']) and $_REQUEST['use_pre']
|
||||||
|
== 'Y') {
|
||||||
|
echo 'checked';
|
||||||
|
} ?>>
|
||||||
|
<label for="use_pre" class="form-label"> Отображать результат выполнения как текст</label>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<input class="btn btn-primary" type="submit" name="btn" value="Выполнить">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/*var editor = CodeMirror.fromTextArea(document.getElementById("query"), {
|
||||||
|
lineNumbers: true
|
||||||
|
});
|
||||||
|
|
||||||
|
function addUseSection(button, text) {
|
||||||
|
editor.setValue(text + "\n" + editor.getValue());
|
||||||
|
//button.disabled = true;
|
||||||
|
console.log(button);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
function addUseSection(button, text) {
|
||||||
|
editor = document.getElementById("query");
|
||||||
|
editor.value = text + "\n" + editor.value;
|
||||||
|
//button.disabled = true;
|
||||||
|
console.log(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php if (isset($_REQUEST['execute']) and $_REQUEST['execute'] == 'Y') {
|
||||||
|
echo '<h2 class="entry-title">Результат</h2><p class="exec_result">';
|
||||||
|
|
||||||
|
$execResult = '';
|
||||||
|
try {
|
||||||
|
ob_start();
|
||||||
|
eval($_REQUEST['query']);
|
||||||
|
$execResult = ob_get_clean();
|
||||||
|
if (isset($_REQUEST['use_pre']) and $_REQUEST['use_pre'] == 'Y') {
|
||||||
|
echo '<pre>' . $execResult . '</pre>';
|
||||||
|
} else {
|
||||||
|
echo $execResult;
|
||||||
|
}
|
||||||
|
} catch (ParseError $p) {
|
||||||
|
echo '<div class="alert alert-danger"><p><strong>(ParseError)</strong> Ошибка парсинга: ' . $p->getMessage() . '</p></div>';
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
echo '<div class="alert alert-danger"><p><strong>(Throwable)</strong> Ошибка при выполнении: ' . $e->getMessage()
|
||||||
|
. '</p></div>';
|
||||||
|
} catch (Error $e) {
|
||||||
|
echo '<div class="alert alert-danger"><p><strong>(Error)</strong> Ошибка при выполнении: ' . $e->getMessage() . '</p></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</p>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!----->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end table -->
|
||||||
|
</div><!-- contentpanel -->
|
||||||
|
<?php require_once __DIR__ . '/inc/footer.php'; ?>
|
||||||
@@ -9,6 +9,11 @@
|
|||||||
*/
|
*/
|
||||||
const ERROR_INCORRECT_USER_ID = 100;
|
const ERROR_INCORRECT_USER_ID = 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Пользователь не найден
|
||||||
|
*/
|
||||||
|
const ERROR_USER_NOT_FOUND = 101;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ошибка создания пользователя
|
* Ошибка создания пользователя
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,6 +50,9 @@
|
|||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
throw new CoreException('Передан некорректный идентификатор пользователя', CoreException::ERROR_INCORRECT_USER_ID);
|
throw new CoreException('Передан некорректный идентификатор пользователя', CoreException::ERROR_INCORRECT_USER_ID);
|
||||||
}
|
}
|
||||||
|
if (!(DB::getInstance())->getItem(self::USERS_TABLE, ['id' => $id])) {
|
||||||
|
throw new CoreException('Пользователь с идентификатором ' . $id . ' отсутствует в базе', CoreException::ERROR_USER_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user