Файл: monst/core/pag/cp.php
Строк: 230
<?
if ( $user['id'] != 1 ) {
g('/main');
exit;
exit;
exit;
}
// ---------------------------------------------------------------------------------------------------------------------
if ( !isset($index[1]) ) {
$donate_today = 0;
$my_donate_today = 0;
$find = $_payment -> find(
[
'time' => [
'$gte' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
],
'xsolla_id' => [
'$gt' => 0
]
]
);
foreach ( $find as $f ) {
$donate_today += $f['data']['purchase']['virtual_currency']['amount'];
$my_donate_today += $f['data']['payment_details']['payout']['amount'];
}
// -
$donate_month = 0;
$my_donate_month = 0;
$find = $_payment -> find(
[
'time' => [
'$gte' => mktime(0, 0, 0, date('m'), 01, date('Y'))
],
'xsolla_id' => [
'$gt' => 0
]
]
);
foreach ( $find as $f ) {
$donate_month += $f['data']['purchase']['virtual_currency']['amount'];
$my_donate_month += $f['data']['payment_details']['payout']['amount'];
}
if ( isset($_GET['user_deleted']) ) {
?>
Персонаж удалён из игры.
<br/><br/>
<?
}
?>
<div class='padding'>
<span style='font-size: 20px;'>Xsolla</span><br/>
- за сегодня, <?=round($donate_today)?> руб. ( <?=round($my_donate_today)?> руб. )<br/>
- за месяц, <?=round($donate_month)?> руб. ( <?=round($my_donate_month)?> руб. )<br/>
<br/>
<a href='/cp/donate_list'>Подробнее</a>
</div>
<br/>
<?
$ok_donate_today = 0;
//$my_donate_today = 0;
$find = $_payment -> find(
[
'time' => [
'$gte' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
],
'ok_payment' => 1
]
);
foreach ( $find as $f ) {
$ok_donate_today += $f['ok'];
// $my_donate_today += $f['data']['payment_details']['payout']['amount'];
}
// -
$ok_donate_month = 0;
// $my_donate_month = 0;
$find = $_payment -> find(
[
'time' => [
'$gte' => mktime(0, 0, 0, date('m'), 01, date('Y'))
],
'ok_payment' => 1
]
);
foreach ( $find as $f ) {
$ok_donate_month += $f['ok'];
// $my_donate_month += $f['data']['payment_details']['payout']['amount'];
}
?>
<div class='padding'>
<span style='font-size: 20px;'>Одноклассники</span><br/>
- за сегодня, <?=round($ok_donate_today)?> ОК'ов<br/>
- за месяц, <?=round($ok_donate_month)?> ОК'ов<br/>
<br/>
<!-- <a href='/cp/ok_donate_list'>Подробнее</a>-->
</div>
<br/>
<a href='/cp/dialog_list'><div class='bt_black'>Диалоги</div></a>
<a href='/cp/backup' onclick="return confirm('Создать бэкап?')"><div class='bt_black'>Бэкап</div></a>
<?
}
if ( @$index[1] == 'backup' ) {
$out = [];
$date = date('d_M_Y_H.i');
exec('mongodump --db monst --gzip -o /home/backup/monst_' . $date . ' 2>&1', $out);
// print_r($out);
foreach ( $out as $log ) {
print $log.'<br/>';
}
}
if ( @$index[1] == 'dialog' ) {
$dialog_id = (int)$index[2];
$on_page = 10;
$find = $_dialog_mess -> find(
[
'dialog_id' => $dialog_id,
]
);
$find -> limit($on_page);
$find -> sort(
[
'time' => -1
]
);
$count = $find -> count();
$nav = nav($on_page);
foreach ( $find as $f ) {
?>
<div style='background: #000; padding: 10px;'>
<a href='/id<?=$f['user_id']?>'>
<img src='<?=av($f['user_id'])?>' alt='' width='70' style='float: left; margin-right: 10px;' class='av'/>
</a>
<?=Name($f['user_id'])?>
<?
// if ( $f['user_id'] != $user['id'] ) {
// ?>
<!-- --><?//=$online?>
<!-- --><?//
// }
?>
<span style='color: #777; font-size: 11px;'><?=replace_time($f['time'])?></span>
<?
if ( !$f['read'] ) {
?>
<span style='color: indianred;'>не прочитано</span>
<?
}
?>
<br/>
<span style='color: #ccc;'><?=$f['mess']?></span>
<div style='clear: both;'></div>
</div>
<?
}
print '<br/>'.$nav.'<br/>';
?>
<a href='/cp/dialog_list'><div class='bt_black'><< Диалоги</div></a>
<?
}
if ( @$index[1] == 'dialog_list' ) {
$on_page = 20;
$find = $_dialog_mess -> find();
$find -> limit($on_page);
$find -> sort(
[
'time' => -1,
]
);
$count = $find -> count();
$nav = nav($on_page);
foreach ( $find as $f ) {
?>
<a href='/cp/dialog/<?=$f['dialog_id']?>'>
<div style='background: #000; padding: 10px;'>
<!-- <a href='/id--><?//=$f['user_id']?><!--'>-->
<img src='<?=av($f['user_id'])?>' alt='' width='70' style='float: left; margin-right: 10px;' class='av'/>
<!-- </a>-->
<?=Name($f['user_id'])?>
››
<!-- <a href='/id--><?//=$f['to_user_id']?><!--'>-->
<img src='<?=av($f['to_user_id'])?>' alt='' width='30' style='f2loat: left; margin-right: 10px;' class='av'/>
<!-- </a>-->
<?=Name($f['to_user_id'])?>
<?
// if ( $f['user_id'] != $user['id'] ) {
// ?>
<!-- --><?//=$online?>
<!-- --><?//
// }
?>
<span style='color: #777; font-size: 11px;'><?=replace_time($f['time'])?></span>
<?
if ( !$f['read'] ) {
?>
<span style='color: indianred;'>не прочитано</span>
<?
}
?>
<br/>
<span style='color: #ccc;'><?=$f['mess']?></span>
<div style='clear: both;'></div>
</div>
</a>
<br/>
<?
}
print $nav.'<br/>';
}
if ( @$index[1] == 'donate_list' ) {
$on_page = 20;
$find = $_payment -> find(
[
'time' => [
'$gte' => 0
],
'xsolla_id' => [
'$gt' => 0
]
]
);
$count = $find -> count(true);
$find -> limit($on_page);
$find -> sort(
[
'time' => -1
]
);
$nav = nav($on_page);
?>
<style>
table {
width: 100%;
}
td {
font-size: 10px;
background: #000;
padding: 2px;
border: 1px solid #333;
text-align: center;
}
.td_title {
background: #000;
color: #756861;
text-align: center;
}
</style>
<table>
<tr>
<td class='td_title'>имя</td>
<td class='td_title'>дата</td>
<td class='td_title'>сумма</td>
<td class='td_title'>моя доля</td>
<td class='td_title'>тип доната</td>
</tr>
<?
foreach ( $find as $f ) {
$sum = $f['data']['purchase']['virtual_currency']['amount'];
$my_sum = $f['data']['payment_details']['payout']['amount'];
?>
<tr>
<td style='text-align: left;'>
<a href='/id<?=$f['user_id']?>'>
<img src='<?=av($f['user_id'])?>' alt='' width='10' class='av'/><?=Name($f['user_id'])?>
</a>
</td>
<td>
<?=replace_time($f['time'])?>
</td>
<td>
<?=$sum?> руб.
</td>
<td>
<?=$my_sum?> руб.
</td>
<td>
<?
if ( isset($f['xsolla_id']) AND !empty($f['xsolla_id']) ) {
?>
Xsolla, method ??
<?
}
?>
</td>
</tr>
<?
}
?>
</table>
<?
print '<br/>'.$nav.'<br/>';
}
if ( @$index[1] == 'user' ) {
$user_id = (int)$index[2];
if ( !$user_id ) {
g('/cp?user_not_found');
}
$find = $_users -> findOne(
[
'id' => $user_id
]
);
if ( !$find ) {
g('/cp?user_not_found');
}
// delete
if ( isset($_GET['delete']) ) {
$_users -> remove(
[
'id' => $user_id
]
);
g('/cp?user_deleted');
}
//
if ( !empty($_POST['save']) ) {
$gold = (int)$_POST['gold'];
$name_color = $_POST['name_color'];
$_users -> update(
[
'id' => $user_id
],
[
'$set' => [
'gold' => $gold,
'name_color' => $name_color,
]
]
);
$refresh_color = Name($user_id, 1);
?>
<div class='padding'>
Изменения для <?=Name($user_id)?> сохранены.
</div>
<?
} else {
?>
<div class='padding'>
<form method='post' action='/cp/user/<?=$user_id?>'>
<input type='hidden' name='save' value='1'/>
<?=Name($find['id'])?><br/>
<br/>
<img src='<?=$gold_icon?>' alt='' width='20'/>
<input name='gold' value='<?=$find['gold']?>' size='10'/><br/>
Цвет имени:<br/>
<input name='name_color' value='<?=$find['name_color']?>' size='15'/><br/>
<br/>
<div style='text-align: center;'>
<input type='submit' value='Сохранить изменения'/>
</div>
</form>
</div>
<br/>
<a href='/cp/user/<?=$user_id?>?delete' onclick="return confirm('Вы точно хотите удалить этого персонажа?')"><div class='bt_black'><span style='color: indianred;'>УДАЛИТЬ ПЕРСОНАЖА</span></div></a>
<?
}
}
if ( isset($index[1]) ) {
?>
<a href='/cp'><div class='bt_black'><< Control panel</div></a>
<?
}