plugins/admin/UserRanks.php
author Dan
Sat, 07 Jun 2008 12:48:39 -0400
changeset 563 0103428e2179
parent 555 ac4c6a7f01d8
child 628 ab6f55abb17e
permissions -rw-r--r--
First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
555
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
     1
<?php
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
     2
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
     3
/*
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
     4
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
     5
 * Version 1.1.4 (Caoineag alpha 4)
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
     6
 * Copyright (C) 2006-2008 Dan Fuhry
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
     7
 *
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
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
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
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.
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    10
 *
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
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
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    12
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    13
 */
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    14
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    15
function page_Admin_UserRanks()
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    16
{
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    17
  global $db, $session, $paths, $template, $plugins; // Common objects
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    18
  global $lang;
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    19
  if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    20
  {
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    21
    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    22
    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    23
    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    24
    return;
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    25
  }
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    26
  
563
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    27
  // This should be a constant somewhere
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    28
  $protected_ranks = array(
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    29
      RANK_ID_MEMBER,
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    30
      RANK_ID_MOD,
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    31
      RANK_ID_ADMIN,
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    32
      RANK_ID_GUEST
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    33
    );
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    34
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    35
  if ( $paths->getParam(0) == 'action.json' )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    36
  {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    37
    // ajax call
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    38
    return true;
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    39
  }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    40
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    41
  // draw initial interface
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    42
  // yes, four paragraphs of introduction. Suck it up.
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    43
  echo '<h3>' . $lang->get('acpur_heading_main') . '</h3>';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    44
  echo '<p>' . $lang->get('acpur_intro_para1') . '</p>';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    45
  echo '<p>' . $lang->get('acpur_intro_para2') . '</p>';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    46
  echo '<p>' . $lang->get('acpur_intro_para3') . '</p>';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    47
  echo '<p>' . $lang->get('acpur_intro_para4') . '</p>';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    48
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    49
  // fetch ranks
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    50
  $q = $db->sql_query('SELECT rank_id, rank_title, rank_style FROM ' . table_prefix . "ranks ORDER BY rank_title ASC;");
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    51
  if ( !$q )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    52
    $db->_die();
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    53
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    54
  echo '<div class="rankadmin-left" id="admin_ranks_container_left">';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    55
  while ( $row = $db->fetchrow() )
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    56
  {
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    57
    // format rank according to what its users look like
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    58
    // rank titles can be stored as language strings, so have the language manager fetch this
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    59
    // normally it refetches (which takes time) if a string isn't found, but it won't try to fetch
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    60
    // a string that isn't in the category_stringid format
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    61
    $rank_title = $lang->get($row['rank_title']);
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    62
    // FIXME: make sure htmlspecialchars() is escaping quotes and backslashes
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    63
    echo '<a href="#rank_edit:' . $row['rank_id'] . '" onclick="ajaxInitRankEdit(' . $row['rank_id'] . '); return false;" class="rankadmin-editlink" style="' . htmlspecialchars($row['rank_style']) . '">' . htmlspecialchars($rank_title) . '</a> ';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    64
  }
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    65
  echo '</div>';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    66
  
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    67
  echo '<div class="rankadmin-right" id="admin_ranks_container_right">';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    68
  echo $lang->get('acpur_msg_select_rank');
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    69
  echo '</div>';
0103428e2179 First test of rank manager interface, not currently capable of doing anything interesting (fills form with placeholder data); strings are in an earlier commit
Dan
parents: 555
diff changeset
    70
  echo '<span class="menuclear"></span>';
555
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    71
}
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    72
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents:
diff changeset
    73
?>