[ Index ]

PHP Cross Reference of Nuke-Evolution v2.0.5

title

Body

[close]

/includes/ -> functions_selects.php (source)

   1  <?php
   2  /*=======================================================================
   3   Nuke-Evolution Basic: Enhanced PHP-Nuke Web Portal System
   4   =======================================================================*/
   5  
   6  /***************************************************************************
   7   *                            function_selects.php
   8   *                            -------------------
   9   *   begin                : Saturday, Feb 13, 2001
  10   *   copyright            : (C) 2001 The phpBB Group
  11   *   email                : support@phpbb.com
  12   *
  13   *   Id: functions_selects.php,v 1.3.2.4 2002/12/22 12:20:35 psotfx Exp
  14   *
  15   ***************************************************************************/
  16  
  17  /***************************************************************************
  18  * phpbb2 forums port version 2.0.5 (c) 2003 - Nuke Cops (http://nukecops.com)
  19  *
  20  * Ported by Nuke Cops to phpbb2 standalone 2.0.5 Test
  21  * and debugging completed by the Elite Nukers and site members.
  22  *
  23  * You run this package at your sole risk. Nuke Cops and affiliates cannot
  24  * be held liable if anything goes wrong. You are advised to test this
  25  * package on a development system. Backup everything before implementing
  26  * in a production environment. If something goes wrong, you can always
  27  * backout and restore your backups.
  28  *
  29  * Installing and running this also means you agree to the terms of the AUP
  30  * found at Nuke Cops.
  31  *
  32  * This is version 2.0.5 of the phpbb2 forum port for PHP-Nuke. Work is based
  33  * on Tom Nitzschner's forum port version 2.0.6. Tom's 2.0.6 port was based
  34  * on the phpbb2 standalone version 2.0.3. Our version 2.0.5 from Nuke Cops is
  35  * now reflecting phpbb2 standalone 2.0.5 that fixes some bugs and the
  36  * invalid_session error message.
  37  ***************************************************************************/
  38  
  39  /***************************************************************************
  40   *   This file is part of the phpBB2 port to Nuke 6.0 (c) copyright 2002
  41   *   by Tom Nitzschner (tom@toms-home.com)
  42   *   http://bbtonuke.sourceforge.net (or http://www.toms-home.com)
  43   *
  44   *   As always, make a backup before messing with anything. All code
  45   *   release by me is considered sample code only. It may be fully
  46   *   functual, but you use it at your own risk, if you break it,
  47   *   you get to fix it too. No waranty is given or implied.
  48   *
  49   *   Please post all questions/request about this port on http://bbtonuke.sourceforge.net first,
  50   *   then on my site. All original header code and copyright messages will be maintained
  51   *   to give credit where credit is due. If you modify this, the only requirement is
  52   *   that you also maintain all original copyright messages. All my work is released
  53   *   under the GNU GENERAL PUBLIC LICENSE. Please see the README for more information.
  54   *
  55   ***************************************************************************/
  56  
  57  /***************************************************************************
  58   *
  59   *   This program is free software; you can redistribute it and/or modify
  60   *   it under the terms of the GNU General Public License as published by
  61   *   the Free Software Foundation; either version 2 of the License, or
  62   *   (at your option) any later version.
  63   *
  64   ***************************************************************************/
  65  
  66  /*****[CHANGES]**********************************************************
  67  -=[Base]=-
  68        Theme Management                         v1.0.2       12/14/2005
  69  -=[Mod]=-
  70        Super Quick Reply                        v1.3.0       06/14/2005
  71        Advanced Time Management                 v2.2.0       07/26/2005
  72        At a Glance Options                      v1.0.0       08/17/2005
  73        Group Colors and Ranks                   v1.0.0       08/24/2005
  74        Log Actions Mod - Topic View             v2.0.0       09/18/2005
  75   ************************************************************************/
  76  
  77  if (!defined('IN_PHPBB'))
  78  {
  79      die('Hacking attempt');
  80  }
  81  
  82  //
  83  // Pick a language, any language ...
  84  //
  85  function language_select($default, $select_name = "language", $dirname="modules/Forums/language")
  86  {
  87          global $phpEx;
  88  
  89          if ($dirname == "modules/Forums/language") {
  90              $dirname = NUKE_MODULES_DIR.'Forums/language';
  91          }
  92  
  93          $dir = @opendir($dirname);
  94  
  95          $lang = array();
  96          while ( $file = @readdir($dir) )
  97          {
  98                  if ( ereg("^lang_", $file) && !is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) )
  99                  {
 100                          $filename = trim(str_replace("lang_", "", $file));
 101                          $displayname = preg_replace("/^(.*?)_(.*)$/", "\\1 [ \\2 ]", $filename);
 102                          $displayname = preg_replace("/\[(.*?)_(.*)\]/", "[ \\1 - \\2 ]", $displayname);
 103                          $lang[$displayname] = $filename;
 104                  }
 105          }
 106  
 107          @closedir($dir);
 108  
 109          @asort($lang);
 110          @reset($lang);
 111  
 112          $lang_select = '<select name="' . $select_name . '">';
 113          while ( list($displayname, $filename) = @each($lang) )
 114          {
 115                  $selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : '';
 116                  $lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
 117          }
 118          $lang_select .= '</select>';
 119  
 120          return $lang_select;
 121  }
 122  
 123  //
 124  // Pick a template/theme combo,
 125  //
 126  /*****[BEGIN]******************************************
 127   [ Base:    Theme Management                   v1.0.2 ]
 128   ******************************************************/
 129  function style_select($name="default_Theme")
 130  {
 131      $themes = get_themes('active');
 132      $select = "<select name=\"" . $name . "\" $extra>";
 133      foreach($themes as $theme) {
 134          $name = (!empty($theme['custom_name'])) ? $theme['custom_name'] : $theme['theme_name'];
 135          $selected = (is_default($theme['theme_name'])) ? "selected" : "";
 136          $select .= "<option value=\"" . $theme['theme_name'] . "\" $selected>" . $name . "</option>";
 137      }
 138      $select .= "</select>";
 139  
 140      return $select;
 141  }
 142  /*****[END]********************************************
 143   [ Base:    Theme Management                   v1.0.2 ]
 144   ******************************************************/
 145  
 146  //
 147  // Pick a timezone
 148  //
 149  function tz_select($default, $select_name = 'timezone')
 150  {
 151          global $sys_timezone, $lang;
 152  
 153          if ( !isset($default) )
 154          {
 155                  $default == $sys_timezone;
 156          }
 157          $tz_select = '<select name="' . $select_name . '">';
 158  
 159          while( list($offset, $zone) = @each($lang['tz']) )
 160          {
 161                  $selected = ( $offset == $default ) ? ' selected="selected"' : '';
 162  /*****[BEGIN]******************************************
 163   [ Mod:    Advanced Time Management            v2.2.0 ]
 164   ******************************************************/
 165                  $tz_select .= '<option value="' . $offset . '"' . $selected . '>' . str_replace('GMT', 'UTC', $zone) . '</option>';
 166  /*****[END]********************************************
 167   [ Mod:    Advanced Time Management            v2.2.0 ]
 168   ******************************************************/
 169          }
 170          $tz_select .= '</select>';
 171  
 172          return $tz_select;
 173  }
 174  
 175  /*****[BEGIN]******************************************
 176   [ Mod:     Super Quick Reply                  v1.3.0 ]
 177   ******************************************************/
 178  function quick_reply_select($default, $select_name = "show_quickreply")
 179  {
 180      global $lang;
 181  
 182      $sqr_select = '<select name="' . $select_name . '">';
 183  
 184      while( list($value, $mode) = @each($lang['sqr']) )
 185      {
 186          $selected = ( $value == $default ) ? ' selected="selected"' : '';
 187          $sqr_select .= '<option value="' . $value . '"' . $selected . '>' . $mode . '</option>';
 188      }
 189  
 190      $sqr_select .= '</select>';
 191  
 192      return $sqr_select;
 193  
 194  }
 195  /*****[END]********************************************
 196   [ Mod:     Super Quick Reply                  v1.3.0 ]
 197   ******************************************************/
 198  
 199  /*****[BEGIN]******************************************
 200   [ Mod:     At a Glance Options                v1.0.0 ]
 201   ******************************************************/
 202  function glance_option_select($default, $select_name = "glance_show")
 203  {
 204  global $lang;
 205  
 206      $g_select = '<select name="' . $select_name . '">';
 207  
 208      while( list($value, $text) = @each($lang['show_glance_option']) )
 209      {
 210          $selected = ( $value == $default ) ? ' selected="selected"' : '';
 211          $g_select .= '<option value="' . $value . '"' . $selected . '>' . $text . '</option>';
 212      }
 213  
 214      $g_select .= '</select>';
 215  
 216      return $g_select;
 217  }
 218  /*****[END]********************************************
 219   [ Mod:     At a Glance Options                v1.0.0 ]
 220   ******************************************************/
 221  
 222  /*****[BEGIN]******************************************
 223   [ Mod:     Group Colors and Ranks             v1.0.0 ]
 224   ******************************************************/
 225  function auc_colors_select($default, $select_name = "color_groups", $value = "group_id")
 226  {
 227  global $db, $prefix;
 228  
 229      $g_select = '<select name="' . $select_name . '">';
 230      $sql = "SELECT * FROM " . $prefix . "_bbadvanced_username_color  ORDER BY group_name ASC";
 231      if (!$result = $db->sql_query($sql)) {
 232          die(mysql_error());
 233      }
 234      $selected = (!$defualt) ? "selected=\"selected\"" : "";
 235      $g_select .= '<option value="0" '.$selected.'>None</option>';
 236      while( $row = $db->sql_fetchrow($result) )
 237      {
 238          $selected = ( $row['group_id'] == $default ) ? ' selected="selected"' : '';
 239          $g_select .= '<option value="' . $row[$value] . '"' . $selected . '>' . $row['group_name'] . '</option>';
 240      }
 241      $db->sql_freeresult($result);
 242  
 243      $g_select .= '</select>';
 244  
 245      return $g_select;
 246  }
 247  
 248  function ranks_select($default, $select_name = "ranks", $value = "rank_id")
 249  {
 250      global $db, $prefix;
 251  
 252      $g_select = '<select name="' . $select_name . '">';
 253      $sql = "SELECT * FROM " . RANKS_TABLE . " WHERE rank_special = 1 ORDER BY rank_title ASC";
 254      if (!$result = $db->sql_query($sql)) {
 255          die(mysql_error());
 256      }
 257      $selected = (!$defualt) ? "selected=\"selected\"" : "";
 258      $g_select .= '<option value="0" '.$selected.'>None</option>';
 259      while( $row = $db->sql_fetchrow($result) )
 260      {
 261          $selected = ( $row['rank_id'] == $default ) ? ' selected="selected"' : '';
 262          $g_select .= '<option value="' . $row[$value] . '"' . $selected . '>' . $row['rank_title'] . '</option>';
 263      }
 264      $db->sql_freeresult($result);
 265  
 266      $g_select .= '</select>';
 267  
 268      return $g_select;
 269  }
 270  /*****[BEGIN]******************************************
 271   [ Mod:     Group Colors and Ranks             v1.0.0 ]
 272   ******************************************************/
 273  
 274  /*****[BEGIN]******************************************
 275   [ Mod:     Log Actions Mod - Topic View       v2.0.0 ]
 276   ******************************************************/
 277  function allow_view_select($default)
 278  {
 279  global $lang;
 280  
 281      $g_select = '<select name="logs_view_level">';
 282  
 283      while( list($value, $text) = @each($lang['logs_view_level']) )
 284      {
 285          $selected = ( $value == $default ) ? ' selected="selected"' : '';
 286          $g_select .= '<option value="' . $value . '"' . $selected . '>' . $text . '</option>';
 287      }
 288  
 289      $g_select .= '</select>';
 290  
 291      return $g_select;
 292  }
 293  /*****[END]********************************************
 294   [ Mod:     Log Actions Mod - Topic View       v2.0.0 ]
 295   ******************************************************/
 296  
 297  ?>


Generated: Wed Jun 6 11:38:01 2007 Cross-referenced by PHPXref 0.7