game/core1/app/logic/debuger.php
2022-06-07 00:30:34 +03:00

83 lines
1.8 KiB
PHP

<?
namespace Logic;
use \Core\View as view;
class Debuger {
/*
@ Áàçîâûé ìåòîä íà÷àë ãåíèðàöèè ìîäóëÿ
@ Çäåñü ïðîèñõîäèò îïðåäåëåíèå òèïà äàííûõ, à òàê-æå
@ ïðîâåðêà âîçìîæíîñòè ïðîñìîòðà äàííîãî ìîäóëÿ
@ âñå ïîääêëþ÷àåìûå êëàññû äîëæíû áûòü ÍÅÎÁÕÎÄÈÌÛÌÈ!
*/
public static function defaultAction() {
//Ïîäêëþ÷àåì ïàêåòû
\Core\User::connect();
\Core\User::room();
if (\Core\User::$data == false ) {
//Íåò äîñòóïà, ïåðñîíàæ íå àâòîðèçèðîâàí èëè çàáëîêèðîâàí
echo 'Àâòîðèçèðóéòåñü ÷åðåç <a href="/index.php">ãëàâíóþ ñòðàíèöó</a>.';
}elseif( stristr($_SERVER['HTTP_ACCEPT'],'application/json') == true ) {
echo self::getJSON();
}else{
echo self::getHTML();
}
}
/*
@ Ìåòîä âûâîäÿùèé HTML-êîíòåíò íà ñòîðîíó ïîëüçîâàòåëÿ
@ ×åðåç êîíêðåòíûé øàáëîíèçàòîð
*/
public static function getHTML() {
//PC âåðñèÿ ãëàâíîé ñòðàíèöû
//
$skills = array();
$pl = \Core\Database::query( 'SELECT * FROM `priems` WHERE `activ` = 1 ORDER BY `img` ASC', array(
//
), true , true );
$i = 0;
while( $i != -1 ) {
if(!isset($pl[$i])) {
$i = -2;
}else{
$skills .= ',[' . $pl[$i]['id'] . ',"' . $pl[$i]['img'] . '","' . $pl[$i]['name'] . '"]';
}
$i++;
}
$skills = ltrim($skills,',');
//
return view::generateTpl( 'debuger', array(
'title' => COPY . ' :: Âîïðîñû ïî èãðå è ñäà÷à áàãîâ',
//Ïåðåäàåì äàííûå ïàêåòîâ
'user' => \Core\User::$data,
'stats' => \Core\User::$stats,
'room' => \Core\User::$room,
'OK' => OK,
'copy' => COPY,
'rights' => RIGHTS,
'skills' => $skills,
'ver' => '0.0.1'
) );
}
/*
@ Ìåòîä âûâîäÿùèé JSON-êîíòåíò íà ñòîðîíó ïîëüçîâàòåëÿ
@ Èíôîðìàöèÿ áåðåòñÿ èç ïåðåìåííîé self::$JSON
*/
public static function getJSON() {
$r = array();
return \Core\Utils::jsonencode( $r );
}
}
?>