Completed
Push — 1.10.x ( e39098...d9ba33 )
by Julito
34:46
created
main/auth/openid/openid.lib.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  * Code
10 10
  */
11 11
 // Diffie-Hellman Key Exchange Default Value.
12
-define('OPENID_DH_DEFAULT_MOD', '155172898181473697471232257763715539915724801' .
13
-        '966915404479707795314057629378541917580651227423698188993727816152646631' .
14
-        '438561595825688188889951272158842675419950341258706556549803580104870537' .
15
-        '681476726513255747040765857479291291572334510643245094715007229621094194' .
12
+define('OPENID_DH_DEFAULT_MOD', '155172898181473697471232257763715539915724801'.
13
+        '966915404479707795314057629378541917580651227423698188993727816152646631'.
14
+        '438561595825688188889951272158842675419950341258706556549803580104870537'.
15
+        '681476726513255747040765857479291291572334510643245094715007229621094194'.
16 16
         '349783925984760375594985848253359305585439638443');
17 17
 
18 18
 // Constants for Diffie-Hellman key exchange computations.
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 function openid_redirect_http($url, $message) {
33 33
     $query = array();
34 34
     foreach ($message as $key => $val) {
35
-        $query[] = $key . '=' . urlencode($val);
35
+        $query[] = $key.'='.urlencode($val);
36 36
     }
37 37
     $sep = (strpos($url, '?') === FALSE) ? '?' : '&';
38
-    header('Location: ' . $url . $sep . implode('&', $query), TRUE, 302);
38
+    header('Location: '.$url.$sep.implode('&', $query), TRUE, 302);
39 39
     //exit;
40 40
 }
41 41
 
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
  * This function should be deprecated for 1.8.6.2 needs documentation
45 45
  */
46 46
 function openid_redirect($url, $message) {
47
-    $output = '<html><head><title>' . get_lang('OpenIDRedirect') . "</title></head>\n<body>";
48
-    $output .= '<form method="post" action="' . $url . '" id="openid-redirect-form">';
47
+    $output = '<html><head><title>'.get_lang('OpenIDRedirect')."</title></head>\n<body>";
48
+    $output .= '<form method="post" action="'.$url.'" id="openid-redirect-form">';
49 49
     foreach ($message as $key => $value) {
50
-        $output .='<input type="hidden" name="' . $key . '" value="' . $value . '">';
50
+        $output .= '<input type="hidden" name="'.$key.'" value="'.$value.'">';
51 51
     }
52
-    $output .= '<noscript><input type="submit" name="submit" value="' . get_lang('Send') . '"/></noscript>';
52
+    $output .= '<noscript><input type="submit" name="submit" value="'.get_lang('Send').'"/></noscript>';
53 53
     $output .= '</form>';
54 54
     $output .= '<script type="text/javascript">document.getElementById("openid-redirect-form").submit();</script>';
55 55
     $output .= "</body></html>";
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     $normalized_url = $url;
95 95
 
96 96
     if (stristr($url, '://') === FALSE) {
97
-        $normalized_url = 'http://' . $url;
97
+        $normalized_url = 'http://'.$url;
98 98
     }
99 99
 
100 100
     if (substr_count($normalized_url, '/') < 3) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             if ($encoded_message != '') {
134 134
                 $encoded_message .= '&';
135 135
             }
136
-            $encoded_message .= rawurlencode(trim($parts[0])) . '=' . rawurlencode(trim($parts[1]));
136
+            $encoded_message .= rawurlencode(trim($parts[0])).'='.rawurlencode(trim($parts[1]));
137 137
         }
138 138
     }
139 139
 
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
  */
165 165
 function _openid_nonce() {
166 166
     // YYYY-MM-DDThh:mm:ssTZD UTC, plus some optional extra unique chars
167
-    return gmstrftime('%Y-%m-%dT%H:%M:%S%Z') .
168
-            chr(mt_rand(0, 25) + 65) .
169
-            chr(mt_rand(0, 25) + 65) .
170
-            chr(mt_rand(0, 25) + 65) .
167
+    return gmstrftime('%Y-%m-%dT%H:%M:%S%Z').
168
+            chr(mt_rand(0, 25) + 65).
169
+            chr(mt_rand(0, 25) + 65).
170
+            chr(mt_rand(0, 25) + 65).
171 171
             chr(mt_rand(0, 25) + 65);
172 172
 }
