<?php

define('_IN_JOHNCMS', 1);

$headmod = 'wapmaster';
require('bootstrap.php');

/** @var Psr\Container\ContainerInterface $container */
$container = App::getContainer();

/** @var PDO $db */
$db = $container->get(PDO::class);

/** @var Johncms\Api\UserInterface $systemUser */
$systemUser = $container->get(Johncms\Api\UserInterface::class);

/** @var Johncms\Api\ToolsInterface $tools */
$tools = $container->get(Johncms\Api\ToolsInterface::class);

/** @var Johncms\Api\EnvironmentInterface $env */
$env = $container->get(Johncms\Api\EnvironmentInterface::class);

/** @var Johncms\Api\BbcodeInterface $bbcode */
$bbcode = $container->get(Johncms\Api\BbcodeInterface::class);

/** @var Johncms\Api\ConfigInterface $config */
$config = $container->get(Johncms\Api\ConfigInterface::class);
require('head.php');
 


####### Dont Touch Ok 
####### Mod by Gabriel Elfha Gymkhana
$mp = new Johncms\NewsWidget();


 
//echo 'Powered By Gymkhana';
if ($config['menu_enable'] == 1) {
   $m_group = $db->query("select * from cms_menu_group mode ORDER BY pos;");
   if ($m_group) {
       while ($m_group_n = $m_group->fetch()) {
            if ($m_group_n['show'] == 1) {
                echo '<div class="phdr">';
                $filename = '../images/icon/';
              
                $filename = $filename . "/" . $m_group_n['pic'];

               if (file_exists($filename) and $m_group_n['pic'] != '') {
                    echo '<img class="mme_image" alt="" src="' . $filename . '" /> ';
                } else {
                    echo $m_group_n['sumbo'] . ' ';
                }
                echo '<b>' . $m_group_n['name'] . '</b></div>';
                $m_link = $db->query("select * from cms_menu_link mode ORDER BY pos;");
                if ($m_link) {
                    while ($m_link_n = $m_link->fetch()) {
                       if ($m_link_n['show'] == 1) {
                           if ($m_group_n['id'] == $m_link_n['group']) {

                             $m_count = $db->query("SELECT * FROM `cms_menu_count` WHERE `id`='" . $m_link_n['type'] .
"' LIMIT 1;");
                              $m_count_n = $m_count->fetch();
                              if ($m_link_n['type'] != 0) {
                                  if ($m_count_n['code'] == '$mp->newscount')
                                     $ehe = ' (' . $mp->newscount . ')';
                                  else
                                     $ehe = ' (' . call_user_func($m_count_n['code']) . ')';
                             } else
                                 $ehe = '';


echo '<div class="menu">';
$filename = '../images/icon/';
$filename = $filename . "/" . $m_link_n['pic'];
if (file_exists($filename) and $m_link_n['pic'] != '')
echo '<img class="mme_image" alt="" src="' . $filename . '" /> ';
else
echo $m_link_n['sumbo'] . ' ';

echo '<a href="' . $m_link_n['link'] . '">' . $m_link_n['name'] . '</a>' .
$ehe . '</div>';
}
}
}
}
}
}
} else {
echo "<p><b>Error:</b><p>";
exit();
}
} else {
header('Location: ../?err');
exit;
} 

 
 

require('end.php');
?>