@@ -12,6 +12,9 @@ discard block |
||
| 12 | 12 | $app->post('/test', 'testX'); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | +/** |
|
| 16 | + * @param string $function |
|
| 17 | + */ |
|
| 15 | 18 | function sendToBackend($function, $payload) |
| 16 | 19 | { |
| 17 | 20 | $context = new ZMQContext(); |
@@ -72,6 +75,9 @@ discard block |
||
| 72 | 75 | } |
| 73 | 76 | } |
| 74 | 77 | |
| 78 | +/** |
|
| 79 | + * @param string $test |
|
| 80 | + */ |
|
| 75 | 81 | function endswith($string, $test) |
| 76 | 82 | { |
| 77 | 83 | $strlen = strlen($string); |
@@ -42,24 +42,24 @@ |
||
| 42 | 42 | |
| 43 | 43 | function add_links() |
| 44 | 44 | { |
| 45 | - $dirMenu = array( |
|
| 46 | - 'All' => 'directory.php', |
|
| 47 | - 'AAR' => 'directory.php?filter=aar', |
|
| 48 | - 'AFs' => 'directory.php?filter=af', |
|
| 49 | - 'CC' => 'directory.php?filter=cc', |
|
| 50 | - '360/24/7 Department' => 'directory.php?filter=360', |
|
| 51 | - 'Art' => 'directory.php?filter=Art', |
|
| 52 | - 'City Planning' => 'directory.php?filter=CityPlanning', |
|
| 53 | - 'Communications' => 'directory.php?filter=Comm', |
|
| 54 | - 'Genesis' => 'directory.php?filter=Genesis', |
|
| 55 | - 'Safety' => 'directory.php?filter=Safety', |
|
| 56 | - 'Site-Ops' => 'directory.php?filter=site-ops', |
|
| 57 | - 'Site Prep' => 'directory.php?filter=siteprep', |
|
| 58 | - 'Site Sign-Off' => 'directory.php?filter=sign-off', |
|
| 59 | - 'Volunteer Coordinator' => 'directory.php?filter=vc' |
|
| 60 | - ); |
|
| 61 | - $this->addLink('<span class="fa fa-dashboard"></span> Dashboard', 'index.php'); |
|
| 62 | - $this->addLink('<span class="fa fa-th-list"></span> Directory', false, $dirMenu); |
|
| 45 | + $dirMenu = array( |
|
| 46 | + 'All' => 'directory.php', |
|
| 47 | + 'AAR' => 'directory.php?filter=aar', |
|
| 48 | + 'AFs' => 'directory.php?filter=af', |
|
| 49 | + 'CC' => 'directory.php?filter=cc', |
|
| 50 | + '360/24/7 Department' => 'directory.php?filter=360', |
|
| 51 | + 'Art' => 'directory.php?filter=Art', |
|
| 52 | + 'City Planning' => 'directory.php?filter=CityPlanning', |
|
| 53 | + 'Communications' => 'directory.php?filter=Comm', |
|
| 54 | + 'Genesis' => 'directory.php?filter=Genesis', |
|
| 55 | + 'Safety' => 'directory.php?filter=Safety', |
|
| 56 | + 'Site-Ops' => 'directory.php?filter=site-ops', |
|
| 57 | + 'Site Prep' => 'directory.php?filter=siteprep', |
|
| 58 | + 'Site Sign-Off' => 'directory.php?filter=sign-off', |
|
| 59 | + 'Volunteer Coordinator' => 'directory.php?filter=vc' |
|
| 60 | + ); |
|
| 61 | + $this->addLink('<span class="fa fa-dashboard"></span> Dashboard', 'index.php'); |
|
| 62 | + $this->addLink('<span class="fa fa-th-list"></span> Directory', false, $dirMenu); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | function add_header() |
@@ -29,6 +29,9 @@ |
||
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | +/** |
|
| 33 | + * @param boolean $directOnly |
|
| 34 | + */ |
|
| 32 | 35 | function expandGroupMembers($group, $odata, $directOnly) |
| 33 | 36 | { |
| 34 | 37 | if($odata->expand !== false && in_array('member', $odata->expand)) |
@@ -43,6 +43,9 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | +/** |
|
| 47 | + * @param boolean $message |
|
| 48 | + */ |
|
| 46 | 49 | function validateCanCreateUser($proposedUser, $auth, &$message) |
| 47 | 50 | { |
| 48 | 51 | $user = $auth->getUsersByFilter(new \Data\Filter('mail eq '.$proposedUser->mail)); |
@@ -103,6 +106,9 @@ discard block |
||
| 103 | 106 | return ($uid === 'me' || $uid === $app->user->uid); |
| 104 | 107 | } |
| 105 | 108 | |
| 109 | +/** |
|
| 110 | + * @param string $uid |
|
| 111 | + */ |
|
| 106 | 112 | function getUserByUIDReadOnly($app, $uid) |
| 107 | 113 | { |
| 108 | 114 | if(userIsMe($app, $uid)) |
@@ -185,6 +191,9 @@ discard block |
||
| 185 | 191 | } |
| 186 | 192 | } |
| 187 | 193 | |
| 194 | +/** |
|
| 195 | + * @param Exception $e |
|
| 196 | + */ |
|
| 188 | 197 | function exceptionCodeToHttpCode($e) |
| 189 | 198 | { |
| 190 | 199 | if($e->getCode() === 3) |
@@ -194,6 +203,9 @@ discard block |
||
| 194 | 203 | return 500; |
| 195 | 204 | } |
| 196 | 205 | |
| 206 | +/** |
|
| 207 | + * @param string $uid |
|
| 208 | + */ |
|
| 197 | 209 | function getUser($app, $uid, $payload) |
| 198 | 210 | { |
| 199 | 211 | if(!$app->user) |
@@ -323,6 +335,10 @@ discard block |
||
| 323 | 335 | echo json_encode(array('success'=>true)); |
| 324 | 336 | } |
| 325 | 337 | |
| 338 | +/** |
|
| 339 | + * @param Data\Filter $filter |
|
| 340 | + * @param boolean $pending |
|
| 341 | + */ |
|
| 326 | 342 | function getAllUsersByFilter($filter, &$pending) |
| 327 | 343 | { |
| 328 | 344 | $auth = AuthProvider::getInstance(); |
@@ -43,6 +43,9 @@ discard block |
||
| 43 | 43 | echo json_encode($ret); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | +/** |
|
| 47 | + * @param string $test |
|
| 48 | + */ |
|
| 46 | 49 | function endswith($string, $test) |
| 47 | 50 | { |
| 48 | 51 | $strlen = strlen($string); |
@@ -107,6 +110,9 @@ discard block |
||
| 107 | 110 | return $object['Body']->__toString(); |
| 108 | 111 | } |
| 109 | 112 | |
| 113 | +/** |
|
| 114 | + * @param string $recipient |
|
| 115 | + */ |
|
| 110 | 116 | function encodeRecipients($recipient) |
| 111 | 117 | { |
| 112 | 118 | if(is_array($recipient)) |
@@ -120,6 +126,9 @@ discard block |
||
| 120 | 126 | return $recipient; |
| 121 | 127 | } |
| 122 | 128 | |
| 129 | +/** |
|
| 130 | + * @param Guzzle\Service\Resource\Model $message |
|
| 131 | + */ |
|
| 123 | 132 | function fixMessage($message) |
| 124 | 133 | { |
| 125 | 134 | $output = array(); |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | 'version' => 'latest', |
| 103 | 103 | 'region' => 'us-west-2', |
| 104 | 104 | 'credentials' => $credentials |
| 105 | - ]); |
|
| 105 | + ]); |
|
| 106 | 106 | $object = $s3Client->getObject(array('Bucket'=>$action->bucketName, 'Key'=>$action->objectKey)); |
| 107 | 107 | return $object['Body']->__toString(); |
| 108 | 108 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | function on_new_socket_cb(ZMQSocket $socket, $persistent_id = null) |
| 7 | 7 | { |
| 8 | - if ($persistent_id === 'server') |
|
| 8 | + if($persistent_id === 'server') |
|
| 9 | 9 | { |
| 10 | 10 | $socket->bind("tcp://*:55555"); |
| 11 | 11 | } |
@@ -47,13 +47,13 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $strlen = strlen($string); |
| 49 | 49 | $testlen = strlen($test); |
| 50 | - if ($testlen > $strlen) return false; |
|
| 50 | + if($testlen > $strlen) return false; |
|
| 51 | 51 | return substr_compare($string, $test, $strlen - $testlen, $testlen) === 0; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | function getDestinationsForID($id) |
| 55 | 55 | { |
| 56 | - if(strcasecmp($id,'pboyd') === 0) |
|
| 56 | + if(strcasecmp($id, 'pboyd') === 0) |
|
| 57 | 57 | { |
| 58 | 58 | return array('[email protected]'); |
| 59 | 59 | } |
@@ -123,14 +123,14 @@ discard block |
||
| 123 | 123 | function fixMessage($message) |
| 124 | 124 | { |
| 125 | 125 | $output = array(); |
| 126 | - $array = explode("\n",$message); |
|
| 126 | + $array = explode("\n", $message); |
|
| 127 | 127 | foreach($array as $arr) |
| 128 | 128 | { |
| 129 | - if((preg_match('/^Return-Path:/',$arr))) |
|
| 129 | + if((preg_match('/^Return-Path:/', $arr))) |
|
| 130 | 130 | { |
| 131 | 131 | //Strip... |
| 132 | 132 | } |
| 133 | - else if((preg_match('/^From:/',$arr))) |
|
| 133 | + else if((preg_match('/^From:/', $arr))) |
|
| 134 | 134 | { |
| 135 | 135 | $from = trim(substr($arr, 5)); |
| 136 | 136 | if(preg_match("/(.*)<(.*)>/", $from, $regs)) |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | if ($persistent_id === 'server') |
| 9 | 9 | { |
| 10 | 10 | $socket->bind("tcp://*:55555"); |
| 11 | - } |
|
| 12 | - else |
|
| 11 | + } |
|
| 12 | + else |
|
| 13 | 13 | { |
| 14 | 14 | $socket->connect("tcp://127.0.0.1:55555"); |
| 15 | 15 | } |
@@ -47,7 +47,10 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $strlen = strlen($string); |
| 49 | 49 | $testlen = strlen($test); |
| 50 | - if ($testlen > $strlen) return false; |
|
| 50 | + if ($testlen > $strlen) |
|
| 51 | + { |
|
| 52 | + return false; |
|
| 53 | + } |
|
| 51 | 54 | return substr_compare($string, $test, $strlen - $testlen, $testlen) === 0; |
| 52 | 55 | } |
| 53 | 56 | |
@@ -24,18 +24,18 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | switch($src) |
| 26 | 26 | { |
| 27 | - case 'google': |
|
| 28 | - $google = $auth->getAuthenticator('Auth\GoogleAuthenticator'); |
|
| 29 | - if(!isset($_GET['code'])) |
|
| 30 | - { |
|
| 31 | - $google->redirect(); |
|
| 32 | - die(); |
|
| 33 | - } |
|
| 34 | - else |
|
| 35 | - { |
|
| 36 | - $res = $google->authenticate($_GET['code'], $current_user); |
|
| 37 | - switch($res) |
|
| 27 | + case 'google': |
|
| 28 | + $google = $auth->getAuthenticator('Auth\GoogleAuthenticator'); |
|
| 29 | + if(!isset($_GET['code'])) |
|
| 30 | + { |
|
| 31 | + $google->redirect(); |
|
| 32 | + die(); |
|
| 33 | + } |
|
| 34 | + else |
|
| 38 | 35 | { |
| 36 | + $res = $google->authenticate($_GET['code'], $current_user); |
|
| 37 | + switch($res) |
|
| 38 | + { |
|
| 39 | 39 | case \Auth\Authenticator::SUCCESS: |
| 40 | 40 | header('Location: '.$ref); |
| 41 | 41 | die(); |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | case \Auth\Authenticator::ALREADY_PRESENT: |
| 47 | 47 | header('Location: user_exists.php?src=google&uid='.$current_user->uid); |
| 48 | 48 | die(); |
| 49 | - } |
|
| 49 | + } |
|
| 50 | 50 | } |
| 51 | 51 | break; |
| 52 | - case 'twitter': |
|
| 53 | - $twitter = $auth->getAuthenticator('Auth\TwitterAuthenticator'); |
|
| 54 | - if(!isset($_GET['oauth_token']) || !isset($_GET['oauth_verifier'])) |
|
| 55 | - { |
|
| 56 | - $twitter->redirect(); |
|
| 57 | - die(); |
|
| 58 | - } |
|
| 59 | - else |
|
| 60 | - { |
|
| 61 | - $twitter->authenticate($_GET['oauth_token'], $_GET['oauth_verifier'], $current_user); |
|
| 62 | - switch($res) |
|
| 52 | + case 'twitter': |
|
| 53 | + $twitter = $auth->getAuthenticator('Auth\TwitterAuthenticator'); |
|
| 54 | + if(!isset($_GET['oauth_token']) || !isset($_GET['oauth_verifier'])) |
|
| 55 | + { |
|
| 56 | + $twitter->redirect(); |
|
| 57 | + die(); |
|
| 58 | + } |
|
| 59 | + else |
|
| 63 | 60 | { |
| 61 | + $twitter->authenticate($_GET['oauth_token'], $_GET['oauth_verifier'], $current_user); |
|
| 62 | + switch($res) |
|
| 63 | + { |
|
| 64 | 64 | case \Auth\Authenticator::SUCCESS: |
| 65 | 65 | header('Location: '.$ref); |
| 66 | 66 | die(); |
@@ -71,21 +71,21 @@ discard block |
||
| 71 | 71 | case \Auth\Authenticator::ALREADY_PRESENT: |
| 72 | 72 | header('Location: user_exists.php?src=twitter&uid='.$current_user->uid); |
| 73 | 73 | die(); |
| 74 | - } |
|
| 74 | + } |
|
| 75 | 75 | } |
| 76 | 76 | break; |
| 77 | - case 'gitlab': |
|
| 78 | - $gitlab = $auth->getAuthenticator('Auth\OAuth2\GitLabAuthenticator'); |
|
| 79 | - if(!isset($_GET['code'])) |
|
| 80 | - { |
|
| 81 | - $google->redirect(); |
|
| 82 | - die(); |
|
| 83 | - } |
|
| 84 | - else |
|
| 85 | - { |
|
| 86 | - $res = $gitlab->authenticate($_GET['code'], $current_user); |
|
| 87 | - switch($res) |
|
| 77 | + case 'gitlab': |
|
| 78 | + $gitlab = $auth->getAuthenticator('Auth\OAuth2\GitLabAuthenticator'); |
|
| 79 | + if(!isset($_GET['code'])) |
|
| 80 | + { |
|
| 81 | + $google->redirect(); |
|
| 82 | + die(); |
|
| 83 | + } |
|
| 84 | + else |
|
| 88 | 85 | { |
| 86 | + $res = $gitlab->authenticate($_GET['code'], $current_user); |
|
| 87 | + switch($res) |
|
| 88 | + { |
|
| 89 | 89 | case \Auth\Authenticator::SUCCESS: |
| 90 | 90 | header('Location: '.$ref); |
| 91 | 91 | die(); |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | case \Auth\Authenticator::ALREADY_PRESENT: |
| 97 | 97 | header('Location: user_exists.php?src=gitlab&uid='.$current_user->uid); |
| 98 | 98 | die(); |
| 99 | - } |
|
| 99 | + } |
|
| 100 | 100 | } |
| 101 | 101 | //Generic OAuth... |
| 102 | - default: |
|
| 103 | - print_r($_SERVER); |
|
| 104 | - break; |
|
| 102 | + default: |
|
| 103 | + print_r($_SERVER); |
|
| 104 | + break; |
|
| 105 | 105 | } |
| 106 | 106 | ?> |