173 173
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function _openid_link_href($rel, $html) {
178 178
     $rel = preg_quote($rel);
179
-    preg_match('|<link\s+rel=["\'](.*)' . $rel . '(.*)["\'](.*)/?>|iU', $html, $matches);
179
+    preg_match('|<link\s+rel=["\'](.*)'.$rel.'(.*)["\'](.*)/?>|iU', $html, $matches);
180 180
     if (isset($matches[3])) {
181 181
         preg_match('|href=["\']([^"]+)["\']|iU', $matches[0], $href);
182 182
         return trim($href[1]);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
  * Pull the http-equiv attribute out of an html meta element
189 189
  */
190 190
 function _openid_meta_httpequiv($equiv, $html) {
191
-    preg_match('|<meta\s+http-equiv=["\']' . $equiv . '["\'](.*)/?>|iU', $html, $matches);
191
+    preg_match('|<meta\s+http-equiv=["\']'.$equiv.'["\'](.*)/?>|iU', $html, $matches);
192 192
     if (isset($matches[1])) {
193 193
         preg_match('|content=["\']([^"]+)["\']|iU', $matches[1], $content);
194 194
         return $content[1];
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
     $sign_data = array();
210 210
 
211 211
     foreach ($keys_to_sign as $key) {
212
-        if (isset($message_array['openid.' . $key])) {
213
-            $sign_data[$key] = $message_array['openid.' . $key];
212
+        if (isset($message_array['openid.'.$key])) {
213
+            $sign_data[$key] = $message_array['openid.'.$key];
214 214
         }
215 215
     }
216 216
 
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
     $key = str_pad($key, OPENID_SHA1_BLOCKSIZE, chr(0x00));
230 230
     $ipad = str_repeat(chr(0x36), OPENID_SHA1_BLOCKSIZE);
231 231
     $opad = str_repeat(chr(0x5c), OPENID_SHA1_BLOCKSIZE);
232
-    $hash1 = _openid_sha1(($key ^ $ipad) . $text, true);
233
-    $hmac = _openid_sha1(($key ^ $opad) . $hash1, true);
232
+    $hash1 = _openid_sha1(($key ^ $ipad).$text, true);
233
+    $hmac = _openid_sha1(($key ^ $opad).$hash1, true);
234 234
 
235 235
     return $hmac;
236 236
 }
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
     }
338 338
 
339 339
     do {
340
-        $bytes = "\x00" . _openid_get_bytes($nbytes);
340
+        $bytes = "\x00"._openid_get_bytes($nbytes);
341 341
         $n = _openid_dh_binary_to_long($bytes);
342 342
         // Keep looping if this value is in the low duplicated range.
343 343
     } while (bccomp($n, $duplicate) < 0);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@
 block discarded – undo
61 61
  */
62 62
 function _openid_is_xri($identifier) {
63 63
     $firstchar = substr($identifier, 0, 1);
64
-    if ($firstchar == "@" || $firstchar == "=")
65
-        return TRUE;
64
+    if ($firstchar == "@" || $firstchar == "=") {
65
+            return TRUE;
66
+    }
66 67
 
67 68
     if (stristr($identifier, 'xri://') !== FALSE) {
68 69
         return TRUE;
Please login to merge, or discard this patch.
main/auth/set_temp_password.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 $cidReset = true;
12 12
 require_once '../inc/global.inc.php';
13 13
 $this_section = SECTION_COURSES;
14
-$course_id = isset($_GET['course_id'])  ? intval($_GET['course_id']) : null;
14
+$course_id = isset($_GET['course_id']) ? intval($_GET['course_id']) : null;
15 15
 $session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : null;
16 16
 $user_id = api_get_user_id();
17 17
 
Please login to merge, or discard this patch.
main/auth/inscription.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         if (api_get_setting('registration', 'email') != 'true') {
91 91
             $form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
92 92
         }
93
-        $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
93
+        $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
94 94
         $form->addRule('email', get_lang('UserTaken'), 'username_available');
95 95
     }
96 96
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $form->addElement('text', 'username', get_lang('UserName'), array('id' => 'username', 'size' => USERNAME_MAX_LENGTH));
124 124
         $form->applyFilter('username', 'trim');
125 125
         $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
126
-        $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
126
+        $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
127 127
         $form->addRule('username', get_lang('UsernameWrong'), 'username');
128 128
         $form->addRule('username', get_lang('UserTaken'), 'username_available');
129 129
     }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     if (CHECK_PASS_EASY_TO_FIND) {
145 145
         $form->addRule(
146 146
             'password1',
147
-            get_lang('PassTooEasy') . ': ' . api_generate_password(),
147
+            get_lang('PassTooEasy').': '.api_generate_password(),
148 148
             'callback',
149 149
             'api_check_password'
150 150
         );
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
             'sessionVar'   => basename(__FILE__, '.php'),
210 210
             'imageOptions' => array(
211 211
                 'font_size' => 20,
212
-                'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/',
212
+                'font_path' => api_get_path(SYS_FONTS_PATH).'opensans/',
213 213
                 'font_file' => 'OpenSans-Regular.ttf',
214 214
                     //'output' => 'gif'
215 215
             )
216 216
         );
217 217
 
218
-        $captcha_question =  $form->addElement('CAPTCHA_Image', 'captcha_question', '', $options);
218
+        $captcha_question = $form->addElement('CAPTCHA_Image', 'captcha_question', '', $options);
219 219
         $form->addElement('static', null, null, get_lang('ClickOnTheImageForANewOne'));
220 220
 
221 221
         $form->addElement('text', 'captcha', get_lang('EnterTheLettersYouSee'), array('size' => 40));
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         }
334 334
     }
335 335
 
336
-    $tool_name = get_lang('Registration', null, (!empty($_POST['language'])?$_POST['language']: $_user['language']));
336
+    $tool_name = get_lang('Registration', null, (!empty($_POST['language']) ? $_POST['language'] : $_user['language']));
337 337
 
338 338
     if (api_get_setting('allow_terms_conditions') == 'true' && $user_already_registered_show_terms) {
339 339
         $tool_name = get_lang('TermsAndConditions');
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
     }
355 355
 
356 356
     if (file_exists($home.'register_top_'.$user_selected_language.'.html')) {
357
-        $home_top_temp = @(string)file_get_contents($home.'register_top_'.$user_selected_language.'.html');
357
+        $home_top_temp = @(string) file_get_contents($home.'register_top_'.$user_selected_language.'.html');
358 358
         $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
359 359
         $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
360 360
         if (!empty($open)) {
361
-            $content =  '<div class="well_border">'.$open.'</div>';
361
+            $content = '<div class="well_border">'.$open.'</div>';
362 362
         }
363 363
     }
364 364
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
             null,
408 408
             get_lang('IHaveReadAndAgree').'&nbsp;<a href="inscription.php?legal" target="_blank">'.get_lang('TermsAndConditions').'</a>'
409 409
         );
410
-        $form->addRule('legal_accept',  get_lang('ThisFieldIsRequired'), 'required');
410
+        $form->addRule('legal_accept', get_lang('ThisFieldIsRequired'), 'required');
411 411
     } else {
412 412
         $preview = LegalManager::show_last_condition($term_preview);
413 413
         $form->addElement('label', null, $preview);
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
                 Database::query($sql);
581 581
 
582 582
                 // 2. Send mail to all platform admin
583
-                $emailsubject  = get_lang('ApprovalForNewAccount', null, $values['language']).': '.$values['username'];
583
+                $emailsubject = get_lang('ApprovalForNewAccount', null, $values['language']).': '.$values['username'];
584 584
                 $emailbody = get_lang('ApprovalForNewAccount', null, $values['language'])."\n";
585 585
                 $emailbody .= get_lang('UserName', null, $values['language']).': '.$values['username']."\n";
586 586
 
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
         '<p>'.
668 668
         get_lang('Dear', null, $_user['language']).' '.
669 669
         stripslashes(Security::remove_XSS($recipient_name)).',<br /><br />'.
670
-        get_lang('PersonalSettings',null,$_user['language']).".</p>";
670
+        get_lang('PersonalSettings', null, $_user['language']).".</p>";
671 671
 
672 672
     $form_data = array(
673 673
         'button' => Display::button('next', get_lang('Next', null, $_user['language']), array('class' => 'btn btn-primary btn-large')),
@@ -680,14 +680,14 @@  discard block
 block discarded – undo
680 680
     } else {
681 681
 
682 682
         if (!empty($values['email'])) {
683
-            $text_after_registration.= '<p>'.get_lang('MailHasBeenSent', null, $_user['language']).'.</p>';
683
+            $text_after_registration .= '<p>'.get_lang('MailHasBeenSent', null, $_user['language']).'.</p>';
684 684
         }
685 685
 
686 686
         if ($is_allowedCreateCourse) {
687 687
             if ($usersCanCreateCourse) {
688
-                $form_data['message'] = '<p>'. get_lang('NowGoCreateYourCourse', null, $_user['language']). "</p>";
688
+                $form_data['message'] = '<p>'.get_lang('NowGoCreateYourCourse', null, $_user['language'])."</p>";
689 689
             }
690
-            $form_data['action']  = '../create_course/add_course.php';
690
+            $form_data['action'] = '../create_course/add_course.php';
691 691
 
692 692
             if (api_get_setting('course_validation') == 'true') {
693 693
                 $form_data['button'] = Display::button(
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
         } else {
708 708
             if (api_get_setting('allow_students_to_browse_courses') == 'true') {
709 709
                 $form_data['action'] = 'courses.php?action=subscribe';
710
-                $form_data['message'] = '<p>'. get_lang('NowGoChooseYourCourses', null, $_user['language']). ".</p>";
710
+                $form_data['message'] = '<p>'.get_lang('NowGoChooseYourCourses', null, $_user['language']).".</p>";
711 711
             } else {
712 712
                 $form_data['action'] = api_get_path(WEB_PATH).'user_portal.php';
713 713
             }
Please login to merge, or discard this patch.
main/auth/profile.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -684,7 +684,7 @@
 block discarded – undo
684 684
 
685 685
     foreach ($user_data as $key => $value) {
686 686
         if (substr($key, 0, 6) == 'extra_') { //an extra field
687
-           continue;
687
+            continue;
688 688
         } elseif (strpos($key, 'remove_extra_') !== false) {
689 689
         } else {
690 690
             if (in_array($key, $available_values_to_modify)) {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 }
32 32
 
33 33
 $htmlHeadXtra[] = api_get_password_checker_js('#username', '#password1');
34
-$htmlHeadXtra[] = '<link  href="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">';
35
-$htmlHeadXtra[] = '<script src="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.js"></script>';
34
+$htmlHeadXtra[] = '<link  href="'.api_get_path(WEB_PATH).'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">';
35
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_PATH).'web/assets/cropper/dist/cropper.min.js"></script>';
36 36
 $htmlHeadXtra[] = '<script>
37 37
 $(document).ready(function() {
38 38
     var $image = $("#previewImage");
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
 if (api_is_western_name_order()) {
169 169
     //    FIRST NAME and LAST NAME
170 170
     $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40));
171
-    $form->addElement('text', 'lastname',  get_lang('LastName'),  array('size' => 40));
171
+    $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40));
172 172
 } else {
173 173
     //    LAST NAME and FIRST NAME
174
-    $form->addElement('text', 'lastname',  get_lang('LastName'),  array('size' => 40));
174
+    $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40));
175 175
     $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40));
176 176
 }
