| @@ -14,7 +14,7 @@ | ||
| 14 | 14 | |
| 15 | 15 | <div class="box med-5of7"> | 
| 16 | 16 | |
| 17 | - <?php include '../inc/common/edit-photo.php';?> | |
| 17 | + <?php include '../inc/common/edit-photo.php'; ?> | |
| 18 | 18 | |
| 19 | 19 | </div> | 
| 20 | 20 | |
| @@ -17,7 +17,7 @@ discard block | ||
| 17 | 17 | |
| 18 | 18 | <?php /* Home */ ?> | 
| 19 | 19 | <div class="page-hero__navigation-item box med-1of5 lg-1of6" id="navigationHomeLinkWrapper" aria-hidden="false"> | 
| 20 | - <?php if (strpos($url,'admin') !== false) : ?> | |
| 20 | + <?php if (strpos($url, 'admin') !== false) : ?> | |
| 21 | 21 | <a href="/admin/" id="navigationHomeLink">Home</a> | 
| 22 | 22 | <?php else : ?> | 
| 23 | 23 | <a href="/" id="navigationHomeLink">Home</a> | 
| @@ -26,7 +26,7 @@ discard block | ||
| 26 | 26 | |
| 27 | 27 | <?php /* Checks to see if the page is the admin portal and then displays the admin home link. */ ?> | 
| 28 | 28 | <?php $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?> | 
| 29 | - <?php if (strpos($url,'admin') !== false) : ?> | |
| 29 | + <?php if (strpos($url, 'admin') !== false) : ?> | |
| 30 | 30 | <?php /* No link for you! */ ?> | 
| 31 | 31 | <?php else : ?> | 
| 32 | 32 | <?php /* Browse Jobs */ ?> | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | </div> | 
| 46 | 46 | |
| 47 | 47 | <?php /* Checks to see if the page is the admin portal and then displays the admin profile link. */ ?> | 
| 48 | - <?php if (strpos($url,'admin') !== false) : ?> | |
| 48 | + <?php if (strpos($url, 'admin') !== false) : ?> | |
| 49 | 49 | <div class="page-hero__navigation-item box med-1of5 lg-1of6 hidden" id="navigationAdminDashboardLinkWrapper" aria-hidden="true"> | 
| 50 | 50 |                      <a href="javascript:void(0)" id="navigationAdminDashboardLink" onclick="AdminDashboardAPI.showDashboard();TalentCloudAPI.setNav('navigationAdminDashboardLinkWrapper');"> | 
| 51 | 51 | My Job Posters | 
| @@ -57,7 +57,7 @@ discard block | ||
| 57 | 57 | <div class="page-hero__navigation-item box med-1of5 lg-1of6 hidden" id="navigationProfileLinkWrapper" aria-hidden="true"> | 
| 58 | 58 | |
| 59 | 59 | <?php /* Checks to see if the page is the admin portal and then displays the admin profile link. */ ?> | 
| 60 | - <?php if (strpos($url,'admin') !== false) : ?> | |
| 60 | + <?php if (strpos($url, 'admin') !== false) : ?> | |
| 61 | 61 |                      <a href="#CreateEditProfile" id="navigationProfileLink" onclick="CreateEditProfileAPI.showCreateEditProfile();TalentCloudAPI.setNav('navigationProfileLinkWrapper');"> | 
| 62 | 62 | My Profile | 
| 63 | 63 | </a> | 
| @@ -69,7 +69,7 @@ discard block | ||
| 69 | 69 | |
| 70 | 70 | </div> | 
| 71 | 71 | |
| 72 | - <?php if (strpos($url,'admin') !== false) : ?> | |
| 72 | + <?php if (strpos($url, 'admin') !== false) : ?> | |
| 73 | 73 | <?php /* Create Job Poster */ ?> | 
| 74 | 74 | <div class="page-hero__navigation-item box med-1of5 lg-1of6 hidden" id="navigationPosterLinkWrapper" aria-hidden="true"> | 
| 75 | 75 |                      <a href="javascript:void(0)" id="navigationPosterLink" onclick="CreateJobPosterAPI.showCreateJobPosterForm(this);TalentCloudAPI.setNav('navigationPosterLinkWrapper');">Job Poster | 
| @@ -80,7 +80,7 @@ discard block | ||
| 80 | 80 | <?php endif; ?> | 
| 81 | 81 | |
| 82 | 82 | <?php /* Register */ | 
| 83 | - if (strpos($url,'admin') !== false) : ?> | |
| 83 | + if (strpos($url, 'admin') !== false) : ?> | |
| 84 | 84 | <div class="page-hero__navigation-item box med-1of5 lg-1of6 hidden" id="navigationRegisterLinkWrapper" aria-hidden="true"> | 
| 85 | 85 |                          <?php echo("<a href=\"\" id=\"navigationRegisterLink\">Register</a>"); ?> | 
| 86 | 86 | </div> | 
| @@ -98,45 +98,45 @@ discard block | ||
| 98 | 98 | } | 
| 99 | 99 | ?> | 
| 100 | 100 | |
| 101 | - <?php if (strpos($url,'admin') !== false) : ?> | |
| 101 | + <?php if (strpos($url, 'admin') !== false) : ?> | |
| 102 | 102 | |
| 103 | - <?php if ($hasUser!=null) : ?> | |
| 103 | + <?php if ($hasUser != null) : ?> | |
| 104 | 104 | <div class="page-hero__navigation-item box med-1of5 lg-1of6 hidden" id="navigationLoginLinkWrapper" aria-hidden="true"> | 
| 105 | 105 | <?php else :?> | 
| 106 | 106 | <div class="page-hero__navigation-item box med-1of5 lg-1of6" id="navigationLoginLinkWrapper" aria-hidden="false"> | 
| 107 | 107 | <?php endif; ?> | 
| 108 | 108 | <?php | 
| 109 | 109 | $loginLink = ""; | 
| 110 | - $loginLink .= OPENID_URI.AUTH_URI; | |
| 111 | - $loginLink .= "?response_type=".URL_RESPONSE_TYPES; | |
| 112 | - $loginLink .= "&redirect_uri=".urlencode(REDIRECT_URI_ADMIN); | |
| 113 | - $loginLink .= "&nonce=".$nonce; | |
| 114 | - $loginLink .= "&state=".$state; | |
| 115 | - $loginLink .= "&client_id=".CLIENT_ID; | |
| 116 | - $loginLink .= "&scope=".SCOPE; | |
| 110 | + $loginLink .= OPENID_URI . AUTH_URI; | |
| 111 | + $loginLink .= "?response_type=" . URL_RESPONSE_TYPES; | |
| 112 | + $loginLink .= "&redirect_uri=" . urlencode(REDIRECT_URI_ADMIN); | |
| 113 | + $loginLink .= "&nonce=" . $nonce; | |
| 114 | + $loginLink .= "&state=" . $state; | |
| 115 | + $loginLink .= "&client_id=" . CLIENT_ID; | |
| 116 | + $loginLink .= "&scope=" . SCOPE; | |
| 117 | 117 | //$loginLink .= "&prompt=consent"; | 
| 118 | -                            echo("<a href=\"".$loginLink."\" id=\"navigationLoginLink\">Login</a>"); | |
| 118 | +                            echo("<a href=\"" . $loginLink . "\" id=\"navigationLoginLink\">Login</a>"); | |
| 119 | 119 | ?> | 
| 120 | 120 | </div> | 
| 121 | 121 | |
| 122 | 122 | <?php else : ?> | 
| 123 | 123 | |
| 124 | - <?php if ($hasUser!=null) : ?> | |
| 124 | + <?php if ($hasUser != null) : ?> | |
| 125 | 125 | <div class="page-hero__navigation-item box med-1of5 lg-1of6 hidden" id="navigationLoginLinkWrapper"> | 
| 126 | 126 | <?php else :?> | 
| 127 | 127 | <div class="page-hero__navigation-item box med-1of5 lg-1of6" id="navigationLoginLinkWrapper"> | 
| 128 | 128 | <?php endif; ?> | 
| 129 | 129 | <?php | 
| 130 | 130 | $loginLink = ""; | 
| 131 | - $loginLink .= OPENID_URI.AUTH_URI; | |
| 132 | - $loginLink .= "?response_type=".URL_RESPONSE_TYPES; | |
| 133 | - $loginLink .= "&redirect_uri=".urlencode(REDIRECT_URI); | |
| 134 | - $loginLink .= "&nonce=".$nonce; | |
| 135 | - $loginLink .= "&state=".$state; | |
| 136 | - $loginLink .= "&client_id=".CLIENT_ID; | |
| 137 | - $loginLink .= "&scope=".SCOPE; | |
| 131 | + $loginLink .= OPENID_URI . AUTH_URI; | |
| 132 | + $loginLink .= "?response_type=" . URL_RESPONSE_TYPES; | |
| 133 | + $loginLink .= "&redirect_uri=" . urlencode(REDIRECT_URI); | |
| 134 | + $loginLink .= "&nonce=" . $nonce; | |
| 135 | + $loginLink .= "&state=" . $state; | |
| 136 | + $loginLink .= "&client_id=" . CLIENT_ID; | |
| 137 | + $loginLink .= "&scope=" . SCOPE; | |
| 138 | 138 | //$loginLink .= "&prompt=consent"; | 
| 139 | -                            echo("<a href=\"".$loginLink."\" id=\"navigationLoginLink\">Login</a>"); | |
| 139 | +                            echo("<a href=\"" . $loginLink . "\" id=\"navigationLoginLink\">Login</a>"); | |
| 140 | 140 | ?> | 
| 141 | 141 | </div> | 
| 142 | 142 | |
| @@ -154,7 +154,7 @@ discard block | ||
| 154 | 154 | </nav> | 
| 155 | 155 | |
| 156 | 156 | <div id="h1"> | 
| 157 | - <?php if (strpos($url,'admin') !== false) : ?> | |
| 157 | + <?php if (strpos($url, 'admin') !== false) : ?> | |
| 158 | 158 | <h1 class="visuallyHidden">Talent Cloud - Admin Portal</h1> | 
| 159 | 159 | <?php else : ?> | 
| 160 | 160 | <h1 class="visuallyHidden">Talent Cloud - Applicant Portal</h1> | 
| @@ -178,7 +178,7 @@ discard block | ||
| 178 | 178 | </div> | 
| 179 | 179 | |
| 180 | 180 | <?php /* Checks to see if the page is the admin portal and then displays the admin tagline. */ ?> | 
| 181 | - <?php if (strpos($url,'admin') !== false) : ?> | |
| 181 | + <?php if (strpos($url, 'admin') !== false) : ?> | |
| 182 | 182 | <div class="box full"> | 
| 183 | 183 | <p id="adminTagline" class="landing-hero__admin-tagline">Changing government through it's people</p> | 
| 184 | 184 | </div> | 
| @@ -19,23 +19,29 @@ discard block | ||
| 19 | 19 | <div class="page-hero__navigation-item box med-1of5 lg-1of6" id="navigationHomeLinkWrapper" aria-hidden="false"> | 
| 20 | 20 | <?php if (strpos($url,'admin') !== false) : ?> | 
| 21 | 21 | <a href="/admin/" id="navigationHomeLink">Home</a> | 
| 22 | - <?php else : ?> | |
| 22 | +                <?php else { | |
| 23 | + : ?> | |
| 23 | 24 | <a href="/" id="navigationHomeLink">Home</a> | 
| 24 | - <?php endif; ?> | |
| 25 | + <?php endif; | |
| 26 | +} | |
| 27 | +?> | |
| 25 | 28 | </div> | 
| 26 | 29 | |
| 27 | 30 | <?php /* Checks to see if the page is the admin portal and then displays the admin home link. */ ?> | 
| 28 | 31 | <?php $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?> | 
| 29 | 32 | <?php if (strpos($url,'admin') !== false) : ?> | 
| 30 | 33 | <?php /* No link for you! */ ?> | 
| 31 | - <?php else : ?> | |
| 34 | +            <?php else { | |
| 35 | + : ?> | |
| 32 | 36 | <?php /* Browse Jobs */ ?> | 
| 33 | 37 | <div class="page-hero__navigation-item box med-1of5 lg-1of6" id="navigationBrowseLinkWrapper" aria-hidden="false"> | 
| 34 | 38 |                      <a href="#BrowseJobs" id="navigationBrowseLink" onclick="JobPostAPI.showBrowseJobs();TalentCloudAPI.setNav('navigationBrowseLinkWrapper');"> | 
| 35 | 39 | Browse Jobs | 
| 36 | 40 | </a> | 
| 37 | 41 | </div> | 
| 38 | - <?php endif; ?> | |
| 42 | + <?php endif; | |
| 43 | +} | |
| 44 | +?> | |
| 39 | 45 | |
| 40 | 46 | <?php /* Dashboard */ ?> | 
| 41 | 47 | <div class="page-hero__navigation-item box med-1of5 lg-1of6 hidden" id="navigationDashboardLinkWrapper" aria-hidden="true"> | 
| @@ -61,11 +67,14 @@ discard block | ||
| 61 | 67 |                      <a href="#CreateEditProfile" id="navigationProfileLink" onclick="CreateEditProfileAPI.showCreateEditProfile();TalentCloudAPI.setNav('navigationProfileLinkWrapper');"> | 
| 62 | 68 | My Profile | 
| 63 | 69 | </a> | 
| 64 | - <?php else : ?> | |
| 70 | +                <?php else { | |
| 71 | + : ?> | |
| 65 | 72 |                      <a href="#MyProfile" id="navigationProfileLink" onclick="JobSeekerAPI.showMyJobSeekerProfile();TalentCloudAPI.setNav('navigationProfileLinkWrapper');"> | 
| 66 | 73 | My Profile | 
| 67 | 74 | </a> | 
| 68 | - <?php endif; ?> | |
| 75 | + <?php endif; | |
| 76 | +} | |
| 77 | +?> | |
| 69 | 78 | |
| 70 | 79 | </div> | 
| 71 | 80 | |
| @@ -75,18 +84,24 @@ discard block | ||
| 75 | 84 |                      <a href="javascript:void(0)" id="navigationPosterLink" onclick="CreateJobPosterAPI.showCreateJobPosterForm(this);TalentCloudAPI.setNav('navigationPosterLinkWrapper');">Job Poster | 
| 76 | 85 | </a> | 
| 77 | 86 | </div> | 
| 78 | - <?php else : ?> | |
| 87 | +            <?php else { | |
| 88 | + : ?> | |
| 79 | 89 | <?php /* No link for you! */ ?> | 
| 80 | - <?php endif; ?> | |
| 90 | + <?php endif; | |
| 91 | +} | |
| 92 | +?> | |
| 81 | 93 | |
| 82 | 94 | <?php /* Register */ | 
| 83 | 95 | if (strpos($url,'admin') !== false) : ?> | 
| 84 | 96 | <div class="page-hero__navigation-item box med-1of5 lg-1of6 hidden" id="navigationRegisterLinkWrapper" aria-hidden="true"> | 
| 85 | 97 |                          <?php echo("<a href=\"\" id=\"navigationRegisterLink\">Register</a>"); ?> | 
| 86 | 98 | </div> | 
| 87 | - <?php else : ?> | |
| 99 | +                <?php else { | |
| 100 | + : ?> | |
| 88 | 101 | <div class="page-hero__navigation-item box med-1of5 lg-1of6" id="navigationRegisterLinkWrapper" aria-hidden="false"> | 
| 89 | -                        <?php echo("<a href=\"https://account.gccollab.ca/register?redirect_uri=https%3A%2F%2Ftc.gccollab.ca%2F\" id=\"navigationRegisterLink\">Register</a>"); ?> | |
| 102 | +                        <?php echo("<a href=\"https://account.gccollab.ca/register?redirect_uri=https%3A%2F%2Ftc.gccollab.ca%2F\" id=\"navigationRegisterLink\">Register</a>"); | |
| 103 | +} | |
| 104 | +?> | |
| 90 | 105 | </div> | 
| 91 | 106 | <?php endif; ?> | 
| 92 | 107 | |
| @@ -102,9 +117,12 @@ discard block | ||
| 102 | 117 | |
| 103 | 118 | <?php if ($hasUser!=null) : ?> | 
| 104 | 119 | <div class="page-hero__navigation-item box med-1of5 lg-1of6 hidden" id="navigationLoginLinkWrapper" aria-hidden="true"> | 
| 105 | - <?php else :?> | |
| 120 | +                <?php else { | |
| 121 | + :?> | |
| 106 | 122 | <div class="page-hero__navigation-item box med-1of5 lg-1of6" id="navigationLoginLinkWrapper" aria-hidden="false"> | 
| 107 | - <?php endif; ?> | |
| 123 | + <?php endif; | |
| 124 | +} | |
| 125 | +?> | |
| 108 | 126 | <?php | 
| 109 | 127 | $loginLink = ""; | 
| 110 | 128 | $loginLink .= OPENID_URI.AUTH_URI; | 
| @@ -119,13 +137,16 @@ discard block | ||
| 119 | 137 | ?> | 
| 120 | 138 | </div> | 
| 121 | 139 | |
| 122 | - <?php else : ?> | |
| 140 | +            <?php else { | |
| 141 | + : ?> | |
| 123 | 142 | |
| 124 | 143 | <?php if ($hasUser!=null) : ?> | 
| 125 | 144 | <div class="page-hero__navigation-item box med-1of5 lg-1of6 hidden" id="navigationLoginLinkWrapper"> | 
| 126 | 145 | <?php else :?> | 
| 127 | 146 | <div class="page-hero__navigation-item box med-1of5 lg-1of6" id="navigationLoginLinkWrapper"> | 
| 128 | - <?php endif; ?> | |
| 147 | + <?php endif; | |
| 148 | +} | |
| 149 | +?> | |
| 129 | 150 | <?php | 
| 130 | 151 | $loginLink = ""; | 
| 131 | 152 | $loginLink .= OPENID_URI.AUTH_URI; | 
| @@ -156,9 +177,12 @@ discard block | ||
| 156 | 177 | <div id="h1"> | 
| 157 | 178 | <?php if (strpos($url,'admin') !== false) : ?> | 
| 158 | 179 | <h1 class="visuallyHidden">Talent Cloud - Admin Portal</h1> | 
| 159 | - <?php else : ?> | |
| 180 | +        <?php else { | |
| 181 | + : ?> | |
| 160 | 182 | <h1 class="visuallyHidden">Talent Cloud - Applicant Portal</h1> | 
| 161 | - <?php endif; ?> | |
| 183 | + <?php endif; | |
| 184 | +} | |
| 185 | +?> | |
| 162 | 186 | </div> | 
| 163 | 187 | |
| 164 | 188 | <div class="landing-hero" id="landingHero"> | 
| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | <?php // Checks to see if the page is the admin portal and then displays the admin tagline. ?> | 
| 21 | 21 | <?php | 
| 22 | 22 | $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; | 
| 23 | -                if (strpos($url,'admin') !== false) { | |
| 23 | +                if (strpos($url, 'admin') !== false) { | |
| 24 | 24 | echo '<p id="adminTagline" class="centered">Changing government through it\'s people</p>'; | 
| 25 | -                } else { | |
| 25 | +                }else { | |
| 26 | 26 | |
| 27 | 27 | } | 
| 28 | 28 | ?> | 
| @@ -240,7 +240,7 @@ | ||
| 240 | 240 | $loginLink .= "?response_type=" . URL_RESPONSE_TYPES; | 
| 241 | 241 |                          if (strpos($url, 'admin') !== false) { | 
| 242 | 242 | $loginLink .= "&redirect_uri=" . urlencode(REDIRECT_URI_ADMIN); | 
| 243 | -                        } else { | |
| 243 | +                        }else { | |
| 244 | 244 | $loginLink .= "&redirect_uri=" . urlencode(REDIRECT_URI); | 
| 245 | 245 | } | 
| 246 | 246 | $loginLink .= "&nonce=" . $nonce; | 
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | |
| 21 | 21 | <div class="box lg-2of5"> | 
| 22 | 22 | |
| 23 | - <?php include 'inc/common/edit-photo.php';?> | |
| 23 | + <?php include 'inc/common/edit-photo.php'; ?> | |
| 24 | 24 | |
| 25 | 25 | </div> | 
| 26 | 26 | |
| @@ -25,9 +25,9 @@ discard block | ||
| 25 | 25 | $state = md5(uniqid(rand(), TRUE)); | 
| 26 | 26 | |
| 27 | 27 | //if querystring is not empty | 
| 28 | -if($query_string !== ""){ | |
| 28 | +if ($query_string !== "") { | |
| 29 | 29 | //if login response code from querystring array is not null | 
| 30 | -    if(array_key_exists("code", $querystring_array) && $querystring_array["code"] !== null){ | |
| 30 | +    if (array_key_exists("code", $querystring_array) && $querystring_array["code"] !== null) { | |
| 31 | 31 | $oidc = new OpenIDConnectClient(OPENID_URI); | 
| 32 | 32 | $oidc->setClientID(CLIENT_ID); | 
| 33 | 33 | $oidc->setClientSecret(CLIENT_SECRET); | 
| @@ -41,28 +41,28 @@ discard block | ||
| 41 | 41 | $oidc->setAccessToken($_SESSION["accessToken"]); | 
| 42 | 42 | }*/ | 
| 43 | 43 | |
| 44 | -        try{ | |
| 44 | +        try { | |
| 45 | 45 | $oidc->authenticate(); | 
| 46 | -        }catch(Jumbojett\OpenIDConnectClientException $e){ | |
| 46 | +        } catch (Jumbojett\OpenIDConnectClientException $e) { | |
| 47 | 47 | echo($e->getMessage()); | 
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | 50 | //set session variables for openid info | 
| 51 | 51 |          if (isset($oidc)) { | 
| 52 | 52 |              if ($oidc->getAccessToken() !== "NULL") { | 
| 53 | - $_SESSION["accessToken"]=$oidc->getAccessToken(); | |
| 54 | - $_SESSION["refreshToken"]=$oidc->getRefreshToken(); | |
| 55 | - $_SESSION["idToken"]=$oidc->getIdToken(); | |
| 56 | - $_SESSION["expires_in"]=$oidc->getTimeout(); | |
| 53 | + $_SESSION["accessToken"] = $oidc->getAccessToken(); | |
| 54 | + $_SESSION["refreshToken"] = $oidc->getRefreshToken(); | |
| 55 | + $_SESSION["idToken"] = $oidc->getIdToken(); | |
| 56 | + $_SESSION["expires_in"] = $oidc->getTimeout(); | |
| 57 | 57 | $time = time(); | 
| 58 | 58 | $expires_at = $time + intval($oidc->getTimeout()); | 
| 59 | 59 | $_SESSION["expires_at"] = $expires_at; | 
| 60 | 60 | } | 
| 61 | 61 | } | 
| 62 | 62 | |
| 63 | -        header("Refresh:0; url=\"".REDIRECT_URI.""); | |
| 63 | +        header("Refresh:0; url=\"" . REDIRECT_URI . ""); | |
| 64 | 64 | } | 
| 65 | -}else{ | |
| 65 | +}else { | |
| 66 | 66 | $_SESSION['openid_connect_state'] = $state; | 
| 67 | 67 | $_SESSION['openid_connect_nonce'] = $nonce; | 
| 68 | 68 | } | 
| @@ -77,38 +77,38 @@ discard block | ||
| 77 | 77 | <script type="text/javascript"> | 
| 78 | 78 | <?php | 
| 79 | 79 |          if (isset($oidc)) { | 
| 80 | -            if($_SESSION["accessToken"] !== null){ | |
| 81 | -                echo("var accessToken = '".$_SESSION["accessToken"]."';"); | |
| 80 | +            if ($_SESSION["accessToken"] !== null) { | |
| 81 | +                echo("var accessToken = '" . $_SESSION["accessToken"] . "';"); | |
| 82 | 82 |                  echo("UserAPI.storeOpenIDAccessToken(accessToken);"); | 
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | -            if($_SESSION["idToken"] !== null){ | |
| 86 | -                echo("var idToken = '".$_SESSION["idToken"]."';"); | |
| 85 | +            if ($_SESSION["idToken"] !== null) { | |
| 86 | +                echo("var idToken = '" . $_SESSION["idToken"] . "';"); | |
| 87 | 87 |                  echo("UserAPI.storeOpenIDToken(idToken);"); | 
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | -            if($_SESSION["refreshToken"] !== null){ | |
| 91 | -                echo("var refreshToken = '".$_SESSION["refreshToken"]."';"); | |
| 90 | +            if ($_SESSION["refreshToken"] !== null) { | |
| 91 | +                echo("var refreshToken = '" . $_SESSION["refreshToken"] . "';"); | |
| 92 | 92 |                  echo("UserAPI.storeOpenIDRefreshToken(refreshToken);"); | 
| 93 | 93 | } | 
| 94 | 94 | |
| 95 | -            if($_SESSION["expires_in"] !== null){ | |
| 96 | -                echo("var expires_in = '".$_SESSION["expires_in"]."';"); | |
| 95 | +            if ($_SESSION["expires_in"] !== null) { | |
| 96 | +                echo("var expires_in = '" . $_SESSION["expires_in"] . "';"); | |
| 97 | 97 |                  echo("UserAPI.storeOpenIDExpiry(expires_in);"); | 
| 98 | 98 | } | 
| 99 | 99 | |
| 100 | -            if($_SESSION["expires_at"] !== null){ | |
| 101 | -                echo("var expires_at = '".$_SESSION["expires_at"]."';"); | |
| 100 | +            if ($_SESSION["expires_at"] !== null) { | |
| 101 | +                echo("var expires_at = '" . $_SESSION["expires_at"] . "';"); | |
| 102 | 102 |                  echo("UserAPI.storeSessionObject(\"expires_at\",expires_at, false);"); | 
| 103 | 103 | } | 
| 104 | 104 | |
| 105 | 105 | $userInfo = $oidc->requestUserInfo(); | 
| 106 | 106 | |
| 107 | -            if($userInfo !== null){ | |
| 108 | -                echo("UserAPI.storeSessionUser(".json_encode($userInfo).");"); | |
| 107 | +            if ($userInfo !== null) { | |
| 108 | +                echo("UserAPI.storeSessionUser(" . json_encode($userInfo) . ");"); | |
| 109 | 109 |                  echo("UserAPI.login();"); | 
| 110 | 110 | } | 
| 111 | -        }else{ | |
| 111 | +        }else { | |
| 112 | 112 |              echo("UserAPI.login();"); | 
| 113 | 113 | } | 
| 114 | 114 | //var isExistingUser = UserAPI.authenticate(UserAPI.getSessionUserAsJSON()); | 
| @@ -116,9 +116,9 @@ discard block | ||
| 116 | 116 | |
| 117 | 117 | </script> | 
| 118 | 118 | <?php // Include for Federal Identity Program (black banner) ?> | 
| 119 | - <?php include 'inc/applicant/header-fip.php';?> | |
| 119 | + <?php include 'inc/applicant/header-fip.php'; ?> | |
| 120 | 120 | <!-- Include for main navigation --> | 
| 121 | - <?php include 'inc/common/header-nav.php';?> | |
| 121 | + <?php include 'inc/common/header-nav.php'; ?> | |
| 122 | 122 | |
| 123 | 123 | <?php // BEGIN - Overlays (all should be children of this div) ?> | 
| 124 | 124 | <div id="overlays"> | 
| @@ -154,6 +154,6 @@ discard block | ||
| 154 | 154 | <?php // END - Page Content ?> | 
| 155 | 155 | |
| 156 | 156 | <?php // Include for footer ?> | 
| 157 | - <?php include 'inc/applicant/footer.php';?> | |
| 157 | + <?php include 'inc/applicant/footer.php'; ?> | |
| 158 | 158 | </body> | 
| 159 | 159 | </html> | 
| @@ -43,7 +43,7 @@ discard block | ||
| 43 | 43 | |
| 44 | 44 |          try{ | 
| 45 | 45 | $oidc->authenticate(); | 
| 46 | -        }catch(Jumbojett\OpenIDConnectClientException $e){ | |
| 46 | +        } catch(Jumbojett\OpenIDConnectClientException $e){ | |
| 47 | 47 | echo($e->getMessage()); | 
| 48 | 48 | } | 
| 49 | 49 | |
| @@ -62,7 +62,7 @@ discard block | ||
| 62 | 62 | |
| 63 | 63 |          header("Refresh:0; url=\"".REDIRECT_URI.""); | 
| 64 | 64 | } | 
| 65 | -}else{ | |
| 65 | +} else{ | |
| 66 | 66 | $_SESSION['openid_connect_state'] = $state; | 
| 67 | 67 | $_SESSION['openid_connect_nonce'] = $nonce; | 
| 68 | 68 | } | 
| @@ -108,7 +108,7 @@ discard block | ||
| 108 | 108 |                  echo("UserAPI.storeSessionUser(".json_encode($userInfo).");"); | 
| 109 | 109 |                  echo("UserAPI.login();"); | 
| 110 | 110 | } | 
| 111 | -        }else{ | |
| 111 | +        } else{ | |
| 112 | 112 |              echo("UserAPI.login();"); | 
| 113 | 113 | } | 
| 114 | 114 | //var isExistingUser = UserAPI.authenticate(UserAPI.getSessionUserAsJSON()); | 
| @@ -25,9 +25,9 @@ discard block | ||
| 25 | 25 | $state = md5(uniqid(rand(), TRUE)); | 
| 26 | 26 | |
| 27 | 27 | //if querystring is not empty | 
| 28 | -if($query_string !== ""){ | |
| 28 | +if ($query_string !== "") { | |
| 29 | 29 | //if login response code from querystring array is not null | 
| 30 | -    if(array_key_exists("code", $querystring_array) && $querystring_array["code"] !== null){ | |
| 30 | +    if (array_key_exists("code", $querystring_array) && $querystring_array["code"] !== null) { | |
| 31 | 31 | $oidc = new OpenIDConnectClient(OPENID_URI); | 
| 32 | 32 | $oidc->setClientID(CLIENT_ID); | 
| 33 | 33 | $oidc->setClientSecret(CLIENT_SECRET); | 
| @@ -41,27 +41,27 @@ discard block | ||
| 41 | 41 | $oidc->setAccessToken($_SESSION["accessToken"]); | 
| 42 | 42 | }*/ | 
| 43 | 43 | |
| 44 | -        try{ | |
| 44 | +        try { | |
| 45 | 45 | $oidc->authenticate(); | 
| 46 | -        }catch(Jumbojett\OpenIDConnectClientException $e){ | |
| 46 | +        } catch (Jumbojett\OpenIDConnectClientException $e) { | |
| 47 | 47 | echo($e->getMessage()); | 
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | 50 | //set session variables for openid info | 
| 51 | 51 |          if (isset($oidc)) { | 
| 52 | 52 |              if ($oidc->getAccessToken() !== "NULL") { | 
| 53 | - $_SESSION["accessToken"]=$oidc->getAccessToken(); | |
| 54 | - $_SESSION["refreshToken"]=$oidc->getRefreshToken(); | |
| 55 | - $_SESSION["idToken"]=$oidc->getIdToken(); | |
| 56 | - $_SESSION["expires_in"]=$oidc->getTimeout(); | |
| 53 | + $_SESSION["accessToken"] = $oidc->getAccessToken(); | |
| 54 | + $_SESSION["refreshToken"] = $oidc->getRefreshToken(); | |
| 55 | + $_SESSION["idToken"] = $oidc->getIdToken(); | |
| 56 | + $_SESSION["expires_in"] = $oidc->getTimeout(); | |
| 57 | 57 | $time = time(); | 
| 58 | 58 | $expires_at = $time + intval($oidc->getTimeout()); | 
| 59 | 59 | $_SESSION["expires_at"] = $expires_at; | 
| 60 | 60 | } | 
| 61 | 61 | } | 
| 62 | -        header("Refresh:0; url=\"".REDIRECT_URI_ADMIN."\""); | |
| 62 | +        header("Refresh:0; url=\"" . REDIRECT_URI_ADMIN . "\""); | |
| 63 | 63 | } | 
| 64 | -}else{ | |
| 64 | +}else { | |
| 65 | 65 | $_SESSION['openid_connect_state'] = $state; | 
| 66 | 66 | $_SESSION['openid_connect_nonce'] = $nonce; | 
| 67 | 67 | } | 
| @@ -76,38 +76,38 @@ discard block | ||
| 76 | 76 | <script type="text/javascript"> | 
| 77 | 77 | <?php | 
| 78 | 78 |          if (isset($oidc)) { | 
| 79 | -            if($_SESSION["accessToken"] !== null){ | |
| 80 | -                echo("var accessToken = '".$_SESSION["accessToken"]."';"); | |
| 79 | +            if ($_SESSION["accessToken"] !== null) { | |
| 80 | +                echo("var accessToken = '" . $_SESSION["accessToken"] . "';"); | |
| 81 | 81 |                  echo("UserAPI.storeOpenIDAccessToken(accessToken);"); | 
| 82 | 82 | } | 
| 83 | 83 | |
| 84 | -            if($_SESSION["idToken"] !== null){ | |
| 85 | -                echo("var idToken = '".$_SESSION["idToken"]."';"); | |
| 84 | +            if ($_SESSION["idToken"] !== null) { | |
| 85 | +                echo("var idToken = '" . $_SESSION["idToken"] . "';"); | |
| 86 | 86 |                  echo("UserAPI.storeOpenIDToken(idToken);"); | 
| 87 | 87 | } | 
| 88 | 88 | |
| 89 | -            if($_SESSION["refreshToken"] !== null){ | |
| 90 | -                echo("var refreshToken = '".$_SESSION["refreshToken"]."';"); | |
| 89 | +            if ($_SESSION["refreshToken"] !== null) { | |
| 90 | +                echo("var refreshToken = '" . $_SESSION["refreshToken"] . "';"); | |
| 91 | 91 |                  echo("UserAPI.storeOpenIDRefreshToken(refreshToken);"); | 
| 92 | 92 | } | 
| 93 | 93 | |
| 94 | -            if($_SESSION["expires_in"] !== null){ | |
| 95 | -                echo("var expires_in = '".$_SESSION["expires_in"]."';"); | |
| 94 | +            if ($_SESSION["expires_in"] !== null) { | |
| 95 | +                echo("var expires_in = '" . $_SESSION["expires_in"] . "';"); | |
| 96 | 96 |                  echo("UserAPI.storeOpenIDExpiry(expires_in);"); | 
| 97 | 97 | } | 
| 98 | 98 | |
| 99 | -            if($_SESSION["expires_at"] !== null){ | |
| 100 | -                echo("var expires_at = '".$_SESSION["expires_at"]."';"); | |
| 99 | +            if ($_SESSION["expires_at"] !== null) { | |
| 100 | +                echo("var expires_at = '" . $_SESSION["expires_at"] . "';"); | |
| 101 | 101 |                  echo("UserAPI.storeSessionObject(\"expires_at\",expires_at, false);"); | 
| 102 | 102 | } | 
| 103 | 103 | |
| 104 | 104 | $userInfo = $oidc->requestUserInfo(); | 
| 105 | 105 | |
| 106 | -            if($userInfo !== null){ | |
| 107 | -                echo("UserAPI.storeSessionUser(".json_encode($userInfo).");"); | |
| 106 | +            if ($userInfo !== null) { | |
| 107 | +                echo("UserAPI.storeSessionUser(" . json_encode($userInfo) . ");"); | |
| 108 | 108 |                  echo("UserAPI.login(true);"); | 
| 109 | 109 | } | 
| 110 | -            }else{ | |
| 110 | +            }else { | |
| 111 | 111 |                  echo("UserAPI.login(false);"); | 
| 112 | 112 | } | 
| 113 | 113 | //var isExistingUser = UserAPI.authenticate(UserAPI.getSessionUserAsJSON()); | 
| @@ -43,7 +43,7 @@ discard block | ||
| 43 | 43 | |
| 44 | 44 |          try{ | 
| 45 | 45 | $oidc->authenticate(); | 
| 46 | -        }catch(Jumbojett\OpenIDConnectClientException $e){ | |
| 46 | +        } catch(Jumbojett\OpenIDConnectClientException $e){ | |
| 47 | 47 | echo($e->getMessage()); | 
| 48 | 48 | } | 
| 49 | 49 | |
| @@ -61,7 +61,7 @@ discard block | ||
| 61 | 61 | } | 
| 62 | 62 |          header("Refresh:0; url=\"".REDIRECT_URI_ADMIN."\""); | 
| 63 | 63 | } | 
| 64 | -}else{ | |
| 64 | +} else{ | |
| 65 | 65 | $_SESSION['openid_connect_state'] = $state; | 
| 66 | 66 | $_SESSION['openid_connect_nonce'] = $nonce; | 
| 67 | 67 | } | 
| @@ -107,7 +107,7 @@ discard block | ||
| 107 | 107 |                  echo("UserAPI.storeSessionUser(".json_encode($userInfo).");"); | 
| 108 | 108 |                  echo("UserAPI.login(true);"); | 
| 109 | 109 | } | 
| 110 | -            }else{ | |
| 110 | +            } else{ | |
| 111 | 111 |                  echo("UserAPI.login(false);"); | 
| 112 | 112 | } | 
| 113 | 113 | //var isExistingUser = UserAPI.authenticate(UserAPI.getSessionUserAsJSON()); | 
| @@ -8,7 +8,7 @@ discard block | ||
| 8 | 8 |          header('HTTP/1.0 401 Unauthorized'); | 
| 9 | 9 | echo 'Text to send if user hits Cancel button'; | 
| 10 | 10 | exit; | 
| 11 | -    }else{ | |
| 11 | +    }else { | |
| 12 | 12 |          if ($_SERVER['PHP_AUTH_USER'] == 'test' && $_SERVER['PHP_AUTH_PW'] == 'test') { | 
| 13 | 13 |              header("Access-Control-Allow-Origin: *"); | 
| 14 | 14 |              header("Content-Type: application/json"); | 
| @@ -16,19 +16,19 @@ discard block | ||
| 16 | 16 | |
| 17 | 17 | $context = '/'; | 
| 18 | 18 | |
| 19 | - $requestParams = substr($requestURI,strlen($context)+1); | |
| 19 | + $requestParams = substr($requestURI, strlen($context) + 1); | |
| 20 | 20 | |
| 21 | 21 |              switch ($requestMethod) { | 
| 22 | 22 | case 'GET': | 
| 23 | 23 | |
| 24 | -                    if(strlen($requestParams) > 1){ | |
| 25 | -                        $result = array('user' => 'test','pass' => 'test'); | |
| 24 | +                    if (strlen($requestParams) > 1) { | |
| 25 | +                        $result = array('user' => 'test', 'pass' => 'test'); | |
| 26 | 26 | $json = json_encode($result); | 
| 27 | 27 | echo($json); | 
| 28 | -                    }else{ | |
| 29 | -                        $result1 = array('user' => 'test','pass' => 'test'); | |
| 30 | -                        $result2 = array('user' => 'test1','pass' => 'test1'); | |
| 31 | -                        $result3 = array('user' => 'test2','pass' => 'test2'); | |
| 28 | +                    }else { | |
| 29 | +                        $result1 = array('user' => 'test', 'pass' => 'test'); | |
| 30 | +                        $result2 = array('user' => 'test1', 'pass' => 'test1'); | |
| 31 | +                        $result3 = array('user' => 'test2', 'pass' => 'test2'); | |
| 32 | 32 | $result = array(); | 
| 33 | 33 | array_push($result, $result1); | 
| 34 | 34 | array_push($result, $result2); | 
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 |                      echo(""); | 
| 56 | 56 | break; | 
| 57 | 57 | } | 
| 58 | -        }else{ | |
| 58 | +        }else { | |
| 59 | 59 |              header('WWW-Authenticate: Basic realm="My Realm"'); | 
| 60 | 60 |              header('HTTP/1.0 401 Unauthorized'); | 
| 61 | 61 | echo 'Authorization declined'; | 
| @@ -8,7 +8,7 @@ discard block | ||
| 8 | 8 |          header('HTTP/1.0 401 Unauthorized'); | 
| 9 | 9 | echo 'Text to send if user hits Cancel button'; | 
| 10 | 10 | exit; | 
| 11 | -    }else{ | |
| 11 | +    } else{ | |
| 12 | 12 |          if ($_SERVER['PHP_AUTH_USER'] == 'test' && $_SERVER['PHP_AUTH_PW'] == 'test') { | 
| 13 | 13 |              header("Access-Control-Allow-Origin: *"); | 
| 14 | 14 |              header("Content-Type: application/json"); | 
| @@ -25,7 +25,7 @@ discard block | ||
| 25 | 25 |                          $result = array('user' => 'test','pass' => 'test'); | 
| 26 | 26 | $json = json_encode($result); | 
| 27 | 27 | echo($json); | 
| 28 | -                    }else{ | |
| 28 | +                    } else{ | |
| 29 | 29 |                          $result1 = array('user' => 'test','pass' => 'test'); | 
| 30 | 30 |                          $result2 = array('user' => 'test1','pass' => 'test1'); | 
| 31 | 31 |                          $result3 = array('user' => 'test2','pass' => 'test2'); | 
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 |                      echo(""); | 
| 56 | 56 | break; | 
| 57 | 57 | } | 
| 58 | -        }else{ | |
| 58 | +        } else{ | |
| 59 | 59 |              header('WWW-Authenticate: Basic realm="My Realm"'); | 
| 60 | 60 |              header('HTTP/1.0 401 Unauthorized'); | 
| 61 | 61 | echo 'Authorization declined'; | 
| @@ -7,15 +7,15 @@ | ||
| 7 | 7 | |
| 8 | 8 |  define('ISSUER', 'talentcloud.localhost');
 | 
| 9 | 9 | |
| 10 | -define("OPENID_URI","https://account.gccollab.ca/openid");
 | |
| 10 | +define("OPENID_URI", "https://account.gccollab.ca/openid");
 | |
| 11 | 11 | |
| 12 | -define("AUTH_URI","/authorize");
 | |
| 12 | +define("AUTH_URI", "/authorize");
 | |
| 13 | 13 | |
| 14 | -define("REGISTER_URI","https://account.gccollab.ca/register");
 | |
| 14 | +define("REGISTER_URI", "https://account.gccollab.ca/register");
 | |
| 15 | 15 | |
| 16 | 16 |  define("CLIENT_ID", "800830");
 | 
| 17 | 17 | |
| 18 | -define("CLIENT_SECRET","68eb6645ec8e59ef31633b80e8b777ebb62fbeeec3d127fc822b4fcc");
 | |
| 18 | +define("CLIENT_SECRET", "68eb6645ec8e59ef31633b80e8b777ebb62fbeeec3d127fc822b4fcc");
 | |
| 19 | 19 | |
| 20 | 20 |  define("REDIRECT_URI", "https://tc.gccollab.ca/");
 | 
| 21 | 21 | |