PageRenderTime 275ms CodeModel.GetById 74ms app.highlight 91ms RepoModel.GetById 101ms app.codeStats 0ms

/WebCalendar-1.2.5/includes/init.php.orig

#
Unknown | 491 lines | 459 code | 32 blank | 0 comment | 0 complexity | f28cfc04d5ad27b3f379be1309a57e95 MD5 | raw file
  1<?php
  2/* Does various initialization tasks and includes all needed files.
  3 *
  4 * This page is included by most WebCalendar pages as the only include file.
  5 * This greatly simplifies the other PHP pages since they don't need to worry
  6 * about what files it includes.
  7 *
  8 * <b>Comments:</b>
  9 * The following scripts do not use this file:
 10 *   - login.php
 11 *   - week_ssi.php
 12 *   - upcoming.php
 13 *   - tools/send_reminders.php
 14 *
 15 * How to use:
 16 *   1. call include_once 'includes/init.php'; at the top of your script.
 17 *   2. call any other functions or includes not in this file that you need
 18 *   3. call the print_header function with proper arguments
 19 *
 20 * What gets called:
 21 *   - include_once 'includes/translate.php';
 22 *   - require_once 'includes/classes/WebCalendar.class';
 23 *   - require_once 'includes/classes/Event.class';
 24 *   - require_once 'includes/classes/RptEvent.class';
 25 *   - include_once 'includes/assert.php';
 26 *   - include_once 'includes/config.php';
 27 *   - include_once 'includes/dbi4php.php';
 28 *   - include_once 'includes/formvars.php';
 29 *   - include_once 'includes/functions.php';
 30 *   - include_once "includes/$user_inc";
 31 *   - include_once 'includes/validate.php';
 32 *   - include_once 'includes/site_extras.php';
 33 *   - include_once 'includes/access.php';
 34 *
 35 * Also, for month.php, day.php, week.php, week_details.php:
 36 *   - {@link send_no_cache_header ()};
 37 *
 38 * @author Craig Knudsen <cknudsen@cknudsen.com>
 39 * @copyright Craig Knudsen, <cknudsen@cknudsen.com>, http://www.k5n.us/cknudsen
 40 * @license http://www.gnu.org/licenses/gpl.html GNU GPL
 41 * @version $Id: init.php,v 1.130.2.15 2011/08/09 03:27:56 cknudsen Exp $
 42 * @package WebCalendar
 43 */
 44if ( empty ( $_SERVER['PHP_SELF'] ) ||
 45    ( ! empty ( $_SERVER['PHP_SELF'] ) &&
 46      preg_match ( "/\/includes\//", $_SERVER['PHP_SELF'] ) ) )
 47  die ( 'You cannot access this file directly!' );
 48
 49include_once 'includes/translate.php';
 50require_once 'includes/classes/WebCalendar.class';
 51require_once 'includes/classes/Event.class';
 52require_once 'includes/classes/RptEvent.class';
 53
 54$WebCalendar = new WebCalendar ( __FILE__ );
 55
 56include_once 'includes/assert.php';
 57include_once 'includes/config.php';
 58include_once 'includes/dbi4php.php';
 59include_once 'includes/formvars.php';
 60include_once 'includes/functions.php';
 61
 62$WebCalendar->initializeFirstPhase ();
 63
 64include_once 'includes/' . $user_inc;
 65include_once 'includes/validate.php';
 66include_once 'includes/site_extras.php';
 67include_once 'includes/access.php';
 68include_once 'includes/gradient.php';
 69
 70$WebCalendar->initializeSecondPhase ();
 71
 72/* Prints the HTML header and opening HTML body tag.
 73 *
 74 * @param array  $includes     Array of additional files to include referenced
 75 *                             from the includes directory
 76 * @param string $HeadX        Data to be printed inside the head tag (meta,
 77 *                             script, etc)
 78 * @param string $BodyX        Data to be printed inside the Body tag (onload
 79 *                             for example)
 80 * @param bool   $disbleCustom Do not include custom header? (useful for small
 81 *                             popup windows, such as color selection)
 82 * @param bool   $disableStyle Do not include the standard css?
 83 * @param bool   $disableRSS   Do not include the RSS link
 84 * @param bool   $disableAJAX  Do not include the prototype.js link
 85 */
 86function print_header ( $includes = '', $HeadX = '', $BodyX = '',
 87  $disableCustom = false, $disableStyle = false, $disableRSS = false,
 88  $disableAJAX = false, $disableUTIL = false ) {
 89  global $BGCOLOR, $browser, $charset, $CUSTOM_HEADER, $CUSTOM_SCRIPT,
 90  $DISABLE_POPUPS, $DISPLAY_TASKS, $DISPLAY_WEEKENDS, $FONTS, $friendly,
 91  $LANGUAGE, $login, $MENU_ENABLED, $MENU_THEME, $OTHERMONTHBG,
 92  $POPUP_FG, $REQUEST_URI, $self, $TABLECELLFG, $TEXTCOLOR,
 93  $THBG, $THFG, $TODAYCELLBG, $WEEKENDBG, $SCRIPT, $PUBLIC_ACCESS_FULLNAME,
 94  $PUBLIC_ACCESS, $is_admin;
 95
 96  $lang = $ret = '';
 97  // Remember this view if the file is a view_x.php script.
 98  if ( ! strstr ( $REQUEST_URI, 'view_entry' ) )
 99    remember_this_view ( true );
100
101  // Check the CSS version for cache clearing if needed.
102  if ( ! $disableStyle ) {
103    if ( isset ( $_COOKIE['webcalendar_csscache'] ) )
104      $webcalendar_csscache = $_COOKIE['webcalendar_csscache'];
105    else {
106      $webcalendar_csscache = 1;
107      SetCookie ( 'webcalendar_csscache', $webcalendar_csscache );
108    }
109  }
110  // Menu control.
111  if ( ! empty ( $friendly ) || $disableCustom )
112    $MENU_ENABLED = 'N';
113
114  $appStr = generate_application_name ( true );
115
116  $ret .= send_doctype ( $appStr );
117  
118  $ret .= ( ! $disableAJAX ? '
119    <script type="text/javascript" src="includes/js/prototype.js"></script>'
120    : '' );
121  // Includes needed for the top menu.
122  if ( $MENU_ENABLED == 'Y' ) {
123    $MENU_THEME = ( ! empty ( $MENU_THEME ) && $MENU_THEME != 'none'
124      ? $MENU_THEME : 'default' );
125    $menu_theme =  ( $SCRIPT == 'admin.php' && ! empty ( $GLOBALS['sys_MENU_THEME'] ) 
126      ? $GLOBALS['sys_MENU_THEME'] :
127      $MENU_THEME );
128    $ret .= '
129    <script type="text/javascript" src="/JSCookMenu/JSCookMenu.js"></script>
130    <link rel="stylesheet" type="text/css" href="includes/menu/themes/'
131     . $menu_theme . '/theme.css" />
132    <script type="text/javascript" src="includes/menu/themes/' . $menu_theme
133     . '/theme.js"></script>';
134  }
135
136  $ret .= ( ! $disableUTIL ? '
137    <script type="text/javascript" src="includes/js/util.js"></script>' : '' );
138  // Any other includes?
139  if ( is_array ( $includes ) ) {
140    foreach ( $includes as $inc ) {
141      if ( substr ( $inc, 0, 13 ) == 'js/popups.php' && !
142          empty ( $DISABLE_POPUPS ) && $DISABLE_POPUPS == 'Y' ) {
143        // Don't load popups.php javascript if DISABLE_POPUPS.
144      } else
145        $ret .= '
146    <script type="text/javascript" src="js_cacher.php?inc='
147         . $inc . '"></script>';
148    }
149  }
150  // Do we need anything else inside the header tag?
151  if ( $HeadX )
152    $ret .= '
153    ' . $HeadX;
154  if ( $MENU_ENABLED == 'Y' ) {
155    include_once 'includes/menu/index.php';
156  }
157  // Add RSS feed for unapproved events if approvals are required
158  if ( $GLOBALS['REQUIRE_APPROVALS'] == 'Y' && $login != '__public__' && $is_admin ) {
159
160  // Prh .. fix theme change for auth_http which does not set webcal*login
161  //        variables.
162  // 
163  //        Pass the logged in user id as login=<whatever> on the URL
164  //        Add css_cache=<cookie setting> to change the URL signature
165  //        to force a fetch from the server rather than from the 
166  //        browser cache when the style changes. 
167    // Note: we could do all the queries to add the RSS feed for every user
168    // the current user has permissions to approve for, but I'm thinking
169    // that's too many db requests to repeat on every page.
170    $ret .= '<link rel="alternate" type="application/rss+xml" title="' . $appStr
171      . ' - Unapproved Events - ' . $login . '" href="rss_unapproved.php"/>';
172    if ( $is_admin && $PUBLIC_ACCESS == 'Y' )
173      $ret .= '<link rel="alternate" type="application/rss+xml" title="' .
174        $appStr . ' - Unapproved Events - ' .
175        translate ( $PUBLIC_ACCESS_FULLNAME ) .
176        '" href="rss_unapproved.php?user=public"/>';
177  }
178  if ( $is_admin ) {
179    $ret .= '<link rel="alternate" type="application/rss+xml" title="' . $appStr
180      . ' - ' . translate('Activity Log') . '" href="rss_activity_log.php"/>';
181  }
182  // If loading admin.php, we will not use an exrternal file because we need to
183  // override the global colors and this is impossible if loading external file.
184  // We will still increment the webcalendar_csscache cookie though.
185  echo $ret . ( $disableStyle ? '' : '
186    <link rel="stylesheet" type="text/css" href="css_cacher.php?login='
187     . ( empty ( $_SESSION['webcal_tmp_login'] )
188      ? $login : $_SESSION['webcal_tmp_login'] )
189     . '&amp;css_cache=' . $webcalendar_csscache
190     . '" />' )
191  // Add custom script/stylesheet if enabled.
192  . ( $CUSTOM_SCRIPT == 'Y' && ! $disableCustom
193    ? load_template ( $login, 'S' ) : '' )
194  // Include includes/print_styles.css as a media="print" stylesheet. When the
195  // user clicks on the "Printer Friendly" link, $friendly will be non-empty,
196  // including this as a normal stylesheet so they can see how it will look
197  // when printed. This maintains backwards-compatibility for browsers that
198  // don't support media="print" stylesheets
199  . ( empty ( $friendly ) ? '' : '
200    <link rel="stylesheet" type="text/css"'
201     . ( empty ( $friendly ) ? ' media="print"' : '' )
202     . ' href="includes/print_styles.css" />' )
203  // Add RSS feed if publishing is enabled.
204  . ( ! empty ( $GLOBALS['RSS_ENABLED'] ) && $GLOBALS['RSS_ENABLED'] == 'Y' &&
205    $login == '__public__' || ( ! empty ( $GLOBALS['USER_RSS_ENABLED'] ) &&
206    $GLOBALS['USER_RSS_ENABLED'] == 'Y' ) && ! $disableRSS ? '
207    <link rel="alternate" type="application/rss+xml" title="' . $appStr
208     . ' [RSS 2.0]" href="rss.php'
209     /* TODO: single-user mode, etc. */
210     . ( $login != '__public__' ? '?user=' . $login : '' ) . '" />' : '' ) . '
211    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />'
212   . ( $MENU_ENABLED == 'Y' ? $menuScript : '' ) . '
213  </head>
214  <body'
215  // Determine the page direction (left-to-right or right-to-left).
216  . ( translate ( 'direction' ) == 'rtl' ? ' dir="rtl"' : '' )
217  /* Add <body> id. */ . ' id="' . preg_replace ( '/(_|.php)/', '',
218    substr ( $self, strrpos ( $self, '/' ) + 1 ) ) . '"'
219  // Add any extra parts to the <body> tag.
220  . ( empty ( $BodyX ) ? '' : " $BodyX" ) . '>' . "\n"
221  // If menu is enabled, place menu above custom header if desired.
222  . ( $MENU_ENABLED == 'Y' && $menuConfig['Above Custom Header']
223    ? $menuHtml : '' )
224  // Add custom header if enabled.
225  . ( $CUSTOM_HEADER == 'Y' && ! $disableCustom
226    ? load_template ( $login, 'H' ) : '' )
227  // Add the top menu if enabled.
228  . ( $MENU_ENABLED == 'Y' && ! $menuConfig['Above Custom Header']
229    ? $menuHtml : '' );
230  // TODO convert this to return value.
231}
232
233/* Prints the common trailer.
234 *
235 * @param bool $include_nav_links Should the standard navigation links be
236 *                                included in the trailer?
237 * @param bool $closeDb           Close the database connection when finished?
238 * @param bool $disableCustom     Disable the custom trailer the administrator
239 *                                has setup? (This is useful for small popup
240 *                                windows and pages being used in an iframe.)
241 */
242function print_trailer ( $include_nav_links = true, $closeDb = true,
243  $disableCustom = false ) {
244  global $ALLOW_VIEW_OTHER, $c, $cat_id, $CATEGORIES_ENABLED, $CUSTOM_TRAILER,
245  $DATE_FORMAT_MD, $DATE_FORMAT_MY, $DEMO_MODE, $DISPLAY_TASKS, $friendly,
246  $DISPLAY_TASKS_IN_GRID, $fullname, $GROUPS_ENABLED, $has_boss, $is_admin,
247  $is_nonuser, $is_nonuser_admin, $LAYER_STATUS, $login, $login_return_path,
248  $MENU_DATE_TOP, $MENU_ENABLED, $NONUSER_ENABLED, $PUBLIC_ACCESS,
249  $PUBLIC_ACCESS_CAN_ADD, $PUBLIC_ACCESS_FULLNAME, $PUBLIC_ACCESS_OTHERS,
250  $readonly, $REPORTS_ENABLED, $REQUIRE_APPROVALS, $single_user, $STARTVIEW,
251  $thisday, $thismonth, $thisyear, $use_http_auth, $user, $views, $WEEK_START;
252
253  $ret = '';
254
255  if ( $include_nav_links && ! $friendly ) {
256    if ( $MENU_ENABLED == 'N' || $MENU_DATE_TOP == 'N' )
257      $ret .= '<div id="dateselector">' . print_menu_dates () . '</div>';
258
259    if ( $MENU_ENABLED == 'N' )
260      include_once 'includes/trailer.php';
261  }
262
263  $ret .= ( empty ( $tret ) ? '' : $tret ) // Data from trailer.
264  // Add custom trailer if enabled.
265  . ( $CUSTOM_TRAILER == 'Y' && ! $disableCustom && isset ( $c )
266    ? load_template ( $login, 'T' ) : '' );
267
268  if ( $closeDb ) {
269    if ( isset ( $c ) )
270      dbi_close ( $c );
271
272    unset ( $c );
273  }
274
275  // Only include version info if user is admin.  No need to publicize
276  // version to would-be hackers.
277  return $ret .
278    ( $is_admin ?
279    "<!-- " . $GLOBALS['PROGRAM_NAME'] . "     "
280    . $GLOBALS['PROGRAM_URL'] . " -->\n" : '' )
281  // Adds an easy link to validate the pages.
282  . ( $DEMO_MODE == 'Y' ? '
283    <p><a href="http://validator.w3.org/check?uri=referer">'
284     . '<img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" '
285     . 'class="valid" /></a></p>' : '' )/* Close HTML page properly. */ . '
286  </body>
287</html>
288';
289}
290
291function print_menu_dates ( $menu = false ) {
292  global $cat_id, $CATEGORIES_ENABLED, $custom_view, $DATE_FORMAT_MD,
293  $DATE_FORMAT_MY, $DISPLAY_WEEKENDS, $id, $login, $SCRIPT, $thisday,
294  $thismonth, $thisyear, $user, $WEEK_START;
295
296  $goStr = translate ( 'Go' );
297  $ret = $urlArgs = $include_id = '';
298  // TODO add this to admin and pref.
299  // Change this value to 'Y' to enable staying in custom views.
300  $STAY_IN_VIEW = 'N';
301  $selected = ' selected="selected"';
302  if ( $STAY_IN_VIEW == 'Y' && ! empty ( $custom_view ) ) {
303    $include_id = true;
304    $monthUrl = $SCRIPT;
305  } else
306  if ( access_can_view_page ( 'month.php' ) )
307    $monthUrl = 'month.php';
308  else {
309    $monthUrl = $GLOBALS['STARTVIEW'];
310    if ( preg_match ( '/[?&](\S+)=(\S+)/', $monthUrl, $match ) ) {
311      $monthUrl = $match[0];
312      $urlArgs = '
313              <input type="hidden" name="'
314       . $match[1] . '" value="' . $match[2] . '" />';
315    }
316  }
317  if ( access_can_access_function ( ACCESS_MONTH ) ) {
318    $ret .= '
319            <form action="' . $monthUrl
320     . '" method="get" name="SelectMonth" id="month'
321     . ( $menu ? 'menu' : 'form' ) . '"> ' . $urlArgs
322     . ( ! empty ( $user ) && $user != $login ? '
323              <input type="hidden" name="user" value="' . $user . '" />' : '' )
324     . ( ! empty ( $id ) && $include_id ? '
325              <input type="hidden" name="id" value="' . $id . '" />' : '' )
326     . ( ! empty ( $cat_id ) && $CATEGORIES_ENABLED == 'Y' &&
327      ( ! $user || $user == $login ) ? '
328              <input type="hidden" name="cat_id" value="'
329       . $cat_id . '" />' : '' ) . '
330              <label for="monthselect"><a '
331     . 'href="javascript:document.SelectMonth.submit()">'
332     . translate ( 'Month' ) . '</a>:&nbsp;</label>
333              <select name="date" id="monthselect" '
334     . 'onchange="document.SelectMonth.submit()">';
335  
336    if ( ! empty ( $thisyear ) && ! empty ( $thismonth ) ) {
337      $m = $thismonth;
338      $y = $thisyear;
339    } else {
340      $m = date ( 'm' );
341      $y = date ( 'Y' );
342    }
343    $d_time = mktime ( 0, 0, 0, $m, 1, $y );
344    $thisdate = date ( 'Ymd', $d_time );
345    // $y--;
346    $m -= 7;
347    for ( $i = 0; $i < 25; $i++ ) {
348      $m++;
349      if ( $m > 12 ) {
350        $m = 1;
351        $y++;
352      }
353      if ( $y >= 1970 && $y < 2038 ) {
354        $d = mktime ( 0, 0, 0, $m, 1, $y );
355        $dateYmd = date ( 'Ymd', $d );
356        $ret .= '
357                  <option value="' . $dateYmd . '"'
358         . ( $dateYmd == $thisdate ? $selected : '' ) . '>'
359         . date_to_str ( $dateYmd, $DATE_FORMAT_MY, false, true, 0 ) . '</option>';
360      }
361    }
362  }
363  if ( access_can_access_function ( ACCESS_WEEK ) ) {
364    $ret .= '
365              </select>' . ( $menu ? '' : '
366              <input type="submit" value="' . $goStr . '" />' ) . '
367            </form>' . ( $menu ? '
368          </td>
369          <td class="ThemeMenubackgr ThemeMenu">' : '' );
370  
371    if ( $STAY_IN_VIEW == 'Y' && ! empty ( $custom_view ) )
372      $weekUrl = $SCRIPT;
373    else
374    if ( access_can_view_page ( 'week.php' ) ) {
375      $urlArgs = '';
376      $weekUrl = 'week.php';
377    } else {
378      $weekUrl = $GLOBALS['STARTVIEW'];
379      if ( preg_match ( '/[?&](\S+)=(\S+)/', $weekUrl, $match ) ) {
380        $weekUrl = $match[0];
381        $urlArgs = '
382                <input type="hidden" name="'
383         . $match[1] . '" value="' . $match[2] . '" />';
384      }
385    }
386    $ret .= '
387            <form action="' . $weekUrl
388     . '" method="get" name="SelectWeek" id="week'
389     . ( $menu ? 'menu' : 'form' ) . '">' . $urlArgs
390     . ( ! empty ( $user ) && $user != $login ? '
391              <input type="hidden" name="user" value="' . $user . '" />' : '' )
392     . ( ! empty ( $id ) && $include_id ? '
393              <input type="hidden" name="id" value="' . $id . '" />' : '' )
394     . ( ! empty ( $cat_id ) && $CATEGORIES_ENABLED == 'Y' &&
395      ( ! $user || $user == $login ) ? '
396              <input type="hidden" name="cat_id" value="'
397       . $cat_id . '" />' : '' ) . '
398              <label for="weekselect"><a '
399     . 'href="javascript:document.SelectWeek.submit()">'
400     . translate ( 'Week' ) . '</a>:&nbsp;</label>
401              <select name="date" id="weekselect" '
402     . 'onchange="document.SelectWeek.submit()">';
403  
404    if ( ! empty ( $thisyear ) && ! empty ( $thismonth ) ) {
405      $m = $thismonth;
406      $y = $thisyear;
407    } else {
408      $m = date ( 'm' );
409      $y = date ( 'Y' );
410    }
411    $d = ( empty ( $thisday ) ? date ( 'd' ) : $thisday  );
412    $d_time = mktime ( 0, 0, 0, $m, $d, $y );
413    $thisweek = date ( 'W', $d_time );
414    $wkstart = get_weekday_before ( $y, $m, $d );
415    $lastDay = ( $DISPLAY_WEEKENDS == 'N' ? 4 : 6 );
416    for ( $i = -5; $i <= 9; $i++ ) {
417      $twkstart = $wkstart + ( 604800 * $i );
418      $twkend = $twkstart + ( 86400 * $lastDay );
419      $dateSYmd = date ( 'Ymd', $twkstart );
420      $dateEYmd = date ( 'Ymd', $twkend );
421      $dateW = date ( 'W',  $twkstart + 86400 );
422      if ( $twkstart > 0 && $twkend < 2146021200 )
423        $ret .= '
424                <option value="' . $dateSYmd . '"'
425         . ( $dateW == $thisweek ? $selected : '' ) . '>'
426         . ( ! empty ( $GLOBALS['PULLDOWN_WEEKNUMBER'] ) &&
427          ( $GLOBALS['PULLDOWN_WEEKNUMBER'] == 'Y' )
428          ? '( ' . $dateW . ' )&nbsp;&nbsp;' : '' ) . sprintf ( "%s - %s",
429          date_to_str ( $dateSYmd, $DATE_FORMAT_MD, false, true, 0 ),
430          date_to_str ( $dateEYmd, $DATE_FORMAT_MD, false, true, 0 ) )
431         . '</option>';
432    }
433  }
434  if ( access_can_access_function ( ACCESS_YEAR ) ) {
435    $ret .= '
436                </select>' . ( $menu ? '' : '
437              <input type="submit" value="' . $goStr . '" />' ) . '
438            </form>' . ( $menu ? '
439          </td>
440          <td class="ThemeMenubackgr ThemeMenu" align="right">' : '' );
441  
442    if ( $STAY_IN_VIEW == 'Y' && ! empty ( $custom_view ) )
443      $yearUrl = $SCRIPT;
444    else
445    if ( access_can_view_page ( 'year.php' ) ) {
446      $urlArgs = '';
447      $yearUrl = 'year.php';
448    } else {
449      $yearUrl = $GLOBALS['STARTVIEW'];
450      if ( preg_match ( '/[?&](\S+)=(\S+)/', $yearUrl, $match ) ) {
451        $yearUrl = $match[0];
452        $urlArgs = '
453              <input type="hidden" name="'
454         . $match[1] . '" value="' . $match[2] . '" />';
455      }
456    }
457    $ret .= '
458            <form action="' . $yearUrl . '" method="get" name="SelectYear" id="year'
459     . ( $menu ? 'menu' : 'form' ) . '">' . $urlArgs
460     . ( ! empty ( $user ) && $user != $login ? '
461              <input type="hidden" name="user" value="' . $user . '" />' : '' )
462     . ( ! empty ( $id ) && $include_id ? '
463              <input type="hidden" name="id" value="' . $id . '" />' : '' )
464     . ( ! empty ( $cat_id ) && $CATEGORIES_ENABLED == 'Y' &&
465      ( ! $user || $user == $login ) ? '
466              <input type="hidden" name="cat_id" value="'
467       . $cat_id . '" />' : '' ) . '
468              <label for="yearselect"><a '
469     . 'href="javascript:document.SelectYear.submit()">'
470     . translate ( 'Year' ) . '</a>:&nbsp;</label>
471              <select name="year" id="yearselect" '
472     . 'onchange="document.SelectYear.submit()">';
473  
474    $y = ( empty ( $thisyear ) ? date ( 'Y' ) : $thisyear );
475  
476    for ( $i = $y - 2; $i < $y + 6; $i++ ) {
477      if ( $i >= 1970 && $i < 2038 )
478        $ret .= '
479                <option value="' . $i . '"'
480         . ( $i == $y ? $selected : '' ) . ">$i" . '</option>';
481    }
482  
483    $ret .= '
484              </select>' . ( $menu ? '' : '
485              <input type="submit" value="' . $goStr . '" />' ) . '
486            </form>';
487  }
488return $ret;
489}
490
491?>