function OnPageInit()
 {
     parent::OnPageInit();
     $a_reasons = array($this->GetSettings()->GetWebEditorEmail() => "It's about this website", $this->GetSettings()->GetEnquiriesEmail() => "I have a question about stoolball or Stoolball England", $this->GetSettings()->GetSalesEmail() => "I want to buy something");
     $this->o_form = new ContactForm($this->GetSettings(), $a_reasons);
     $this->RegisterControlForValidation($this->o_form);
 }
 public function OnPageInit()
 {
     $this->edit = new EditSchoolControl($this->GetSettings());
     $this->RegisterControlForValidation($this->edit);
     $this->school_manager = new SchoolManager($this->GetSettings(), $this->GetDataConnection());
     $this->ground_manager = new GroundManager($this->GetSettings(), $this->GetDataConnection());
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     # new data manager
     $this->ground_manager = new GroundManager($this->GetSettings(), $this->GetDataConnection());
     # New edit control
     $this->editor = new GroundEditControl($this->GetSettings());
     $this->RegisterControlForValidation($this->editor);
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     $this->authentication_manager = $this->GetAuthenticationManager();
     # New edit control
     $this->editor = new RoleEditControl($this->GetSettings());
     $this->RegisterControlForValidation($this->editor);
     # run template method
     parent::OnPageInit();
 }
 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();
 }
 function OnPageInit()
 {
     # new data manager
     $this->o_club_manager = new ClubManager($this->GetSettings(), $this->GetDataConnection());
     # New edit control
     $this->o_edit = new ClubEditControl($this->GetSettings());
     $this->RegisterControlForValidation($this->o_edit);
     # run template method
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     # new data managers
     $this->season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection());
     $this->team_manager = new TeamManager($this->GetSettings(), $this->GetDataConnection());
     # data edit control
     $this->edit = new SeasonEditControl($this->GetSettings());
     $this->RegisterControlForValidation($this->edit);
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     # new data managers
     $this->o_comp_manager = new CompetitionManager($this->GetSettings(), $this->GetDataConnection());
     $this->o_season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection());
     # data edit control
     $this->o_edit = new CompetitionEditControl($this->GetSettings(), $this->GetCategories());
     $this->RegisterControlForValidation($this->o_edit);
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     $this->SetHasGoogleMap(true);
     if (isset($_GET['competition']) and is_numeric($_GET['competition'])) {
         $this->competition_id = (int) $_GET['competition'];
     }
     if (isset($_GET['season']) and is_numeric($_GET['season'])) {
         $this->season_id = (int) $_GET['season'];
     }
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     # New edit control
     $this->editor = new PersonEditControl($this->GetSettings());
     $this->RegisterControlForValidation($this->editor);
     if (!isset($_GET["item"]) or !is_numeric($_GET['item'])) {
         http_response_code(400);
         exit;
     }
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     # new data managers
     $this->match_manager = new MatchManager($this->GetSettings(), $this->GetDataConnection());
     # new edit control
     $this->editor = new TournamentMatchesControl($this->GetSettings());
     $this->editor->SetCssClass('panel');
     $this->RegisterControlForValidation($this->editor);
     # run template method
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     # new data managers
     $this->team_manager = new TeamManager($this->GetSettings(), $this->GetDataConnection());
     $this->team_manager->FilterByTeamType(array());
     $this->club_manager = new ClubManager($this->GetSettings(), $this->GetDataConnection());
     $this->ground_manager = new GroundManager($this->GetSettings(), $this->GetDataConnection());
     # New edit control
     $this->edit = new TeamEditControl($this->GetSettings());
     $this->RegisterControlForValidation($this->edit);
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     # new data managers
     $this->match_manager = new MatchManager($this->GetSettings(), $this->GetDataConnection());
     # new edit control
     $this->editor = new TournamentEditControl($this->GetSettings());
     $this->editor->SetCssClass('panel');
     $this->RegisterControlForValidation($this->editor);
     # check permissions
     $this->b_user_is_match_admin = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_MATCHES);
     # run template method
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     $this->o_review_item = new ReviewItem($this->GetSettings());
     $this->o_review_item->SetId($_GET['item']);
     $this->o_review_item->SetType($_GET['type']);
     if (isset($_GET['title'])) {
         $this->o_review_item->SetTitle($_GET['title']);
     }
     // data already sanitised in OnSiteInit
     if (isset($_GET['page'])) {
         $this->o_review_item->SetNavigateUrl($_GET['page']);
     } elseif (isset($_SERVER['HTTP_REFERER'])) {
         $this->o_review_item->SetNavigateUrl($_SERVER['HTTP_REFERER']);
     }
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     parent::OnPageInit();
     $this->form = new EmailForm($this->GetSettings());
     $this->RegisterControlForValidation($this->form);
     $this->valid = isset($_GET['to']);
     if ($this->valid) {
         $protector = new EmailAddressProtector($this->GetSettings());
         $this->address = $protector->DecryptProtectedEmail($_GET['to']);
         $email = new EmailAddress($this->address);
         $this->valid = $email->IsValid();
     }
     if ($this->valid) {
         $this->address_display = HTML::Encode(substr($this->address, 0, strpos($this->address, "@"))) . "@… (protected address)";
     } else {
         header($_SERVER["SERVER_PROTOCOL"] . " 400 Bad Request");
     }
 }
 public function OnPageInit()
 {
     parent::OnPageInit();
     $this->form = new PasswordForm();
     $this->RegisterControlForValidation($this->form);
 }
 function OnPageInit()
 {
     # new data manager
     $this->manager = new MatchManager($this->GetSettings(), $this->GetDataConnection());
     parent::OnPageInit();
 }
 public function OnPageInit()
 {
     $this->edit = new AddSchoolControl($this->GetSettings());
     $this->RegisterControlForValidation($this->edit);
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     $this->SetHasGoogleMap(true);
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     $this->manager = $this->GetAuthenticationManager();
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     $this->manager = new CategoryManager($this->GetSettings(), $this->GetDataConnection());
     $this->has_permission = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_CATEGORIES);
     parent::OnPageInit();
 }
 function OnPageInit()
 {
     parent::OnPageInit();
     # Set up form, which must exist to be validated
     $this->form = new XhtmlForm();
     $fs1 = new XhtmlElement('fieldset', new XhtmlElement('legend', 'Your team name'));
     $this->form->AddControl($fs1);
     $o_team = new TextBox('team', isset($_POST['team']) ? $_POST['team'] : '');
     $o_team->SetMaxLength(200);
     $o_team_part = new FormPart('Team name', $o_team);
     $o_team_part->SetIsRequired(true);
     $fs1->AddControl($o_team_part);
     $o_club = new TextBox('club', isset($_POST['club']) ? $_POST['club'] : '');
     $o_club->SetMaxLength(200);
     $o_club_part = new FormPart('Club (if different)', $o_club);
     $fs1->AddControl($o_club_part);
     $fs2 = new XhtmlElement('fieldset', new XhtmlElement('legend', 'Where and when you play'));
     $this->form->AddControl($fs2);
     $o_ground = new TextBox('ground', isset($_POST['ground']) ? $_POST['ground'] : '');
     $o_ground->SetMode(TextBoxMode::MultiLine());
     $o_ground_part = new FormPart('Address of playing field', $o_ground);
     $o_ground_part->SetIsRequired(true);
     $fs2->AddControl($o_ground_part);
     $o_prac = new TextBox('pracNight', isset($_POST['pracNight']) ? $_POST['pracNight'] : '');
     $o_prac->SetMaxLength(50);
     $o_prac_part = new FormPart('Practice night', $o_prac);
     $fs2->AddControl($o_prac_part);
     $o_match = new TextBox('matchNight', isset($_POST['matchNight']) ? $_POST['matchNight'] : '');
     $o_match->SetMaxLength(100);
     $o_match_part = new FormPart('Match nights', $o_match);
     $fs2->AddControl($o_match_part);
     $o_league = new TextBox('leagues', isset($_POST['leagues']) ? $_POST['leagues'] : '');
     $o_league->SetMode(TextBoxMode::MultiLine());
     $o_league_part = new FormPart('League(s) or friendlies you play in', $o_league);
     $fs2->AddControl($o_league_part);
     $fs3 = new XhtmlElement('fieldset', new XhtmlElement('legend', 'Contact details for Stoolball England to use'));
     $this->form->AddControl($fs3);
     $o_contact = new TextBox('contact', isset($_POST['contact']) ? $_POST['contact'] : '');
     $o_contact->SetMaxLength(150);
     $o_contact_part = new FormPart('Contact name', $o_contact);
     $o_contact_part->SetIsRequired(true);
     $fs3->AddControl($o_contact_part);
     $o_contact_addr = new TextBox('address', isset($_POST['address']) ? $_POST['address'] : '');
     $o_contact_addr->SetMode(TextBoxMode::MultiLine());
     $o_contact_addr_part = new FormPart('Contact address', $o_contact_addr);
     $fs3->AddControl($o_contact_addr_part);
     $o_contact_phone = new TextBox('contactPhone', isset($_POST['contactPhone']) ? $_POST['contactPhone'] : '');
     $o_contact_phone->SetMaxLength(50);
     $o_contact_phone_part = new FormPart('Contact phone number', $o_contact_phone);
     $fs3->AddControl($o_contact_phone_part);
     $o_contact_e = new TextBox('email', isset($_POST['email']) ? $_POST['email'] : '');
     $o_contact_e_part = new FormPart('Contact email', $o_contact_e);
     $o_contact_e_part->SetIsRequired(true);
     $fs3->AddControl($o_contact_e_part);
     $fs4 = new XhtmlElement('fieldset', new XhtmlElement('legend', 'Contact details for the website'), '#publicContact');
     $fs4->SetCssClass("radioButtonList");
     $this->form->AddControl($fs4);
     $public1 = new RadioButton('publicAbove', 'public', 'Same as above', 'Same', $this->IsPostback() ? isset($_POST['public']) and $_POST['public'] == 'Same' : true);
     $public3 = new RadioButton('publicDiff', 'public', 'Display different contact details on the website', 'Different', $this->IsPostback() ? isset($_POST['public']) and $_POST['public'] == 'Different' : false);
     $public2 = new RadioButton('publicNone', 'public', 'Don\'t display any contact details (not recommended)', 'None', $this->IsPostback() ? isset($_POST['public']) and $_POST['public'] == 'None' : false);
     $fs4->AddControl($public1);
     $fs4->AddControl($public3);
     $fs4->AddControl($public2);
     $public_contact = new TextBox('publicContact', isset($_POST['publicContact']) ? $_POST['publicContact'] : '');
     $public_contact->SetMode(TextBoxMode::MultiLine());
     $public_contact_part = new FormPart('Contact details for the website', $public_contact);
     $public_contact_part->SetXhtmlId('publicContactPart');
     $fs4->AddControl($public_contact_part);
     $fs5 = new XhtmlElement('fieldset', new XhtmlElement('legend', 'Anything else you\'d like on your team\'s page'));
     $this->form->AddControl($fs5);
     $o_notes = new TextBox('notes', isset($_POST['notes']) ? $_POST['notes'] : '');
     $o_notes->SetMode(TextBoxMode::MultiLine());
     $o_notes_part = new FormPart('Other details', $o_notes);
     $fs5->AddControl($o_notes_part);
     $o_buttons = new XhtmlElement('div');
     $o_buttons->SetCssClass('buttonGroup');
     $o_submit = new Button('send', 'Send email');
     $o_buttons->AddControl($o_submit);
     $this->form->AddControl($o_buttons);
     # Set up validation
     require_once 'data/validation/required-field-validator.class.php';
     require_once 'data/validation/length-validator.class.php';
     require_once 'data/validation/email-validator.class.php';
     $a_validators = array();
     $a_validators[] = new RequiredFieldValidator(array('team'), 'A team name is required');
     $a_validators[] = new LengthValidator(array('team'), 'Your team name is too long', 0, 200);
     $a_validators[] = new LengthValidator(array('club'), 'Your club name is too long', 0, 200);
     $a_validators[] = new RequiredFieldValidator(array('ground'), 'A playing field address is required');
     $a_validators[] = new LengthValidator(array('ground'), 'The playing field address is too long', 0, 2000);
     $a_validators[] = new RequiredFieldValidator(array('contact'), 'A contact name for the team is required');
     $a_validators[] = new LengthValidator(array('pracNight'), 'Practice night must be 50 characters or less', 0, 50);
     $a_validators[] = new LengthValidator(array('matchNight'), 'Match nights must be 100 characters or less', 0, 100);
     $a_validators[] = new LengthValidator(array('leagues'), 'Your league or friendly group(s) must be 2000 characters or less', 0, 2000);
     $a_validators[] = new LengthValidator(array('contact'), 'Your contact name is too long', 0, 150);
     $a_validators[] = new LengthValidator(array('address'), 'The contact address is too long', 0, 2000);
     $a_validators[] = new LengthValidator(array('contactPhone'), 'The contact phone number is too long', 0, 50);
     $a_validators[] = new RequiredFieldValidator(array('email'), 'A contact email for the team is required');
     $a_validators[] = new EmailValidator('email', 'Please enter a valid email address');
     $a_validators[] = new LengthValidator('publicContact', 'You\'ve put too much in the "website contact details" box. Please make the text shorter.', 0, 10000);
     $a_validators[] = new LengthValidator('notes', 'You\'ve put too much in the "other details" box. Please make the text shorter.', 0, 10000);
     foreach ($a_validators as $o_v) {
         $this->form->AddValidator($o_v);
         unset($o_v);
     }
     $this->RegisterControlForValidation($this->form);
 }