コード例 #1
0
ファイル: ym-logs.php プロジェクト: AdultStack/ap-members
    echo ym_end_box();
    echo ym_start_box(__('Logs', 'ym'));
}
if ($transaction_id) {
    echo '<p>' . sprintf(__('Transaction Group: %s', 'ym'), $transaction_id);
    $query = 'SELECT * FROM ' . $wpdb->prefix . 'ym_transaction WHERE transaction_id = ' . $transaction_id;
    echo '<table class="form-table">
	<tr><th style="width: 75px;">ID</th><th>User</th><th>Action</th><th>Data</th><th>Date</th></tr>';
    foreach ($wpdb->get_results($query) as $transaction) {
        echo '<tr>';
        echo '<td>' . $transaction->id . '</td>';
        echo '<td nowrap="nowrap">(' . $transaction->user_id . ') ';
        $user = get_user_by('id', $transaction->user_id);
        echo $user->user_login;
        echo '</td>';
        $log_type = ym_get_transaction_action($transaction->action_id);
        echo '<td>' . $log_type->name . '</td>';
        $mod = maybe_unserialize($transaction->data);
        if ($transaction->action_id == YM_ACCESS_EXTENSION || $transaction->action_id == YM_ACCESS_EXPIRY) {
            // TODO: for YM 11 only
            if (strpos($transaction->data, ' ') || strpos($transaction->data, '-')) {
                $transaction->data = strtotime($transaction->data);
            }
            echo '<td>';
            if ($transaction->data) {
                echo date(YM_DATE, $transaction->data);
            } else {
                echo 'No Data';
            }
            echo '</td>';
        } else {
コード例 #2
0
function ym_show_timeline_log_home($limit = 20)
{
    if ($transactions = ym_get_all_logs(false, false, false, false, 'unixtime DESC LIMIT ' . $limit)) {
        echo '<table class="form-table widefat">';
        foreach ($transactions as $transaction) {
            $user = get_userdata($transaction->user_id);
            echo '<tr>';
            $action = ym_get_transaction_action($transaction->action_id);
            if (is_object($action)) {
                echo '<td>' . $action->name . ' <span style="display: none;">' . $action->id . '</span></td>';
            } else {
                echo '<td>' . __('Unknown', 'ym') . ' (' . $transaction->action_id . ') <span style="display: none;">' . $transaction->id . '</span></td>';
            }
            echo '<td>';
            if (isset($transaction->user_id) && isset($user->user_login)) {
                echo '<a href="?page=' . YM_ADMIN_FUNCTION . '&amp;ym_page=user-edit&amp;user_id=' . $transaction->user_id . '&amp;TB_iframe=true&amp;height=700&amp;width=800" class="thickbox">';
                echo $user->user_login . '</a>';
            } else {
                echo 'DeletedUser';
            }
            echo '</td>';
            echo '<td>';
            echo '<a href="?page=' . YM_ADMIN_FUNCTION . '&amp;ym_page=ym-logs&amp;user_id=' . $transaction->user_id . '&amp;TB_iframe=true&amp;height=700&amp;width=800" class="thickbox ym_node_tree"></a></td>';
            echo '</td>';
            if (is_serialized($transaction->data)) {
                $data = unserialize($transaction->data);
                echo '<td><a href="#nowhere" class="ym_packetize_show">' . __('Click to Show Packet', 'ym') . '<div class="ym_packetize_packet"><table class="ym_packetize_data">';
                foreach ($data as $name => $value) {
                    echo '<tr><th>' . $name . '</th><td>';
                    $is = gettype($value);
                    if ($is == 'object' || $is == 'array') {
                        //						echo print_r($value, TRUE);
                        echo '<table>';
                        foreach ($value as $k => $v) {
                            echo '<tr><td>' . $k . '</td><td><pre>' . print_r($v, true) . '</pre></td></tr>';
                        }
                        echo '</table>';
                    } else {
                        echo $value;
                    }
                    echo '</td></tr>';
                }
                echo '</table></div></a></td>';
            } else {
                if ($transaction->action_id == YM_ACCESS_EXTENSION || $transaction->action_id == YM_ACCESS_EXPIRY) {
                    // TODO: for YM 11 only
                    if (strpos($transaction->data, ' ') || strpos($transaction->data, '-')) {
                        $transaction->data = strtotime($transaction->data);
                    }
                    echo '<td>';
                    if ($transaction->data) {
                        echo date(YM_DATE, $transaction->data + get_option('gmt_offset') * 3600);
                    } else {
                        echo 'No Data';
                    }
                    echo '</td>';
                } else {
                    echo '<td>' . $transaction->data . '</td>';
                }
            }
            echo '<td>' . date(YM_DATE, $transaction->unixtime + get_option('gmt_offset') * 3600) . '</td>';
            echo '</tr>';
        }
        echo '</table>';
    } else {
        echo '<p>' . __('There is nothing to report at the moment. Check back soon though!', 'ym') . '</p>';
    }
}