public static function Current() { if (!StakeLeader::IsLoggedIn()) { return null; } return StakeLeader::Load($_SESSION['stakeLeaderID']); }
<?php require_once "lib/init.php"; if (Member::IsLoggedIn() || StakeLeader::IsLoggedIn()) { header("Location: /directory"); } ?> <!DOCTYPE html> <html> <head> <title><?php echo SHORT_SITE_NAME; ?> </title> <?php include "includes/head.php"; ?> <!-- Facebook OpenGraph tags (for sharing) --> <meta name="description" content="Sign up so your ward can get your membership records. You'll also get a custom directory and abilities to text and email."> <meta property="og:image" content="http://<?php echo $_SERVER['SERVER_NAME']; echo SITE_LARGE_IMG; ?> "> <meta property="og:title" content="Welcome — <?php echo SITE_NAME; ?> "> <meta property="og:site_name" content="<?php echo SITE_NAME; ?>
public function FirstName() { if (StakeLeader::IsLoggedIn()) { return $this->FirstName; } $formal = false; $callings = $this->Callings(); $merited = array("Bishop", "Bishopric 1st Counselor", "Bishopric 2nd Counselor", "High Counselor"); // First check for calling foreach ($callings as $c) { if ($c->Name == "Bishop") { return "Bishop"; } // Bishop gets own title if (in_array($c->Name, $merited)) { $formal = true; break; } } // Now check age if not already decided if (!$formal) { $secondsPerYear = 31557600; $formal = floor(abs(strtotime(now()) - strtotime($this->Birthday)) / $secondsPerYear) > 30; } return $formal ? Gender::RenderLDS($this->Gender) : $this->FirstName; }
function protectPage($privilegeID = 0, $allowStakeLeader = false) { $currentMember = Member::Current(); // (The $MEMBER variable hasn't been created yet) $isMember = $currentMember != null; $isLeader = StakeLeader::IsLoggedIn(); if ($isLeader && !$allowStakeLeader) { header("Location: /directory"); exit; // not usually necessary, but extra safety } if (!$isMember && !$isLeader || $privilegeID && !$isMember) { $_SESSION['after_login'] = $_SERVER['REQUEST_URI']; header("Location: /"); exit; // not usually necessary, but extra safety } if ($privilegeID && $isMember) { if (!$currentMember->HasPrivilege($privilegeID)) { header("Location: /directory"); exit; } } // New members, or those who have not updated their profile // or survey answers either since registering or are still registering, // must fill out the survey before being allowed to continue. if ($isMember && $currentMember) { if ($currentMember->LastUpdated() == "0000-00-00 00:00:00" && strpos($_SERVER['REQUEST_URI'], "/survey") === false && strpos($_SERVER['REQUEST_URI'], "/api/saveanswers") === false) { header("Location: /survey"); } } }