decir/functions_viewtopic.php
author Dan
Wed, 24 Oct 2007 18:30:03 -0400
changeset 5 6eea55374f5b
parent 3 88b85b9b9272
permissions -rw-r--r--
Merging in some changes from Nighthawk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
     1
<?php
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
     2
/*
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
     3
 * Decir
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
     4
 * Version 0.1
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
     5
 * Copyright (C) 2007 Dan Fuhry
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
     6
 * functions_viewtopic.php - Postbit compiler
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
     7
 *
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
     8
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
     9
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    10
 *
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    11
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    12
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    13
 */
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    14
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    15
/**
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    16
 * Internally used in viewtopic; called by paginate()
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    17
 * @package Decir
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    18
 * @subpackage Presentation/UI
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    19
 * @access private
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    20
 */
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    21
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    22
class DecirPostbit
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    23
{
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    24
  var $post_template = '
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    25
    <!-- Start of post: {POST_ID} -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    26
    
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    27
    <a name="{POST_ID}" id="{POST_ID}"></a>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    28
    <div class="post tblholder">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    29
      <table border="0" cellspacing="1" cellpadding="4" style="width: 100%;">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    30
        <!-- BEGIN post_deleted -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    31
        <tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    32
          <td class="row3" valign="top" style="height: 100%;">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    33
            <i>This post was deleted by {LAST_EDITED_BY}.<br />
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    34
            <b>Reason:</b> {EDIT_REASON}</i>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    35
            <!-- BEGIN show_post -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    36
            <br />
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    37
            <br />
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    38
            <b>The deleted post is shown below:</b>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    39
            <!-- END show_post -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    40
          </td>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    41
          <td class="row1" style="width: 120px;" valign="top">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    42
            {USER_LINK}
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    43
          </td>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    44
        </tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    45
        <!-- END post_deleted -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    46
        <!-- BEGIN show_post -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    47
        <tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    48
          <th colspan="2" style="text-align: left;">Posted: {TIMESTAMP}</th>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    49
        </tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    50
        <tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    51
          <td class="row3" valign="top" style="height: 100%;">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    52
            <table border="0" width="100%" style="height: 100%; background-color: transparent;">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    53
              <tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    54
                <td valign="top" colspan="2">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    55
                  {POST_TEXT}
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    56
                </td>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    57
              </tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    58
              <!-- BEGINNOT post_deleted -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    59
              <tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    60
                <td valign="bottom" style="text-align: left; font-size: smaller;">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    61
                  <!-- BEGIN post_edited -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    62
                  <i>Last edited by {LAST_EDITED_BY}; edited <b>{EDIT_COUNT}</b> time{EDIT_COUNT_S} in total<br />
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    63
                  <b>Reason:</b> {EDIT_REASON}</i>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    64
                  <!-- END post_edited -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    65
                </td>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    66
                <td valign="bottom" style="text-align: right;">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    67
                  <small><a href="{EDIT_LINK}">edit</a> | <a href="{DELETE_LINK}">delete</a> | <a href="{QUOTE_LINK}">+ quote</a></small>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    68
                </td>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    69
              </tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    70
              <!-- BEGINELSE post_deleted -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    71
              <tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    72
                <td valign="bottom" style="text-align: left; font-size: smaller;">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    73
                </td>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    74
                <td valign="bottom" style="text-align: right;">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    75
                  <small><a href="{RESTORE_LINK}">restore post</a> | <a href="{DELETE_LINK}">physically delete</a></small>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    76
                </td>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    77
              </tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    78
              <!-- END post_deleted -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    79
            </table>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    80
          </td>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    81
          <td class="row1" style="width: 120px;" valign="top">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    82
            <div class="menu_nojs">
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    83
              {USER_LINK}
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    84
              <ul>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    85
                <li><a>View profile</a></li>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    86
                <li><a>Visit homepage</a></li>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    87
                <li><a href="{QUOTE_LINK}">Quote this post</a></li>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    88
                <li><a>Vote to ban this user</a></li>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    89
                <li><a>Send private message</a></li>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    90
                <li><a>View all messages posted by {USERNAME}</a></li>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    91
              </ul>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    92
            </div>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    93
            <span class="menuclear"></span>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    94
            {USER_TITLE}<br />
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    95
            <br />
3
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
    96
            <!-- BEGIN user_is_registered -->
2
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    97
            Joined: {REG_TIME}
3
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
    98
            <!-- END user_is_registered -->
2
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
    99
            <!-- BEGIN whos_online_support -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   100
              <br />
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   101
              <!-- BEGIN user_is_online -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   102
              <span style="color: #007900;"><b>Online</b></span>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   103
              <!-- BEGINELSE user_is_online -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   104
              <span style="color: #666666;">Offline</span>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   105
              <!-- END user_is_online -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   106
            <!-- END whos_online_support -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   107
          </td>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   108
        </tr>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   109
        <!-- END show_post -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   110
      </table>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   111
    </div>
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   112
    
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   113
    <!-- End of post: {POST_ID} -->
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   114
    ';
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   115
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   116
  var $parser;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   117
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   118
  /**
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   119
   * Constructor. Sets up parser object.
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   120
   */
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   121
  
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   122
  function __construct()
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   123
  {
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   124
    global $db, $session, $paths, $template, $plugins; // Common objects
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   125
    $this->parser = $template->makeParserText($this->post_template);
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   126
  }
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   127
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   128
  /**
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   129
   * Renders a post.
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   130
   * @todo document
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   131
   * @access private
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   132
   */
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   133
  
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   134
  function _render($_, $row)
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   135
  {
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   136
    global $db, $session, $paths, $template, $plugins; // Common objects
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   137
    global $whos_online;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   138
    
3
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
   139
    if ( $row['deleted'] == 1 && !$session->get_permissions('decir_see_deleted_post') )
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
   140
    {
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
   141
      return '';
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
   142
    }
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
   143
    
2
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   144
    $poster_name = ( $row['poster_id'] == 1 ) ? $row['poster_name'] : $row['username'];
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   145
    $datetime = date('F d, Y h:i a', $row['timestamp']);
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   146
    $post_text = render_bbcode($row['post_text'], $row['bbcode_uid']);
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   147
    $post_text = RenderMan::smilieyize($post_text);
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   148
    $regtime = date('F Y', $row['reg_time']);
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   149
    
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   150
    $user_color = '#0000AA';
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   151
    switch ( $row['user_level'] )
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   152
    {
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   153
      case USER_LEVEL_ADMIN: $user_color = '#AA0000'; break;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   154
      case USER_LEVEL_MOD:   $user_color = '#00AA00'; break;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   155
    }
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   156
    if ( $row['poster_id'] > 1 )
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   157
    {
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   158
      $user_link = "<a style='color: $user_color; background-color: transparent; display: inline; padding: 0;' href='".makeUrlNS('User', str_replace(' ', '_', $poster_name))."'><big>$poster_name</big></a>";
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   159
    }
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   160
    else
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   161
    {
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   162
      $user_link = '<big>'.$poster_name.'</big>';
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   163
    }
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   164
    $quote_link  = makeUrlNS('Special', 'Forum/New/Quote/' . $row['post_id'], false, true);
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   165
    $edit_link   = makeUrlNS('Special', 'Forum/Edit/' . $row['post_id'], false, true);
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   166
    $delete_link = makeUrlNS('Special', 'Forum/Delete/' . $row['post_id'], false, true);
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   167
    $restore_link = makeUrlNS('Special', 'Forum/Delete/' . $row['post_id'], 'act=restore', true);
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   168
    $user_title = 'Anonymous user';
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   169
    switch ( $row['user_level'] )
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   170
    {
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   171
      case USER_LEVEL_ADMIN: $user_title = 'Administrator'; break;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   172
      case USER_LEVEL_MOD:   $user_title = 'Moderator'; break;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   173
      case USER_LEVEL_MEMBER:$user_title = 'Member'; break;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   174
      case USER_LEVEL_GUEST: $user_title = 'Guest'; break;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   175
    }
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   176
    $leb_link = '';
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   177
    if ( $row['editor'] )
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   178
    {
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   179
      $userpage_url = makeUrlNS('User', sanitize_page_id($row['editor']), false, true);
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   180
      $row['editor'] = htmlspecialchars($row['editor']);
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   181
      $leb_link = "<a href=\"$userpage_url\">{$row['editor']}</a>";
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   182
    }
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   183
    $this->parser->assign_vars(Array(
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   184
        'POST_ID' => (string)$row['post_id'],
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   185
        'USERNAME' => $poster_name,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   186
        'USER_LINK' => $user_link,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   187
        'REG_TIME' => $regtime,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   188
        'TIMESTAMP' => $datetime,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   189
        'POST_TEXT' => $post_text,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   190
        'USER_TITLE' => $user_title,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   191
        'QUOTE_LINK' => $quote_link,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   192
        'EDIT_LINK' => $edit_link,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   193
        'DELETE_LINK' => $delete_link,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   194
        'RESTORE_LINK' => $restore_link,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   195
        'EDIT_COUNT' => $row['edit_count'],
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   196
        'EDIT_COUNT_S' => ( $row['edit_count'] == 1 ? '' : 's' ),
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   197
        'LAST_EDITED_BY' => $leb_link,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   198
        'EDIT_REASON' => htmlspecialchars($row['edit_reason'])
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   199
      ));
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   200
    // Decir can integrate with the Who's Online plugin
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   201
    $who_support = $plugins->loaded('WhosOnline') && $row['user_level'] >= USER_LEVEL_GUEST;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   202
    $user_online = false;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   203
    if ( $who_support && in_array($row['username'], $whos_online['users']) )
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   204
    {
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   205
      $user_online = true;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   206
    }
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   207
    elseif ( $row['poster_id'] < 2 )
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   208
    {
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   209
      $who_support = false;
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   210
    }
3
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
   211
    
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
   212
    // die('<pre>' . print_r($session, true) . '</pre>');
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
   213
    
2
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   214
    $this->parser->assign_bool(Array(
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   215
        'whos_online_support' => $who_support,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   216
        'user_is_online' => $user_online,
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   217
        'post_edited' => ( $row['edit_count'] > 0 ),
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   218
        'post_deleted' => ( $row['post_deleted'] == 1 ),
3
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
   219
        'show_post' => ( $session->get_permissions('decir_see_deleted_post_full') || $row['post_deleted'] != 1 ),
88b85b9b9272 What can I say? More progress. Mostly bugfixes and ACL stuff now. Which reminds me - don't use this release, there are quite a few access bugs in it right now.
Dan
parents: 2
diff changeset
   220
        'user_is_registered' => ( $row['poster_id'] > 1 )
2
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   221
      ));
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   222
    return $this->parser->run();
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   223
  }
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   224
}
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   225
253118325c65 Pagination on topics and a whole crapload of other stuff.
Dan
parents:
diff changeset
   226
?>