From: <tec...@us...> - 2004-02-28 22:10:53
|
Update of /cvsroot/tikiwiki/tiki In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10180 Modified Files: tiki-list_games.php Log Message: Feature may not work as expected in this revision. Reformat needed to revive abandoned feature. Index: tiki-list_games.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/tiki-list_games.php,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- tiki-list_games.php 26 Feb 2004 22:48:27 -0000 1.16 +++ tiki-list_games.php 28 Feb 2004 22:01:07 -0000 1.17 @@ -43,6 +43,60 @@ } + +// 1. List Games // +$games = array(); +$h = opendir("games/thumbs"); + +while ($file = readdir($h)) { + $game = array(); + + // LeChuckdaPirate added "is_file" so folders don't be taken as games... + if (is_file("games/thumbs/$file") && $file != '.' && $file != '..' && !ereg('\.txt$',$file)) { + + if (is_file("games/thumbs/$file" . '.txt')) { + $data = file_get_contents("games/thumbs/$file" . '.txt'); + $desc = nl2br($data); + } else { + $desc = ''; + } + + $game["hits"] = $gamelib->get_game_hits($file); + $game["desc"] = $desc; + $game["game"] = $file; + $games[$file] = $game; + } +} + +closedir($h); + +function compare($ar1, $ar2) { + return $ar2["hits"] - $ar1["hits"]; +} + +uasort($games, 'compare'); + +$smarty->assign_by_ref('games', $games); + + + +// 2. Play games and count times game was played // +$smarty->assign('play', 'n'); + +if(isset($_REQUEST["game"])) { + $gamelib->add_game_hit($_REQUEST["game"]); + $game = str_replace( array('/','\\'), '_', $_REQUEST["game"]); + $parts=explode('.',$game); + $source='games/flash/'.$parts[0].'.'.$parts[1]; + if (is_file($source)) + { + $smarty->assign('source',$source); + $smarty->assign('play','y'); + } +} + + + // 3. Upload games // $smarty->assign('uploadform', 'n'); @@ -112,6 +166,7 @@ } + // 4. Edit them // $smarty->assign('editgame', 'n'); @@ -146,6 +201,7 @@ } + // 5. Delete // if (isset($_REQUEST["remove"]) && $tiki_p_admin_games == 'y') { // security issue - remove slashes to avoid deleting in parent directory @@ -164,55 +220,7 @@ } -// 1. List Games // -$games = array(); -$h = opendir("games/thumbs"); - -while ($file = readdir($h)) { - $game = array(); - - // LeChuckdaPirate added "is_file" so folders don't be taken as games... - if (is_file("games/thumbs/$file") && $file != '.' && $file != '..' && !ereg('\.txt$',$file)) { - - if (is_file("games/thumbs/$file" . '.txt')) { - $data = file_get_contents("games/thumbs/$file" . '.txt'); - $desc = nl2br($data); - } else { - $desc = ''; - } - - $game["hits"] = $gamelib->get_game_hits($file); - $game["desc"] = $desc; - $game["game"] = $file; - $games[$file] = $game; - } -} - -closedir($h); - -function compare($ar1, $ar2) { - return $ar2["hits"] - $ar1["hits"]; -} - -uasort($games, 'compare'); - -$smarty->assign_by_ref('games', $games); - - -// 2. Play games and count times game was played // -$smarty->assign('play', 'n'); -if(isset($_REQUEST["game"])) { - $gamelib->add_game_hit($_REQUEST["game"]); - $game = str_replace( array('/','\\'), '_', $_REQUEST["game"]); - $parts=explode('.',$game); - $source='games/flash/'.$parts[0].'.'.$parts[1]; - if (is_file($source)) - { - $smarty->assign('source',$source); - $smarty->assign('play','y'); - } -} $section = 'games'; |