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


PHP logAction函数代码示例

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


在下文中一共展示了logAction函数的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']));
        // We need to log that we're doing something.
        logAction('approve_member', array('member' => $memID), 'admin');
        // 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:chenhao6593,项目名称:smf,代码行数:27,代码来源:Profile-Actions.php

示例2: logTriggersUpdates

/**
 * A small function to unify logging of triggers (updates and new)
 *
 * @package Bans
 * @param mixed[] $logs an array of logs, each log contains the following keys:
 * - bantype: a known type of ban (ip_range, hostname, email, user, main_ip)
 * - value: the value of the bantype (e.g. the IP or the email address banned)
 * @param boolean|string $new type of trigger
 * - if the trigger is new (true), an update (false), or a removal ('remove') of an existing one
 */
function logTriggersUpdates($logs, $new = true)
{
    if (empty($logs)) {
        return;
    }
    $log_name_map = array('main_ip' => 'ip_range', 'hostname' => 'hostname', 'email' => 'email', 'user' => 'member', 'ip_range' => 'ip_range');
    // Log the addition of the ban entries into the moderation log.
    foreach ($logs as $log) {
        logAction('ban', array($log_name_map[$log['bantype']] => $log['value'], 'new' => empty($new) ? 0 : ($new === true ? 1 : -1), 'type' => $log['bantype']));
    }
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:21,代码来源:Bans.subs.php

示例3: QuickInTopicModeration

function QuickInTopicModeration()
{
    global $sourcedir, $topic, $board, $user_info, $smcFunc, $modSettings, $context;
    // Check the session = get or post.
    checkSession('request');
    require_once $sourcedir . '/RemoveTopic.php';
    if (empty($_REQUEST['msgs'])) {
        redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
    }
    $messages = array();
    foreach ($_REQUEST['msgs'] as $dummy) {
        $messages[] = (int) $dummy;
    }
    // We are restoring messages. We handle this in another place.
    if (isset($_REQUEST['restore_selected'])) {
        redirectexit('action=restoretopic;msgs=' . implode(',', $messages) . ';' . $context['session_var'] . '=' . $context['session_id']);
    }
    // Allowed to delete any message?
    if (allowedTo('delete_any')) {
        $allowed_all = true;
    } elseif (allowedTo('delete_replies')) {
        $request = $smcFunc['db_query']('', '
			SELECT id_member_started
			FROM {db_prefix}topics
			WHERE id_topic = {int:current_topic}
			LIMIT 1', array('current_topic' => $topic));
        list($starter) = $smcFunc['db_fetch_row']($request);
        $smcFunc['db_free_result']($request);
        $allowed_all = $starter == $user_info['id'];
    } else {
        $allowed_all = false;
    }
    // Make sure they're allowed to delete their own messages, if not any.
    if (!$allowed_all) {
        isAllowedTo('delete_own');
    }
    // Allowed to remove which messages?
    $request = $smcFunc['db_query']('', '
		SELECT id_msg, subject, id_member, poster_time, GREATEST(poster_time, modified_time) AS last_modified_time
		FROM {db_prefix}messages
		WHERE id_msg IN ({array_int:message_list})
			AND id_topic = {int:current_topic}' . (!$allowed_all ? '
			AND id_member = {int:current_member}' : '') . '
		LIMIT ' . count($messages), array('current_member' => $user_info['id'], 'current_topic' => $topic, 'message_list' => $messages));
    $messages = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        if (!$allowed_all && !empty($modSettings['edit_disable_time']) && $row['last_modified_time'] + $modSettings['edit_disable_time'] * 60 < time()) {
            continue;
        }
        $messages[$row['id_msg']] = array($row['subject'], $row['id_member']);
    }
    $smcFunc['db_free_result']($request);
    // Get the first message in the topic - because you can't delete that!
    $request = $smcFunc['db_query']('', '
		SELECT id_first_msg, id_last_msg
		FROM {db_prefix}topics
		WHERE id_topic = {int:current_topic}
		LIMIT 1', array('current_topic' => $topic));
    list($first_message, $last_message) = $smcFunc['db_fetch_row']($request);
    $smcFunc['db_free_result']($request);
    // Delete all the messages we know they can delete. ($messages)
    foreach ($messages as $message => $info) {
        // Just skip the first message - if it's not the last.
        if ($message == $first_message && $message != $last_message) {
            continue;
        } elseif ($message == $first_message) {
            $topicGone = true;
        }
        removeMessage($message);
        // Log this moderation action ;).
        if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) {
            logAction('delete', array('topic' => $topic, 'subject' => $info[0], 'member' => $info[1], 'board' => $board));
        }
    }
    redirectexit(!empty($topicGone) ? 'board=' . $board : 'topic=' . $topic . '.' . $_REQUEST['start']);
}
开发者ID:sk8rdude461,项目名称:moparscape.org-smf,代码行数:76,代码来源:Display.php

示例4: MoveTopic2


//.........这里部分代码省略.........
    }
    list($pcounter, $board_name, $subject) = $smcFunc['db_fetch_row']($request);
    $smcFunc['db_free_result']($request);
    // Remember this for later.
    $_SESSION['move_to_topic'] = $_POST['toboard'];
    // Rename the topic...
    if (isset($_POST['reset_subject'], $_POST['custom_subject']) && $_POST['custom_subject'] != '') {
        $_POST['custom_subject'] = strtr($smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['custom_subject'])), array("\r" => '', "\n" => '', "\t" => ''));
        // Keep checking the length.
        if ($smcFunc['strlen']($_POST['custom_subject']) > 100) {
            $_POST['custom_subject'] = $smcFunc['substr']($_POST['custom_subject'], 0, 100);
        }
        // If it's still valid move onwards and upwards.
        if ($_POST['custom_subject'] != '') {
            if (isset($_POST['enforce_subject'])) {
                // Get a response prefix, but in the forum's default language.
                if (!isset($context['response_prefix']) && !($context['response_prefix'] = cache_get_data('response_prefix'))) {
                    if ($language === $user_info['language']) {
                        $context['response_prefix'] = $txt['response_prefix'];
                    } else {
                        loadLanguage('index', $language, false);
                        $context['response_prefix'] = $txt['response_prefix'];
                        loadLanguage('index');
                    }
                    cache_put_data('response_prefix', $context['response_prefix'], 600);
                }
                $smcFunc['db_query']('', '
					UPDATE {db_prefix}messages
					SET subject = {string:subject}
					WHERE id_topic = {int:current_topic}', array('current_topic' => $topic, 'subject' => $context['response_prefix'] . $_POST['custom_subject']));
            }
            $smcFunc['db_query']('', '
				UPDATE {db_prefix}messages
				SET subject = {string:custom_subject}
				WHERE id_msg = {int:id_first_msg}', array('id_first_msg' => $id_first_msg, 'custom_subject' => $_POST['custom_subject']));
            // Fix the subject cache.
            updateStats('subject', $topic, $_POST['custom_subject']);
        }
    }
    // Create a link to this in the old board.
    //!!! Does this make sense if the topic was unapproved before? I'd just about say so.
    if (isset($_POST['postRedirect'])) {
        // Should be in the boardwide language.
        if ($user_info['language'] != $language) {
            loadLanguage('index', $language);
        }
        $_POST['reason'] = $smcFunc['htmlspecialchars']($_POST['reason'], ENT_QUOTES);
        preparsecode($_POST['reason']);
        // Add a URL onto the message.
        $_POST['reason'] = strtr($_POST['reason'], array($txt['movetopic_auto_board'] => '[url=' . $scripturl . '?board=' . $_POST['toboard'] . '.0]' . $board_name . '[/url]', $txt['movetopic_auto_topic'] => '[iurl]' . $scripturl . '?topic=' . $topic . '.0[/iurl]'));
        $msgOptions = array('subject' => $txt['moved'] . ': ' . $subject, 'body' => $_POST['reason'], 'icon' => 'moved', 'smileys_enabled' => 1);
        $topicOptions = array('board' => $board, 'lock_mode' => 1, 'mark_as_read' => true);
        $posterOptions = array('id' => $user_info['id'], 'update_post_count' => empty($pcounter));
        createPost($msgOptions, $topicOptions, $posterOptions);
    }
    $request = $smcFunc['db_query']('', '
		SELECT count_posts
		FROM {db_prefix}boards
		WHERE id_board = {int:current_board}
		LIMIT 1', array('current_board' => $board));
    list($pcounter_from) = $smcFunc['db_fetch_row']($request);
    $smcFunc['db_free_result']($request);
    if ($pcounter_from != $pcounter) {
        $request = $smcFunc['db_query']('', '
			SELECT id_member
			FROM {db_prefix}messages
			WHERE id_topic = {int:current_topic}
				AND approved = {int:is_approved}', array('current_topic' => $topic, 'is_approved' => 1));
        $posters = array();
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            if (!isset($posters[$row['id_member']])) {
                $posters[$row['id_member']] = 0;
            }
            $posters[$row['id_member']]++;
        }
        $smcFunc['db_free_result']($request);
        foreach ($posters as $id_member => $posts) {
            // The board we're moving from counted posts, but not to.
            if (empty($pcounter_from)) {
                updateMemberData($id_member, array('posts' => 'posts - ' . $posts));
            } else {
                updateMemberData($id_member, array('posts' => 'posts + ' . $posts));
            }
        }
    }
    // Do the move (includes statistics update needed for the redirect topic).
    moveTopics($topic, $_POST['toboard']);
    // Log that they moved this topic.
    if (!allowedTo('move_own') || $id_member_started != $user_info['id']) {
        logAction('move', array('topic' => $topic, 'board_from' => $board, 'board_to' => $_POST['toboard']));
    }
    // Notify people that this topic has been moved?
    sendNotifications($topic, 'move');
    // Why not go back to the original board in case they want to keep moving?
    if (!isset($_REQUEST['goback'])) {
        redirectexit('board=' . $board . '.0');
    } else {
        redirectexit('topic=' . $topic . '.0');
    }
}
开发者ID:Kheros,项目名称:MMOver,代码行数:101,代码来源:MoveTopic.php

示例5: serverConnect

<?php

$db_link = serverConnect();
$max = 'LIMIT ' . ($pageNum - 1) * $_SESSION['items'] . ',' . $_SESSION['items'];
if (isset($search)) {
    logAction($_SESSION['user_name'], $lang['searched'] . ' (' . $search . ') ' . $lang['in'] . ' ' . $lang['vehicles'], 1);
    $sql = "SELECT `id` FROM `houses` INNER JOIN `players` ON houses.pid=players.playerid WHERE `id` LIKE '" . $search . "' OR `pos` LIKE '" . $search . "' OR `inventory` LIKE '%" . $search . "%' OR `name` LIKE '%" . $search . "%' AND `pid` = '" . $_SESSION['playerid'] . "';";
    $result_of_query = $db_link->query($sql);
    $total_records = mysqli_num_rows($result_of_query);
    if ($pageNum > $total_records) {
        $pageNum = $total_records;
    }
    $sql = "SELECT `id`,`pid`,`pos`,`name`,`owned` FROM `houses` INNER JOIN `players` ON houses.pid=players.playerid WHERE `id` LIKE '" . $search . "' OR `pos` LIKE '" . $search . "' OR `inventory` LIKE '%" . $search . "%' OR `name` LIKE '%" . $search . "%' AND `pid` = '" . $_SESSION['playerid'] . "' " . $max . " ;";
} else {
    $sql = "SELECT `id` FROM `houses`;";
    $result_of_query = $db_link->query($sql);
    $total_records = mysqli_num_rows($result_of_query);
    if ($pageNum > $total_records) {
        $pageNum = $total_records;
    }
    $sql = "SELECT `id`,`pid`,`pos`,`name`,`owned` FROM `houses` INNER JOIN `players` ON houses.pid=players.playerid AND `pid` = '" . $_SESSION['playerid'] . "' " . $max . " ;";
}
$result_of_query = $db_link->query($sql);
if ($result_of_query->num_rows > 0) {
    ?>
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">
                <?php 
    echo $lang['houses'];
    ?>
开发者ID:GlitchedMan,项目名称:CyberWorks,代码行数:31,代码来源:houses.php

示例6: QuickModeration


//.........这里部分代码省略.........
                    } else {
                        $members[$row['id_member']] -= 1;
                    }
                }
                $smcFunc['db_free_result']($request);
                // And now update them member's post counts
                foreach ($members as $id_member => $post_adj) {
                    updateMemberData($id_member, array('posts' => 'posts + ' . $post_adj));
                }
            }
        }
    }
    // Now delete the topics...
    if (!empty($removeCache)) {
        // They can only delete their own topics. (we wouldn't be here if they couldn't do that..)
        $result = $smcFunc['db_query']('', '
			SELECT id_topic, id_board
			FROM {db_prefix}topics
			WHERE id_topic IN ({array_int:removed_topic_ids})' . (!empty($board) && !allowedTo('remove_any') ? '
				AND id_member_started = {int:current_member}' : '') . '
			LIMIT ' . count($removeCache), array('current_member' => $user_info['id'], 'removed_topic_ids' => $removeCache));
        $removeCache = array();
        $removeCacheBoards = array();
        while ($row = $smcFunc['db_fetch_assoc']($result)) {
            $removeCache[] = $row['id_topic'];
            $removeCacheBoards[$row['id_topic']] = $row['id_board'];
        }
        $smcFunc['db_free_result']($result);
        // Maybe *none* were their own topics.
        if (!empty($removeCache)) {
            // Gotta send the notifications *first*!
            foreach ($removeCache as $topic) {
                // Only log the topic ID if it's not in the recycle board.
                logAction('remove', array(empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $removeCacheBoards[$topic] ? 'topic' : 'old_topic_id' => $topic, 'board' => $removeCacheBoards[$topic]));
                sendNotifications($topic, 'remove');
            }
            require_once $sourcedir . '/RemoveTopic.php';
            removeTopics($removeCache);
        }
    }
    // 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]));
            }
        }
    }
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:67,代码来源:MessageIndex.php

