<?php
$must_login     = true ;
$require_path   = '../../' ;
$require_sub    = '../' ;
require( $require_sub.'header.php' ) ;

$select         = $mysqli->query( "SELECT version, url, is_update FROM versions a
							       WHERE a.platform = '".$array['platform']."' LIMIT 1" ) ;

$status         = '200' ;
$screens 		= [] ;

$data 		    = [ 
	'version'   => '',
	'url'       => '',
	'is_update' => 'no'
] ;
if ( $select->num_rows > 0 ){
	$data       = $select->fetch_assoc() ;
}

if ( $array['islogin'] == 'no' ){
	$select     = $mysqli->query( "SELECT a.file, b.title, b.content FROM app_screen a
								   LEFT JOIN app_screen_translation b ON ( a.screen_id = b.screen_id )
						           WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."' ORDER BY a.sortable" ) ;
	if ( $select->num_rows > 0 ){
		while ( $row  = $select->fetch_assoc() ){
			$row['title']   = dataFilter( $row['title'] ) ;
			$row['content'] = dataFilter( $row['content'] ) ;
			$row['file']    = ( $row['file'] != '' ? PATH.'uploads/AppScreen/b/'.$row['file'].'?v='.filemtime( $_SERVER["DOCUMENT_ROOT"].'/uploads/AppScreen/b/'.$row['file'] ) : '' ) ;
			$screens[]      = $row ;
		}
	}
}

$data['screens'] = $screens ;

require( $require_sub.'footer.php' ) ;
?>