当前位置: 首页>>代码示例>>PHP>>正文


PHP updateStats函数代码示例

本文整理汇总了PHP中updateStats函数的典型用法代码示例。如果您正苦于以下问题:PHP updateStats函数的具体用法?PHP updateStats怎么用?PHP updateStats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了updateStats函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: activateAccount

function activateAccount($memID)
{
    global $sourcedir, $context, $user_profile, $modSettings;
    isAllowedTo('moderate_forum');
    if (isset($_REQUEST['save']) && isset($user_profile[$memID]['is_activated']) && $user_profile[$memID]['is_activated'] != 1) {
        // If we are approving the deletion of an account, we do something special ;)
        if ($user_profile[$memID]['is_activated'] == 4) {
            require_once $sourcedir . '/Subs-Members.php';
            deleteMembers($context['id_member']);
            redirectexit();
        }
        // Let the integrations know of the activation.
        call_integration_hook('integrate_activate', array($user_profile[$memID]['member_name']));
        // Actually update this member now, as it guarantees the unapproved count can't get corrupted.
        updateMemberData($context['id_member'], array('is_activated' => $user_profile[$memID]['is_activated'] >= 10 ? 11 : 1, 'validation_code' => ''));
        // If we are doing approval, update the stats for the member just in case.
        if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 13, 14))) {
            updateSettings(array('unapprovedMembers' => $modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0));
        }
        // Make sure we update the stats too.
        updateStats('member', false);
    }
    // Leave it be...
    redirectexit('action=profile;u=' . $memID . ';area=summary');
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:25,代码来源:Profile-Actions.php

示例2: updateUniqueClicks

function updateUniqueClicks($class, $id)
{
    if (!isset($_COOKIE["ffjvisit_" . $class . $id])) {
        setcookie("ffjvisit_" . $class . $id, "true", time() + 86400, "/", ".fastfoodjobsuk.co.uk");
        updateStats($class, $id, "clicks");
    }
}
开发者ID:BackupTheBerlios,项目名称:scrapbook,代码行数:7,代码来源:common_functions.php

示例3: returnSeed

function returnSeed()
{
    global $db, $seedtable;
    global $reservationid, $externaldns, $secondDCstart, $indexid;
    # Find external dns of first node
    $query = $db->prepare("SELECT seed_dns\n                         FROM {$seedtable} \n                         WHERE reservation_id=:reservationid AND index_id=0");
    $query->bindParam(':reservationid', $reservationid, PDO::PARAM_STR, 20);
    $query->execute();
    $results = $query->fetchAll();
    $zeronodedns = $results[0]['seed_dns'];
    # Query for the seeds.
    $query = $db->prepare("SELECT seed_ip, index_id \n                         FROM {$seedtable} \n                         WHERE reservation_id=:reservationid AND (index_id=0 OR index_id=:secondDCstart)\n                         ORDER BY index_id");
    $query->bindParam(':reservationid', $reservationid, PDO::PARAM_STR, 20);
    $query->bindParam(':secondDCstart', $secondDCstart, PDO::PARAM_STR, 20);
    $query->execute();
    $results = $query->fetchAll();
    if ($indexid == 0 and sizeof($results) >= 1) {
        newStats(1);
    } elseif ($indexid > 0) {
        updateStats();
    }
    echo sizeof($results);
    echo "\n" . $externaldns;
    #print_r($results);
    foreach ($results as $result) {
        echo "\n" . $result['seed_ip'];
    }
}
开发者ID:nzroller,项目名称:ComboAMI,代码行数:28,代码来源:reflector.php

示例4: RepairBoards

/**
 * Finds or repairs errors in the database to fix possible problems.
 * Requires the admin_forum permission.
 * Calls createSalvageArea() to create a new board, if necesary.
 * Accessed by ?action=admin;area=repairboards.
 *
 * @uses raw_data sub-template.
 */
function RepairBoards()
{
    global $txt, $context, $sourcedir, $salvageBoardID;
    isAllowedTo('admin_forum');
    // Try secure more memory.
    setMemoryLimit('128M');
    // Print out the top of the webpage.
    $context['page_title'] = $txt['admin_repair'];
    $context['sub_template'] = 'repair_boards';
    $context[$context['admin_menu_name']]['current_subsection'] = 'general';
    // Load the language file.
    loadLanguage('ManageMaintenance');
    // Make sure the tabs stay nice.
    $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['maintain_title'], 'help' => '', 'description' => $txt['maintain_info'], 'tabs' => array());
    // Start displaying errors without fixing them.
    if (isset($_GET['fixErrors'])) {
        checkSession('get');
    }
    // Will want this.
    loadForumTests();
    // Giant if/else. The first displays the forum errors if a variable is not set and asks
    // if you would like to continue, the other fixes the errors.
    if (!isset($_GET['fixErrors'])) {
        $context['error_search'] = true;
        $context['repair_errors'] = array();
        $context['to_fix'] = findForumErrors();
        if (!empty($context['to_fix'])) {
            $_SESSION['repairboards_to_fix'] = $context['to_fix'];
            $_SESSION['repairboards_to_fix2'] = null;
            if (empty($context['repair_errors'])) {
                $context['repair_errors'][] = '???';
            }
        }
    } else {
        $context['error_search'] = false;
        $context['to_fix'] = isset($_SESSION['repairboards_to_fix']) ? $_SESSION['repairboards_to_fix'] : array();
        require_once $sourcedir . '/Subs-Boards.php';
        // Actually do the fix.
        findForumErrors(true);
        // Note that we've changed everything possible ;)
        updateSettings(array('settings_updated' => time()));
        updateStats('message');
        updateStats('topic');
        updateSettings(array('calendar_updated' => time()));
        if (!empty($salvageBoardID)) {
            $context['redirect_to_recount'] = true;
        }
        $_SESSION['repairboards_to_fix'] = null;
        $_SESSION['repairboards_to_fix2'] = null;
    }
}
开发者ID:albertlast,项目名称:SMF2.1,代码行数:59,代码来源:RepairBoards.php

示例5: resetStats

