function topChampionShuffle($indexArray = 1, $jsDump = false)
{
    $path = __ROOT__ . 'cdn/img/nav-random/';
    if (!isset($_SESSION['graphics'])) {
        if ($handle = opendir($path)) {
            while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != ".." && $file != ".svn") {
                    $fileInfo = pathinfo($path . $file);
                    if ($fileInfo['extension'] == 'png' || $fileInfo['extension'] == 'jpg') {
                        $_SESSION['graphics'][] = $file;
                    }
                }
            }
            closedir($handle);
        }
    }
    shuffle($_SESSION['graphics']);
    if ($jsDump == true) {
        return $_SESSION['graphics'];
    }
    if (file_exists($path . $_SESSION['graphics'][$indexArray])) {
        return $_SESSION['graphics'][$indexArray];
    } else {
        unset($_SESSION['graphics']);
        topChampionShuffle(2);
    }
}
Example #2
0
			jQuery.App={
		    url:			'<?php 
location(false, false, false);
?>
',
		    locale:		'<?php 
echo $_SESSION['user']['locale'];
?>
',
		    platform:	'<?php 
echo $_SESSION['user']['platform'];
?>
',
				graphics:	new Array(
					<?php 
foreach (topChampionShuffle(null, true) as $grafic) {
    ?>
						'<?php 
    echo CDN_DIR . 'img/nav-random/' . $grafic;
    ?>
',
					<?php 
}
?>
				''),
			}
		</script>
		<script type="text/javascript" src="<?php 
echo CDN_DIR;
?>
js/functions.js"></script>
Example #3
0
?>
</head>
	<body>
		<header>
			<?php 
if ($_SESSION['user']['platform'] == 'desktop') {
    ?>
				<div id="nav-random-champions">
					<div class="container-fluid">
						<div class="col-lg-1"></div>
						<div class="col-lg-4" id="random-left">
							<img src="<?php 
    echo CDN_DIR;
    ?>
img/nav-random/<?php 
    echo $c = topChampionShuffle();
    ?>
" />
						</div>
						<div class="col-lg-2"></div>
						<div class="col-lg-4" id="random-right">
							<img src="<?php 
    echo CDN_DIR;
    ?>
img/nav-random/<?php 
    echo $c;
    ?>
" />
						</div>
						<div class="col-lg-1"></div>
					</div>