コード例 #1
0
function ArcadeMaintenance()
{
    global $sourcedir, $scripturl, $txt, $modSettings, $context, $settings;
    require_once $sourcedir . '/Arcade.php';
    require_once $sourcedir . '/Subs-ArcadeAdmin.php';
    require_once $sourcedir . '/ManageServer.php';
    isAllowedTo('arcade_admin');
    SMFArcade::loadArcade('admin', 'arcademaintenance');
    // Template
    $context[$context['admin_menu_name']]['tab_data']['title'] = $txt['arcade_maintenance'];
    $context[$context['admin_menu_name']]['tab_data']['description'] = $txt['arcade_maintenance_desc'];
    $subActions = array('main' => array('ArcadeMaintenanceActions'), 'highscore' => array('ArcadeMaintenanceHighscore'));
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'main';
    $subActions[$_REQUEST['sa']][0]();
}
コード例 #2
0
ファイル: ManageGames.php プロジェクト: nikop/SMF-Arcade
function ManageGames()
{
    global $scripturl, $txt, $context, $sourcedir, $smcFunc, $modSettings;
    require_once $sourcedir . '/Arcade.php';
    require_once $sourcedir . '/Subs-ArcadeAdmin.php';
    // Templates
    loadTemplate('ManageGames');
    SMFArcade::loadArcade('admin', 'manage_games');
    loadClassFile('Class-Package.php');
    // Need to update files in database?
    if (!empty($modSettings['arcadeGamecacheUpdate']) && (empty($modSettings['arcadeDBUpdate']) || $modSettings['arcadeDBUpdate'] < max(filemtime($modSettings['gamesDirectory']), filemtime(__FILE__)))) {
        updateGameCache();
    }
    if (isset($_REQUEST['uninstall_submit']) && !isset($_REQUEST['sa'])) {
        $_REQUEST['sa'] = 'uninstall';
    }
    if (isset($_REQUEST['done']) && !empty($_SESSION['qaction'])) {
        $context['show_done'] = true;
        if ($_SESSION['qaction'] == 'install') {
            $context['qaction_title'] = $txt['arcade_install_complete'];
            $context['qaction_text'] = $txt['arcade_install_following_games'];
        } elseif ($_SESSION['qaction'] == 'uninstall') {
            $context['qaction_title'] = $txt['arcade_uninstall_complete'];
            $context['qaction_text'] = $txt['arcade_uninstall_following_games'];
        }
        if (isset($_SESSION['qaction_data']) && is_array($_SESSION['qaction_data'])) {
            $context['qaction_data'] = $_SESSION['qaction_data'];
        }
        unset($_SESSION['qaction_data']);
        unset($_SESSION['qaction']);
    }
    $subActions = array('list' => array('ManageGamesList', 'arcade_admin'), 'uninstall' => array('ManageGamesUninstall', 'arcade_admin'), 'uninstall2' => array('ManageGamesUninstall2', 'arcade_admin'), 'install' => array('ManageGamesInstall', 'arcade_admin'), 'install2' => array('ManageGamesInstall2', 'arcade_admin'), 'upload' => array('ManageGamesUpload', 'arcade_admin'), 'upload2' => array('ManageGamesUpload2', 'arcade_admin'), 'quickedit' => array('ManageGamesQuickEdit', 'arcade_admin'), 'edit' => array('EditGame', 'arcade_admin'), 'edit2' => array('EditGame2', 'arcade_admin'), 'export' => array('ExportGameinfo', 'arcade_admin'));
    // What user wants to do?
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'list';
    // Do we have reason to allow him/her to do it?
    isAllowedTo($subActions[$_REQUEST['sa']][1]);
    $context[$context['admin_menu_name']]['tab_data']['title'] = $txt['arcade_manage_games'];
    $context[$context['admin_menu_name']]['tab_data']['description'] = $txt['arcade_manage_games_desc'];
    $subActions[$_REQUEST['sa']][0]();
}
コード例 #3
0
ファイル: ArcadeAdmin.php プロジェクト: nikop/SMF-Arcade
function ArcadeAdminCategory()
{
    global $context, $sourcedir, $txt;
    require_once $sourcedir . '/Arcade.php';
    require_once $sourcedir . '/Subs-ArcadeAdmin.php';
    SMFArcade::loadArcade('admin', 'managecategory');
    $context[$context['admin_menu_name']]['tab_data']['title'] = $txt['arcade_manage_category'];
    $context[$context['admin_menu_name']]['tab_data']['description'] = $txt['arcade_manage_category_desc'];
    $subActions = array('list' => array('ArcadeCategoryList', 'arcade_admin'), 'edit' => array('ArcadeCategoryEdit', 'arcade_admin'), 'new' => array('ArcadeCategoryEdit', 'arcade_admin'), 'save' => array('ArcadeCategorySave', 'arcade_admin'));
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'list';
    isAllowedTo($subActions[$_REQUEST['sa']][1]);
    $subActions[$_REQUEST['sa']][0]();
}
コード例 #4
0
ファイル: Profile-Arcade.php プロジェクト: nikop/SMF-Arcade
function arcadeSettings($memID)
{
    global $scripturl, $txt, $db_prefix, $context, $smcFunc, $user_info, $sourcedir, $modSettings;
    require_once $sourcedir . '/Arcade.php';
    SMFArcade::loadArcade('profile');
    $events = arcadeEvent('get');
    $arcadeSettings = loadArcadeSettings($memID);
    $context['profile_fields'] = array('notifications' => array('type' => 'callback', 'callback_func' => 'arcade_notification'), 'gamesPerPage' => array('label' => $txt['arcade_user_gamesPerPage'], 'type' => 'select', 'options' => array(0 => sprintf($txt['arcade_user_gamesPerPage_default'], $modSettings['gamesPerPage']), 5 => 5, 10 => 10, 20 => 20, 25 => 25, 50 => 50), 'cast' => 'int', 'validate' => 'int', 'value' => isset($arcadeSettings['gamesPerPage']) ? $arcadeSettings['gamesPerPage'] : 0), 'scoresPerPage' => array('label' => $txt['arcade_user_scoresPerPage'], 'type' => 'select', 'options' => array(0 => sprintf($txt['arcade_user_scoresPerPage_default'], $modSettings['scoresPerPage']), 5 => 5, 10 => 10, 20 => 20, 25 => 25, 50 => 50), 'cast' => 'int', 'validate' => 'int', 'value' => isset($arcadeSettings['scoresPerPage']) ? $arcadeSettings['scoresPerPage'] : 0));
    if (!empty($modSettings['disableCustomPerPage'])) {
        unset($context['profile_fields']['gamesPerPage']);
        unset($context['profile_fields']['scoresPerPage']);
    }
    if (isset($_REQUEST['save'])) {
        checkSession('post');
        $updates = array();
        $errors = false;
        foreach ($events as $event) {
            foreach ($event['notification'] as $notify => $default) {
                if (empty($_POST[$notify])) {
                    $updates[] = array($memID, $notify, 0);
                } else {
                    $updates[] = array($memID, $notify, 1);
                }
            }
        }
        foreach ($context['profile_fields'] as $id => $field) {
            if ($id == 'notifications' || !isset($_POST[$id])) {
                continue;
            }
            if ($field['cast'] == 'int') {
                $_POST[$id] = (int) $_POST[$id];
            }
            if ($field['type'] == 'select') {
                if (isset($field['options'][$_POST[$id]])) {
                    $updates[] = array($memID, $id, $_POST[$id]);
                }
            }
        }
        if (!$errors) {
            $smcFunc['db_insert']('replace', '{db_prefix}arcade_settings', array('id_member' => 'int', 'variable' => 'string-255', 'value' => 'string'), $updates, array('id_member', 'variable'));
            redirectexit('action=profile;u=' . $memID . ';sa=arcadeSettings');
        }
    }
    $context['notifications'] = array();
    foreach ($events as $event) {
        foreach ($event['notification'] as $notify => $default) {
            $context['notifications'][$notify] = array('id' => $notify, 'text' => $txt['arcade_notification_' . $notify], 'value' => isset($arcadeSettings[$notify]) ? (bool) $arcadeSettings[$notify] : $default, 'default' => !isset($arcadeSettings[$notify]));
        }
    }
    // Template
    $context['profile_custom_submit_url'] = $scripturl . '?action=profile;area=arcadeSettings;u=' . $memID . ';save';
    $context['page_desc'] = $txt['arcade_usersettings_desc'];
    $context['sub_template'] = 'edit_options';
}