Файл: pages/clan/hall-clan.php
Строк: 151
<?php
// Physical module map v50.6: public URL stays clean while code lives in /pages.
if (!defined('GAME_ROOT')) define('GAME_ROOT', dirname(__DIR__, 2));
chdir(GAME_ROOT);
if (PHP_SAPI !== 'cli') { $_SERVER['PHP_SELF']='/hall-clan.php'; $_SERVER['SCRIPT_NAME']='/hall-clan.php'; }
/* Клановый Зал славы доступен только участникам собственного клана. by Метриум (Стэлп) */
require_once './system/common.php';
require_once './system/functions.php';
require_once './system/user.php';
if(!$user){ header('Location:/'); exit; }
game_hall_bootstrap();
$cm=game_hall_user_clan((int)$user['id']);
if(!$cm){ $_SESSION['err']='Зал славы доступен только участникам клана.'; header('Location:/clans/'); exit; }
$cid=(int)$cm['clan']; $defs=game_hall_clan_defs();
$title='Зал славы клановых рекордов';
require './system/h.php';
?>
<div class="menu"><a href="/clan/">← <span class="yellow">Назад</span></a></div>
<div class="hall-slogan">Установите клановый рекорд и впишите имя клана в историю!</div>
<div class="hall-banner"><img src="/images/hall/records_banner.jpg" alt="Зал славы"></div>
<div class="hall-classic hall-clan-private">
<?php foreach($defs as $code=>$def):
$rec=game_hall_record('clan',$code); $currentMetric=game_hall_clan_score($cid,$def); $attempt=game_hall_attempt_row('clan',$code,$cid);
$score=$attempt?max(0,$currentMetric-(int)($attempt['baseline_score']??0)):$currentMetric;
$target=$attempt?max(1,(int)$attempt['target_score']):game_hall_required_score('clan',$code,$cid); $pct=$target?min(100,(int)floor($score/$target*100)):0;
$holder=null; if((int)$rec['holder_id']>0) $holder=db_fetch_assoc(db_query('SELECT `id`,`name`,`r` FROM `clans` WHERE `id`='.(int)$rec['holder_id'].' LIMIT 1'));
?>
<section class="hall-classic-record">
<div class="hall-classic-title"><img src="<?=security_html($def['icon'])?>" alt=""> <?=security_html($def['title'])?></div>
<div><?=security_html($def['description'])?></div>
<?php if($holder): ?><div class="hall-best">Лучший клан: <img src="/images/icon/clan/<?=(int)$holder['r']?>.png" alt=""> <span class="yellow"><?=security_html($holder['name'])?></span> — <span class="dgreen"><?=n_f((int)$rec['score'])?></span></div><?php else: ?><div class="grey">Клановый рекорд пока не установлен</div><?php endif; ?>
<div><span class="hall-blue">Результат вашего клана:</span> <?=n_f($score)?><?php if($attempt): ?> из <?=n_f($target)?> <span class="grey">(осталось <?=n_f(max(0,$target-$score))?>)</span><?php endif; ?></div>
<?php if($attempt): ?><div class="hall-classic-progress"><span style="width:<?=$pct?>%"></span></div><?php endif; ?>
<div><img src="/images/icon/equip.png" alt=""> <b>Бонус:</b> <span class="dgreen">+40 к сумме параметров участникам</span></div>
<div class="hall-record-form">
<?php if($attempt):
$runner=db_fetch_assoc(db_query('SELECT `id`,`login`,`r` FROM `users` WHERE `id`='.(int)($attempt['actor_user']??0).' LIMIT 1'));
?>
<div class="hall-runner">Выполняет: <?php if($runner): ?><img src="/images/icon/race/<?=(int)$runner['r']?>.png" alt=""> <a href="/user/<?=(int)$runner['id']?>/"><?=security_html($runner['login'])?></a><?php else: ?><span class="yellow">Клан</span><?php endif; ?> <span class="white">(осталось: <b data-hall-until="<?=(int)$attempt['expires_at']?>"><?=_time(max(0,(int)$attempt['expires_at']-time()))?></b>)</span></div>
<a class="btn" href="<?=security_html(game_hall_target('clan',$code))?>"><span class="end"><span class="label">Перейти к выполнению</span></span></a>
<?php if((int)$cm['rank']>=4): ?><br><a class="hall-cancel-link" href="/hall-confirm/?scope=clan&code=<?=urlencode($code)?>">Отменить задание</a><?php endif; ?>
<?php elseif((int)$cm['rank']>=4): ?>
<form action="/hall-action/" method="post" class="hall-start-form"><?=security_csrf_field()?>
<input type="hidden" name="scope" value="clan"><input type="hidden" name="code" value="<?=security_html($code)?>">
<button class="btn" type="submit" name="start" value="1"><span class="end"><span class="label"><?=((int)$rec['holder_id']>0?'Побить рекорд':'Установить рекорд')?></span></span></button>
</form>
<?php else: ?><div class="grey">Установить или побить клановый рекорд может лидер или заместитель.</div><?php endif; ?>
</div>
</section>
<?php endforeach; ?>
</div>
<div class="menu"><a href="/clan/">← <span class="yellow">Назад</span></a></div>
<?php require './system/f.php'; ?>