示例7: action_mailingsend


//.........这里部分代码省略.........
         }
         // Don't sent it twice!
         unset($context['recipients']['emails'][$k]);
         // Dammit - can't PM emails!
         if ($context['send_pm']) {
             continue;
         }
         $to_member = array($email, !empty($_POST['send_html']) ? '<a href="mailto:' . $email . '">' . $email . '</a>' : $email, '??', $email);
         sendmail($email, str_replace($from_member, $to_member, $base_subject), str_replace($from_member, $to_member, $base_message), null, null, !empty($_POST['send_html']), 5);
         // Done another...
         $i++;
     }
     // Got some more to send this batch?
     $last_id_member = 0;
     if ($i < $num_at_once) {
         // Need to build quite a query!
         $sendQuery = '(';
         $sendParams = array();
         if (!empty($context['recipients']['groups'])) {
             // Take the long route...
             $queryBuild = array();
             foreach ($context['recipients']['groups'] as $group) {
                 $sendParams['group_' . $group] = $group;
                 $queryBuild[] = 'mem.id_group = {int:group_' . $group . '}';
                 if (!empty($group)) {
                     $queryBuild[] = 'FIND_IN_SET({int:group_' . $group . '}, mem.additional_groups) != 0';
                     $queryBuild[] = 'mem.id_post_group = {int:group_' . $group . '}';
                 }
             }
             if (!empty($queryBuild)) {
                 $sendQuery .= implode(' OR ', $queryBuild);
             }
         }
         if (!empty($context['recipients']['members'])) {
             $sendQuery .= ($sendQuery == '(' ? '' : ' OR ') . 'mem.id_member IN ({array_int:members})';
             $sendParams['members'] = $context['recipients']['members'];
         }
         $sendQuery .= ')';
         // If we've not got a query then we must be done!
         if ($sendQuery == '()') {
             redirectexit('action=admin');
         }
         // Anything to exclude?
         if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups'])) {
             $sendQuery .= ' AND mem.id_group != {int:regular_group}';
         }
         if (!empty($context['recipients']['exclude_members'])) {
             $sendQuery .= ' AND mem.id_member NOT IN ({array_int:exclude_members})';
             $sendParams['exclude_members'] = $context['recipients']['exclude_members'];
         }
         // Force them to have it?
         if (empty($context['email_force'])) {
             $sendQuery .= ' AND mem.notify_announcements = {int:notify_announcements}';
         }
         require_once SUBSDIR . '/News.subs.php';
         // Get the smelly people - note we respect the id_member range as it gives us a quicker query.
         $recipients = getNewsletterRecipients($sendQuery, $sendParams, $context['start'], $num_at_once, $i);
         foreach ($recipients as $row) {
             $last_id_member = $row['id_member'];
             // What groups are we looking at here?
             if (empty($row['additional_groups'])) {
                 $groups = array($row['id_group'], $row['id_post_group']);
             } else {
                 $groups = array_merge(array($row['id_group'], $row['id_post_group']), explode(',', $row['additional_groups']));
             }
             // Excluded groups?
             if (array_intersect($groups, $context['recipients']['exclude_groups'])) {
                 continue;
             }
             // We might need this
             $cleanMemberName = empty($_POST['send_html']) || $context['send_pm'] ? un_htmlspecialchars($row['real_name']) : $row['real_name'];
             // Replace the member-dependant variables
             $message = str_replace($from_member, array($row['email_address'], !empty($_POST['send_html']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $cleanMemberName . '</a>' : ($context['send_pm'] ? '[url=' . $scripturl . '?action=profile;u=' . $row['id_member'] . ']' . $cleanMemberName . '[/url]' : $cleanMemberName), $row['id_member'], $cleanMemberName), $base_message);
             $subject = str_replace($from_member, array($row['email_address'], $row['real_name'], $row['id_member'], $row['real_name']), $base_subject);
             // Send the actual email - or a PM!
             if (!$context['send_pm']) {
                 sendmail($row['email_address'], $subject, $message, null, null, !empty($_POST['send_html']), 5);
             } else {
                 sendpm(array('to' => array($row['id_member']), 'bcc' => array()), $subject, $message);
             }
         }
     }
     // If used our batch assume we still have a member.
     if ($i >= $num_at_once) {
         $last_id_member = $context['start'];
     } elseif (empty($last_id_member) && $context['start'] + $num_at_once < $context['max_id_member']) {
         $last_id_member = $context['start'] + $num_at_once;
     } elseif (empty($last_id_member) && empty($context['recipients']['emails'])) {
         // Log this into the admin log.
         logAction('newsletter', array(), 'admin');
         redirectexit('action=admin;area=news;sa=mailingsend;success');
     }
     $context['start'] = $last_id_member;
     // Working out progress is a black art of sorts.
     $percentEmails = $context['total_emails'] == 0 ? 0 : count($context['recipients']['emails']) / $context['total_emails'] * ($context['total_emails'] / ($context['total_emails'] + $context['max_id_member']));
     $percentMembers = $context['start'] / $context['max_id_member'] * ($context['max_id_member'] / ($context['total_emails'] + $context['max_id_member']));
     $context['percentage_done'] = round(($percentEmails + $percentMembers) * 100, 2);
     $context['page_title'] = $txt['admin_newsletters'];
     $context['sub_template'] = 'email_members_send';
 }
