Passed
Push — 1.10.x ( 3f2a42...07da6d )
by Yannick
43:34
created
main/admin/user_move_stats.php 1 patch
Braces   +111 added lines, -47 removed lines patch added patch discarded remove patch
@@ -106,7 +106,9 @@  discard block
 block discarded – undo
106 106
                 //Check if the user is registered in the session otherwise we will add it
107 107
                 $result = SessionManager::get_users_by_session($new_session_id);
108 108
                 if (empty($result) || !in_array($user_id, array_keys($result))) {
109
-                    if ($debug) echo 'User added to the session';
109
+                    if ($debug) {
110
+                        echo 'User added to the session';
111
+                    }
110 112
                     //Registering user to the new session
111 113
                     SessionManager::suscribe_users_to_session($new_session_id,array($user_id),false);
112 114
                 }
@@ -141,10 +143,11 @@  discard block
 block discarded – undo
141 143
                     $list[$row['exe_id']]= $row;
142 144
                 }
143 145
 
144
-                if (!empty($list))
145
-                    foreach ($list as $exe_id =>$data) {
146
+                if (!empty($list)) {
147
+                                    foreach ($list as $exe_id =>$data) {
146 148
                         if ($update_database) {
147 149
                             $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
150
+                }
148 151
                             $res = Database::query($sql);
149 152
                             $result_message[$TABLETRACK_EXERCICES]++;
150 153
                         } else {
@@ -168,10 +171,11 @@  discard block
 block discarded – undo
168 171
                         $list[$row['exe_id']]= $row;
169 172
                     }
170 173
 
171
-                    if (!empty($list))
172
-                        foreach ($list as $exe_id =>$data) {
174
+                    if (!empty($list)) {
175
+                                            foreach ($list as $exe_id =>$data) {
173 176
                             if ($update_database) {
174 177
                                 $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
178
+                    }
175 179
                                 $res = Database::query($sql);
176 180
                                 $result_message[$TABLETRACK_EXERCICES]++;
177 181
                             } else {
@@ -196,10 +200,11 @@  discard block
 block discarded – undo
196 200
                     $list[$row['course_access_id']] = $row;
197 201
                 }
198 202
 
199
-                if (!empty($list))
200
-                    foreach ($list as $id => $data) {
203
+                if (!empty($list)) {
204
+                                    foreach ($list as $id => $data) {
201 205
                         if ($update_database) {
202 206
                             $sql = "UPDATE $TBL_TRACK_E_COURSE_ACCESS SET session_id = $new_session_id WHERE course_access_id = $id";
207
+                }
203 208
                             if ($debug) {
204 209
                                 echo $sql;
205 210
                             }
@@ -218,13 +223,18 @@  discard block
 block discarded – undo
218 223
                 while($row = Database::fetch_array($res,'ASSOC')) {
219 224
                     $list[] = $row['access_id'];
220 225
                 }
221
-                if (!empty($list))
222
-                    foreach ($list as $id) {
226
+                if (!empty($list)) {
227
+                                    foreach ($list as $id) {
223 228
                         if ($update_database) {
224 229
                             $sql = "UPDATE $TBL_TRACK_E_LAST_ACCESS SET access_session_id = $new_session_id WHERE access_id = $id";
225
-                            if ($debug) echo $sql;
230
+                }
231
+                            if ($debug) {
232
+                                echo $sql;
233
+                            }
226 234
                             $res = Database::query($sql);
227
-                            if ($debug) var_dump($res);
235
+                            if ($debug) {
236
+                                var_dump($res);
237
+                            }
228 238
                             $result_message[$TBL_TRACK_E_LAST_ACCESS]++;
229 239
                         }
230 240
                     }
@@ -248,13 +258,18 @@  discard block
 block discarded – undo
248 258
                     }
249 259
                 }
250 260
 
251
-                if (!empty($list))
252
-                    foreach ($list as $id=>$data) {
261
+                if (!empty($list)) {
262
+                                    foreach ($list as $id=>$data) {
253 263
                         if ($update_database) {
254 264
                             $sql = "UPDATE $TBL_LP_VIEW SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
255
-                            if ($debug) var_dump($sql);
265
+                }
266
+                            if ($debug) {
267
+                                var_dump($sql);
268
+                            }
256 269
                             $res = Database::query($sql);
257
-                            if ($debug) var_dump($res);
270
+                            if ($debug) {
271
+                                var_dump($res);
272
+                            }
258 273
                             $result_message[$TBL_LP_VIEW]++;
259 274
                         } else {
260 275
                             //Getting all information of that lp_item_id
@@ -281,10 +296,11 @@  discard block
 block discarded – undo
281 296
                             $list[$row['id']] = $row;
282 297
                         }
283 298
                     }
284
-                    if (!empty($list))
285
-                        foreach ($list as $id=>$data) {
299
+                    if (!empty($list)) {
300
+                                            foreach ($list as $id=>$data) {
286 301
                             //Getting all information of that lp_item_id
287 302
                             $score    = Tracking::get_avg_student_score($user_id, $origin_course_code,        array($data['lp_id']), $new_session_id);
303
+                    }
288 304
                             $progress = Tracking::get_avg_student_progress($user_id, $origin_course_code,     array($data['lp_id']), $new_session_id);
289 305
                             $result_message_compare['LP_VIEW'][$data['lp_id']] = array('score' => $score, 'progress' =>$progress);
290 306
                         }
@@ -300,9 +316,13 @@  discard block
 block discarded – undo
300 316
                     $id = $row['ref'];
301 317
                     if ($update_database) {
302 318
                         $sql = "UPDATE $TBL_AGENDA SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
303
-                        if ($debug) var_dump($sql);
319
+                        if ($debug) {
320
+                            var_dump($sql);
321
+                        }
304 322
                         $res_update = Database::query($sql);
305
-                        if ($debug) var_dump($res_update);
323
+                        if ($debug) {
324
+                            var_dump($res_update);
325
+                        }
306 326
                         $result_message['agenda']++;
307 327
                     }
308 328
                 }
@@ -314,22 +334,30 @@  discard block
 block discarded – undo
314 334
                 //echo '<h1>Student publication</h1>';
315 335
 
316 336
                 $sql = "SELECT ref FROM $TBL_ITEM_PROPERTY WHERE tool = 'work' AND insert_user_id = $user_id AND c_id = $course_id";
317
-                if ($debug) echo $sql;
337
+                if ($debug) {
338
+                    echo $sql;
339
+                }
318 340
                 $res = Database::query($sql);
319 341
                 while($row = Database::fetch_array($res,'ASSOC')) {
320 342
                     $id = $row['ref'];
321 343
                     $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $id AND session_id = $origin_session_id AND c_id = $course_id";
322
-                    if ($debug) var_dump($sql);
344
+                    if ($debug) {
345
+                        var_dump($sql);
346
+                    }
323 347
                     $sub_res = Database::query($sql);
324 348
                     if (Database::num_rows($sub_res) > 0 ) {
325 349
                         $data = Database::fetch_array($sub_res,'ASSOC');
326
-                        if ($debug) var_dump($data);
350
+                        if ($debug) {
351
+                            var_dump($data);
352
+                        }
327 353
                         $parent_id = $data['parent_id'];
328 354
                         if (isset($data['parent_id']) && !empty($data['parent_id'])) {
329 355
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $parent_id AND c_id = $course_id";
330 356
                             $select_res     = Database::query($sql);
331 357
                             $parent_data    = Database::fetch_array($select_res,'ASSOC');
332
-                            if ($debug)     var_dump($parent_data);
358
+                            if ($debug) {
359
+                                var_dump($parent_data);
360
+                            }
333 361
 
334 362
                             $sys_course_path = api_get_path(SYS_COURSE_PATH);
335 363
                             $course_dir = $sys_course_path . $course_info['path'];
@@ -344,7 +372,9 @@  discard block
 block discarded – undo
344 372
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION
345 373
                             		WHERE description like '%$search_this%' AND url LIKE '%$search_this2%' AND session_id = $new_session_id AND c_id = $course_id
346 374
                             		ORDER BY id desc  LIMIT 1";
347
-                            if ($debug) echo $sql;
375
+                            if ($debug) {
376
+                                echo $sql;
377
+                            }
348 378
                             $sub_res = Database::query($sql);
349 379
                             $num_rows = Database::num_rows($sub_res);
350 380
 
@@ -377,12 +407,16 @@  discard block
 block discarded – undo
377 407
 	                                       date_of_qualification    = '0000-00-00 00:00:00',
378 408
 	                                       session_id   = ".$new_session_id;
379 409
                                     $rest_insert     = Database::query($sql_add_publication);
380
-                                    if ($debug) echo ($sql_add_publication);
410
+                                    if ($debug) {
411
+                                        echo ($sql_add_publication);
412
+                                    }
381 413
                                     // add the directory
382 414
                                     $id = Database::insert_id();
383 415
                                     //Folder created
384 416
                                     api_item_property_update($course_info, 'work', $id, 'DirectoryCreated', api_get_user_id());
385
-                                    if ($debug) var_dump($rest_insert);
417
+                                    if ($debug) {
418
+                                        var_dump($rest_insert);
419
+                                    }
386 420
                                     $new_parent_id = $id;
387 421
                                     $result_message[$TBL_STUDENT_PUBLICATION.' - new folder created called: '.$created_dir]++;
388 422
                                 }
@@ -390,7 +424,9 @@  discard block
 block discarded – undo
390 424
 
391 425
                             //Creating student_publication_assignment if exists
392 426
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION_ASSIGNMENT WHERE publication_id = $parent_id AND c_id = $course_id";
393
-                            if ($debug) var_dump($sql);
427
+                            if ($debug) {
428
+                                var_dump($sql);
429
+                            }
394 430
                             $rest_select     = Database::query($sql);
395 431
                             if (Database::num_rows($rest_select) > 0 ) {
396 432
                                 if ($update_database) {
@@ -402,7 +438,9 @@  discard block
 block discarded – undo
402 438
                                        add_to_calendar      = '".$assignment_data['add_to_calendar']."',
403 439
                                        enable_qualification = '".$assignment_data['enable_qualification']."',
404 440
                                        publication_id       = '".$new_parent_id."'";
405
-                                    if ($debug) echo $sql_add_publication;
441
+                                    if ($debug) {
442
+                                        echo $sql_add_publication;
443
+                                    }
406 444
                                     $rest_select     = Database::query($sql_add_publication);
407 445
                                     $id = Database::insert_id();
408 446
 
@@ -410,11 +448,15 @@  discard block
 block discarded – undo
410 448
                                         "has_properties         = '".$id."',
411 449
                                        view_properties    = '1'
412 450
                                        WHERE id   = ".$new_parent_id;
413
-                                    if ($debug) echo $sql_update;
451
+                                    if ($debug) {
452
+                                        echo $sql_update;
453
+                                    }
414 454
                                     $rest_update     = Database::query($sql_update);
415 455
 
416 456
 
417
-                                    if ($debug) var_dump($sql_update);
457
+                                    if ($debug) {
458
+                                        var_dump($sql_update);
459
+                                    }
418 460
                                     $result_message[$TBL_STUDENT_PUBLICATION_ASSIGNMENT]++;
419 461
                                 }
420 462
                             }
@@ -437,9 +479,13 @@  discard block
 block discarded – undo
437 479
                                                parent_id    =  ".$new_parent_id ." ,
438 480
                                                session_id = ".$new_session_id;
439 481
 
440
-                                if ($debug) echo $sql_add_publication;
482
+                                if ($debug) {
483
+                                    echo $sql_add_publication;
484
+                                }
441 485
                                 $rest_insert     = Database::query($sql_add_publication);
442
-                                if ($debug) var_dump($rest_insert);
486
+                                if ($debug) {
487
+                                    var_dump($rest_insert);
488
+                                }
443 489
                                 $id = Database::insert_id();
444 490
                                 api_item_property_update($course_info, 'work', $id, 'DocumentAdded', $user_id);
445 491
                                 $result_message[$TBL_STUDENT_PUBLICATION]++;
@@ -453,7 +499,9 @@  discard block
 block discarded – undo
453 499
                                     if ($result) {
454 500
                                         unlink($full_file_name);
455 501
                                         $sql = "DELETE FROM $TBL_STUDENT_PUBLICATION WHERE id= ".$data['id'];
456
-                                        if ($debug) var_dump($sql);
502
+                                        if ($debug) {
503
+                                            var_dump($sql);
504
+                                        }
457 505
                                         $result_delete     = Database::query($sql);
458 506
                                         api_item_property_update($course_info, 'work', $data['id'], 'DocumentDeleted', api_get_user_id());
459 507
                                     }
@@ -469,22 +517,30 @@  discard block
 block discarded – undo
469 517
                 //10. Dropbox - not neccesary to move categories (no presence of session_id)
470 518
 
471 519
                 $sql = "SELECT id FROM $TBL_DROPBOX_FILE WHERE uploader_id = $user_id AND session_id = $origin_session_id AND c_id = $course_id";
472
-                if ($debug) var_dump($sql);
520
+                if ($debug) {
521
+                    var_dump($sql);
522
+                }
473 523
                 $res = Database::query($sql);
474 524
                 while($row = Database::fetch_array($res,'ASSOC')) {
475 525
                     $id = $row['id'];
476 526
                     if ($update_database) {
477 527
                         $sql = "UPDATE $TBL_DROPBOX_FILE SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id";
478
-                        if ($debug) var_dump($sql);
528
+                        if ($debug) {
529
+                            var_dump($sql);
530
+                        }
479 531
                         $res = Database::query($sql);
480
-                        if ($debug) var_dump($res);
532
+                        if ($debug) {
533
+                            var_dump($res);
534
+                        }
481 535
 
482 536
                         $sql = "UPDATE $TBL_DROPBOX_POST SET session_id = $new_session_id WHERE file_id = $id";
483
-                        if ($debug)
484
-                            var_dump($sql);
537
+                        if ($debug) {
538
+                                                    var_dump($sql);
539
+                        }
485 540
                         $res = Database::query($sql);
486
-                        if ($debug)
487
-                            var_dump($res);
541
+                        if ($debug) {
542
+                                                    var_dump($res);
543
+                        }
488 544
                         $result_message[$TBL_DROPBOX_FILE]++;
489 545
                     }
490 546
                 }
@@ -493,23 +549,30 @@  discard block
 block discarded – undo
493 549
 
494 550
                 $sql = "SELECT notebook_id FROM $TBL_NOTEBOOK
495 551
                         WHERE user_id = $user_id AND session_id = $origin_session_id AND course = '$origin_course_code' AND c_id = $course_id";
496
-                if ($debug) var_dump($sql);
552
+                if ($debug) {
553
+                    var_dump($sql);
554
+                }
497 555
                 $res = Database::query($sql);
498 556
                 while($row = Database::fetch_array($res,'ASSOC')) {
499 557
                     $id = $row['notebook_id'];
500 558
                     if ($update_database) {
501 559
                         $sql = "UPDATE $TBL_NOTEBOOK SET session_id = $new_session_id WHERE c_id = $course_id AND notebook_id = $id";
502
-                        if ($debug) var_dump($sql);
560
+                        if ($debug) {
561
+                            var_dump($sql);
562
+                        }
503 563
                         $res = Database::query($sql);
504
-                        if ($debug) var_dump($res);
564
+                        if ($debug) {
565
+                            var_dump($res);
566
+                        }
505 567
                     }
506 568
                 }
507 569
 
508 570
                 if ($update_database) {
509 571
                     echo '<h2>'.get_lang('StatsMoved').'</h2>';
510
-                    if (is_array($result_message))
511
-                        foreach ($result_message as $table=>$times) {
572
+                    if (is_array($result_message)) {
573
+                                            foreach ($result_message as $table=>$times) {
512 574
                             echo 'Table '.$table.' - '.$times.' records updated <br />';
575
+                    }
513 576
                         }
514 577
                 } else {
515 578
                     echo '<h2>'.get_lang('UserInformationOfThisCourse').'</h2>';
@@ -626,10 +689,11 @@  discard block
 block discarded – undo
626 689
 }
627 690
 $navigation .= '&nbsp;';
628 691
 $page ++;
629
-if ($page < $nro_pages)
692
+if ($page < $nro_pages) {
630 693
     $navigation .= '<a href="'.api_get_self().'?page='.$page.'">'.get_lang('Next').'</a>';
631
-else
694
+} else {
632 695
     $navigation .= get_lang('Next');
696
+}
633 697
 
634 698
 echo $navigation;
635 699
 $user_list      = UserManager::get_user_list(array(), array(), $begin, $default);
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/PGTStorage/pgt-db.php 1 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 a 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 a 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 the 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 the 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 an 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 an 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 $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 $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.