Esempio n. 1
0
function ArcadeCategoryEdit()
{
    global $db_prefix, $modSettings, $context, $sourcedir, $smcFunc;
    $new = false;
    if (isset($_REQUEST['category'])) {
        $request = $smcFunc['db_query']('', '
			SELECT id_cat, cat_name, num_games, cat_order, member_groups
			FROM {db_prefix}arcade_categories
			WHERE id_Cat = {int:category}', array('category' => $_REQUEST['category']));
        $row = $smcFunc['db_fetch_assoc']($request);
        $smcFunc['db_free_result']($request);
        $context['category'] = array('id' => $row['id_cat'], 'name' => $row['cat_name'], 'member_groups' => explode(',', $row['member_groups']));
    } else {
        $new = true;
        $context['category'] = array('id' => 'new', 'name' => '', 'member_groups' => array());
    }
    $context['groups'] = arcadeGetGroups($new ? 'all' : $context['category']['member_groups']);
    // Template
    $context['sub_template'] = 'arcade_admin_category_edit';
}
Esempio n. 2
0
function EditGame()
{
    global $scripturl, $txt, $db_prefix, $modSettings, $context, $sourcedir, $smcFunc, $boarddir;
    $context['game_permissions'] = $modSettings['arcadePermissionMode'] > 2;
    $context['edit_page'] = !isset($_REQUEST['advanced']) ? 'basic' : 'advanced';
    // Load game data unless it has been loaded by EditGame2
    if (!isset($context['game'])) {
        $id = loadGame((int) $_REQUEST['game'], true);
        if ($id === false) {
            fatal_lang_error('arcade_game_not_found', false);
        }
        $game =& $context['arcade']['game_data'][$id];
        $context['game'] = array('id' => $game['id_game'], 'internal_name' => $game['internal_name'], 'category' => $game['id_cat'], 'name' => htmlspecialchars($game['game_name']), 'thumbnail' => htmlspecialchars($game['thumbnail']), 'thumbnail_small' => htmlspecialchars($game['thumbnail_small']), 'description' => htmlspecialchars($game['description']), 'help' => htmlspecialchars($game['help']), 'game_file' => $game['game_file'], 'game_directory' => $game['game_directory'], 'submit_system' => $game['submit_system'], 'score_type' => $game['score_type'], 'member_groups' => explode(',', $game['member_groups']), 'game_settings' => unserialize($game['game_settings']), 'enabled' => !empty($game['enabled']));
        /*if (!is_array($context['game']['game_settings']) || isset($_REQUEST['detect']))
        		{
        			require_once($sourcedir . '/SWFReader.php');
        			$swf = new SWFReader();
        
        			if (substr($game['game_file'], -3) == 'swf')
        			{
        				$swf->open($modSettings['gamesDirectory'] . '/' . $game['game_directory'] . '/' . $game['game_file']);
        
        				$context['game']['extra_data'] = array(
        					'width' => $swf->header['width'],
        					'height' => $swf->header['height'],
        					'flash_version' => $swf->header['version'],
        					'background_color' => $swf->header['background'],
        				);
        
        				$swf->close();
        			}
        			else
        			{
        				$context['game']['extra_data'] = array(
        					'width' => '',
        					'height' => '',
        					'flash_version' => '',
        					'background_color' => array('', '', ''),
        				);
        			}
        		}*/
    }
    if ($context['game_permissions']) {
        $context['groups'] = arcadeGetGroups($context['game']['member_groups']);
    }
    // Load categories
    if (!isset($context['arcade_category'])) {
        $request = $smcFunc['db_query']('', '
			SELECT id_cat, cat_name
			FROM {db_prefix}arcade_categories');
        $context['arcade_category'] = array();
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $context['arcade_category'][] = array('id' => $row['id_cat'], 'name' => $row['cat_name']);
        }
        $smcFunc['db_free_result']($request);
    }
    // Load Sumbit Systems
    if (!isset($context['submit_systems'])) {
        $context['submit_systems'] = SubmitSystemInfo('*');
    }
    $context['template_layers'][] = 'edit_game';
    if (!isset($_REQUEST['advanced'])) {
        $context['sub_template'] = 'edit_game_basic';
    } else {
        $context['sub_template'] = 'edit_game_advanced';
    }
}