function resetStats()
{
    $games = file_get_contents('games.log');
    $games = explode("\n", $games);
    file_put_contents('games.stats', '');
    file_put_contents('players.stats', '');
    foreach ($games as $game) {
        if (empty($game)) {
            continue;
        }
        $game = explode("\t", $game);
        updateStats($game[0], $game[1], $game[2], $game[3], false);
    }
}
开发者ID:rebdrup,项目名称:foosball,代码行数:14,代码来源:reset_stats.php

示例6: fix_serialized_columns

function fix_serialized_columns()
{
    global $db_prefix;
    $request = db_query("\n\t\tSELECT ID_ACTION, extra\n\t\tFROM {$db_prefix}log_actions\n\t\tWHERE action IN ('remove', 'delete')", __FILE__, __LINE__);
    while ($row = mysql_fetch_assoc($request)) {
        if (@unserialize($row['extra']) === false && preg_match('~^(a:3:{s:5:"topic";i:\\d+;s:7:"subject";s:)(\\d+):"(.+)"(;s:6:"member";s:5:"\\d+";})$~', $row['extra'], $matches) === 1) {
            db_query("\n\t\t\t\tUPDATE {$db_prefix}log_actions\n\t\t\t\tSET extra = '{$matches['1']}" . strlen($matches[3]) . ":\"{$matches['3']}\"{$matches['4']}'\n\t\t\t\tWHERE ID_ACTION = {$row['ID_ACTION']}\n\t\t\t\tLIMIT 1", __FILE__, __LINE__);
        }
    }
    mysql_free_result($request);
    // Refresh some serialized strings stored in the settings table.
    updateStats('calendar');
    // The memberlist cache needs to be recalculated too.
    updateSettings(array('memberlist_updated' => time()));
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:15,代码来源:Subs-Charset.php

示例7: ModifySettings

function ModifySettings()
{
    global $modSettings, $context, $settings, $db_prefix, $txt, $boarddir, $sourcedir;
    loadTemplate('ManageCalendar');
    $context['page_title'] = $txt['calendar_settings'];
    $context['sub_template'] = 'modify_settings';
    // A file we need to show permissions inline.
    require_once $sourcedir . '/ManagePermissions.php';
    $calendarPermissions = array('calendar_view', 'calendar_post', 'calendar_edit_own', 'calendar_edit_any');
    // A form was submitted.
    if (isset($_POST['sc'], $_POST['cal_days_for_index'])) {
        checkSession();
        // Although the display settings are combined to the user, they are seperate to the database.
        $toSet['cal_showholidaysonindex'] = $_POST['cal_showholidays'] == 'index' || $_POST['cal_showholidays'] == 'all' ? '1' : '0';
        $toSet['cal_showbdaysonindex'] = $_POST['cal_showbdays'] == 'index' || $_POST['cal_showbdays'] == 'all' ? '1' : '0';
        $toSet['cal_showeventsonindex'] = $_POST['cal_showevents'] == 'index' || $_POST['cal_showevents'] == 'all' ? '1' : '0';
        $toSet['cal_showholidaysoncalendar'] = $_POST['cal_showholidays'] == 'cal' || $_POST['cal_showholidays'] == 'all' ? '1' : '0';
        $toSet['cal_showbdaysoncalendar'] = $_POST['cal_showbdays'] == 'cal' || $_POST['cal_showbdays'] == 'all' ? '1' : '0';
        $toSet['cal_showeventsoncalendar'] = $_POST['cal_showevents'] == 'cal' || $_POST['cal_showevents'] == 'all' ? '1' : '0';
        updateSettings(array('cal_enabled' => isset($_POST['cal_enabled']) ? '1' : '0', 'cal_daysaslink' => isset($_POST['cal_daysaslink']) ? '1' : '0', 'cal_showweeknum' => isset($_POST['cal_showweeknum']) ? '1' : '0', 'cal_days_for_index' => (int) $_POST['cal_days_for_index'], 'cal_showholidaysonindex' => $toSet['cal_showholidaysonindex'], 'cal_showbdaysonindex' => $toSet['cal_showbdaysonindex'], 'cal_showeventsonindex' => $toSet['cal_showeventsonindex'], 'cal_showholidaysoncalendar' => $toSet['cal_showholidaysoncalendar'], 'cal_showbdaysoncalendar' => $toSet['cal_showbdaysoncalendar'], 'cal_showeventsoncalendar' => $toSet['cal_showeventsoncalendar'], 'cal_defaultboard' => (int) $_POST['cal_defaultboard'], 'cal_allow_unlinked' => isset($_POST['cal_allow_unlinked']) ? '1' : '0', 'cal_minyear' => (int) $_POST['cal_minyear'], 'cal_maxyear' => (int) $_POST['cal_maxyear'], 'cal_bdaycolor' => $_POST['cal_bdaycolor'], 'cal_eventcolor' => $_POST['cal_eventcolor'], 'cal_holidaycolor' => $_POST['cal_holidaycolor'], 'cal_allowspan' => isset($_POST['cal_allowspan']) ? '1' : '0', 'cal_maxspan' => (int) $_POST['cal_maxspan'], 'cal_showInTopic' => isset($_POST['cal_showInTopic']) ? '1' : '0'));
        save_inline_permissions($calendarPermissions);
        updateStats('calendar');
        // Ensure we redirect incase the change in settings means the tabs are outdated.
        redirectexit('action=managecalendar;sa=settings');
    }
    // Load the boards list.
    $context['cal_boards'] = array('');
    $request = db_query("\n\t\tSELECT b.ID_BOARD, b.name AS bName, c.name AS cName\n\t\tFROM {$db_prefix}boards AS b\n\t\t\tLEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)", __FILE__, __LINE__);
    while ($row = mysql_fetch_assoc($request)) {
        $context['cal_boards'][$row['ID_BOARD']] = $row['cName'] . ' - ' . $row['bName'];
    }
    mysql_free_result($request);
    // Initialize the inline permission settings.
    init_inline_permissions($calendarPermissions);
    // Setup the display settings, just for better UI ;)
    $context['cal_showholidays'] = empty($modSettings['cal_showholidaysonindex']) ? empty($modSettings['cal_showholidaysoncalendar']) ? 'never' : 'cal' : (empty($modSettings['cal_showholidaysoncalendar']) ? 'index' : 'all');
    $context['cal_showbdays'] = empty($modSettings['cal_showbdaysonindex']) ? empty($modSettings['cal_showbdaysoncalendar']) ? 'never' : 'cal' : (empty($modSettings['cal_showbdaysoncalendar']) ? 'index' : 'all');
    $context['cal_showevents'] = empty($modSettings['cal_showeventsonindex']) ? empty($modSettings['cal_showeventsoncalendar']) ? 'never' : 'cal' : (empty($modSettings['cal_showeventsoncalendar']) ? 'index' : 'all');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:39,代码来源:ManageCalendar.php

示例8: action_activateaccount

 /**
  * Activate an account.
  * This function is called from the profile account actions area.
  */
 public function action_activateaccount()
 {
     global $context, $user_profile, $modSettings;
     isAllowedTo('moderate_forum');
     $memID = currentMemberID();
     if (isset($_REQUEST['save']) && isset($user_profile[$memID]['is_activated']) && $user_profile[$memID]['is_activated'] != 1) {
         require_once SUBSDIR . '/Members.subs.php';
         // If we are approving the deletion of an account, we do something special ;)
         if ($user_profile[$memID]['is_activated'] == 4) {
             deleteMembers($context['id_member']);
             redirectexit();
         }
         // Actually update this member now, as it guarantees the unapproved count can't get corrupted.
         approveMembers(array('members' => array($context['id_member']), 'activated_status' => $user_profile[$memID]['is_activated']));
         // Log what we did?
         logAction('approve_member', array('member' => $memID), 'admin');
         // If we are doing approval, update the stats for the member just in case.
         if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 13, 14))) {
             updateSettings(array('unapprovedMembers' => $modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0));
         }
         // Make sure we update the stats too.
         updateStats('member', false);
     }
     // Leave it be...
     redirectexit('action=profile;u=' . $memID . ';area=summary');
 }