开发者ID:Ralkage,项目名称:Elkarte,代码行数:101,代码来源:ManageNews.controller.php

示例8: elseif

    exit;
} elseif (hasPermission($_SESSION['id'], 'Admin') == false) {
    echo "<p class='error_message'>Você não possui privilégios para acessar esta área.</p>";
    exit;
}
/*
	Verifica se a configuração de log está ligada ou desligada. Se estiver ligada, ele irá fazer uso da 
	função logAction.
*/
$c = new conexao();
$c->set_charset('utf8');
$q = "SELECT * FROM configuracoes WHERE opcao = 'log';";
$r = $c->query($q);
$log = $r->fetch_object();
if ($log->valor == 'ligado') {
    logAction($_SESSION['id'], $_SERVER['REQUEST_URI'], var_export($_POST, true), var_export($_GET, true));
}
?>
   	<div id="header">
    	<h1>HSTOCK - Módulo Administrador</h1>
    </div>
    
    <div id="menu">
        <?php 
require_once 'menu.php';
?>
	</div>
    	
    <div id="content">
    	<p>Seja bem-vindo(a), <?php 
echo $_SESSION['nome'];
开发者ID:NAILIWB,项目名称:hstock,代码行数:31,代码来源:home.php

示例9: Alert

            }
        }
    }
    if ($err) {
        Alert($err);
    } else {
        $newsalt = Shake();
        $sha = doHash($_POST['pass'] . $salt . $newsalt);
        $sex = validateSex($_POST["sex"]);
        $rUsers = Query("insert into {users} (name, password, pss, regdate, lastactivity, lastip, email, sex, theme) values ({0}, {1}, {2}, {3}, {3}, {4}, {5}, {6}, {7})", $_POST['name'], $sha, $newsalt, time(), $_SERVER['REMOTE_ADDR'], $_POST['email'], $sex, Settings::get("defaultTheme"));
        $uid = insertId();
        if ($uid == 1) {
            Query("update {users} set powerlevel = 4 where id = 1");
        }
        recalculateKarma($uid);
        logAction('register', array('user' => $uid));
        $user = Fetch(Query("select * from {users} where id={0}", $uid));
        $user["rawpass"] = $_POST["pass"];
        $bucket = "newuser";
        include "lib/pluginloader.php";
        $sessionID = Shake();
        setcookie("logsession", $sessionID, 0, $boardroot, "", false, true);
        Query("INSERT INTO {sessions} (id, user, autoexpire) VALUES ({0}, {1}, {2})", doHash($sessionID . $salt), $user["id"], 0);
        redirectAction("board");
    }
}
$sexes = array(__("Male"), __("Female"), __("N/A"));
$name = "";
if (isset($_POST["name"])) {
    $name = htmlspecialchars($_POST["name"]);
}
开发者ID:knytrune,项目名称:ABXD,代码行数:31,代码来源:register.php

