Exemplo n.º 1
0
      <input type="submit" value="Go" />
    </div>
    <?php 
if (isset($_GET['site'])) {
    $site = API::Site($_GET['site']);
    $request = $site->Users();
    if (isset($_GET['sort'])) {
        $request->SortBy($_GET['sort']);
    }
    if (isset($_GET['order']) && $_GET['order'] == 'asc') {
        $request->Ascending();
    } else {
        $request->Descending();
    }
    $response = $request->Exec();
    $table = OutputHelper::CreateTable($response);
    $table->SetSortImages('../common/sort_asc.png', '../common/sort_desc.png');
    // Create the method that will display the user's name with a link
    // (In PHP 5.3, we can just embed the function as a parameter to AddColumn)
    function DisplayUsername($item)
    {
        $mod = $item['user_type'] == 'moderator' ? ' &diams;' : '';
        return "<a href='{$item['link']}'>{$item['display_name']}{$mod}</a>";
    }
    $table->AddColumn(new TableColumn('display_name', 'Username', 'name', 'DisplayUsername'));
    $table->AddColumn(new TableColumn('reputation', 'Reputation', 'reputation'));
    $table->AddColumn(new TableColumn('location', 'Location'));
    $table->AddColumn(new TableColumn('creation_date', 'Date Joined', 'creation', Format::RelativeDate));
    ?>
    <div>
      <img src="<?php 
Exemplo n.º 2
0
    echo OutputHelper::GetHelperJS();
    echo 'Please wait...';
    exit;
}
?>
<!DOCTYPE html>
<html>
<head>
  <title>Stack.PHP - Client Side Authentication</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <link rel='stylesheet' type='text/css' href='../common/style.css' />
  <?php 
echo OutputHelper::GetHelperCSS();
?>
  <?php 
echo OutputHelper::GetHelperJS();
?>
  <script type='text/javascript'>
  
  function DisplayInbox(data) {
      
      // Check for an error
      if(typeof data['error_message'] != 'undefined')
          return Failure(data['error_message']);
      
      // Build a string containing the response
      var item_string = '<ul>';
      
      for(var i=0;i<data['items'].length;++i) {
          
          var display_title = (data['items'][i]['is_unread'])?
Exemplo n.º 3
0
<body>
  <form id='form'>
    <div id='site_selector'>
      <b>Select a Stack Exchange site:</b>
      <?php 
echo $site_html;
?>
      <input type="submit" value="Go" />
    </div>
    <?php 
if (isset($_GET['site'])) {
    ?>
        <div>
            <b>User:</b>
            <?php 
    echo OutputHelper::DisplayUserSelector('user_id', $_GET['site'], isset($_GET['user_id']) ? $_GET['user_id'] : '');
    ?>
            | <input type="submit" value="Go" />
        </div><br />
        <?php 
    if (isset($_GET['user_id']) && $_GET['user_id'] != '') {
        // Retrieve the user's account
        $user = API::Site($_GET['site'])->Users($_GET['user_id']);
        $user_data = $user->Exec()->Fetch();
        if ($user_data === FALSE) {
            echo '<pre>Error: the supplied user_id parameter is invalid.</pre>';
        } else {
            ?>
                <hr /><br />
                <div class='user-profile'>
                  <div class='gravatar'>