开发者ID:joshuaadickerson,项目名称:Elkarte,代码行数:30,代码来源:ProfileAccount.controller.php

示例9: DeleteInstall

function DeleteInstall()
{
    global $txt, $HTTP_SESSION_VARS, $incontext;
    global $current_smf_version, $sourcedir, $forum_version, $modSettings, $user_info, $db_type;
    $incontext['page_title'] = $txt['congratulations'];
    $incontext['sub_template'] = 'delete_install';
    $incontext['continue'] = 0;
    require dirname(__FILE__) . '/Settings.php';
    load_database();
    chdir(dirname(__FILE__));
    require_once $sourcedir . '/Errors.php';
    require_once $sourcedir . '/lib/Subs.php';
    require_once $sourcedir . '/CommonAPI.php';
    require_once $sourcedir . '/Load.php';
    require_once $sourcedir . '/Security.php';
    require_once $sourcedir . '/lib/Subs-Auth.php';
    // Bring a warning over.
    if (!empty($incontext['account_existed'])) {
        $incontext['warning'] = $incontext['account_existed'];
    }
    smf_db_query('
		SET NAMES utf8', array());
    // As track stats is by default enabled let's add some activity.
    smf_db_insert('ignore', '{db_prefix}log_activity', array('date' => 'date', 'topics' => 'int', 'posts' => 'int', 'registers' => 'int'), array(strftime('%Y-%m-%d', time()), 1, 1, !empty($incontext['member_id']) ? 1 : 0), array('date'));
    // Automatically log them in ;)
    if (isset($incontext['member_id']) && isset($incontext['member_salt'])) {
        setLoginCookie(3153600 * 60, $incontext['member_id'], sha1(sha1(strtolower($_POST['username']) . $_POST['password1']) . $incontext['member_salt']));
    }
    $result = smf_db_query('
		SELECT value
		FROM {db_prefix}settings
		WHERE variable = {string:db_sessions}', array('db_sessions' => 'databaseSession_enable', 'db_error_skip' => true));
    if (mysql_num_rows($result) != 0) {
        list($db_sessions) = mysql_fetch_row($result);
    }
    mysql_free_result($result);
    if (empty($db_sessions)) {
        if (@version_compare(PHP_VERSION, '4.2.0') == -1) {
            $HTTP_SESSION_VARS['php_412_bugfix'] = true;
        }
        $_SESSION['admin_time'] = time();
    } else {
        $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211);
        smf_db_insert('replace', '{db_prefix}sessions', array('session_id' => 'string', 'last_update' => 'int', 'data' => 'string'), array(session_id(), time(), 'USER_AGENT|s:' . strlen($_SERVER['HTTP_USER_AGENT']) . ':"' . $_SERVER['HTTP_USER_AGENT'] . '";admin_time|i:' . time() . ';'), array('session_id'));
    }
    // We're going to want our lovely $modSettings now.
    $request = smf_db_query('
		SELECT variable, value
		FROM {db_prefix}settings', array('db_error_skip' => true));
    // Only proceed if we can load the data.
    if ($request) {
        while ($row = mysql_fetch_row($request)) {
            $modSettings[$row[0]] = $row[1];
        }
        mysql_free_result($request);
    }
    updateStats('member');
    updateStats('message');
    updateStats('topic');
    $request = smf_db_query('
		SELECT id_msg
		FROM {db_prefix}messages
		WHERE id_msg = 1
			AND modified_time = 0
		LIMIT 1', array('db_error_skip' => true));
    if (mysql_num_rows($request) > 0) {
        updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject']));
    }
    mysql_free_result($request);
    // Now is the perfect time to fetch the SM files.
    require_once $sourcedir . '/ScheduledTasks.php';
    // Sanity check that they loaded earlier!
    if (isset($modSettings['recycle_board'])) {
        $forum_version = $current_smf_version;
        // The variable is usually defined in index.php so lets just use our variable to do it for us.
        scheduled_fetchSMfiles();
        // Now go get those files!
        // We've just installed!
        $user_info['ip'] = $_SERVER['REMOTE_ADDR'];
        $user_info['id'] = isset($incontext['member_id']) ? $incontext['member_id'] : 0;
        logAction('install', array('version' => $forum_version), 'admin');
    }
    // Check if we need some stupid MySQL fix.
    $server_version = smf_db_get_version();
    if ($db_type == 'mysql' && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) {
        updateSettings(array('db_mysql_group_by_fix' => '1'));
    }
    // Some final context for the template.
    $incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\';
    $incontext['probably_delete_install'] = isset($_SESSION['installer_temp_ftp']) || is_writable(dirname(__FILE__)) || is_writable(__FILE__);
    return false;
}
开发者ID:norv,项目名称:EosAlpha,代码行数:92,代码来源:install.php

示例10: QuickModeration


//.........这里部分代码省略.........
    // Approve the topics...
    if (!empty($approveCache)) {
        // We need unapproved topic ids and their authors!
        $request = $smcFunc['db_query']('', '
			SELECT id_topic, id_member_started
			FROM {db_prefix}topics
			WHERE id_topic IN ({array_int:approve_topic_ids})
				AND approved = {int:not_approved}
			LIMIT ' . count($approveCache), array('approve_topic_ids' => $approveCache, 'not_approved' => 0));
        $approveCache = array();
        $approveCacheMembers = array();
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $approveCache[] = $row['id_topic'];
            $approveCacheMembers[$row['id_topic']] = $row['id_member_started'];
        }
        $smcFunc['db_free_result']($request);
        // Any topics to approve?
        if (!empty($approveCache)) {
            // Handle the approval part...
            approveTopics($approveCache);
            // Time for some logging!
            foreach ($approveCache as $topic) {
                logAction('approve_topic', array('topic' => $topic, 'member' => $approveCacheMembers[$topic]));
            }
        }
    }
    // And (almost) lastly, lock the topics...
    if (!empty($lockCache)) {
        $lockStatus = array();
        // Gotta make sure they CAN lock/unlock these topics...
        if (!empty($board) && !allowedTo('lock_any')) {
            // Make sure they started the topic AND it isn't already locked by someone with higher priv's.
            $result = $smcFunc['db_query']('', '
				SELECT id_topic, locked, id_board
				FROM {db_prefix}topics
				WHERE id_topic IN ({array_int:locked_topic_ids})
					AND id_member_started = {int:current_member}
					AND locked IN (2, 0)
				LIMIT ' . count($lockCache), array('current_member' => $user_info['id'], 'locked_topic_ids' => $lockCache));
            $lockCache = array();
            $lockCacheBoards = array();
            while ($row = $smcFunc['db_fetch_assoc']($result)) {
                $lockCache[] = $row['id_topic'];
                $lockCacheBoards[$row['id_topic']] = $row['id_board'];
                $lockStatus[$row['id_topic']] = empty($row['locked']);
            }
            $smcFunc['db_free_result']($result);
        } else {
            $result = $smcFunc['db_query']('', '
				SELECT id_topic, locked, id_board
				FROM {db_prefix}topics
				WHERE id_topic IN ({array_int:locked_topic_ids})
				LIMIT ' . count($lockCache), array('locked_topic_ids' => $lockCache));
            $lockCacheBoards = array();
            while ($row = $smcFunc['db_fetch_assoc']($result)) {
                $lockStatus[$row['id_topic']] = empty($row['locked']);
                $lockCacheBoards[$row['id_topic']] = $row['id_board'];
            }
            $smcFunc['db_free_result']($result);
        }
        // It could just be that *none* were their own topics...
        if (!empty($lockCache)) {
            // Alternate the locked value.
            $smcFunc['db_query']('', '
				UPDATE {db_prefix}topics
				SET locked = CASE WHEN locked = {int:is_locked} THEN ' . (allowedTo('lock_any') ? '1' : '2') . ' ELSE 0 END
				WHERE id_topic IN ({array_int:locked_topic_ids})', array('locked_topic_ids' => $lockCache, 'is_locked' => 0));
        }
    }
    if (!empty($markCache)) {
        $markArray = array();
        foreach ($markCache as $topic) {
            $markArray[] = array($modSettings['maxMsgID'], $user_info['id'], $topic);
        }
        $smcFunc['db_insert']('replace', '{db_prefix}log_topics', array('id_msg' => 'int', 'id_member' => 'int', 'id_topic' => 'int'), $markArray, array('id_member', 'id_topic'));
    }
    foreach ($moveCache as $topic) {
        // Didn't actually move anything!
        if (!isset($topic[0])) {
            break;
        }
        logAction('move', array('topic' => $topic[0], 'board_from' => $topic[1], 'board_to' => $topic[2]));
        sendNotifications($topic[0], 'move');
    }
    foreach ($lockCache as $topic) {
        logAction($lockStatus[$topic] ? 'lock' : 'unlock', array('topic' => $topic, 'board' => $lockCacheBoards[$topic]));
        sendNotifications($topic, $lockStatus[$topic] ? 'lock' : 'unlock');
    }
    foreach ($stickyCache as $topic) {
        logAction($stickyCacheStatus[$topic] ? 'unsticky' : 'sticky', array('topic' => $topic, 'board' => $stickyCacheBoards[$topic]));
        sendNotifications($topic, 'sticky');
    }
    updateStats('topic');
    updateStats('message');
    updateSettings(array('calendar_updated' => time()));
    if (!empty($affectedBoards)) {
        updateLastMessages(array_keys($affectedBoards));
    }
    redirectexit($redirect_url);
}
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:101,代码来源:MessageIndex.php

示例11: updateMemberData

function updateMemberData($members, $data)
{
    global $modSettings, $user_info, $smcFunc;
    $parameters = array();
    if (is_array($members)) {
        $condition = 'id_member IN ({array_int:members})';
        $parameters['members'] = $members;
    } elseif ($members === null) {
        $condition = '1=1';
    } else {
        $condition = 'id_member = {int:member}';
        $parameters['member'] = $members;
    }
    if (!empty($modSettings['integrate_change_member_data'])) {
        // Only a few member variables are really interesting for integration.
        $integration_vars = array('member_name', 'real_name', 'email_address', 'id_group', 'gender', 'birthdate', 'website_title', 'website_url', 'location', 'hide_email', 'time_format', 'time_offset', 'avatar', 'lngfile');
        $vars_to_integrate = array_intersect($integration_vars, array_keys($data));
        // Only proceed if there are any variables left to call the integration function.
        if (count($vars_to_integrate) != 0) {
            // Fetch a list of member_names if necessary
            if (!is_array($members) && $members === $user_info['id'] || is_array($members) && count($members) == 1 && in_array($user_info['id'], $members)) {
                $member_names = array($user_info['username']);
            } else {
                $member_names = array();
                $request = $smcFunc['db_query']('', '
					SELECT member_name
					FROM {db_prefix}members
					WHERE ' . $condition, $parameters);
                while ($row = $smcFunc['db_fetch_assoc']($request)) {
                    $member_names[] = $row['member_name'];
                }
                $smcFunc['db_free_result']($request);
            }
            if (!empty($member_names)) {
                foreach ($vars_to_integrate as $var) {
                    call_integration_hook('integrate_change_member_data', array($member_names, $var, $data[$var]));
                }
            }
        }
    }
    // Everything is assumed to be a string unless it's in the below.
    $knownInts = array('date_registered', 'posts', 'id_group', 'last_login', 'instant_messages', 'unread_messages', 'new_pm', 'pm_prefs', 'gender', 'hide_email', 'show_online', 'pm_email_notify', 'pm_receive_from', 'karma_good', 'karma_bad', 'notify_announcements', 'notify_send_body', 'notify_regularity', 'notify_types', 'id_theme', 'is_activated', 'id_msg_last_visit', 'id_post_group', 'total_time_logged_in', 'warning');
    $knownFloats = array('time_offset');
    $setString = '';
    foreach ($data as $var => $val) {
        $type = 'string';
        if (in_array($var, $knownInts)) {
            $type = 'int';
        } elseif (in_array($var, $knownFloats)) {
            $type = 'float';
        } elseif ($var == 'birthdate') {
            $type = 'date';
        }
        // Doing an increment?
        if ($type == 'int' && ($val === '+' || $val === '-')) {
            $val = $var . ' ' . $val . ' 1';
            $type = 'raw';
        }
        // Ensure posts, instant_messages, and unread_messages don't overflow or underflow.
        if (in_array($var, array('posts', 'instant_messages', 'unread_messages'))) {
            if (preg_match('~^' . $var . ' (\\+ |- |\\+ -)([\\d]+)~', $val, $match)) {
                if ($match[1] != '+ ') {
                    $val = 'CASE WHEN ' . $var . ' <= ' . abs($match[2]) . ' THEN 0 ELSE ' . $val . ' END';
                }
                $type = 'raw';
            }
        }
        $setString .= ' ' . $var . ' = {' . $type . ':p_' . $var . '},';
        $parameters['p_' . $var] = $val;
    }
    $smcFunc['db_query']('', '
		UPDATE {db_prefix}members
		SET' . substr($setString, 0, -1) . '
		WHERE ' . $condition, $parameters);
    updateStats('postgroups', $members, array_keys($data));
    // Clear any caching?
    if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2 && !empty($members)) {
        if (!is_array($members)) {
            $members = array($members);
        }
        foreach ($members as $member) {
            if ($modSettings['cache_enable'] >= 3) {
                cache_put_data('member_data-profile-' . $member, null, 120);
                cache_put_data('member_data-normal-' . $member, null, 120);
                cache_put_data('member_data-minimal-' . $member, null, 120);
            }
            cache_put_data('user_settings-' . $member, null, 60);
        }
    }
}
开发者ID:AhoyLemon,项目名称:ballpit,代码行数:90,代码来源:Subs.backup.2.php

示例12: modifyPost


//.........这里部分代码省略.........
    $db = database();
    $topicOptions['poll'] = isset($topicOptions['poll']) ? (int) $topicOptions['poll'] : null;
    $topicOptions['lock_mode'] = isset($topicOptions['lock_mode']) ? $topicOptions['lock_mode'] : null;
    $topicOptions['sticky_mode'] = isset($topicOptions['sticky_mode']) ? $topicOptions['sticky_mode'] : null;
    // This is longer than it has to be, but makes it so we only set/change what we have to.
    $messages_columns = array();
    if (isset($posterOptions['name'])) {
        $messages_columns['poster_name'] = $posterOptions['name'];
    }
    if (isset($posterOptions['email'])) {
        $messages_columns['poster_email'] = $posterOptions['email'];
    }
    if (isset($msgOptions['icon'])) {
        $messages_columns['icon'] = $msgOptions['icon'];
    }
    if (isset($msgOptions['subject'])) {
        $messages_columns['subject'] = $msgOptions['subject'];
    }
    if (isset($msgOptions['body'])) {
        $messages_columns['body'] = $msgOptions['body'];
        // using a custom search index, then lets get the old message so we can update our index as needed
        if (!empty($modSettings['search_custom_index_config'])) {
            require_once SUBSDIR . '/Messages.subs.php';
            $message = basicMessageInfo($msgOptions['id'], true);
            $msgOptions['old_body'] = $message['body'];
        }
    }
    if (!empty($msgOptions['modify_time'])) {
        $messages_columns['modified_time'] = $msgOptions['modify_time'];
        $messages_columns['modified_name'] = $msgOptions['modify_name'];
        $messages_columns['id_msg_modified'] = $modSettings['maxMsgID'];
    }
    if (isset($msgOptions['smileys_enabled'])) {
        $messages_columns['smileys_enabled'] = empty($msgOptions['smileys_enabled']) ? 0 : 1;
    }
    // Which columns need to be ints?
    $messageInts = array('modified_time', 'id_msg_modified', 'smileys_enabled');
    $update_parameters = array('id_msg' => $msgOptions['id']);
    call_integration_hook('integrate_before_modify_post', array(&$messages_columns, &$update_parameters, &$msgOptions, &$topicOptions, &$posterOptions, &$messageInts));
    foreach ($messages_columns as $var => $val) {
        $messages_columns[$var] = $var . ' = {' . (in_array($var, $messageInts) ? 'int' : 'string') . ':var_' . $var . '}';
        $update_parameters['var_' . $var] = $val;
    }
    // Nothing to do?
    if (empty($messages_columns)) {
        return true;
    }
    // Change the post.
    $db->query('', '
		UPDATE {db_prefix}messages
		SET ' . implode(', ', $messages_columns) . '
		WHERE id_msg = {int:id_msg}', $update_parameters);
    // Lock and or sticky the post.
    if ($topicOptions['sticky_mode'] !== null || $topicOptions['lock_mode'] !== null || $topicOptions['poll'] !== null) {
        $db->query('', '
			UPDATE {db_prefix}topics
			SET
				is_sticky = {raw:is_sticky},
				locked = {raw:locked},
				id_poll = {raw:id_poll}
			WHERE id_topic = {int:id_topic}', array('is_sticky' => $topicOptions['sticky_mode'] === null ? 'is_sticky' : (int) $topicOptions['sticky_mode'], 'locked' => $topicOptions['lock_mode'] === null ? 'locked' : (int) $topicOptions['lock_mode'], 'id_poll' => $topicOptions['poll'] === null ? 'id_poll' : (int) $topicOptions['poll'], 'id_topic' => $topicOptions['id']));
    }
    // Mark the edited post as read.
    if (!empty($topicOptions['mark_as_read']) && !$user_info['is_guest']) {
        // Since it's likely they *read* it before editing, let's try an UPDATE first.
        $db->query('', '
			UPDATE {db_prefix}log_topics
			SET id_msg = {int:id_msg}
			WHERE id_member = {int:current_member}
				AND id_topic = {int:id_topic}', array('current_member' => $user_info['id'], 'id_msg' => $modSettings['maxMsgID'], 'id_topic' => $topicOptions['id']));
        $flag = $db->affected_rows() != 0;
        if (empty($flag)) {
            require_once SUBSDIR . '/Topic.subs.php';
            markTopicsRead(array($user_info['id'], $topicOptions['id'], $modSettings['maxMsgID'], 0), false);
        }
    }
    // If there's a custom search index, it needs to be modified...
    require_once SUBSDIR . '/Search.subs.php';
    $searchAPI = findSearchAPI();
    if (is_callable(array($searchAPI, 'postModified'))) {
        $searchAPI->postModified($msgOptions, $topicOptions, $posterOptions);
    }
    if (isset($msgOptions['subject'])) {
        // Only update the subject if this was the first message in the topic.
        $request = $db->query('', '
			SELECT id_topic
			FROM {db_prefix}topics
			WHERE id_first_msg = {int:id_first_msg}
			LIMIT 1', array('id_first_msg' => $msgOptions['id']));
        if ($db->num_rows($request) == 1) {
            updateStats('subject', $topicOptions['id'], $msgOptions['subject']);
        }
        $db->free_result($request);
    }
    // Finally, if we are setting the approved state we need to do much more work :(
    if ($modSettings['postmod_active'] && isset($msgOptions['approved'])) {
        approvePosts($msgOptions['id'], $msgOptions['approved']);
    }
    return true;
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:101,代码来源:Post.subs.php

示例13: action_deleteInstall

/**
 * Final step, clean up and a complete message!
 */
function action_deleteInstall()
{
    global $txt, $incontext, $db_character_set;
    global $current_version, $databases, $forum_version, $modSettings, $user_info, $db_type;
    // A few items we will load in from settings and make avaialble.
    global $boardurl, $db_prefix, $cookiename, $mbname, $language;
    $incontext['page_title'] = $txt['congratulations'];
    $incontext['sub_template'] = 'delete_install';
    $incontext['continue'] = 0;
    require dirname(__FILE__) . '/Settings.php';
    if (!defined('ELK')) {
        define('ELK', 1);
    }
    definePaths();
    $db = load_database();
    if (!defined('SUBSDIR')) {
        define('SUBSDIR', dirname(__FILE__) . '/sources/subs');
    }
    chdir(dirname(__FILE__));
    require_once SOURCEDIR . '/Errors.php';
    require_once SOURCEDIR . '/Logging.php';
    require_once SOURCEDIR . '/Subs.php';
    require_once SOURCEDIR . '/Load.php';
    require_once SUBSDIR . '/Cache.subs.php';
    require_once SOURCEDIR . '/Security.php';
    require_once SUBSDIR . '/Auth.subs.php';
    require_once SUBSDIR . '/Util.class.php';
    // Bring a warning over.
    if (!empty($incontext['account_existed'])) {
        $incontext['warning'] = $incontext['account_existed'];
    }
    if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) {
        $db->query('', '
			SET NAMES {raw:db_character_set}', array('db_character_set' => $db_character_set, 'db_error_skip' => true));
    }
    // As track stats is by default enabled let's add some activity.
    $db->insert('ignore', '{db_prefix}log_activity', array('date' => 'date', 'topics' => 'int', 'posts' => 'int', 'registers' => 'int'), array(strftime('%Y-%m-%d', time()), 1, 1, !empty($incontext['member_id']) ? 1 : 0), array('date'));
    // We're going to want our lovely $modSettings now.
    $request = $db->query('', '
		SELECT variable, value
		FROM {db_prefix}settings', array('db_error_skip' => true));
    // Only proceed if we can load the data.
    if ($request) {
        while ($row = $db->fetch_row($request)) {
            $modSettings[$row[0]] = $row[1];
        }
        $db->free_result($request);
    }
    // Automatically log them in ;)
    if (isset($incontext['member_id']) && isset($incontext['member_salt'])) {
        setLoginCookie(3153600 * 60, $incontext['member_id'], hash('sha256', $incontext['passwd'] . $incontext['member_salt']));
    }
    $result = $db->query('', '
		SELECT value
		FROM {db_prefix}settings
		WHERE variable = {string:db_sessions}', array('db_sessions' => 'databaseSession_enable', 'db_error_skip' => true));
    if ($db->num_rows($result) != 0) {
        list($db_sessions) = $db->fetch_row($result);
    }
    $db->free_result($result);
    if (empty($db_sessions)) {
        $_SESSION['admin_time'] = time();
    } else {
        $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211);
        $db->insert('replace', '{db_prefix}sessions', array('session_id' => 'string', 'last_update' => 'int', 'data' => 'string'), array(session_id(), time(), 'USER_AGENT|s:' . strlen($_SERVER['HTTP_USER_AGENT']) . ':"' . $_SERVER['HTTP_USER_AGENT'] . '";admin_time|i:' . time() . ';'), array('session_id'));
    }
    updateStats('member');
    updateStats('message');
    updateStats('topic');
    $request = $db->query('', '
		SELECT id_msg
		FROM {db_prefix}messages
		WHERE id_msg = 1
			AND modified_time = 0
		LIMIT 1', array('db_error_skip' => true));
    if ($db->num_rows($request) > 0) {
        updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject']));
    }
    $db->free_result($request);
    // Now is the perfect time to fetch remote files.
    require_once SUBSDIR . '/ScheduledTask.class.php';
    // Sanity check that they loaded earlier!
    if (isset($modSettings['recycle_board'])) {
        // The variable is usually defined in index.php so lets just use our variable to do it for us.
        $forum_version = $current_version;
        // Now go get those files!
        $task = new Scheduled_Task();
        $task->fetchFiles();
        // We've just installed!
        $user_info['ip'] = $_SERVER['REMOTE_ADDR'];
        $user_info['id'] = isset($incontext['member_id']) ? $incontext['member_id'] : 0;
        logAction('install', array('version' => $forum_version), 'admin');
    }
    // Check if we need some stupid MySQL fix.
    $server_version = $db->db_server_info();
    if ($db_type == 'mysql' && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) {
        updateSettings(array('db_mysql_group_by_fix' => '1'));
//.........这里部分代码省略.........
开发者ID:joshuaadickerson,项目名称:Elkarte,代码行数:101,代码来源:install.php

示例14: RepairBoards


//.........这里部分代码省略.........
            }
            mysql_free_result($result);
            if (!empty($members)) {
                db_query("\n\t\t\t\t\tDELETE FROM {$db_prefix}pm_recipients\n\t\t\t\t\tWHERE ID_MEMBER IN (" . implode(', ', $members) . ")", __FILE__, __LINE__);
            }
        }
        if (empty($to_fix) || in_array('missing_senders', $to_fix)) {
            $result = db_query("\n\t\t\t\tSELECT pm.ID_PM\n\t\t\t\tFROM {$db_prefix}personal_messages AS pm\n\t\t\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = pm.ID_MEMBER_FROM)\n\t\t\t\tWHERE pm.ID_MEMBER_FROM != 0\n\t\t\t\t\tAND mem.ID_MEMBER IS NULL", __FILE__, __LINE__);
            if (mysql_num_rows($result) > 0) {
                $guestMessages = array();
                while ($row = mysql_fetch_assoc($result)) {
                    $guestMessages[] = $row['ID_PM'];
                }
                db_query("\n\t\t\t\t\tUPDATE {$db_prefix}personal_messages\n\t\t\t\t\tSET ID_MEMBER_FROM = 0\n\t\t\t\t\tWHERE ID_PM IN (" . implode(',', $guestMessages) . ')
					LIMIT ' . count($guestMessages), __FILE__, __LINE__);
            }
            mysql_free_result($result);
        }
        if (empty($to_fix) || in_array('missing_notify_members', $to_fix)) {
            $result = db_query("\n\t\t\t\tSELECT ln.ID_MEMBER\n\t\t\t\tFROM {$db_prefix}log_notify AS ln\n\t\t\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = ln.ID_MEMBER)\n\t\t\t\tWHERE mem.ID_MEMBER IS NULL\n\t\t\t\tGROUP BY ln.ID_MEMBER", __FILE__, __LINE__);
            $members = array();
            while ($row = mysql_fetch_assoc($result)) {
                $members[] = $row['ID_MEMBER'];
            }
            mysql_free_result($result);
            if (!empty($members)) {
                db_query("\n\t\t\t\t\tDELETE FROM {$db_prefix}log_notify\n\t\t\t\t\tWHERE ID_MEMBER IN (" . implode(', ', $members) . ")", __FILE__, __LINE__);
            }
        }
        if (empty($to_fix) || in_array('missing_cached_subject', $to_fix)) {
            $request = db_query("\n\t\t\t\tSELECT t.ID_TOPIC, m.subject\n\t\t\t\tFROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)\n\t\t\t\t\tLEFT JOIN {$db_prefix}log_search_subjects AS lss ON (lss.ID_TOPIC = t.ID_TOPIC)\n\t\t\t\tWHERE m.ID_MSG = t.ID_FIRST_MSG\n\t\t\t\t\tAND lss.ID_TOPIC IS NULL", __FILE__, __LINE__);
            $insertRows = array();
            while ($row = mysql_fetch_assoc($request)) {
                foreach (text2words($row['subject']) as $word) {
                    $insertRows[] = "'{$word}', {$row['ID_TOPIC']}";
                }
                if (count($insertRows) > 500) {
                    db_query("\n\t\t\t\t\t\tINSERT IGNORE INTO {$db_prefix}log_search_subjects\n\t\t\t\t\t\t\t(word, ID_TOPIC)\n\t\t\t\t\t\tVALUES (" . implode('),
							(', $insertRows) . ")", __FILE__, __LINE__);
                    $insertRows = array();
                }
            }
            mysql_free_result($request);
            if (!empty($insertRows)) {
                db_query("\n\t\t\t\t\tINSERT IGNORE INTO {$db_prefix}log_search_subjects\n\t\t\t\t\t\t(word, ID_TOPIC)\n\t\t\t\t\tVALUES (" . implode('),
						(', $insertRows) . ")", __FILE__, __LINE__);
            }
        }
        if (empty($to_fix) || in_array('missing_topic_for_cache', $to_fix)) {
            $request = db_query("\n\t\t\t\tSELECT lss.ID_TOPIC\n\t\t\t\tFROM {$db_prefix}log_search_subjects AS lss\n\t\t\t\t\tLEFT JOIN {$db_prefix}topics AS t ON (t.ID_TOPIC = lss.ID_TOPIC)\n\t\t\t\tWHERE t.ID_TOPIC IS NULL\n\t\t\t\tGROUP BY lss.ID_TOPIC", __FILE__, __LINE__);
            $deleteTopics = array();
            while ($row = mysql_fetch_assoc($request)) {
                $deleteTopics[] = $row['ID_TOPIC'];
            }
            mysql_free_result($request);
            if (!empty($deleteTopics)) {
                db_query("\n\t\t\t\t\tDELETE FROM {$db_prefix}log_search_subjects\n\t\t\t\t\tWHERE ID_TOPIC IN (" . implode(', ', $deleteTopics) . ')', __FILE__, __LINE__);
            }
        }
        if (empty($to_fix) || in_array('missing_member_vote', $to_fix)) {
            $result = db_query("\n\t\t\t\tSELECT lp.ID_MEMBER\n\t\t\t\tFROM {$db_prefix}log_polls AS lp\n\t\t\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lp.ID_MEMBER)\n\t\t\t\tWHERE mem.ID_MEMBER IS NULL\n\t\t\t\tGROUP BY lp.ID_MEMBER", __FILE__, __LINE__);
            $members = array();
            while ($row = mysql_fetch_assoc($result)) {
                $members[] = $row['ID_MEMBER'];
            }
            mysql_free_result($result);
            if (!empty($members)) {
                db_query("\n\t\t\t\t\tDELETE FROM {$db_prefix}log_polls\n\t\t\t\t\tWHERE ID_MEMBER IN (" . implode(', ', $members) . ")", __FILE__, __LINE__);
            }
        }
        if (empty($to_fix) || in_array('missing_log_poll_vote', $to_fix)) {
            $request = db_query("\n\t\t\t\tSELECT lp.ID_POLL\n\t\t\t\tFROM {$db_prefix}log_polls AS lp\n\t\t\t\t\tLEFT JOIN {$db_prefix}polls AS p ON (p.ID_POLL = lp.ID_POLL)\n\t\t\t\tWHERE p.ID_POLL IS NULL\n\t\t\t\tGROUP BY lp.ID_POLL", __FILE__, __LINE__);
            $polls = array();
            while ($row = mysql_fetch_assoc($request)) {
                $polls[] = $row['ID_POLL'];
            }
            mysql_free_result($request);
            if (!empty($polls)) {
                db_query("\n\t\t\t\t\tDELETE FROM {$db_prefix}log_polls\n\t\t\t\t\tWHERE ID_POLL IN (" . implode(', ', $polls) . ")", __FILE__, __LINE__);
            }
        }
        updateStats('message');
        updateStats('topic');
        updateStats('calendar');
        $context['raw_data'] = '
			<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tborder">
				<tr class="titlebg">
					<td>' . $txt['smf86'] . '</td>
				</tr><tr>
					<td class="windowbg">
						' . $txt['smf92'] . '<br />
						<br />
						<a href="' . $scripturl . '?action=maintain">' . $txt['maintain_return'] . '</a>
					</td>
				</tr>
			</table>';
        $_SESSION['repairboards_to_fix'] = null;
        $_SESSION['repairboards_to_fix2'] = null;
    }
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:101,代码来源:RepairBoards.php

示例15: eventScoresUpdate

 /**
  * eventScoresUpdate - Re-calculate the scores and players of an event
  */
 function eventScoresUpdate($current_match)
 {
     global $sql;
     global $time;
     //echo "dbg: current_match $current_match<br>";
     $numMatchsPerUpdate = 10;
     $q = "SELECT " . TBL_MATCHS . ".*" . " FROM " . TBL_MATCHS . " WHERE (" . TBL_MATCHS . ".Event = '" . $this->fields['EventID'] . "')" . " AND (" . TBL_MATCHS . ".Status = 'active')" . " ORDER BY TimeReported";
     $result = $sql->db_Query($q);
     $num_matches = mysql_numrows($result);
     if ($current_match > $num_matches) {
         switch ($this->fields['Type']) {
             case "One Player Ladder":
                 updateStats($this->fields['EventID'], $time, true);
                 break;
             case "Team Ladder":
                 updateStats($this->fields['EventID'], $time, true);
                 updateTeamStats($this->fields['EventID'], $time, true);
                 break;
             case "Clan Ladder":
                 updateTeamStats($this->fields['EventID'], $time, true);
                 break;
             case "One Player Tournament":
             case "Clan Tournament":
                 break;
             default:
         }
         echo "Done.";
         echo '<META HTTP-EQUIV="Refresh" Content="0; URL=eventmanage.php?eventid=' . $this->fields['EventID'] . '">';
     } else {
         $next_match = 1;
         if ($current_match == 0) {
             // Reset players stats
             $this->resetPlayers();
             $this->resetTeams();
             switch ($this->fields['Type']) {
                 case "One Player Ladder":
                     updateStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                     break;
                 case "Team Ladder":
                     updateStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                     updateTeamStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                     break;
                 case "Clan Ladder":
                     updateTeamStats($this->fields['EventID'], $this->fields['getStartDateTime'], false);
                     break;
                 case "One Player Tournament":
                 case "Clan Tournament":
                     break;
                 default:
             }
         } else {
             if (ob_get_level() == 0) {
                 ob_start();
             }
             // Output a 'waiting message'
             echo str_pad('Please wait while this task completes... ', 4096) . "<br />\n";
             // Update matchs scores
             for ($j = $current_match - 1; $j < min($current_match + $numMatchsPerUpdate - 1, $num_matches); $j++) {
                 set_time_limit(10);
                 $next_match = $j + 2;
                 $match_id = mysql_result($result, $j, TBL_MATCHS . ".MatchID");
                 $match = new Match($match_id);
                 $time_reported = mysql_result($result, $j, TBL_MATCHS . ".TimeReported");
                 //echo "dbg: match: $match_id<br>";
                 //echo "dbg: etype: $this->fields['Type']<br>";
                 $match->match_scores_update();
                 switch ($this->fields['Type']) {
                     case "One Player Ladder":
                         $match->match_players_update();
                         updateStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                         break;
                     case "Team Ladder":
                         $match->match_players_update();
                         updateStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                         updateTeamStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                         break;
                     case "Clan Ladder":
                         $match->match_teams_update();
                         updateTeamStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                         break;
                     case "One Player Tournament":
                     case "Clan Tournament":
                         break;
                     default:
                 }
                 //echo 'match '.$j.': '.$match_id.'<br>';
                 //echo '<div class="percents">match '.$j.': '.$match_id.'</div>';
                 echo '<div class="percents">' . number_format(100 * ($j + 1) / $num_matches, 0, '.', '') . '%&nbsp;complete</div>';
                 echo str_pad('', 4096) . "\n";
                 ob_flush();
                 flush();
             }
         }
         echo '<form name="updateform" action="' . e_PLUGIN . 'ebattles/eventprocess.php?eventid=' . $this->fields['EventID'] . '" method="post">';
         echo '<input type="hidden" name="match" value="' . $next_match . '"/>';
         echo '<input type="hidden" name="eventupdatescores" value="1"/>';
         echo '</form>';
//.........这里部分代码省略.........
开发者ID:testt98,项目名称:ebattles,代码行数:101,代码来源:event.php


注:本文中的updateStats函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。