function OnPreRender()
 {
     /* @var $o_top_level Category */
     $review_item = $this->o_topic->GetReviewItem();
     $s_suggested_title = urlencode(StringFormatter::PlainText(trim($review_item->GetTitle())));
     $s_page = urlencode($_SERVER['REQUEST_URI']);
     $s_subscribe_link = '/play/subscribe.php?type=' . $review_item->GetType() . '&item=' . $review_item->GetId() . '&title=' . $s_suggested_title . '&page=' . $s_page;
     $s_subscribe_title = 'Get an email alert every time there are new comments on this page';
     $this->AddControl('<div class="forumSubscribe"><a href="' . $s_subscribe_link . '" title="' . $s_subscribe_title . '">Subscribe to comments</a></div>');
     if (!$this->authentication_manager->GetUser()->Permissions()->HasPermission(PermissionType::ForumAddMessage())) {
         $add = $this->o_topic->GetCount() ? 'Add your comments' : 'Be the first to add your comments!';
         $this->AddControl('<div class="forumPost"><a href="' . Html::Encode($this->authentication_manager->GetPermissionUrl()) . urlencode('#forumMessageForm') . '">' . $add . '</a></div>');
     }
 }
 /**
  * Creates a new EditSchoolControl
  *
  * @param SiteSettings $settings
  */
 public function __construct(SiteSettings $settings)
 {
     # set up element
     $this->SetDataObjectClass('School');
     parent::__construct($settings);
     $this->is_admin = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS);
 }
 function OnLoadPageData()
 {
     # get id of team
     $i_id = $this->team_manager->GetItemId($this->team);
     # no need to read team data if creating a new team
     # unlike some pages though, re-read after a save because not all info is posted back
     if ($i_id) {
         # get team
         $this->team_manager->ReadById(array($i_id));
         $this->team = $this->team_manager->GetFirst();
         # Check user has permission to edit this team
         if (!$this->team instanceof Team or !AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS, $this->team->GetLinkedDataUri())) {
             $this->GetAuthenticationManager()->GetPermission();
         }
     } else {
         # Check user has permission to create teams
         if (!AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS)) {
             $this->GetAuthenticationManager()->GetPermission();
         }
     }
     # get all clubs
     $this->club_manager->ReadAll();
     $this->edit->SetClubs($this->club_manager->GetItems());
     # get all grounds
     $this->ground_manager->ReadAll();
     $this->edit->SetGrounds($this->ground_manager->GetItems());
     # tidy up
     unset($this->team_manager);
     unset($this->club_manager);
     unset($this->ground_manager);
 }
 function OnPageLoad()
 {
     echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
     $user = AuthenticationManager::GetUser();
     $list = '';
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_CATEGORIES)) {
         $list .= '<li><a href="/yesnosorry/categorylist.php">Categories</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS)) {
         $list .= '<li><a href="/play/clubs">Clubs and schools</a></li>';
         $list .= '<li><a href="/yesnosorry/contact-audit.php">Contact details audit</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_GROUNDS)) {
         $list .= '<li><a href="/yesnosorry/groundlist.php">Grounds</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_USERS_AND_PERMISSIONS)) {
         $list .= '<li><a href="/yesnosorry/personlist.php">Users</a></li>' . '<li><a href="/yesnosorry/roles.php">Roles</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_URLS)) {
         $list .= '<li><a href="regenerate-short-urls.php">Regenerate short URL cache</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_SEARCH)) {
         $list .= '<li><a href="/search/reindex.php">Reindex search</a></li>';
     }
     if ($user->Permissions()->HasPermission(PermissionType::MANAGE_STATISTICS)) {
         $list .= '<li><form action="/play/statistics/recalculate-player-statistics.php" method="post"><div><input type="submit" value="Recalculate player statistics" /></div></form></li>';
     }
     if ($list) {
         echo '<ul>' . $list . '</ul>';
     }
 }
    function OnPageLoad()
    {
        if ($this->b_success) {
            ?>
<h1>Confirmation successful</h1>
<p>Thank you for confirming your email address. Your profile has been updated.</p>
<p>When you next sign in to <?php 
            echo Html::Encode($this->GetSettings()->GetSiteName());
            ?>
 you'll
need to use your new email address, <strong><?php 
            echo Html::Encode(AuthenticationManager::GetUser()->GetEmail());
            ?>
</strong>, along with your existing password.</p>
<p><a href="<?php 
            echo Html::Encode($this->GetSettings()->GetUrl('AccountEdit'));
            ?>
">Back to your profile</a></p>
			<?php 
        } else {
            ?>
<h1>Confirmation failed</h1>
<p>Sorry, your request to change your registered email address could not be confirmed.</p>
<p>Please check that you used the exact address in the email you received, or try to <a href="<?php 
            echo Html::Encode($this->GetSettings()->GetUrl('AccountEssential'));
            ?>
">change your email address</a> again.</p>
			<?php 
        }
    }
 function OnLoadPageData()
 {
     # Add subscription
     $o_subs = new SubscriptionManager($this->GetSettings(), $this->GetDataConnection());
     $o_subs->SaveSubscription($this->o_review_item->GetId(), $this->o_review_item->GetType(), AuthenticationManager::GetUser()->GetId());
     unset($o_subs);
 }
 function OnPageInit()
 {
     $this->manager = new ClubManager($this->GetSettings(), $this->GetDataConnection());
     $this->has_permission = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS);
     if (!$this->has_permission) {
         header("HTTP/1.1 401 Unauthorized");
     }
     parent::OnPageInit();
 }
 /**
  * Creates a new TeamEditControl
  *
  * @param SiteSettings $settings
  */
 public function __construct(SiteSettings $settings)
 {
     # set up element
     $this->SetDataObjectClass('Team');
     parent::__construct($settings);
     # Set up aggregated editors
     $this->a_clubs = array();
     $this->a_grounds = array();
     $this->is_admin = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS);
 }
 /**
  * Creates a TeamEditPanel
  *
  * @param SiteSettings $settings
  * @param Team $team
  * @param Season[] $seasons
  * @param Match[] $matches
  */
 public function __construct(SiteSettings $settings, Team $team, $seasons, $matches)
 {
     parent::__construct($settings, " this team");
     $is_one_time_team = $team->GetTeamType() == Team::ONCE;
     if (!$is_one_time_team) {
         $this->AddLink('tell us about your team', $settings->GetUrl('TeamAdd'));
     }
     if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS, $team->GetLinkedDataUri())) {
         $this->AddLink('edit this team', $team->GetEditTeamUrl());
     }
     if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS)) {
         $this->AddLink('delete this team', $team->GetDeleteTeamUrl());
     }
     if (!$is_one_time_team) {
         $b_in_league = false;
         $b_in_cup = false;
         if (is_array($seasons)) {
             foreach ($seasons as $season) {
                 /* @var $season Season */
                 if (!$b_in_cup and $season->MatchTypes()->Contains(MatchType::CUP)) {
                     $b_in_cup = true;
                 }
                 if (!$b_in_league and $season->MatchTypes()->Contains(MatchType::LEAGUE)) {
                     $b_in_league = true;
                 }
                 if ($b_in_cup and $b_in_league) {
                     break;
                 }
             }
         }
         $this->AddLink('add practice', $team->GetAddMatchNavigateUrl(MatchType::PRACTICE));
         $this->AddLink('add friendly match', $team->GetAddMatchNavigateUrl(MatchType::FRIENDLY));
         $this->AddLink('add tournament', $team->GetAddMatchNavigateUrl(MatchType::TOURNAMENT));
         if ($b_in_league) {
             $this->AddLink('add league match', $team->GetAddMatchNavigateUrl(MatchType::LEAGUE));
         }
         if ($b_in_cup) {
             $this->AddLink('add cup match', $team->GetAddMatchNavigateUrl(MatchType::CUP));
         }
         if (is_array($matches) and count($matches)) {
             # Make sure there's at least one match which is not a tournament or a practice
             foreach ($matches as $o_match) {
                 /* @var $o_match Match */
                 if ($o_match->GetMatchType() == MatchType::PRACTICE or $o_match->GetMatchType() == MatchType::TOURNAMENT or $o_match->GetMatchType() == MatchType::TOURNAMENT_MATCH) {
                     continue;
                 } else {
                     $this->AddLink('update results', $team->GetResultsNavigateUrl());
                     break;
                 }
             }
             $this->AddLink('add matches to your calendar', $team->GetCalendarNavigateUrl());
         }
     }
 }
    function OnPageLoad()
    {
        echo new XhtmlElement('h1', $this->GetPageTitle());
        # If no search term, show a search form (intended for mobile)
        if (!$this->query instanceof SearchQuery) {
            ?>
            <form action="/search" method="get"><div>
            <input type="search" name="q" />
            <input type="submit" value="Search" />
            </div></form>
            <?php 
            return;
        }
        if ($this->paging->GetTotalResults()) {
            # write the paging navbar
            $paging_bar = $this->paging->GetNavigationBar();
            echo $paging_bar;
            # Load files used for custom formats
            require_once 'email/email-address-protector.class.php';
            require_once 'search/search-highlighter.class.php';
            $protector = new EmailAddressProtector($this->GetSettings());
            $highlighter = new SearchHighlighter();
            echo '<dl class="search">';
            foreach ($this->results as $result) {
                /* @var $result SearchItem */
                echo '<dt>';
                $title = htmlentities($result->Title(), ENT_QUOTES, "UTF-8", false);
                $title = $highlighter->Highlight($this->query->GetSanitisedTerms(), $title);
                echo '<a href="' . htmlentities($result->Url(), ENT_QUOTES, "UTF-8", false) . '">' . $title . "</a> ";
                echo "</dt>";
                echo '<dd>';
                $description = htmlentities($result->Description(), ENT_QUOTES, "UTF-8", false);
                $description = $protector->ApplyEmailProtection($description, AuthenticationManager::GetUser()->IsSignedIn());
                $description = $highlighter->Highlight($this->query->GetSanitisedTerms(), $description);
                echo "<p>" . $description . "</p>";
                echo $result->RelatedLinksHtml();
                echo '<p class="url">' . htmlentities($this->DisplayUrl($result->Url()), ENT_QUOTES, "UTF-8", false) . "</p>";
                if (isset($_GET['debug'])) {
                    echo '<ul class="weight">' . '<li>Matched field weight: <strong>' . $result->WeightOfMatchedField() . '</strong></li>' . '<li>Weight of result type: <strong>' . $result->WeightOfType() . '</strong></li>' . '<li>Weight within type: <strong>' . $result->WeightWithinType() . '</strong></li>' . '<li>Weight: <strong>' . $result->Weight() . '</strong></li>' . '</ul>';
                }
                echo "</dd>";
            }
            echo '</dl>';
            echo $paging_bar;
        } else {
            ?>
			<p>Sorry, we didn't find anything matching your search.</p>
			<p>Please check your spelling, or try rewording your search.</p>
			<p>If you still can't find what you're looking for, please <a href="/contact/"> contact us</a>.</p>
			<?php 
        }
        $this->AddSeparator();
        $this->BuySomething();
    }
 function OnPageLoad()
 {
     echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
     echo new ClubListControl($this->a_clubs);
     if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS)) {
         require_once "stoolball/user-edit-panel.class.php";
         $this->AddSeparator();
         $panel = new UserEditPanel($this->GetSettings(), "clubs and schools");
         $panel->AddLink("add a club or school", "/play/clubs/clubedit.php");
         echo $panel;
     }
 }
 function OnPageLoad()
 {
     echo new XhtmlElement('h1', htmlentities($this->GetPageTitle(), ENT_QUOTES, "UTF-8", false));
     echo new XhtmlElement('div', $this->content, "play");
     $this->ShowSocialAccounts();
     if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_COMPETITIONS)) {
         $this->AddSeparator();
         require_once 'stoolball/user-edit-panel.class.php';
         $panel = new UserEditPanel($this->GetSettings(), '');
         $panel->AddLink('add a competition', '/play/competitions/competitionedit.php');
         echo $panel;
     }
 }
 function OnPostback()
 {
     $user = AuthenticationManager::GetUser();
     if (isset($_POST['gender'])) {
         $user->SetGender($_POST['gender']);
     }
     $user->SetOccupation(trim($_POST['occupation']));
     $user->SetInterests(trim($_POST['interests']));
     $user->SetLocation(trim($_POST['location']));
     $authentication_manager = $this->GetAuthenticationManager();
     $authentication_manager->SavePersonalInfo($user);
     # redirect to edit profile home
     $this->Redirect($this->GetSettings()->GetUrl('AccountEdit'));
 }
 /**
  * Creates a MatchFixtureEditControl
  *
  * @param SiteSettings $o_settings
  * @param Match $o_match
  * @param bool $b_entire_form
  */
 public function __construct(SiteSettings $o_settings, Match $o_match = null, $b_entire_form = true)
 {
     $this->SetDataObjectClass('Match');
     if (!is_null($o_match)) {
         $this->SetDataObject($o_match);
     }
     parent::__construct($o_settings, $b_entire_form);
     $this->a_teams = array();
     $this->a_grounds = array();
     $this->SetButtonText('Save match');
     $this->i_match_type = MatchType::FRIENDLY;
     $this->seasons = new Collection();
     if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_MATCHES)) {
         $this->b_user_is_admin = true;
     }
 }
 /**
  * (non-PHPdoc)
  * @see data/DataEditControl#BuildPostedDataObject()
  */
 protected function BuildPostedDataObject()
 {
     # Prepare swear filter
     require_once 'text/bad-language-filter.class.php';
     $o_filter = new BadLanguageFilter();
     # Build object
     $user = AuthenticationManager::GetUser();
     $user->SetName($o_filter->Filter($_POST['known_as']));
     $user->SetFirstName($o_filter->Filter($_POST['first_name']));
     $user->SetLastName($o_filter->Filter($_POST['last_name']));
     $user->SetRequestedEmail($_POST['email']);
     $user->SetPassword($_POST['password1']);
     $user->SetRequestedPassword($_POST['password2']);
     $user->SetAutoSignIn(isset($_POST['remember_me']));
     $this->SetDataObject($user);
 }
 function CreateControls()
 {
     $match = $this->GetDataObject();
     /* @var $match Match */
     $this->b_user_is_match_owner = ($match->GetAddedBy() instanceof User and AuthenticationManager::GetUser()->GetId() == $match->GetAddedBy()->GetId());
     $this->CreateHighlightsControls($match);
 }
    function OnPageLoad()
    {
        if (!$this->player instanceof Player) {
            echo new XhtmlElement('h1', 'Player already deleted');
            echo new XhtmlElement('p', "The player you're trying to delete does not exist or has already been deleted.");
            return;
        }
        echo new XhtmlElement('h1', 'Delete player: <cite>' . Html::Encode($this->player->GetName()) . '</cite>');
        if ($this->player->GetPlayerRole() != Player::PLAYER) {
            ?>
Sorry, an extras player can't be deleted.<?php 
            return;
        }
        if ($this->b_deleted) {
            echo "<p>" . Html::Encode($this->player->GetName()) . "'s information has been deleted.</p>\n\t\t\t<p><a href=\"" . Html::Encode($this->player->Team()->GetPlayersNavigateUrl()) . "\">List players for " . Html::Encode($this->player->Team()->GetName()) . "</a></p>";
        } else {
            $has_permission = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_PLAYERS);
            if ($has_permission) {
                $s_detail = $this->player->GetName() . " has ";
                switch ($this->player->GetTotalMatches()) {
                    case 0:
                        $s_detail .= "not played any matches";
                        break;
                    case 1:
                        $s_detail .= "played one match";
                        break;
                    default:
                        $s_detail .= "played " . $this->player->GetTotalMatches() . " matches";
                        break;
                }
                $s_detail .= " for " . $this->player->Team()->GetName() . '. ';
                echo new XhtmlElement('p', Html::Encode($s_detail));
                ?>
<p>Deleting a player cannot be undone. Their scores and performances
will be removed from all match scorecards and statistics.</p>
<p>Are you sure you want to delete this player?</p>
<form action="<?php 
                echo Html::Encode($this->player->GetDeleteUrl());
                ?>
" method="post"
	class="deleteButtons">
<div><input type="submit" value="Delete player" name="delete" /> <input
	type="submit" value="Cancel" name="cancel" /></div>
</form>
				<?php 
                $this->AddSeparator();
                require_once 'stoolball/user-edit-panel.class.php';
                $panel = new UserEditPanel($this->GetSettings(), $this->player->GetName());
                $panel->AddLink("view this player", $this->player->GetPlayerUrl());
                $panel->AddLink("rename this player", $this->player->GetEditUrl());
                echo $panel;
            } else {
                ?>
<p>Sorry, you can't delete a player unless you're responsible for
updating their team.</p>
<p><a href="<?php 
                echo Html::Encode($this->player->GetPlayerUrl());
                ?>
">Go back to <?php 
                echo Html::Encode($this->player->GetName());
                ?>
's
profile</a></p>
				<?php 
            }
        }
    }
 function OnPrePageLoad()
 {
     $this->SetPageTitle('Email alerts for ' . AuthenticationManager::GetUser()->GetName());
 }
 /**
  * @return string
  * @desc Gets the screen name the user is known as, or "you" for the current user
  */
 public function GetRelativeName()
 {
     if ($this->GetId() and $this->GetId() == AuthenticationManager::GetUser()->GetId()) {
         return "you";
     } else {
         return $this->GetName();
     }
 }
 function OnLoadPageData()
 {
     /* @var $match_manager MatchManager */
     /* @var $editor TournamentEditControl */
     # get id of Match
     $i_id = $this->match_manager->GetItemId();
     if (!$i_id) {
         return;
     }
     # no need to read if redisplaying invalid form
     if ($this->IsValid()) {
         $this->match_manager->ReadByMatchId(array($i_id));
         $this->tournament = $this->match_manager->GetFirst();
         if ($this->tournament instanceof Match) {
             $this->b_user_is_match_owner = AuthenticationManager::GetUser()->GetId() == $this->tournament->GetAddedBy()->GetId();
             $this->b_is_tournament = $this->tournament->GetMatchType() == MatchType::TOURNAMENT;
         } else {
             return;
         }
     }
     if ($this->b_user_is_match_admin or $this->b_user_is_match_owner) {
         # get all grounds
         require_once 'stoolball/ground-manager.class.php';
         $o_ground_manager = new GroundManager($this->GetSettings(), $this->GetDataConnection());
         $o_ground_manager->ReadAll();
         $this->editor->Grounds()->SetItems($o_ground_manager->GetItems());
         unset($o_ground_manager);
         # get teams in seasons, in order to promote home grounds of teams
         $season_ids = array();
         foreach ($this->tournament->Seasons() as $season) {
             $season_ids[] = $season->GetId();
         }
         require_once 'stoolball/team-manager.class.php';
         $team_manager = new TeamManager($this->GetSettings(), $this->GetDataConnection());
         if (count($season_ids)) {
             $team_manager->ReadBySeasonId($season_ids);
             $this->editor->ProbableTeams()->SetItems($team_manager->GetItems());
         }
         unset($team_manager);
     }
 }
 function OnPageLoad()
 {
     echo '<div class="ground vcard" typeof="schema:Place" about="' . $this->ground->GetLinkedDataUri() . '">';
     $o_fn = new XhtmlElement('h1', htmlentities($this->ground->GetNameAndTown(), ENT_QUOTES, "UTF-8", false));
     $o_fn->SetCssClass('fn');
     $o_fn->AddAttribute("property", "schema:name");
     echo $o_fn;
     require_once 'xhtml/navigation/tabs.class.php';
     $tabs = array('Summary' => '', 'Statistics' => $this->ground->GetStatsNavigateUrl());
     echo new Tabs($tabs);
     ?>
     <div class="box tab-box">
         <div class="dataFilter"></div>
         <div class="box-content">
     <?php 
     $address = new XhtmlElement("div");
     $address->AddAttribute("rel", "schema:address");
     $address->AddAttribute("resource", $this->ground->GetLinkedDataUri() . "#PostalAddress");
     $postal = new PostalAddressControl($this->ground->GetAddress());
     $postal->AddAttribute("about", $this->ground->GetLinkedDataUri() . "#PostalAddress");
     $address->AddControl($postal);
     echo $address;
     # Show teams based at this ground
     if ($this->ground->Teams()->GetCount()) {
         require_once "stoolball/team-list-control.class.php";
         echo "<h2>Teams based at this ground</h2>" . new TeamListControl($this->ground->Teams()->GetItems());
     }
     if (!is_null($this->ground->GetAddress()->GetLatitude()) and !is_null($this->ground->GetAddress()->GetLongitude())) {
         $o_geo = new XhtmlElement('div');
         $o_geo->SetXhtmlId('geoGround');
         $o_geo->AddAttribute("rel", "schema:geo");
         $o_geo->AddAttribute("resource", $this->ground->GetLinkedDataUri() . "#geo");
         $o_latlong = new XhtmlElement('p');
         $o_latlong->SetCssClass('geo');
         # geo microformat
         $o_latlong->AddAttribute("about", $this->ground->GetLinkedDataUri() . "#geo");
         $o_latlong->AddAttribute("typeof", "schema:GeoCoordinates");
         $o_latlong->AddControl('Latitude ');
         $o_lat = new XhtmlElement('span', (string) $this->ground->GetAddress()->GetLatitude());
         $o_lat->SetCssClass('latitude');
         # geo microformat
         $o_lat->AddAttribute("property", "schema:latitude");
         $o_latlong->AddControl($o_lat);
         $o_latlong->AddControl('; longitude ');
         $o_long = new XhtmlElement('span', (string) $this->ground->GetAddress()->GetLongitude());
         $o_long->SetCssClass('longitude');
         # geo microformat
         $o_long->AddAttribute("property", "schema:longitude");
         $o_latlong->AddControl($o_long);
         $o_geo->AddControl($o_latlong);
         $s_place = '';
         $s_class = '';
         switch ($this->ground->GetAddress()->GetGeoPrecision()) {
             case GeoPrecision::Exact():
                 $s_place = $this->ground->GetNameAndTown();
                 $s_class = 'exact';
                 break;
             case GeoPrecision::Postcode():
                 $s_place = $this->ground->GetAddress()->GetPostcode();
                 $s_class = 'postcode';
                 break;
             case GeoPrecision::StreetDescriptor():
                 $s_place = $this->ground->GetAddress()->GetStreetDescriptor() . ', ' . $this->ground->GetAddress()->GetTown();
                 $s_class = 'street';
                 break;
             case GeoPrecision::Town():
                 $s_place = $this->ground->GetAddress()->GetTown();
                 $s_class = 'town';
                 break;
         }
         $o_map_link = new XhtmlAnchor('Map of <span class="' . $s_class . '">' . htmlentities($s_place, ENT_QUOTES, "UTF-8", false) . '</span> on Google Maps', 'http://maps.google.co.uk/?z=16&amp;q=' . urlencode($this->ground->GetNameAndTown()) . '@' . $this->ground->GetAddress()->GetLatitude() . ',' . $this->ground->GetAddress()->GetLongitude() . '&amp;ll=' . $this->ground->GetAddress()->GetLatitude() . ',' . $this->ground->GetAddress()->GetLongitude());
         $o_map = new XhtmlElement('div', $o_map_link);
         $o_geo->AddControl($o_map);
         echo $o_geo;
     }
     if ($this->ground->GetDirections()) {
         echo new XhtmlElement('h2', 'Directions');
         $s_directions = htmlentities($this->ground->GetDirections(), ENT_QUOTES, "UTF-8", false);
         $s_directions = XhtmlMarkup::ApplyCharacterEntities($s_directions);
         $s_directions = XhtmlMarkup::ApplyParagraphs($s_directions);
         $s_directions = XhtmlMarkup::ApplySimpleTags($s_directions);
         echo $s_directions;
     }
     if ($this->ground->GetParking()) {
         echo new XhtmlElement('h2', 'Parking');
         $s_parking = htmlentities($this->ground->GetParking(), ENT_QUOTES, "UTF-8", false);
         $s_parking = XhtmlMarkup::ApplyCharacterEntities($s_parking);
         $s_parking = XhtmlMarkup::ApplyParagraphs($s_parking);
         $s_parking = XhtmlMarkup::ApplySimpleTags($s_parking);
         $s_parking = XhtmlMarkup::ApplyLinks($s_parking);
         echo $s_parking;
     }
     if ($this->ground->GetFacilities()) {
         echo new XhtmlElement('h2', 'Facilities');
         $s_facilities = htmlentities($this->ground->GetFacilities(), ENT_QUOTES, "UTF-8", false);
         $s_facilities = XhtmlMarkup::ApplyCharacterEntities($s_facilities);
         $s_facilities = XhtmlMarkup::ApplyParagraphs($s_facilities);
         $s_facilities = XhtmlMarkup::ApplySimpleTags($s_facilities);
         $s_facilities = XhtmlMarkup::ApplyLinks($s_facilities);
         echo $s_facilities;
     }
     $o_meta = new XhtmlElement('p');
     $o_meta->SetCssClass('metadata');
     $o_meta->AddControl('Status: ');
     $o_uid = new XhtmlElement('span', $this->ground->GetLinkedDataUri());
     $o_uid->SetCssClass('uid');
     $o_meta->AddControl($o_uid);
     $o_meta->AddControl(' last updated at ');
     $o_rev = new XhtmlElement('abbr', Date::BritishDateAndTime($this->ground->GetDateUpdated()));
     $o_rev->SetTitle(Date::Microformat($this->ground->GetDateUpdated()));
     $o_rev->SetCssClass('rev');
     $o_meta->AddControl($o_rev);
     $o_meta->AddControl(', sort as ');
     $o_url = new XhtmlAnchor(htmlentities($this->ground->GetAddress()->GenerateSortName(), ENT_QUOTES, "UTF-8", false), $this->ground->GetNavigateUrl());
     $o_url->SetCssClass('url sort-string');
     $o_meta->AddControl($o_url);
     echo $o_meta;
     echo "</div>";
     ?>
     </div>
     </div>
     <?php 
     $this->AddSeparator();
     $o_user = new UserEditPanel($this->GetSettings(), 'this ground');
     $o_user->AddCssClass("with-tabs");
     if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_GROUNDS)) {
         $o_user->AddLink("edit this ground", $this->ground->GetEditGroundUrl());
         $o_user->AddLink("delete this ground", $this->ground->GetDeleteGroundUrl());
     }
     echo $o_user;
     # Show top players
     if ($this->has_player_stats) {
         require_once 'stoolball/statistics-highlight-table.class.php';
         echo new StatisticsHighlightTable($this->best_batting, $this->most_runs, $this->best_bowling, $this->most_wickets, $this->most_catches, "All seasons");
     }
 }
 public function OnPageInit()
 {
     $this->form = new ResetPasswordForm($this->GetSettings(), AuthenticationManager::GetUser());
     $this->RegisterControlForValidation($this->form);
     $this->valid_token = isset($_GET['request']) and preg_match('/^[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}$/', $_GET['request']);
 }
 function CreateControls()
 {
     $match = $this->GetDataObject();
     /* @var $match Match */
     $this->b_user_is_match_owner = ($match->GetAddedBy() instanceof User and AuthenticationManager::GetUser()->GetId() == $match->GetAddedBy()->GetId());
     $this->AddCssClass('legacy-form');
     if ($this->b_user_is_match_admin) {
         # Add match title editing
         $b_new = !$match->GetId();
         $title = new TextBox('title', $b_new ? '' : $match->GetTitle());
         $title->SetMaxLength(100);
         $this->AddControl(new FormPart('Match title', $title));
         $o_generate = new CheckBox('defaultTitle', 'Use default title', 1);
         if ($b_new) {
             $o_generate->SetChecked(true);
         } else {
             $o_generate->SetChecked(!$match->GetUseCustomTitle());
         }
         $this->AddControl($o_generate);
         # Add match type
         if ($match->GetMatchType() != MatchType::TOURNAMENT_MATCH) {
             $o_type_list = new XhtmlSelect('type');
             $o_type_list->AddControl(new XhtmlOption(MatchType::Text(MatchType::LEAGUE), MatchType::LEAGUE));
             $o_type_list->AddControl(new XhtmlOption(MatchType::Text(MatchType::PRACTICE), MatchType::PRACTICE));
             $o_type_list->AddControl(new XhtmlOption(MatchType::Text(MatchType::FRIENDLY), MatchType::FRIENDLY));
             $o_type_list->AddControl(new XhtmlOption(MatchType::Text(MatchType::CUP), MatchType::CUP));
             $o_type_list->SelectOption($match->GetMatchType());
             $this->AddControl(new FormPart('Type of match', $o_type_list));
         }
     }
     if ($this->b_user_is_match_owner or $this->b_user_is_match_admin) {
         $this->EnsureAggregatedEditors();
         $this->fixture_editor->SetDataObject($match);
         $this->AddControl($this->fixture_editor);
     }
     if ($this->b_user_is_match_admin) {
         # add season
         if (!$this->IsPostback()) {
             $this->season_editor->DataObjects()->SetItems($match->Seasons()->GetItems());
         }
         $this->AddControl($this->season_editor);
         # Hidden data on teams, for use by match-fixture-edit-control.js to re-sort teams when the season is changed
         # Format is 1,2,3,4,5;2,3,4,5,6
         # where ; separates each team, and for each team the first number identifies the team and subsequent numbers identify the season
         /* @var $o_team Team */
         /* @var $o_comp Competition */
         $s_team_season = '';
         # Build a list of all seasons, so that the "Not known yet" option can be added to all seasons
         $all_seasons = array();
         foreach ($this->fixture_editor->GetTeams() as $group) {
             foreach ($group as $o_team) {
                 if (!$o_team instanceof Team) {
                     continue;
                 }
                 # Add team id
                 if ($s_team_season) {
                     $s_team_season .= ';';
                 }
                 $s_team_season .= $o_team->GetId();
                 # add team seasons
                 foreach ($o_team->Seasons() as $team_in_season) {
                     $s_team_season .= ',' . $team_in_season->GetSeasonId();
                     $all_seasons[] = $team_in_season->GetSeasonId();
                 }
             }
         }
         # Add the "Don't know yet" option with all seasons
         $all_seasons = array_unique($all_seasons);
         $s_team_season = "0," . implode(",", $all_seasons) . ";{$s_team_season}";
         # Put it in a hidden field accessible to JavaScript.
         $o_ts = new TextBox($this->GetNamingPrefix() . 'TeamSeason', $s_team_season);
         $o_ts->SetMode(TextBoxMode::Hidden());
         $this->AddControl($o_ts);
     }
     $got_home_team = !is_null($match->GetHomeTeam());
     $got_away_team = !is_null($match->GetAwayTeam());
     $b_got_teams = ($got_home_team and $got_away_team);
     $b_future = ($match->GetId() and $match->GetStartTime() > gmdate('U'));
     // Move CSS class to div element
     $match_outer_1 = new XhtmlElement('div');
     $match_outer_1->SetCssClass('matchResultEdit panel');
     $match_outer_2 = new XhtmlElement('div');
     $match_box = new XhtmlElement('div');
     $this->AddControl($match_outer_1);
     $match_outer_1->AddControl($match_outer_2);
     $match_outer_2->AddControl($match_box);
     $o_title_inner_1 = new XhtmlElement('span', "Result of this match");
     $o_title_inner_2 = new XhtmlElement('span', $o_title_inner_1);
     $o_title_inner_3 = new XhtmlElement('span', $o_title_inner_2);
     $o_heading = new XhtmlElement('h2', $o_title_inner_3);
     $match_box->AddControl($o_heading);
     # Who batted first?
     if (!$b_future) {
         $match_box->AddControl('<h3>If the match went ahead:</h3>');
         $toss = $this->SelectOneOfTwoTeams($this->GetNamingPrefix() . 'Toss', $match, $match->Result()->GetTossWonBy() === TeamRole::Home(), $match->Result()->GetTossWonBy() === TeamRole::Away());
         $toss_part = new FormPart('Who won the toss?', $toss);
         $match_box->AddControl($toss_part);
         $bat_first = $this->SelectOneOfTwoTeams($this->GetNamingPrefix() . 'BatFirst', $match, $match->Result()->GetHomeBattedFirst() === true, $match->Result()->GetHomeBattedFirst() === false);
         $bat_part = new FormPart('Who batted first?', $bat_first);
         $match_box->AddControl($bat_part);
     }
     # Who won?
     $o_winner = new XhtmlSelect($this->GetNamingPrefix() . 'Result');
     if ($b_future) {
         $o_winner->AddControl(new XhtmlOption('The match will go ahead', ''));
     } else {
         # This option means "no change", therefore it has to have the current value for the match result even though that's
         # a different value from match to match. If it's not there the submitted match doesn't have result info, so when admin
         # saves fixture it regenerates its title as "Team A v Team B", which doesn't match the existing title so gets saved to db.
         # Can't be exactly the current value though, because otherwise a cancelled match has two options with the same value,
         # so re-selecting the option doesn't work. Instead change it to a negative number, which can be converted back when submitted.
         $o_winner->AddControl(new XhtmlOption('Not applicable &#8211; match went ahead', $match->Result()->GetResultType() * -1));
     }
     $result_types = array(MatchResult::HOME_WIN_BY_FORFEIT, MatchResult::AWAY_WIN_BY_FORFEIT, MatchResult::POSTPONED, MatchResult::CANCELLED, MatchResult::ABANDONED);
     foreach ($result_types as $result_type) {
         if (!$b_future or MatchResult::PossibleInAdvance($result_type)) {
             if ($b_got_teams) {
                 $o_winner->AddControl(new XhtmlOption($this->NameTeams(MatchResult::Text($result_type), $match->GetHomeTeam(), $match->GetAwayTeam()), $result_type));
             } else {
                 $o_winner->AddControl(new XhtmlOption(MatchResult::Text($result_type), $result_type));
             }
         }
     }
     $o_winner->SelectOption($match->Result()->GetResultType());
     if (!$b_future) {
         $match_box->AddControl('<h3 class="ifNotPlayed">Or, if the match was not played:</h3>');
     }
     $o_win_part = new FormPart($b_future ? 'Will it happen?' : 'Why not?', $o_winner);
     $match_box->AddControl($o_win_part);
     # Show audit data
     if ($match->GetLastAudit() != null) {
         require_once "data/audit-control.class.php";
         $match_box->AddControl(new AuditControl($match->GetLastAudit(), "match"));
     }
     # Remember short URL
     $o_short_url = new TextBox($this->GetNamingPrefix() . 'ShortUrl', $match->GetShortUrl());
     if ($this->b_user_is_match_admin) {
         $o_url_part = new FormPart('Short URL', $o_short_url);
         $this->AddControl($o_url_part);
         $this->AddControl(new CheckBox($this->GetNamingPrefix() . 'RegenerateUrl', 'Regenerate short URL', 1, !$match->GetUseCustomShortUrl(), $this->IsValidSubmit()));
     } else {
         $o_short_url->SetMode(TextBoxMode::Hidden());
         $this->AddControl($o_short_url);
     }
     if ($b_future and !$this->b_user_is_match_admin and !$this->b_user_is_match_owner) {
         $this->SetButtonText("Save result");
     }
 }
 function OnLoadPageData()
 {
     /* @var $match_manager MatchManager */
     /* @var $editor TournamentEditControl */
     # get id of Match
     $i_id = $this->match_manager->GetItemId();
     if (!$i_id) {
         return;
     }
     # no need to read if redisplaying invalid form
     if ($this->IsValid()) {
         $this->match_manager->ReadByMatchId(array($i_id));
         $this->tournament = $this->match_manager->GetFirst();
         if ($this->tournament instanceof Match) {
             $this->b_user_is_match_owner = AuthenticationManager::GetUser()->GetId() == $this->tournament->GetAddedBy()->GetId();
             $this->b_is_tournament = $this->tournament->GetMatchType() == MatchType::TOURNAMENT;
         } else {
             return;
         }
     }
     if ($this->b_user_is_match_admin or $this->b_user_is_match_owner) {
         # Get all seasons
         # Don't filter by match type at this point because we want to know what other types of match the seasons support.
         # If it's tournaments only, they'll be treated differently.
         require_once 'stoolball/season-manager.class.php';
         $season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection());
         $season_dates = Season::SeasonDates($this->tournament->GetStartTime());
         $season_manager->FilterByDateStart($season_dates[0]);
         $season_manager->FilterByDateEnd($season_dates[1]);
         $season_manager->ReadSeasonSummaries(array($this->tournament->GetPlayerType()));
         $this->editor->Seasons()->SetItems($season_manager->GetItems());
         unset($season_manager);
     }
 }
 function OnLoadPageData()
 {
     /* @var $match_manager MatchManager */
     /* @var $editor MatchEditControl */
     # get id of Match
     $i_id = $this->match_manager->GetItemId();
     if ($i_id) {
         # Get details of match but, if invalid, don't replace submitted details with saved ones
         if ($this->IsValid()) {
             $this->match_manager->ReadByMatchId(array($i_id));
             $this->match_manager->ExpandMatchScorecards();
             $this->match = $this->match_manager->GetFirst();
             if ($this->match instanceof Match) {
                 $this->b_user_is_match_owner = AuthenticationManager::GetUser()->GetId() == $this->match->GetAddedBy()->GetId();
                 $this->b_is_tournament = $this->match->GetMatchType() == MatchType::TOURNAMENT;
             }
         }
         unset($this->match_manager);
         # get all competitions if user has permission to change the season
         if ($this->b_user_is_match_admin) {
             require_once 'stoolball/competition-manager.class.php';
             $o_comp_manager = new CompetitionManager($this->GetSettings(), $this->GetDataConnection());
             $o_comp_manager->ReadAllSummaries();
             $this->editor->SetSeasons(CompetitionManager::GetSeasonsFromCompetitions($o_comp_manager->GetItems()));
             unset($o_comp_manager);
         }
         if ($this->b_user_is_match_admin or $this->b_user_is_match_owner) {
             # get all teams
             $season_ids = array();
             if ($this->match instanceof Match) {
                 foreach ($this->match->Seasons() as $season) {
                     $season_ids[] = $season->GetId();
                 }
             }
             require_once 'stoolball/team-manager.class.php';
             $o_team_manager = new TeamManager($this->GetSettings(), $this->GetDataConnection());
             if ($this->match instanceof Match and $this->match->GetMatchType() == MatchType::TOURNAMENT_MATCH) {
                 $o_team_manager->FilterByTournament(array($this->match->GetTournament()->GetId()));
                 $o_team_manager->FilterByTeamType(array());
                 # override default to allow all team types
                 $o_team_manager->ReadTeamSummaries();
             } else {
                 if ($this->b_user_is_match_admin or !count($season_ids) or $this->match->GetMatchType() == MatchType::FRIENDLY) {
                     $o_team_manager->ReadById();
                     # we need full data on the teams to get the seasons they are playing in;
                 } else {
                     # If the user can't change the season, why let them select a team that's not in the season?
                     $o_team_manager->ReadBySeasonId($season_ids);
                 }
             }
             $this->editor->SetTeams(array($o_team_manager->GetItems()));
             unset($o_team_manager);
             # get all grounds
             require_once 'stoolball/ground-manager.class.php';
             $o_ground_manager = new GroundManager($this->GetSettings(), $this->GetDataConnection());
             $o_ground_manager->ReadAll();
             $this->editor->SetGrounds($o_ground_manager->GetItems());
             unset($o_ground_manager);
         }
     }
     # Tournament or match not found is page not found
     if (!$this->match instanceof Match or $this->b_is_tournament) {
         http_response_code(404);
         $this->page_not_found = true;
     }
 }
 function OnLoadPageData()
 {
     /* @var $match_manager MatchManager */
     # get id of Match
     $i_id = $this->match_manager->GetItemId();
     # Get details of match but, if invalid, don't replace submitted details with saved ones
     if ($i_id and $this->IsValid()) {
         $this->match_manager->ReadByMatchId(array($i_id));
         $this->match_manager->ExpandMatchScorecards();
         $this->match = $this->match_manager->GetFirst();
         if ($this->match instanceof Match) {
             $this->b_user_is_match_owner = AuthenticationManager::GetUser()->GetId() == $this->match->GetAddedBy()->GetId();
             $this->b_is_tournament = $this->match->GetMatchType() == MatchType::TOURNAMENT;
         }
     }
     unset($this->match_manager);
     # Tournament or match in the future or not played is page not found
     $editable_results = array(MatchResult::UNKNOWN, MatchResult::HOME_WIN, MatchResult::AWAY_WIN, MatchResult::TIE, MatchResult::ABANDONED);
     if (!$this->match instanceof Match or $this->b_is_tournament or $this->match->GetStartTime() > gmdate('U') or !in_array($this->match->Result()->GetResultType(), $editable_results)) {
         http_response_code(404);
         $this->page_not_found = true;
     }
 }
 function OnPageInit()
 {
     $this->manager = new CategoryManager($this->GetSettings(), $this->GetDataConnection());
     $this->has_permission = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_CATEGORIES);
     parent::OnPageInit();
 }
    /**
     * @return void
     * @param Match $o_match
     * @desc Save the result and player(s) of the match to the database
     */
    public function SaveHighlights(Match $o_match)
    {
        # To add a result there must always already be a match to update
        if (!$o_match->GetId()) {
            return;
        }
        require_once "stoolball/player-manager.class.php";
        $player_manager = new PlayerManager($this->GetSettings(), $this->GetDataConnection());
        # build query
        $s_match = $this->GetSettings()->GetTable('Match');
        $statistics = $this->GetSettings()->GetTable('PlayerMatch');
        $i_result = $o_match->Result()->GetResultType() <= 0 ? null : $o_match->Result()->GetResultType();
        $player_of_match = $player_manager->SaveOrMatchPlayer($o_match->Result()->GetPlayerOfTheMatch());
        $player_of_match_home = $player_manager->SaveOrMatchPlayer($o_match->Result()->GetPlayerOfTheMatchHome());
        $player_of_match_away = $player_manager->SaveOrMatchPlayer($o_match->Result()->GetPlayerOfTheMatchAway());
        # Check whether anything's changed and don't re-save if not
        $s_sql = 'SELECT match_id FROM ' . $s_match . ' ';
        $s_where = $this->SqlAddCondition("", 'match_result_id' . Sql::ProtectNumeric($i_result, true, true));
        $s_where = $this->SqlAddCondition($s_where, 'player_of_match_id ' . Sql::ProtectNumeric($player_of_match, true, true));
        $s_where = $this->SqlAddCondition($s_where, 'player_of_match_home_id ' . Sql::ProtectNumeric($player_of_match_home, true, true));
        $s_where = $this->SqlAddCondition($s_where, 'player_of_match_away_id ' . Sql::ProtectNumeric($player_of_match_away, true, true));
        $s_where = $this->SqlAddCondition($s_where, 'match_id = ' . Sql::ProtectNumeric($o_match->GetId()));
        $s_sql = $this->SqlAddWhereClause($s_sql, $s_where);
        $o_result = $this->GetDataConnection()->query($s_sql);
        if ($o_result->fetch()) {
            return;
        }
        # Should the match_title be regenerated?
        $s_sql = "SELECT custom_title FROM {$s_match} WHERE {$s_match}.match_id = " . Sql::ProtectNumeric($o_match->GetId());
        $o_result = $this->GetDataConnection()->query($s_sql);
        $o_row = $o_result->fetch();
        if (!is_null($o_row)) {
            $o_match->SetUseCustomTitle($o_row->custom_title);
        }
        # Save IDs of players affected by any change
        $affected_players = array();
        if (!is_null($player_of_match)) {
            $affected_players[] = $player_of_match;
        }
        if (!is_null($player_of_match_home)) {
            $affected_players[] = $player_of_match_home;
        }
        if (!is_null($player_of_match_away)) {
            $affected_players[] = $player_of_match_away;
        }
        $s_sql = "SELECT player_of_match_id, player_of_match_home_id, player_of_match_away_id FROM {$s_match} WHERE {$s_match}.match_id = " . Sql::ProtectNumeric($o_match->GetId());
        $o_result = $this->GetDataConnection()->query($s_sql);
        $row = $o_result->fetch();
        if (!is_null($row)) {
            if (!is_null($row->player_of_match_id)) {
                $affected_players[] = $row->player_of_match_id;
            }
            if (!is_null($row->player_of_match_home_id)) {
                $affected_players[] = $row->player_of_match_home_id;
            }
            if (!is_null($row->player_of_match_away_id)) {
                $affected_players[] = $row->player_of_match_away_id;
            }
        }
        # Update the main match record
        # All changes from here to master data are logged, because this method can be called from the public interface
        $sql = "UPDATE {$s_match} SET ";
        if (!$o_match->GetUseCustomTitle()) {
            $sql .= "match_title = " . Sql::ProtectString($this->GetDataConnection(), $o_match->GetTitle()) . ", ";
        }
        $sql .= 'match_result_id = ' . Sql::ProtectNumeric($i_result, true) . ",\r\n\t\t\tplayer_of_match_id = " . Sql::ProtectNumeric($player_of_match, true) . ', ' . "player_of_match_home_id = " . Sql::ProtectNumeric($player_of_match_home, true) . ', ' . "player_of_match_away_id = " . Sql::ProtectNumeric($player_of_match_away, true) . ', 
			update_search = 1,  
            date_changed = ' . gmdate('U') . ", \r\n            modified_by_id = " . Sql::ProtectNumeric(AuthenticationManager::GetUser()->GetId()) . ' ' . 'WHERE match_id = ' . Sql::ProtectNumeric($o_match->GetId());
        $this->LoggedQuery($sql);
        # Copy updated match to statistics
        require_once 'stoolball/statistics/statistics-manager.class.php';
        $statistics_manager = new StatisticsManager($this->GetSettings(), $this->GetDataConnection());
        $statistics_manager->UpdateMatchDataInStatistics($this, $o_match->GetId());
        # Save IDs of players affected by any change
        if (count($affected_players)) {
            $statistics_manager->UpdatePlayerOfTheMatchStatistics($o_match->GetId());
            $statistics_manager->DeleteObsoleteStatistics($o_match->GetId());
            $statistics_manager->UpdatePlayerStatistics($affected_players);
        }
        unset($statistics_manager);
        # Match data has changed so notify moderator
        $this->QueueForNotification($o_match->GetId(), false);
    }
 function OnPrePageLoad()
 {
     $this->SetPageTitle('Edit profile for ' . AuthenticationManager::GetUser()->GetName());
 }
    public function DisplayIntro()
    {
        # build welcome message
        $s_welcome = '';
        if (isset($_GET['action']) and $_GET['action'] == 'wrongscreen') {
            $s_welcome .= "You've already registered using the email address and password you just entered. Please sign in.";
        } else {
            if (isset($_GET['action']) and $_GET['action'] == 'required') {
                if (AuthenticationManager::GetUser()->IsSignedIn()) {
                    $s_welcome .= '<strong>You do not have permission to use this feature.</strong></p>' . '<p>Please sign in with a different account.';
                } else {
                    $s_welcome .= '<strong>Please sign in to use this feature.</strong></p>' . '<p>If you have not already registered, please <a href="' . Html::Encode($this->GetSettings()->GetUrl('AccountCreate')) . '">register now</a>.';
                }
            } else {
                if (AuthenticationManager::GetUser()->IsSignedIn()) {
                    $s_signed_in_as = AuthenticationManager::GetUser()->GetName();
                    ?>
<p><strong>You're already signed in as <?php 
                    echo Html::Encode($s_signed_in_as);
                    ?>
.</strong></p>
			<?php 
                } else {
                    $s_welcome = '<p>If you haven\'t already registered, please <a href="' . Html::Encode($this->GetSettings()->GetUrl('AccountCreate')) . '">register now</a>.';
                }
            }
        }
        echo new XhtmlElement('p', $s_welcome);
    }