Esempio n. 1
0
 /**
  * Verifies that a valid timezoneoffset has been specified
  *
  * @param	float	Event timezoneoffset
  *
  * @return	boolean	Returns true if the timezone is valid
  */
 function verify_utc(&$timezoneoffset)
 {
     require_once DIR . '/includes/functions_misc.php';
     if (fetch_timezone($timezoneoffset)) {
         return true;
     } else {
         $this->error('invalid_timezone_specified');
         return false;
     }
 }
Esempio n. 2
0
     ${$dname} = 'selected="selected"';
 }
 // daylight savings time
 $selectdst = array();
 if ($vbulletin->userinfo['dstauto']) {
     $selectdst[2] = 'selected="selected"';
 } else {
     if ($vbulletin->userinfo['dstonoff']) {
         $selectdst[1] = 'selected="selected"';
     } else {
         $selectdst[0] = 'selected="selected"';
     }
 }
 require_once DIR . '/includes/functions_misc.php';
 $timezoneoptions = '';
 foreach (fetch_timezone() as $optionvalue => $timezonephrase) {
     $optiontitle = $vbphrase["{$timezonephrase}"];
     $optionselected = iif($optionvalue == $vbulletin->userinfo['timezoneoffset'], 'selected="selected"', '');
     eval('$timezoneoptions .= "' . fetch_template('option') . '";');
 }
 eval('$timezoneoptions = "' . fetch_template('modifyoptions_timezone') . '";');
 // start of the week
 if ($vbulletin->userinfo['startofweek'] > 0) {
     $dname = 'day' . $vbulletin->userinfo['startofweek'] . 'selected';
     ${$dname} = 'selected="selected"';
 } else {
     $day1selected = 'selected="selected"';
 }
 // bb code editor options
 if (!is_array($vbulletin->options['editormodes_array'])) {
     $vbulletin->options['editormodes_array'] = unserialize($vbulletin->options['editormodes']);
Esempio n. 3
0
	public function render($current_user, $criteria, $template = '')
	{
		//ensure that the phrases used by events are in the phrase list.
	 	$phrase = new vB_Legacy_Phrase();
	 	$phrase->add_phrase_groups(array('calendar', 'holiday', 'timezone', 'posting', 'user'));

		global $show, $bgclass;

		//a bunch of crap set by fetch_event_date_time that we send to the template
		global $date1, $date2, $time1, $time2, $recurcriteria, $eventdate;

		//a bunch of crap set by fetch_event_date_time that I can't find any use of.
		//leaving it in for now in case I missed some use of globals.
		global $titlecolor, $allday;

		$eventinfo = $this->event->get_record();

		//event['dst'] means "don't adjust event time for dst"
		$offset = $current_user->getTimezoneOffset(!$eventinfo['dst']);
		$eventinfo['dateline_from_user'] = $eventinfo['dateline_from'] + $offset * 3600;
		$eventinfo['dateline_to_user'] = $eventinfo['dateline_to'] + $offset * 3600;

		$eventinfo = fetch_event_date_time($eventinfo);
		fetch_musername($eventinfo);

		if (!$eventinfo['holidayid'])
		{
			$bgclass = 'alt2';

			//Custom fields are a little weird.  By default we don't show a blank value, but
			//the conditional is in the template so its possible that the user by change that.
			//We don't show the text block unless we have at least one set field, but again
			//the user can change that.  I'm not sure why somebody would want to do these
			//things but its not worth altering the behavior.  It does mean that we can't
			//rely on either field_text being blank when there are no set fields
			$custom_fields = $this->event->get_custom_fields();
			$custom_field_text = $this->render_custom_fields($custom_fields);
			$show['customfields'] = $this->have_set_customfield($custom_fields);

			$show['holiday'] = false;
			$show['caneditevent'] = $this->event->can_edit($current_user);
			$show['subscribed'] = $this->event->is_subscribed($current_user);
			$show['subscribelink'] = ($eventinfo['subscribed'] AND $this->event->can_subscribe($current_user));
		}
		else
		{
			$custom_field_text = '';
			$show['holiday'] = true;
			$show['caneditevent'] = false;
			$show['subscribed'] = false;
			$show['subscribelink'] = false;
		}

		exec_switch_bg();
		if (!$eventinfo['singleday'] AND
			gmdate('w', $eventinfo['dateline_from_user']) !=
				gmdate('w', $eventinfo['dateline_from'] + ($eventinfo['utc'] * 3600))
		)
		{
			$show['adjustedday'] = true;
			$eventinfo['timezone'] = str_replace(' ', ' ', $vbphrase[fetch_timezone($eventinfo['utc'])]);
		}
		else
		{
			$show['adjustedday'] = false;
		}

		$show['ignoredst'] = ($eventinfo['dst'] AND !$eventinfo['singleday']) ? true : false;
		$show['postedby'] = !empty($eventinfo['userid']) ? true : false;
		$show['singleday'] = !empty($eventinfo['singleday']) ? true : false;
		if (($show['candeleteevent'] OR $show['canmoveevent'] OR $show['caneditevent']) AND !$show['holiday'])
		{
			$show['eventoptions'] = true;
		}

		$calendarinfo = $this->event->get_calendar()->get_record();

		($hook = vBulletinHook::fetch_hook('calendar_getday_event')) ? eval($hook) : false;

		//some globals registered for the template's sake
		global $gobutton, $spacer_open, $spacer_close;
		$templater = vB_Template::create('calendar_showeventsbit');
		$templater->register('calendarinfo', $calendarinfo);
		$templater->register('customfields', $custom_field_text);
		$templater->register('date1', $date1);
		$templater->register('date2', $date2);
		$templater->register('time1', $time1);
		$templater->register('time2', $time2);
		$templater->register('eventdate', $eventdate);
		$templater->register('eventinfo', $eventinfo);
		$templater->register('gobutton', $gobutton);
		$templater->register('recurcriteria', $recurcriteria);
		$templater->register('spacer_close', $spacer_close);
		$templater->register('spacer_open', $spacer_open);

		return $templater->render();
	}