177 177
 if (api_get_setting('profile', 'name') !== 'true') {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 $form->applyFilter(array('lastname', 'firstname'), 'stripslashes');
181 181
 $form->applyFilter(array('lastname', 'firstname'), 'trim');
182 182
 $form->applyFilter(array('lastname', 'firstname'), 'html_filter');
183
-$form->addRule('lastname' , get_lang('ThisFieldIsRequired'), 'required');
183
+$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
184 184
 $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
185 185
 
186 186
 //    USERNAME
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     $form->freeze('email');
224 224
 }
225 225
 
226
-if (api_get_setting('registration', 'email') == 'true' &&  api_get_setting('profile', 'email') == 'true') {
226
+if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profile', 'email') == 'true') {
227 227
     $form->applyFilter('email', 'stripslashes');
228 228
     $form->applyFilter('email', 'trim');
229 229
     $form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
 // the $jquery_ready_content variable collects all functions that
391 391
 // will be load in the $(document).ready javascript function
392
-$htmlHeadXtra[] ='<script>
392
+$htmlHeadXtra[] = '<script>
393 393
 $(document).ready(function(){
394 394
     '.$jquery_ready_content.'
395 395
 });
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 
546 546
             if (!check_user_email($user_data['email']) &&
547 547
                 empty($user_data['password0'])
548
-            ){
548
+            ) {
549 549
                 Display::addFlash(
550 550
                     Display:: return_message(
551 551
                         get_lang('ToChangeYourEmailMustTypeYourPassword'),
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
     $available_values_to_modify = array();
655 655
     foreach ($profile_list as $key => $status) {
656 656
         if ($status == 'true') {
657
-            switch($key) {
657
+            switch ($key) {
658 658
                 case 'login':
659 659
                     $available_values_to_modify[] = 'username';
660 660
                     break;
@@ -787,10 +787,10 @@  discard block
 block discarded – undo
787 787
 
788 788
         if (isset($_GET['type']) && $_GET['type'] == 'extended') {
789 789
             $actions .= '<a href="profile.php?type=reduced'.$show.'">'.
790
-                Display::return_icon('edit.png', get_lang('EditNormalProfile'),'',16).'</a>';
790
+                Display::return_icon('edit.png', get_lang('EditNormalProfile'), '', 16).'</a>';
791 791
         } else {
792 792
             $actions .= '<a href="profile.php?type=extended'.$show.'">'.
793
-                Display::return_icon('edit.png', get_lang('EditExtendProfile'),'',16).'</a>';
793
+                Display::return_icon('edit.png', get_lang('EditExtendProfile'), '', 16).'</a>';
794 794
         }
795 795
         $actions .= '</div>';
796 796
     }
Please login to merge, or discard this patch.
main/auth/cas/logout.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,5 +9,5 @@
 block discarded – undo
9 9
 require_once('authcas.php');
10 10
 global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri;
11 11
 
12
-phpCAS::client($cas_auth_ver,$cas_auth_server,$cas_auth_port,$cas_auth_uri);
12
+phpCAS::client($cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri);
13 13
 phpCAS::logout();
Please login to merge, or discard this patch.
main/auth/cas/logincas.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
         $firstpage = $_GET['firstpage'];
40 40
         setcookie("GotoCourse", $firstpage);
41 41
     }
42
-    if (!is_object($PHPCAS_CLIENT) ) {
42
+    if (!is_object($PHPCAS_CLIENT)) {
43 43
         phpCAS::client(
44 44
             $cas_auth_ver,
45 45
             $cas_auth_server,
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/PGTStorage/pgt-file.php 4 patches
Switch Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -163,12 +163,12 @@
 block discarded – undo
163 163
       $this->_path = $path;
164 164
       // check the format and store it
165 165
       switch ($format) {
166
-      case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
167
-      case CAS_PGT_STORAGE_FILE_FORMAT_XML:
168
-	$this->_format = $format;
169
-	break;
170
-      default:
171
-	phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
166
+          case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
167
+          case CAS_PGT_STORAGE_FILE_FORMAT_XML:
168
+	    $this->_format = $format;
169
+	    break;
170
+          default:
171
+	    phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
172 172
       }
173 173
       phpCAS::traceEnd();      
174 174
     }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -131,17 +131,17 @@  discard block
 block discarded – undo
131 131
    *
132 132
    * @public
133 133
    */
134
-  function PGTStorageFile($cas_parent,$format,$path)
134
+  function PGTStorageFile($cas_parent, $format, $path)
135 135
     {
136 136
       phpCAS::traceBegin();
137 137
       // call the ancestor's constructor
138 138
       $this->PGTStorage($cas_parent);
139 139
 
140
-      if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
141
-      if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
140
+      if (empty($format)) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
141
+      if (empty($path)) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
142 142
 
143 143
       // check that the path is an absolute path
144
-      if (getenv("OS")=="Windows_NT"){
144
+      if (getenv("OS") == "Windows_NT") {
145 145
       	
146 146
       	 if (!preg_match('`^[a-zA-Z]:`', $path)) {
147 147
 	     	phpCAS::error('an absolute path is needed for PGT storage to file');
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
       else
152 152
       {
153 153
       
154
-      	if ( $path[0] != '/' ) {
154
+      	if ($path[0] != '/') {
155 155
 			phpCAS::error('an absolute path is needed for PGT storage to file');
156 156
       	}
157 157
 
158 158
       	// store the path (with a leading and trailing '/')      
159
-      	$path = preg_replace('|[/]*$|','/',$path);
160
-      	$path = preg_replace('|^[/]*|','/',$path);
159
+      	$path = preg_replace('|[/]*$|', '/', $path);
160
+      	$path = preg_replace('|^[/]*|', '/', $path);
161 161
       }
162 162
       
163 163
       $this->_path = $path;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     {
187 187
       phpCAS::traceBegin();
188 188
       // if the storage has already been initialized, return immediatly
189
-      if ( $this->isInitialized() )
189
+      if ($this->isInitialized())
190 190
 	return;
191 191
       // call the ancestor's method (mark as initialized)
192 192
       parent::init();
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
    *
223 223
    * @public
224 224
    */
225
-  function write($pgt,$pgt_iou)
225
+  function write($pgt, $pgt_iou)
226 226
     {
227 227
       phpCAS::traceBegin();
228 228
       $fname = $this->getPGTIouFilename($pgt_iou);
229
-      if ( $f=fopen($fname,"w") ) {
230
-	if ( fputs($f,$pgt) === FALSE ) {
229
+      if ($f = fopen($fname, "w")) {
230
+	if (fputs($f, $pgt) === FALSE) {
231 231
 	  phpCAS::error('could not write PGT to `'.$fname.'\'');
232 232
 	}
233 233
 	fclose($f);
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
       phpCAS::traceBegin();
253 253
       $pgt = FALSE;
254 254
       $fname = $this->getPGTIouFilename($pgt_iou);
255
-      if ( !($f=fopen($fname,"r")) ) {
255
+      if (!($f = fopen($fname, "r"))) {
256 256
 	phpCAS::trace('could not open `'.$fname.'\'');
257 257
       } else {
258
-	if ( ($pgt=fgets($f)) === FALSE ) {
258
+	if (($pgt = fgets($f)) === FALSE) {
259 259
 	  phpCAS::trace('could not read PGT from `'.$fname.'\'');
260 260
 	} 
261 261
 	fclose($f);
Please login to merge, or discard this patch.
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -137,8 +137,12 @@  discard block
 block discarded – undo
137 137
       // call the ancestor's constructor
138 138
       $this->PGTStorage($cas_parent);
139 139
 
140
-      if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
141
-      if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
140
+      if (empty($format) ) {
141
+          $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
142
+      }
143
+      if (empty($path) ) {
144
+          $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
145
+      }
142 146
 
143 147
       // check that the path is an absolute path
144 148
       if (getenv("OS")=="Windows_NT"){
@@ -147,8 +151,7 @@  discard block
 block discarded – undo
147 151
 	     	phpCAS::error('an absolute path is needed for PGT storage to file');
148 152
       	}
149 153
       	
150
-      }
151
-      else
154
+      } else
152 155
       {
153 156
       
154 157
       	if ( $path[0] != '/' ) {
@@ -186,8 +189,9 @@  discard block
 block discarded – undo
186 189
     {
187 190
       phpCAS::traceBegin();
188 191
       // if the storage has already been initialized, return immediatly
189
-      if ( $this->isInitialized() )
190
-	return;
192
+      if ( $this->isInitialized() ) {
193
+      	return;
194
+      }
191 195
       // call the ancestor's method (mark as initialized)
192 196
       parent::init();
193 197
       phpCAS::traceEnd();      
Please login to merge, or discard this patch.
Indentation   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -44,231 +44,231 @@
 block discarded – undo
44 44
 
45 45
 class PGTStorageFile extends PGTStorage
46 46
 {
47
-  /** 
48
-   * @addtogroup internalPGTStorageFile 
49
-   * @{ 
50
-   */
47
+    /** 
48
+     * @addtogroup internalPGTStorageFile 
49
+     * @{ 
50
+     */
51 51
 
52
-  /**
53
-   * a string telling where PGT's should be stored on the filesystem. Written by
54
-   * PGTStorageFile::PGTStorageFile(), read by getPath().
55
-   *
56
-   * @private
57
-   */
58
-  var $_path;
52
+    /**
53
+     * a string telling where PGT's should be stored on the filesystem. Written by
54
+     * PGTStorageFile::PGTStorageFile(), read by getPath().
55
+     *
56
+     * @private
57
+     */
58
+    var $_path;
59 59
 
60
-  /**
61
-   * This method returns the name of the directory where PGT's should be stored 
62
-   * on the filesystem.
63
-   *
64
-   * @return the name of a directory (with leading and trailing '/')
65
-   *
66
-   * @private
67
-   */
68
-  function getPath()
60
+    /**
61
+     * This method returns the name of the directory where PGT's should be stored 
62
+     * on the filesystem.
63
+     *
64
+     * @return the name of a directory (with leading and trailing '/')
65
+     *
66
+     * @private
67
+     */
68
+    function getPath()
69 69
     {
70
-      return $this->_path;
70
+        return $this->_path;
71 71
     }
72 72
 
73
-  /**
74
-   * a string telling the format to use to store PGT's (plain or xml). Written by
75
-   * PGTStorageFile::PGTStorageFile(), read by getFormat().
76
-   *
77
-   * @private
78
-   */
79
-  var $_format;
73
+    /**
74
+     * a string telling the format to use to store PGT's (plain or xml). Written by
75
+     * PGTStorageFile::PGTStorageFile(), read by getFormat().
76
+     *
77
+     * @private
78
+     */
79
+    var $_format;
80 80
 
81
-  /**
82
-   * This method returns the format to use when storing PGT's on the filesystem.
83
-   *
84
-   * @return a string corresponding to the format used (plain or xml).
85
-   *
86
-   * @private
87
-   */
88
-  function getFormat()
81
+    /**
82
+     * This method returns the format to use when storing PGT's on the filesystem.
83
+     *
84
+     * @return a string corresponding to the format used (plain or xml).
85
+     *
86
+     * @private
87
+     */
88
+    function getFormat()
89 89
     {
90
-      return $this->_format;
90
+        return $this->_format;
91 91
     }
92 92
 
93
-  // ########################################################################
94
-  //  DEBUGGING
95
-  // ########################################################################
93
+    // ########################################################################
94
+    //  DEBUGGING
95
+    // ########################################################################
96 96
   
97
-  /**
98
-   * This method returns an informational string giving the type of storage
99
-   * used by the object (used for debugging purposes).
100
-   *
101
-   * @return string informational string.
102
-   * @public
103
-   */
104
-  function getStorageType()
97
+    /**
98
+     * This method returns an informational string giving the type of storage
99
+     * used by the object (used for debugging purposes).
100
+     *
101
+     * @return string informational string.
102
+     * @public
103
+     */
104
+    function getStorageType()
105 105
     {
106
-      return "file";
106
+        return "file";
107 107
     }
108 108
 
109
-  /**
110
-   * This method returns an informational string giving informations on the
111
-   * parameters of the storage.(used for debugging purposes).
112
-   *
113
-   * @return string informational string.
114
-   * @public
115
-   */
116
-  function getStorageInfo()
109
+    /**
110
+     * This method returns an informational string giving informations on the
111
+     * parameters of the storage.(used for debugging purposes).
112
+     *
113
+     * @return string informational string.
114
+     * @public
115
+     */
116
+    function getStorageInfo()
117 117
     {
118
-      return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
118
+        return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
119 119
     }
120 120
 
121
-  // ########################################################################
122
-  //  CONSTRUCTOR
123
-  // ########################################################################
121
+    // ########################################################################
122
+    //  CONSTRUCTOR
123
+    // ########################################################################
124 124
   
125
-  /**
126
-   * The class constructor, called by CASClient::SetPGTStorageFile().
127
-   *
128
-   * @param CASClient $cas_parent the CASClient instance that creates the object.
129
-   * @param string $format the format used to store the PGT's (`plain' and `xml' allowed).
130
-   * @param string $path the path where the PGT's should be stored
131
-   *
132
-   * @public
133
-   */
134
-  function PGTStorageFile($cas_parent,$format,$path)
125
+    /**
126
+     * The class constructor, called by CASClient::SetPGTStorageFile().
127
+     *
128
+     * @param CASClient $cas_parent the CASClient instance that creates the object.
129
+     * @param string $format the format used to store the PGT's (`plain' and `xml' allowed).
130
+     * @param string $path the path where the PGT's should be stored
131
+     *
132
+     * @public
133
+     */
134
+    function PGTStorageFile($cas_parent,$format,$path)
135 135
     {
136
-      phpCAS::traceBegin();
137
-      // call the ancestor's constructor
138
-      $this->PGTStorage($cas_parent);
136
+        phpCAS::traceBegin();
137
+        // call the ancestor's constructor
138
+        $this->PGTStorage($cas_parent);
139 139
 
140
-      if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
141
-      if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
140
+        if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
141
+        if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
142 142
 
143
-      // check that the path is an absolute path
144
-      if (getenv("OS")=="Windows_NT"){
143
+        // check that the path is an absolute path
144
+        if (getenv("OS")=="Windows_NT"){
145 145
       	
146
-      	 if (!preg_match('`^[a-zA-Z]:`', $path)) {
147
-	     	phpCAS::error('an absolute path is needed for PGT storage to file');
148
-      	}
146
+            if (!preg_match('`^[a-zA-Z]:`', $path)) {
147
+                phpCAS::error('an absolute path is needed for PGT storage to file');
148
+            }
149 149
       	
150
-      }
151
-      else
152
-      {
150
+        }
151
+        else
152
+        {
153 153
       
154
-      	if ( $path[0] != '/' ) {
155
-			phpCAS::error('an absolute path is needed for PGT storage to file');
156
-      	}
154
+            if ( $path[0] != '/' ) {
155
+            phpCAS::error('an absolute path is needed for PGT storage to file');
156
+            }
157 157
 
158
-      	// store the path (with a leading and trailing '/')      
159
-      	$path = preg_replace('|[/]*$|','/',$path);
160
-      	$path = preg_replace('|^[/]*|','/',$path);
161
-      }
158
+            // store the path (with a leading and trailing '/')      
159
+            $path = preg_replace('|[/]*$|','/',$path);
160
+            $path = preg_replace('|^[/]*|','/',$path);
161
+        }
162 162
       
163
-      $this->_path = $path;
164
-      // check the format and store it
165
-      switch ($format) {
166
-      case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
163
+        $this->_path = $path;
164
+        // check the format and store it
165
+        switch ($format) {
166
+        case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
167 167
       case CAS_PGT_STORAGE_FILE_FORMAT_XML:
168
-	$this->_format = $format;
169
-	break;
170
-      default:
171
-	phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
172
-      }
173
-      phpCAS::traceEnd();      
168
+    $this->_format = $format;
169
+    break;
170
+        default:
171
+    phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
172
+        }
173
+        phpCAS::traceEnd();      
174 174
     }
175 175
 
176
-  // ########################################################################
177
-  //  INITIALIZATION
178
-  // ########################################################################
176
+    // ########################################################################
177
+    //  INITIALIZATION
178
+    // ########################################################################
179 179
   
180
-  /**
181
-   * This method is used to initialize the storage. Halts on error.
182
-   *
183
-   * @public
184
-   */
185
-  function init()
180
+    /**
181
+     * This method is used to initialize the storage. Halts on error.
182
+     *
183
+     * @public
184
+     */
185
+    function init()
186 186
     {
187
-      phpCAS::traceBegin();
188
-      // if the storage has already been initialized, return immediatly
189
-      if ( $this->isInitialized() )
190
-	return;
191
-      // call the ancestor's method (mark as initialized)
192
-      parent::init();
193
-      phpCAS::traceEnd();      
187
+        phpCAS::traceBegin();
188
+        // if the storage has already been initialized, return immediatly
189
+        if ( $this->isInitialized() )
190
+    return;
191
+        // call the ancestor's method (mark as initialized)
192
+        parent::init();
193
+        phpCAS::traceEnd();      
194 194
     }
195 195
 
196
-  // ########################################################################
197
-  //  PGT I/O
198
-  // ########################################################################
196
+    // ########################################################################
197
+    //  PGT I/O
198
+    // ########################################################################
199 199
 
200
-  /**
201
-   * This method returns the filename corresponding to a PGT Iou.
202
-   *
203
-   * @param $pgt_iou the PGT iou.
204
-   *
205
-   * @return string filename
206
-   * @private
207
-   */
208
-  function getPGTIouFilename($pgt_iou)
200
+    /**
201
+     * This method returns the filename corresponding to a PGT Iou.
202
+     *
203
+     * @param $pgt_iou the PGT iou.
204
+     *
205
+     * @return string filename
206
+     * @private
207
+     */
208
+    function getPGTIouFilename($pgt_iou)
209 209
     {
210
-      phpCAS::traceBegin();
211
-      $filename = $this->getPath().$pgt_iou.'.'.$this->getFormat();
212
-      phpCAS::traceEnd($filename);
213
-      return $filename;
210
+        phpCAS::traceBegin();
211
+        $filename = $this->getPath().$pgt_iou.'.'.$this->getFormat();
212
+        phpCAS::traceEnd($filename);
213
+        return $filename;
214 214
     }
215 215
   
216
-  /**
217
-   * This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
218
-   * warning on error.
219
-   *
220
-   * @param $pgt the PGT
221
-   * @param $pgt_iou the PGT iou
222
-   *
223
-   * @public
224
-   */
225
-  function write($pgt,$pgt_iou)
216
+    /**
217
+     * This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
218
+     * warning on error.
219
+     *
220
+     * @param $pgt the PGT
221
+     * @param $pgt_iou the PGT iou
222
+     *
223
+     * @public
224
+     */
225
+    function write($pgt,$pgt_iou)
226 226
     {
227
-      phpCAS::traceBegin();
228
-      $fname = $this->getPGTIouFilename($pgt_iou);
229
-      if ( $f=fopen($fname,"w") ) {
230
-	if ( fputs($f,$pgt) === FALSE ) {
231
-	  phpCAS::error('could not write PGT to `'.$fname.'\'');
232
-	}
233
-	fclose($f);
234
-      } else {
235
-	phpCAS::error('could not open `'.$fname.'\'');
236
-      }
237
-      phpCAS::traceEnd();      
227
+        phpCAS::traceBegin();
228
+        $fname = $this->getPGTIouFilename($pgt_iou);
229
+        if ( $f=fopen($fname,"w") ) {
230
+    if ( fputs($f,$pgt) === FALSE ) {
231
+        phpCAS::error('could not write PGT to `'.$fname.'\'');
232
+    }
233
+    fclose($f);
234
+        } else {
235
+    phpCAS::error('could not open `'.$fname.'\'');
236
+        }
237
+        phpCAS::traceEnd();      
238 238
     }
239 239
 
240
-  /**
241
-   * This method reads a PGT corresponding to a PGT Iou and deletes the 
242
-   * corresponding file.
243
-   *
244
-   * @param $pgt_iou the PGT iou
245
-   *
246
-   * @return false|string corresponding PGT, or FALSE on error
247
-   *
248
-   * @public
249
-   */
250
-  function read($pgt_iou)
240
+    /**
241
+     * This method reads a PGT corresponding to a PGT Iou and deletes the 
242
+     * corresponding file.
243
+     *
244
+     * @param $pgt_iou the PGT iou
245
+     *
246
+     * @return false|string corresponding PGT, or FALSE on error
247
+     *
248
+     * @public
249
+     */
250
+    function read($pgt_iou)
251 251
     {
252
-      phpCAS::traceBegin();
253
-      $pgt = FALSE;
254
-      $fname = $this->getPGTIouFilename($pgt_iou);
255
-      if ( !($f=fopen($fname,"r")) ) {
256
-	phpCAS::trace('could not open `'.$fname.'\'');
257
-      } else {
258
-	if ( ($pgt=fgets($f)) === FALSE ) {
259
-	  phpCAS::trace('could not read PGT from `'.$fname.'\'');
260
-	} 
261
-	fclose($f);
262
-      }
252
+        phpCAS::traceBegin();
253
+        $pgt = FALSE;
254
+        $fname = $this->getPGTIouFilename($pgt_iou);
255
+        if ( !($f=fopen($fname,"r")) ) {
256
+    phpCAS::trace('could not open `'.$fname.'\'');
257
+        } else {
258
+    if ( ($pgt=fgets($f)) === FALSE ) {
259
+        phpCAS::trace('could not read PGT from `'.$fname.'\'');
260
+    } 
261
+    fclose($f);
262
+        }
263 263
 
264
-      // delete the PGT file
265
-      @unlink($fname);
264
+        // delete the PGT file
265
+        @unlink($fname);
266 266
 
267
-      phpCAS::traceEnd($pgt);
268
-      return $pgt;
267
+        phpCAS::traceEnd($pgt);
268
+        return $pgt;
269 269
     }
270 270
   
271
-  /** @} */
271
+    /** @} */
272 272
   
273 273
 }
274 274
 
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/PGTStorage/pgt-db.php 3 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
    * @hideinitializer
58 58
    * @private
59 59
    */
60
-  var $_url='';
60
+  var $_url = '';
61 61
 
62 62
   /**
63 63
    * This method returns the PEAR DB URL to use to connect to the database.
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
    *
160 160
    * @public
161 161
    */
162
-  function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
162
+  function PGTStorageDB($cas_parent, $user, $password, $database_type, $hostname, $port, $database, $table)
163 163
     {
164 164
       phpCAS::traceBegin();
165 165
 
166 166
       // call the ancestor's constructor
167 167
       $this->PGTStorage($cas_parent);
168 168
 
169
-      if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
170
-      if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
171
-      if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
172
-      if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
173
-      if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
169
+      if (empty($database_type)) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
170
+      if (empty($hostname)) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
171
+      if ($port == 0) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
172
+      if (empty($database)) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
173
+      if (empty($table)) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
174 174
 
175 175
       // build and store the PEAR DB URL
176 176
       $this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     {
193 193
       phpCAS::traceBegin();
194 194
       // if the storage has already been initialized, return immediatly
195
-      if ( $this->isInitialized() )
195
+      if ($this->isInitialized())
196 196
 		return;
197 197
       // call the ancestor's method (mark as initialized)
198 198
       parent::init();
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
       // try to connect to the database
207 207
       $this->_link = DB::connect($this->getURL());
208
-      if ( DB::isError($this->_link) ) {
208
+      if (DB::isError($this->_link)) {
209 209
 	phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
210 210
       }
211 211
       var_dump($this->_link);
Please login to merge, or discard this patch.
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -166,11 +166,21 @@  discard block
 block discarded – undo
166 166
       // call the ancestor's constructor
167 167
       $this->PGTStorage($cas_parent);
168 168
 
169
-      if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
170
-      if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
171
-      if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
172
-      if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
173
-      if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
169
+      if ( empty($database_type) ) {
170
+          $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
171
+      }
172
+      if ( empty($hostname) ) {
173
+          $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
174
+      }
175
+      if ( $port==0 ) {
176
+          $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
177
+      }
178
+      if ( empty($database) ) {
179
+          $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
180
+      }
181
+      if ( empty($table) ) {
182
+          $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
183
+      }
174 184
 
175 185
       // build and store the PEAR DB URL
176 186
       $this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
@@ -192,8 +202,9 @@  discard block
 block discarded – undo
192 202
     {
193 203
       phpCAS::traceBegin();
194 204
       // if the storage has already been initialized, return immediatly
195
-      if ( $this->isInitialized() )
196
-		return;
205
+      if ( $this->isInitialized() ) {
206
+      		return;
207
+      }
197 208
       // call the ancestor's method (mark as initialized)
198 209
       parent::init();
199 210
       
Please login to merge, or discard this patch.
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -45,175 +45,175 @@
 block discarded – undo
45 45
 
46 46
 class PGTStorageDB extends PGTStorage
47 47
 {
48
-  /** 
49
-   * @addtogroup internalPGTStorageDB
50
-   * @{ 
51
-   */
52
-
53
-  /**
54
-   * a string representing a PEAR DB URL to connect to the database. Written by
55
-   * PGTStorageDB::PGTStorageDB(), read by getURL().
56
-   *
57
-   * @hideinitializer
58
-   * @private
59
-   */
60
-  var $_url='';
61
-
62
-  /**
63
-   * This method returns the PEAR DB URL to use to connect to the database.
64
-   *
65
-   * @return string PEAR DB URL
66
-   *
67
-   * @private
68
-   */
69
-  function getURL()
48
+    /** 
49
+     * @addtogroup internalPGTStorageDB
50
+     * @{ 
51
+     */
52
+
53
+    /**
54
+     * a string representing a PEAR DB URL to connect to the database. Written by
55
+     * PGTStorageDB::PGTStorageDB(), read by getURL().
56
+     *
57
+     * @hideinitializer
58
+     * @private
59
+     */
60
+    var $_url='';
61
+
62
+    /**
63
+     * This method returns the PEAR DB URL to use to connect to the database.
64
+     *
65
+     * @return string PEAR DB URL
66
+     *
67
+     * @private
68
+     */
69
+    function getURL()
70 70
     {
71
-      return $this->_url;
71
+        return $this->_url;
72 72
     }
73 73
 
74
-  /**
75
-   * The handle of the connection to the database where PGT's are stored. Written by
76
-   * PGTStorageDB::init(), read by getLink().
77
-   *
78
-   * @hideinitializer
79
-   * @private
80
-   */
81
-  var $_link = null;
82
-
83
-  /**
84
-   * This method returns the handle of the connection to the database where PGT's are 
85
-   * stored.
86
-   *
87
-   * @return a handle of connection.
88
-   *
89
-   * @private
90
-   */
91
-  function getLink()
74
+    /**
75
+     * The handle of the connection to the database where PGT's are stored. Written by
76
+     * PGTStorageDB::init(), read by getLink().
77
+     *
78
+     * @hideinitializer
79
+     * @private
80
+     */
81
+    var $_link = null;
82
+
83
+    /**
84
+     * This method returns the handle of the connection to the database where PGT's are 
85
+     * stored.
86
+     *
87
+     * @return a handle of connection.
88
+     *
89
+     * @private
90
+     */
91
+    function getLink()
92 92
     {
93
-      return $this->_link;
93
+        return $this->_link;
94 94
     }
95 95
 
96
-  /**
97
-   * The name of the table where PGT's are stored. Written by 
98
-   * PGTStorageDB::PGTStorageDB(), read by getTable().
99
-   *
100
-   * @hideinitializer
101
-   * @private
102
-   */
103
-  var $_table = '';
104
-
105
-  /**
106
-   * This method returns the name of the table where PGT's are stored.
107
-   *
108
-   * @return string name of a table.
109
-   *
110
-   * @private
111
-   */
112
-  function getTable()
96
+    /**
97
+     * The name of the table where PGT's are stored. Written by 
98
+     * PGTStorageDB::PGTStorageDB(), read by getTable().
99
+     *
100
+     * @hideinitializer
101
+     * @private
102
+     */
103
+    var $_table = '';
104
+
105
+    /**
106
+     * This method returns the name of the table where PGT's are stored.
107
+     *
108
+     * @return string name of a table.
109
+     *
110
+     * @private
111
+     */
112
+    function getTable()
113 113
     {
114
-      return $this->_table;
114
+        return $this->_table;
115 115
     }
116 116
 
117
-  // ########################################################################
118
-  //  DEBUGGING
119
-  // ########################################################################
117
+    // ########################################################################
118
+    //  DEBUGGING
119
+    // ########################################################################
120 120
   
121
-  /**
122
-   * This method returns an informational string giving the type of storage
123
-   * used by the object (used for debugging purposes).
124
-   *
125
-   * @return string informational string.
126
-   * @public
127
-   */
128
-  function getStorageType()
121
+    /**
122
+     * This method returns an informational string giving the type of storage
123
+     * used by the object (used for debugging purposes).
124
+     *
125
+     * @return string informational string.
126
+     * @public
127
+     */
128
+    function getStorageType()
129 129
     {
130
-      return "database";
130
+        return "database";
131 131
     }
132 132
 
133
-  /**
134
-   * This method returns an informational string giving informations on the
135
-   * parameters of the storage.(used for debugging purposes).
136
-   *
137
-   * @public
138
-   */
139
-  function getStorageInfo()
133
+    /**
134
+     * This method returns an informational string giving informations on the
135
+     * parameters of the storage.(used for debugging purposes).
136
+     *
137
+     * @public
138
+     */
139
+    function getStorageInfo()
140 140
     {
141
-      return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
141
+        return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
142 142
     }
143 143
 
144
-  // ########################################################################
145
-  //  CONSTRUCTOR
146
-  // ########################################################################
144
+    // ########################################################################
145
+    //  CONSTRUCTOR
146
+    // ########################################################################
147 147
   
148
-  /**
149
-   * The class constructor, called by CASClient::SetPGTStorageDB().
150
-   *
151
-   * @param CASClient $cas_parent the CASClient instance that creates the object.
152
-   * @param $user the user to access the data with
153
-   * @param $password the user's password
154
-   * @param $database_type the type of the database hosting the data
155
-   * @param $hostname the server hosting the database
156
-   * @param $port the port the server is listening on
157
-   * @param $database the name of the database
158
-   * @param $table the name of the table storing the data
159
-   *
160
-   * @public
161
-   */
162
-  function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
148
+    /**
149
+     * The class constructor, called by CASClient::SetPGTStorageDB().
150
+     *
151
+     * @param CASClient $cas_parent the CASClient instance that creates the object.
152
+     * @param $user the user to access the data with
153
+     * @param $password the user's password
154
+     * @param $database_type the type of the database hosting the data
155
+     * @param $hostname the server hosting the database
156
+     * @param $port the port the server is listening on
157
+     * @param $database the name of the database
158
+     * @param $table the name of the table storing the data
159
+     *
160
+     * @public
161
+     */
162
+    function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
163 163
     {
164
-      phpCAS::traceBegin();
164
+        phpCAS::traceBegin();
165 165
 
166
-      // call the ancestor's constructor
167
-      $this->PGTStorage($cas_parent);
166
+        // call the ancestor's constructor
167
+        $this->PGTStorage($cas_parent);
168 168
 
169
-      if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
170
-      if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
171
-      if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
172
-      if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
173
-      if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
169
+        if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
170
+        if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
171
+        if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
172
+        if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
173
+        if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
174 174
 
175
-      // build and store the PEAR DB URL
176
-      $this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
175
+        // build and store the PEAR DB URL
176
+        $this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
177 177
 
178
-      // XXX should use setURL and setTable
179
-      phpCAS::traceEnd();
178
+        // XXX should use setURL and setTable
179
+        phpCAS::traceEnd();
180 180
     }
181 181
   
182
-  // ########################################################################
183
-  //  INITIALIZATION
184
-  // ########################################################################
182
+    // ########################################################################
183
+    //  INITIALIZATION
184
+    // ########################################################################
185 185
   
186
-  /**
187
-   * This method is used to initialize the storage. Halts on error.
188
-   *
189
-   * @public
190
-   */
191
-  function init()
186
+    /**
187
+     * This method is used to initialize the storage. Halts on error.
188
+     *
189
+     * @public
190
+     */
191
+    function init()
192 192
     {
193
-      phpCAS::traceBegin();
194
-      // if the storage has already been initialized, return immediatly
195
-      if ( $this->isInitialized() )
196
-		return;
197
-      // call the ancestor's method (mark as initialized)
198
-      parent::init();
193
+        phpCAS::traceBegin();
194
+        // if the storage has already been initialized, return immediatly
195
+        if ( $this->isInitialized() )
196
+        return;
197
+        // call the ancestor's method (mark as initialized)
198
+        parent::init();
199 199
       
200
-	  //include phpDB library (the test was introduced in release 0.4.8 for 
201
-	  //the integration into Tikiwiki).
202
-	  if (!class_exists('DB')) {
203
-		include_once('DB.php');
204
-	  }
205
-
206
-      // try to connect to the database
207
-      $this->_link = DB::connect($this->getURL());
208
-      if ( DB::isError($this->_link) ) {
209
-	    phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
210
-      }
211
-      // Dump into trace
212
-      var_dump($this->_link);
213
-      phpCAS::traceBEnd();
200
+        //include phpDB library (the test was introduced in release 0.4.8 for 
201
+        //the integration into Tikiwiki).
202
+        if (!class_exists('DB')) {
203
+        include_once('DB.php');
204
+        }
205
+
206
+        // try to connect to the database
207
+        $this->_link = DB::connect($this->getURL());
208
+        if ( DB::isError($this->_link) ) {
209
+        phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
210
+        }
211
+        // Dump into trace
212
+        var_dump($this->_link);
213
+        phpCAS::traceBEnd();
214 214
     }
215 215
 
216
-  /** @} */
216
+    /** @} */
217 217
 }
218 218
 
219 219
 ?>
220 220
\ No newline at end of file
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/PGTStorage/pgt-main.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
   function PGTStorage($cas_parent)
64 64
     {
65 65
       phpCAS::traceBegin();
66
-      if ( !$cas_parent->isProxy() ) {
66
+      if (!$cas_parent->isProxy()) {
67 67
 	phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy'); 
68 68
       }
69 69
       phpCAS::traceEnd();
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
    * @private
108 108
    * @deprecated not used.
109 109
    */
110
-  var $_error_message=FALSE;
110
+  var $_error_message = FALSE;
111 111
 
112 112
   /**
113 113
    * This method sets en error message, which can be read later by 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
    *
186 186
    * @protected
187 187
    */
188
-  function write($pgt,$pgt_iou)
188
+  function write($pgt, $pgt_iou)
189 189
     {
190 190
       phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
191 191
     }
Please login to merge, or discard this patch.
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -44,167 +44,167 @@
 block discarded – undo
44 44
 
45 45
 class PGTStorage
46 46
 {
47
-  /** 
48
-   * @addtogroup internalPGTStorage
49
-   * @{ 
50
-   */
51
-
52
-  // ########################################################################
53
-  //  CONSTRUCTOR
54
-  // ########################################################################
47
+    /** 
48
+     * @addtogroup internalPGTStorage
49
+     * @{ 
50
+     */
51
+
52
+    // ########################################################################
53
+    //  CONSTRUCTOR
54
+    // ########################################################################
55 55
   
56
-  /**
57
-   * The constructor of the class, should be called only by inherited classes.
58
-   *
59
-   * @param $cas_parent the CASclient instance that creates the current object.
60
-   *
61
-   * @protected
62
-   */
63
-  function PGTStorage($cas_parent)
56
+    /**
57
+     * The constructor of the class, should be called only by inherited classes.
58
+     *
59
+     * @param $cas_parent the CASclient instance that creates the current object.
60
+     *
61
+     * @protected
62
+     */
63
+    function PGTStorage($cas_parent)
64 64
     {
65
-      phpCAS::traceBegin();
66
-      if ( !$cas_parent->isProxy() ) {
67
-	phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy'); 
68
-      }
69
-      phpCAS::traceEnd();
65
+        phpCAS::traceBegin();
66
+        if ( !$cas_parent->isProxy() ) {
67
+    phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy'); 
68
+        }
69
+        phpCAS::traceEnd();
70 70
     }
71 71
 
72
-  // ########################################################################
73
-  //  DEBUGGING
74
-  // ########################################################################
72
+    // ########################################################################
73
+    //  DEBUGGING
74
+    // ########################################################################
75 75
   
76
-  /**
77
-   * This virtual method returns an informational string giving the type of storage
78
-   * used by the object (used for debugging purposes).
79
-   *
80
-   * @public
81
-   */
82
-  function getStorageType()
76
+    /**
77
+     * This virtual method returns an informational string giving the type of storage
78
+     * used by the object (used for debugging purposes).
79
+     *
80
+     * @public
81
+     */
82
+    function getStorageType()
83 83
     {
84
-      phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
84
+        phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
85 85
     }
86 86
 
87
-  /**
88
-   * This virtual method returns an informational string giving informations on the
89
-   * parameters of the storage.(used for debugging purposes).
90
-   *
91
-   * @public
92
-   */
93
-  function getStorageInfo()
87
+    /**
88
+     * This virtual method returns an informational string giving informations on the
89
+     * parameters of the storage.(used for debugging purposes).
90
+     *
91
+     * @public
92
+     */
93
+    function getStorageInfo()
94 94
     {
95
-      phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
95
+        phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
96 96
     }
97 97
 
98
-  // ########################################################################
99
-  //  ERROR HANDLING
100
-  // ########################################################################
98
+    // ########################################################################
99
+    //  ERROR HANDLING
100
+    // ########################################################################
101 101
   
102
-  /**
103
-   * string used to store an error message. Written by PGTStorage::setErrorMessage(),
104
-   * read by PGTStorage::getErrorMessage().
105
-   *
106
-   * @hideinitializer
107
-   * @private
108
-   * @deprecated not used.
109
-   */
110
-  var $_error_message=FALSE;
111
-
112
-  /**
113
-   * This method sets en error message, which can be read later by 
114
-   * PGTStorage::getErrorMessage().
115
-   *
116
-   * @param $error_message an error message
117
-   *
118
-   * @protected
119
-   * @deprecated not used.
120
-   */
121
-  function setErrorMessage($error_message)
102
+    /**
103
+     * string used to store an error message. Written by PGTStorage::setErrorMessage(),
104
+     * read by PGTStorage::getErrorMessage().
105
+     *
106
+     * @hideinitializer
107
+     * @private
108
+     * @deprecated not used.
109
+     */
110
+    var $_error_message=FALSE;
111
+
112
+    /**
113
+     * This method sets en error message, which can be read later by 
114
+     * PGTStorage::getErrorMessage().
115
+     *
116
+     * @param $error_message an error message
117
+     *
118
+     * @protected
119
+     * @deprecated not used.
120
+     */
121
+    function setErrorMessage($error_message)
122 122
     {
123
-      $this->_error_message = $error_message;
123
+        $this->_error_message = $error_message;
124 124
     }
125 125
 
126
-  /**
127
-   * This method returns an error message set by PGTStorage::setErrorMessage().
128
-   *
129
-   * @return boolean error message when set by PGTStorage::setErrorMessage(), FALSE
130
-   * otherwise.
131
-   *
132
-   * @public
133
-   * @deprecated not used.
134
-   */
135
-  function getErrorMessage()
126
+    /**
127
+     * This method returns an error message set by PGTStorage::setErrorMessage().
128
+     *
129
+     * @return boolean error message when set by PGTStorage::setErrorMessage(), FALSE
130
+     * otherwise.
131
+     *
132
+     * @public
133
+     * @deprecated not used.
134
+     */
135
+    function getErrorMessage()
136 136
     {
137
-      return $this->_error_message;
137
+        return $this->_error_message;
138 138
     }
139 139
 
140
-  // ########################################################################
141
-  //  INITIALIZATION
142
-  // ########################################################################
143
-
144
-  /**
145
-   * a boolean telling if the storage has already been initialized. Written by 
146
-   * PGTStorage::init(), read by PGTStorage::isInitialized().
147
-   *
148
-   * @hideinitializer
149
-   * @private
150
-   */
151
-  var $_initialized = FALSE;
152
-
153
-  /**
154
-   * This method tells if the storage has already been intialized.
155
-   *
156
-   * @return boolean boolean
157
-   *
158
-   * @protected
159
-   */
160
-  function isInitialized()
140
+    // ########################################################################
141
+    //  INITIALIZATION
142
+    // ########################################################################
143
+
144
+    /**
145
+     * a boolean telling if the storage has already been initialized. Written by 
146
+     * PGTStorage::init(), read by PGTStorage::isInitialized().
147
+     *
148
+     * @hideinitializer
149
+     * @private
150
+     */
151
+    var $_initialized = FALSE;
152
+
153
+    /**
154
+     * This method tells if the storage has already been intialized.
155
+     *
156
+     * @return boolean boolean
157
+     *
158
+     * @protected
159
+     */
160
+    function isInitialized()
161 161
     {
162
-      return $this->_initialized;
162
+        return $this->_initialized;
163 163
     }
164 164
 
165
-  /**
166
-   * This virtual method initializes the object.
167
-   *
168
-   * @protected
169
-   */
170
-  function init()
165
+    /**
166
+     * This virtual method initializes the object.
167
+     *
168
+     * @protected
169
+     */
170
+    function init()
171 171
     {
172
-      $this->_initialized = TRUE;
172
+        $this->_initialized = TRUE;
173 173
     }
174 174
 
175
-  // ########################################################################
176
-  //  PGT I/O
177
-  // ########################################################################
178
-
179
-  /**
180
-   * This virtual method stores a PGT and its corresponding PGT Iuo.
181
-   * @note Should never be called.
182
-   *
183
-   * @param $pgt the PGT
184
-   * @param $pgt_iou the PGT iou
185
-   *
186
-   * @protected
187
-   */
188
-  function write($pgt,$pgt_iou)
175
+    // ########################################################################
176
+    //  PGT I/O
177
+    // ########################################################################
178
+
179
+    /**
180
+     * This virtual method stores a PGT and its corresponding PGT Iuo.
181
+     * @note Should never be called.
182
+     *
183
+     * @param $pgt the PGT
184
+     * @param $pgt_iou the PGT iou
185
+     *
186
+     * @protected
187
+     */
188
+    function write($pgt,$pgt_iou)
189 189
     {
190
-      phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
190
+        phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
191 191
     }
192 192
 
193
-  /**
194
-   * This virtual method reads a PGT corresponding to a PGT Iou and deletes
195
-   * the corresponding storage entry.
196
-   * @note Should never be called.
197
-   *
198
-   * @param $pgt_iou the PGT iou
199
-   *
200
-   * @protected
201
-   */
202
-  function read($pgt_iou)
193
+    /**
194
+     * This virtual method reads a PGT corresponding to a PGT Iou and deletes
195
+     * the corresponding storage entry.
196
+     * @note Should never be called.
197
+     *
198
+     * @param $pgt_iou the PGT iou
199
+     *
200
+     * @protected
201
+     */
202
+    function read($pgt_iou)
203 203
     {
204
-      phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
204
+        phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); 
205 205
     }
206 206
 
207
-  /** @} */
207
+    /** @} */
208 208
   
209 209
 } 
210 210
 
Please login to merge, or discard this patch.