示例10: clean

                $name = clean($_POST['name'], "string");
                $usegsq = clean($_POST['usegsq'], "int");
                if ($_POST['usegsq'] == 1) {
                    $sq_ip = encrypt(clean($_POST['sq_ip'], "string"));
                    $sq_port = encrypt(clean($_POST['sq_port'], "string"));
                    $rcon_pass = encrypt(clean($_POST['rcon_pass'], "string"));
                    $sql = "UPDATE `servers` SET `name`= '" . $name . "',`type`= '" . $type . "',`use_sq`= '" . $usegsq . "',`sq_port`= '" . $sq_port . "',`sq_ip`= '" . $sq_ip . "',`rcon_pass`= '" . $rcon_pass . "' WHERE `dbid`='" . $id . "';";
                } else {
                    $sql = "UPDATE `servers` SET `name`= '" . $name . "',`type`= '" . $type . "',`use_sq`= '" . $usegsq . "' WHERE `dbid`='" . $id . "';";
                }
                $result_of_query = $db_connection->query($sql);
            } else {
                message($lang['expired']);
            }
        } else {
            logAction($_SESSION['user_name'], $lang['failedUpdate'] . ' ' . $lang['gsq'], 3);
        }
    }
}
$sql = "SELECT * FROM `servers` WHERE `dbid`='" . $id . "';";
$result_of_query = $db_connection->query($sql);
if ($result_of_query->num_rows == 1) {
    $server = $result_of_query->fetch_object();
    $sql = "SELECT `sql_host`,`dbid`,`sql_name`,`sql_pass`,`sql_user` FROM `db` WHERE `dbid`='" . $id . "';";
    $result = $db_connection->query($sql);
    if ($result->num_rows == 1) {
        $db = $result->fetch_object();
        ?>
<div class="row">
    <div class="col-lg-8">
        <h1 class="page-header">
开发者ID:GlitchedMan,项目名称:CyberWorks,代码行数:31,代码来源:editServer.php

示例11: PackageInstall


//.........这里部分代码省略.........
                require $boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename'];
            } elseif ($action['type'] == 'redirect' && !empty($action['redirect_url'])) {
                $context['redirect_url'] = $action['redirect_url'];
                $context['redirect_text'] = !empty($action['filename']) && file_exists($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']) ? file_get_contents($boarddir . '/Packages/temp/' . $context['base_path'] . $action['filename']) : ($context['uninstalling'] ? $txt['package_uninstall_done'] : $txt['package_installed_done']);
                $context['redirect_timeout'] = $action['redirect_timeout'];
                // Parse out a couple of common urls.
                $urls = array('$boardurl' => $boardurl, '$scripturl' => $scripturl, '$session_var' => $context['session_var'], '$session_id' => $context['session_id']);
                $context['redirect_url'] = strtr($context['redirect_url'], $urls);
            }
        }
        package_flush_cache();
        // First, ensure this change doesn't get removed by putting a stake in the ground (So to speak).
        package_put_contents($boarddir . '/Packages/installed.list', time());
        // See if this is already installed, and change it's state as required.
        $request = smf_db_query('
			SELECT package_id, install_state, db_changes
			FROM {db_prefix}log_packages
			WHERE install_state != {int:not_installed}
				AND package_id = {string:current_package}
				' . ($context['install_id'] ? ' AND id_install = {int:install_id} ' : '') . '
			ORDER BY time_installed DESC
			LIMIT 1', array('not_installed' => 0, 'install_id' => $context['install_id'], 'current_package' => $packageInfo['id']));
        $is_upgrade = false;
        while ($row = mysql_fetch_assoc($request)) {
            // Uninstalling?
            if ($context['uninstalling']) {
                smf_db_query('
					UPDATE {db_prefix}log_packages
					SET install_state = {int:not_installed}, member_removed = {string:member_name}, id_member_removed = {int:current_member},
						time_removed = {int:current_time}
					WHERE package_id = {string:package_id}', array('current_member' => $user_info['id'], 'not_installed' => 0, 'current_time' => time(), 'package_id' => $row['package_id'], 'member_name' => $user_info['name']));
            } else {
                $is_upgrade = true;
                $old_db_changes = empty($row['db_changes']) ? array() : unserialize($row['db_changes']);
            }
        }
        // Assuming we're not uninstalling, add the entry.
        if (!$context['uninstalling']) {
            // Any db changes from older version?
            if (!empty($old_db_changes)) {
                $db_package_log = empty($db_package_log) ? $old_db_changes : array_merge($old_db_changes, $db_package_log);
            }
            // If there are some database changes we might want to remove then filter them out.
            if (!empty($db_package_log)) {
                // We're really just checking for entries which are create table AND add columns (etc).
                $tables = array();
                function sort_table_first($a, $b)
                {
                    if ($a[0] == $b[0]) {
                        return 0;
                    }
                    return $a[0] == 'remove_table' ? -1 : 1;
                }
                usort($db_package_log, 'sort_table_first');
                foreach ($db_package_log as $k => $log) {
                    if ($log[0] == 'remove_table') {
                        $tables[] = $log[1];
                    } elseif (in_array($log[1], $tables)) {
                        unset($db_package_log[$k]);
                    }
                }
                $db_changes = serialize($db_package_log);
            } else {
                $db_changes = '';
            }
            // What themes did we actually install?
            $themes_installed = array_unique($themes_installed);
            $themes_installed = implode(',', $themes_installed);
            // What failed steps?
            $failed_step_insert = serialize($failed_steps);
            smf_db_insert('', '{db_prefix}log_packages', array('filename' => 'string', 'name' => 'string', 'package_id' => 'string', 'version' => 'string', 'id_member_installed' => 'int', 'member_installed' => 'string', 'time_installed' => 'int', 'install_state' => 'int', 'failed_steps' => 'string', 'themes_installed' => 'string', 'member_removed' => 'int', 'db_changes' => 'string'), array($packageInfo['filename'], $packageInfo['name'], $packageInfo['id'], $packageInfo['version'], $user_info['id'], $user_info['name'], time(), $is_upgrade ? 2 : 1, $failed_step_insert, $themes_installed, 0, $db_changes), array('id_install'));
        }
        mysql_free_result($request);
        $context['install_finished'] = true;
    }
    // If there's database changes - and they want them removed - let's do it last!
    if (!empty($db_changes) && !empty($_POST['do_db_changes'])) {
        // We're gonna be needing the package db functions!
        db_extend('packages');
        foreach ($db_changes as $change) {
            if ($change[0] == 'remove_table' && isset($change[1])) {
                smf_db_drop_table($change[1]);
            } elseif ($change[0] == 'remove_column' && isset($change[2])) {
                smf_db_remove_column($change[1], $change[2]);
            } elseif ($change[0] == 'remove_index' && isset($change[2])) {
                smf_db_remove_index($change[1], $change[2]);
            }
        }
    }
    // Clean house... get rid of the evidence ;).
    if (file_exists($boarddir . '/Packages/temp')) {
        deltree($boarddir . '/Packages/temp');
    }
    // Log what we just did.
    logAction($context['uninstalling'] ? 'uninstall_package' : (!empty($is_upgrade) ? 'upgrade_package' : 'install_package'), array('package' => commonAPI::htmlspecialchars($packageInfo['name']), 'version' => commonAPI::htmlspecialchars($packageInfo['version'])), 'admin');
    // Just in case, let's clear the whole cache to avoid anything going up the swanny.
    clean_cache();
    // Restore file permissions?
    create_chmod_control(array(), array(), true);
}
开发者ID:norv,项目名称:EosAlpha,代码行数:101,代码来源:Packages.php

示例12: action_modify_bounce_templates

 /**
  * Edit a 'it bounced' template.
  *
  * @uses bounce_template sub template
  */
 public function action_modify_bounce_templates()
 {
     global $context, $txt, $user_info;
     require_once SUBSDIR . '/Moderation.subs.php';
     $context['id_template'] = isset($_REQUEST['tid']) ? (int) $_REQUEST['tid'] : 0;
     $context['is_edit'] = (bool) $context['id_template'];
     // Standard template things, you know the drill
     $context['page_title'] = $context['is_edit'] ? $txt['ml_bounce_template_modify'] : $txt['ml_bounce_template_add'];
     $context['sub_template'] = 'bounce_template';
     $context[$context['admin_menu_name']]['current_subsection'] = 'templates';
     // Defaults to show
     $context['template_data'] = array('title' => '', 'body' => $txt['ml_bounce_template_body_default'], 'subject' => $txt['ml_bounce_template_subject_default'], 'personal' => false, 'can_edit_personal' => true);
     // If it's an edit load it.
     if ($context['is_edit']) {
         modLoadTemplate($context['id_template'], 'bnctpl');
     }
     // Wait, we are saving?
     if (isset($_POST['save'])) {
         checkSession('post');
         validateToken('mod-mlt');
         // To check the BBC is good...
         require_once SUBSDIR . '/Post.subs.php';
         // Bit of cleaning!
         $template_body = trim($_POST['template_body']);
         $template_title = trim($_POST['template_title']);
         // Need something in both boxes.
         if (!empty($template_body) && !empty($template_title)) {
             // Safety first.
             $template_title = Util::htmlspecialchars($template_title);
             // Clean up BBC.
             preparsecode($template_body);
             // But put line breaks back!
             $template_body = strtr($template_body, array('<br />' => "\n"));
             // Is this personal?
             $recipient_id = !empty($_POST['make_personal']) ? $user_info['id'] : 0;
             // Updating or adding ?
             if ($context['is_edit']) {
                 // Simple update...
                 modAddUpdateTemplate($recipient_id, $template_title, $template_body, $context['id_template'], true, 'bnctpl');
                 // If it wasn't visible and now is they've effectively added it.
                 if ($context['template_data']['personal'] && !$recipient_id) {
                     logAction('add_bounce_template', array('template' => $template_title));
                 } elseif (!$context['template_data']['personal'] && $recipient_id) {
                     logAction('delete_bounce_template', array('template' => $template_title));
                 } else {
                     logAction('modify_bounce_template', array('template' => $template_title));
                 }
             } else {
                 modAddUpdateTemplate($recipient_id, $template_title, $template_body, $context['id_template'], false, 'bnctpl');
                 logAction('add_bounce_template', array('template' => $template_title));
             }
             // Get out of town...
             redirectexit('action=admin;area=maillist;sa=emailtemplates');
         } else {
             $context['warning_errors'] = array();
             $context['template_data']['title'] = !empty($template_title) ? $template_title : '';
             $context['template_data']['body'] = !empty($template_body) ? $template_body : $txt['ml_bounce_template_body_default'];
             $context['template_data']['personal'] = !empty($recipient_id);
             if (empty($template_title)) {
                 $context['warning_errors'][] = $txt['ml_bounce_template_error_no_title'];
             }
             if (empty($template_body)) {
                 $context['warning_errors'][] = $txt['ml_bounce_template_error_no_body'];
             }
         }
     }
     createToken('mod-mlt');
 }
开发者ID:KeiroD,项目名称:Elkarte,代码行数:73,代码来源:ManageMaillist.controller.php

示例13: mysql_real_escape_string

// update user?
if (@$_POST['action'] == 'Submit') {
    $id = (int) @$_POST['id'];
    $old_id = (int) @$_POST['old_id'];
    $name = @$_POST['username'];
    $name = mysql_real_escape_string($name);
    mysql_select_db('thengamer_userdb');
    query("DELETE FROM users WHERE id = {$old_id} LIMIT 1");
    $rs = query("SELECT COUNT(*) FROM users WHERE id = {$id}");
    list($num) = mysql_fetch_row($rs);
    if ($num) {
        query("UPDATE users SET id = {$id}, name = '{$name}' WHERE id = {$old_id} LIMIT 1");
        logAction("updated user {$id} with username \"{$name}\" and old id {$old_id}");
    } else {
        query("INSERT INTO users (id, name) VALUES ({$id},'{$name}')");
        logAction("inserted user {$id} with username \"{$name}\"");
    }
    mysql_select_db('thengamer_forum');
    $message = "<p>User added/edited.</p>";
}
writeHead('GFuserDB Moderation');
if (@$_POST['action'] == 'Next...') {
    $id = (int) @$_POST['user'];
    mysql_select_db('thengamer_userdb');
    $rs = query("SELECT name FROM users WHERE id = {$id}");
    list($username) = @mysql_fetch_row($rs);
    mysql_select_db('thengamer_forum');
    $username = htmlspecialchars($username);
    echo <<<ADDEDIT
<h3>Add/edit a user</h3>
开发者ID:Albertoni,项目名称:GFUserDatabase,代码行数:30,代码来源:gfuserdb.php

示例14: time

                if ($_POST['stick']) {
                    $mod .= ", sticky = 1";
                } else {
                    if ($_POST['unstick']) {
                        $mod .= ", sticky = 0";
                    }
                }
            }
            $now = time();
            $rUsers = Query("update {users} set posts=posts+1, lastposttime={0} where id={1} limit 1", time(), $loguserid);
            $rPosts = Query("insert into {posts} (thread, user, date, ip, num, options, mood) values ({0},{1},{2},{3},{4}, {5}, {6})", $tid, $loguserid, $now, $_SERVER['REMOTE_ADDR'], $loguser['posts'] + 1, $options, (int) $_POST['mood']);
            $pid = InsertId();
            $rPostsText = Query("insert into {posts_text} (pid,text,revision,user,date) values ({0}, {1}, {2}, {3}, {4})", $pid, $post, 0, $loguserid, time());
            $rFora = Query("update {forums} set numposts=numposts+1, lastpostdate={0}, lastpostuser={1}, lastpostid={2} where id={3} limit 1", $now, $loguserid, $pid, $fid);
            $rThreads = Query("update {threads} set lastposter={0}, lastpostdate={1}, replies=replies+1, lastpostid={2}" . $mod . " where id={3} limit 1", $loguserid, $now, $pid, $tid);
            logAction('newreply', array('forum' => $fid, 'thread' => $tid, 'post' => $pid));
            $bucket = "newreply";
            include "lib/pluginloader.php";
            redirectAction("post", $pid);
        }
    }
}
$prefill = htmlspecialchars($_POST['text']);
if ($_GET['link']) {
    $prefill = ">>" . (int) $_GET['link'] . "\r\n\r\n";
} else {
    if ($_GET['quote']) {
        $rQuote = Query("\tselect\n\t\t\t\t\tp.id, p.deleted, pt.text,\n\t\t\t\t\tf.minpower,\n\t\t\t\t\tu.name poster\n\t\t\t\tfrom {posts} p\n\t\t\t\t\tleft join {posts_text} pt on pt.pid = p.id and pt.revision = p.currentrevision\n\t\t\t\t\tleft join {threads} t on t.id=p.thread\n\t\t\t\t\tleft join {forums} f on f.id=t.forum\n\t\t\t\t\tleft join {users} u on u.id=p.user\n\t\t\t\twhere p.id={0}", (int) $_GET['quote']);
        if (NumRows($rQuote)) {
            $quote = Fetch($rQuote);
            //SPY CHECK!
开发者ID:knytrune,项目名称:ABXD,代码行数:31,代码来源:newreply.php

示例15: unlink

        $file = R::load('attachment', $data->fileId);
        if ($file->id) {
            $filename = $file->name;
            $before = $item->export();
            unlink('uploads/' . $file->filename);
            R::trash($file);
            R::store($item);
            logAction($actor->username . ' removed attachment ' . $filename . ' from item ' . $item->title, $before, $item, $itemId);
            $jsonResponse->addAlert('success', $filename . ' was deleted.');
            $jsonResponse->addBeans($item);
        }
    }
    $app->response->setBody($jsonResponse->asJson());
})->conditions(['itemId' => '\\d+']);
// Remove an item.
$app->post('/items/remove', function () use($app, $jsonResponse) {
    $data = json_decode($app->environment['slim.input']);
    if (validateToken(true)) {
        $item = R::load('item', $data->itemId);
        if ($item->id) {
            $before = $item->export();
            R::trash($item);
            renumberItems($item->lane_id, $item->position);
            $actor = getUser();
            logAction($actor->username . ' removed item ' . $item->title, $before, null, $data->itemId);
            $jsonResponse->addAlert('success', $item->title . ' was deleted.');
            $jsonResponse->addBeans(getBoards());
        }
    }
    $app->response->setBody($jsonResponse->asJson());
});
开发者ID:BIGGANI,项目名称:TaskBoard,代码行数:31,代码来源:itemRoutes.php


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