コード例 #1
0
ファイル: footer_t.php プロジェクト: thekabal/tki
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Affero General Public License for more details.
//
//  You should have received a copy of the GNU Affero General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// File: footer_t.php
$online = (int) 0;
if (Tki\Db::isActive($pdo_db)) {
    $stamp = date("Y-m-d H:i:s", time());
    // Now (as seen by PHP)
    $since_stamp = date("Y-m-d H:i:s", time() - 5 * 60);
    // Five minutes ago
    $players_gateway = new \Tki\Players\PlayersGateway($pdo_db);
    // Build a player gateway object to handle the SQL calls
    $online = $players_gateway->selectPlayersLoggedIn($since_stamp, $stamp);
    // Online is the (int) count of the numbers of players currently logged in via SQL select
}
$elapsed = (int) 999;
// Default value for elapsed, overridden with an actual value if its available
if ($tkireg !== null) {
    if (property_exists($tkireg, 'tkitimer')) {
        $tkireg->tkitimer->stop();
        $elapsed = $tkireg->tkitimer->elapsed();
    }
}
// Suppress the news ticker on the IBANK and index pages
$news_ticker_active = !(preg_match("/index.php/i", $request->server->get('SCRIPT_NAME')) || preg_match("/ibank.php/i", $request->server->get('SCRIPT_NAME')) || preg_match("/new.php/i", $request->server->get('SCRIPT_NAME')));
// Suppress the news ticker if the database is not active
if (!Tki\Db::isActive($pdo_db)) {
    $news_ticker_active = false;