[ Index ]
 

Code source de PHP NUKE 7.9

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/includes/ -> functions_selects.php (source)

   1  <?php
   2  /***************************************************************************
   3   *                            function_selects.php
   4   *                            -------------------
   5   *   begin                : Saturday, Feb 13, 2001
   6   *   copyright            : (C) 2001 The phpBB Group
   7   *   email                : support@phpbb.com
   8   *
   9   *   Id: functions_selects.php,v 1.3.2.4 2002/12/22 12:20:35 psotfx Exp
  10   *
  11   *
  12   ***************************************************************************/
  13  /***************************************************************************
  14  * phpbb2 forums port version 2.0.5 (c) 2003 - Nuke Cops (http://nukecops.com)
  15  *
  16  * Ported by Nuke Cops to phpbb2 standalone 2.0.5 Test
  17  * and debugging completed by the Elite Nukers and site members.
  18  *
  19  * You run this package at your sole risk. Nuke Cops and affiliates cannot
  20  * be held liable if anything goes wrong. You are advised to test this
  21  * package on a development system. Backup everything before implementing
  22  * in a production environment. If something goes wrong, you can always
  23  * backout and restore your backups.
  24  *
  25  * Installing and running this also means you agree to the terms of the AUP
  26  * found at Nuke Cops.
  27  *
  28  * This is version 2.0.5 of the phpbb2 forum port for PHP-Nuke. Work is based
  29  * on Tom Nitzschner's forum port version 2.0.6. Tom's 2.0.6 port was based
  30  * on the phpbb2 standalone version 2.0.3. Our version 2.0.5 from Nuke Cops is
  31  * now reflecting phpbb2 standalone 2.0.5 that fixes some bugs and the
  32  * invalid_session error message.
  33  ***************************************************************************/
  34  /***************************************************************************
  35   *   This file is part of the phpBB2 port to Nuke 6.0 (c) copyright 2002
  36   *   by Tom Nitzschner (tom@toms-home.com)
  37   *   http://bbtonuke.sourceforge.net (or http://www.toms-home.com)
  38   *
  39   *   As always, make a backup before messing with anything. All code
  40   *   release by me is considered sample code only. It may be fully
  41   *   functual, but you use it at your own risk, if you break it,
  42   *   you get to fix it too. No waranty is given or implied.
  43   *
  44   *   Please post all questions/request about this port on http://bbtonuke.sourceforge.net first,
  45   *   then on my site. All original header code and copyright messages will be maintained
  46   *   to give credit where credit is due. If you modify this, the only requirement is
  47   *   that you also maintain all original copyright messages. All my work is released
  48   *   under the GNU GENERAL PUBLIC LICENSE. Please see the README for more information.
  49   *
  50   ***************************************************************************/
  51  /***************************************************************************
  52   *
  53   *   This program is free software; you can redistribute it and/or modify
  54   *   it under the terms of the GNU General Public License as published by
  55   *   the Free Software Foundation; either version 2 of the License, or
  56   *   (at your option) any later version.
  57   *
  58   *
  59   ***************************************************************************/
  60  
  61  //
  62  // Pick a language, any language ...
  63  //
  64  
  65  if (!defined('IN_PHPBB')) {
  66      die();
  67  }
  68  
  69  function language_select($default, $select_name = "language", $dirname="modules/Forums/language")
  70  {
  71          global $phpEx;
  72  
  73          $dir = @opendir($dirname);
  74  
  75          $lang = array();
  76          while ( $file = @readdir($dir) )
  77          {
  78                  if ( ereg("^lang_", $file) && !is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) )
  79                  {
  80                          $filename = trim(str_replace("lang_", "", $file));
  81                          $displayname = preg_replace("/^(.*?)_(.*)$/", "\\1 [ \\2 ]", $filename);
  82                          $displayname = preg_replace("/\[(.*?)_(.*)\]/", "[ \\1 - \\2 ]", $displayname);
  83                          $lang[$displayname] = $filename;
  84                  }
  85          }
  86  
  87          @closedir($dir);
  88  
  89          @asort($lang);
  90          @reset($lang);
  91  
  92          $lang_select = '<select name="' . $select_name . '">';
  93          while ( list($displayname, $filename) = @each($lang) )
  94          {
  95                  $selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : '';
  96                  $lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
  97          }
  98          $lang_select .= '</select>';
  99  
 100          return $lang_select;
 101  }
 102  
 103  //
 104  // Pick a template/theme combo,
 105  //
 106  function style_select($default_style, $select_name = "style", $dirname = "templates")
 107  {
 108          global $db;
 109  
 110          $sql = "SELECT themes_id, style_name
 111                  FROM " . THEMES_TABLE . "
 112                  ORDER BY template_name, themes_id";
 113          if ( !($result = $db->sql_query($sql)) )
 114          {
 115                  message_die(GENERAL_ERROR, "Couldn't query themes table", "", __LINE__, __FILE__, $sql);
 116          }
 117  
 118          $style_select = '<select name="' . $select_name . '">';
 119          while ( $row = $db->sql_fetchrow($result) )
 120          {
 121                  $selected = ( $row['themes_id'] == $default_style ) ? ' selected="selected"' : '';
 122  
 123                  $style_select .= '<option value="' . $row['themes_id'] . '"' . $selected . '>' . $row['style_name'] . '</option>';
 124          }
 125          $style_select .= "</select>";
 126  
 127          return $style_select;
 128  }
 129  
 130  //
 131  // Pick a timezone
 132  //
 133  function tz_select($default, $select_name = 'timezone')
 134  {
 135          global $sys_timezone, $lang;
 136  
 137          if ( !isset($default) )
 138          {
 139                  $default == $sys_timezone;
 140          }
 141          $tz_select = '<select name="' . $select_name . '">';
 142  
 143          while( list($offset, $zone) = @each($lang['tz']) )
 144          {
 145                  $selected = ( $offset == $default ) ? ' selected="selected"' : '';
 146                  $tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>';
 147          }
 148          $tz_select .= '</select>';
 149  
 150          return $tz_select;
 151  }
 152  
 153  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7