<?php
/*
 * Naijadev Clone 3.1.0 (http://naijadev.ml or http://naijadev.in)
 *
 * For copyright and license information, please see the LICENSE.md
 * Installing the system or redistributions of files must retain the above copyright notice.
 *
 * @link        http://facebook.com/tunzxywalex Tunz Project
 * @email		Tunzxywalex@gmail.com
 * @Whatsapp	+2349076642400
 * @copyright   Copyright (C) Naijadev Community 2018
 * @license     Premium Version Licence
 */
define('_IN_JOHNCMS', 1);
$textl = '' . $config->copyright . ' - Terms of Services';
$headmod = 'login';
require('system/bootstrap.php');
require('system/head.php');

// Notifications after Header codes
if ($systemUser->id) {
    $list = [];
    $new_sys_mail = $db->query("SELECT COUNT(*) FROM `cms_mail` WHERE `from_id`='" . $systemUser->id . "' AND `read`='0' AND `sys`='1' AND `delete`!='" . $systemUser->id . "'")->fetchColumn();

    if ($new_sys_mail) {
        $list[] = '<article class="_55wo _56bf _5rgl"><div class="story_body_container"><a class="_5n99" href="' . $config['homeurl'] . '/mail/index.php?act=systems"><img src="' . $config->homeurl . '/images/mail-inbox.png" width="16" height="16" class="img">' . _t('You have a new mail from Staff', 'system') . ' (+' . $new_sys_mail . ')</a></div></article>';
    }

    $new_mail = $db->query("SELECT COUNT(*) FROM `cms_mail`
                            LEFT JOIN `cms_contact` ON `cms_mail`.`user_id`=`cms_contact`.`from_id` AND `cms_contact`.`user_id`='" . $systemUser->id . "'
                            WHERE `cms_mail`.`from_id`='" . $systemUser->id . "'
                            AND `cms_mail`.`sys`='0'
                            AND `cms_mail`.`read`='0'
                            AND `cms_mail`.`delete`!='" . $systemUser->id . "'
                            AND `cms_contact`.`ban`!='1'")->fetchColumn();

    if ($new_mail) {
        $list[] = '<article class="_55wo _56bf _5rgl"><div class="story_body_container"><a class="_5n99" href="' . $config['homeurl'] . '/mail/index.php?act=new"><img src="' . $config->homeurl . '/images/mail-inbox.png" width="16" height="16" class="img">' . _t('You have a new Mail', 'system') . '(+' . $new_mail . ')</a></div></article>';
    }

    if ($systemUser->comm_count > $systemUser->comm_old) {
        $list[] = '<article class="_55wo _56bf _5rgl"><div class="story_body_container"><a class="_5n99" href="' . $config['homeurl'] . '/profile/?act=guestbook&amp;user=' . $systemUser->id . '"><img src="' . $config->homeurl . '/images/H7R1sIfGmOU.png" width="16" height="16" class="img"> You have ' . ($systemUser->comm_count - $systemUser->comm_old) . ' new Comments on your  Profile</a></div></article>';
    }

    $new_album_comm = $db->query('SELECT COUNT(*) FROM `cms_album_files` WHERE `user_id` = ' . $systemUser->id . ' AND `unread_comments` = 1')->fetchColumn();

    if ($new_album_comm) {
        $list[] = '<article class="_55wo _56bf _5rgl"><div class="story_body_container"><a class="_5n99" href="' . $config['homeurl'] . '/album/index.php?act=top&amp;mod=my_new_comm"><img src="' . $config->homeurl . '/images/MwyyUZO7WaL.png" width="16" height="16" class="img">' . _t('You have a Comments in your album', 'system') . '</a></div></article>';
    }

   # @var notif forum
   if ($systemUser->notif_forum) {
       $list[] = '<article class="_55wo _56bf _5rgl"><div class="story_body_container"><a class="_5n99" href="' . $config['homeurl'] . '/profile/notif.php"><img src="' . $config->homeurl . '/images/Of8Ht9mAZ3d.png" width="16" height="16" class="img"> New Forum Notification</a>&#160;(' . $systemUser->notif_forum . ')</div></article>';
   }

    if (!empty($list)) {
        echo '' . implode('', $list) . '';
    }
}

if ($systemUser->isValid() && !$systemUser->premium) {
   echo '<article class="_55wo _56bf _5rgl"><div class="story_body_container"><a href="'.$config['homeurl'].'/help/?act=premium"><img src="' . $config->homeurl . '/images/Of8Ht9mAZ3d.png" width="16" height="16" class="img">Update your account with premium to have full access see here</a></div></article>';
}
//!$systemUser->id ?: include '../bonus.inc.php';
    

if ($user['dayb'] == date('j', time()) && $user['monthb'] == date('n', time())) {
        echo '<article class="_55wo _56bf _5rgl"><div class="story_body_container"><img src="' . $config->homeurl . '/images/N7PbiWpJrZj.png" width="16" height="16" class="img">' . _t('We Greet you a Happy Birthday') . ' ' . $user['name'] . '!!!</div></article>';
}
// End Notifications Codes

require('system/end.php');