@@ -124,7 +124,7 @@ |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | - * @param $variable |
|
127 | + * @param string $variable |
|
128 | 128 | * @return mixed |
129 | 129 | */ |
130 | 130 | public function getConfigurationValue($variable) |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | * display the edit and delete icons in the sortable table |
908 | 908 | * |
909 | 909 | * @param integer $id the id of the template |
910 | - * @return html code for the link to edit and delete the template |
|
910 | + * @return string code for the link to edit and delete the template |
|
911 | 911 | * |
912 | 912 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
913 | 913 | * @version August 2008 |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | * Display the image of the template in the sortable table |
924 | 924 | * |
925 | 925 | * @param string $image the image |
926 | - * @return html code for the image |
|
926 | + * @return string code for the image |
|
927 | 927 | * |
928 | 928 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
929 | 929 | * @version August 2008 |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | /** |
1121 | 1121 | * Returns an array containing the list of options used to populate the gradebook_number_decimals variable |
1122 | 1122 | * This function is called through a call_user_func() in the generate_settings_form function. |
1123 | - * @return array List of gradebook_number_decimals options |
|
1123 | + * @return string[] List of gradebook_number_decimals options |
|
1124 | 1124 | * |
1125 | 1125 | * @author Guillaume Viguier <[email protected]> |
1126 | 1126 | */ |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @package chamilo.admin |
12 | 12 | */ |
13 | 13 | |
14 | -define('CSS_UPLOAD_PATH', api_get_path(SYS_APP_PATH) . 'Resources/public/css/themes/'); |
|
14 | +define('CSS_UPLOAD_PATH', api_get_path(SYS_APP_PATH).'Resources/public/css/themes/'); |
|
15 | 15 | |
16 | 16 | use Symfony\Component\Filesystem\Filesystem; |
17 | 17 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $possible_plugins = $plugin_obj->read_plugins_from_path(); |
41 | 41 | $installed_plugins = $plugin_obj->get_installed_plugins(); |
42 | 42 | |
43 | - echo '<form name="plugins" method="post" action="' . api_get_self() . '?category=' . Security::remove_XSS($_GET['category']) . '">'; |
|
43 | + echo '<form name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'">'; |
|
44 | 44 | echo '<table class="data_table">'; |
45 | 45 | echo '<tr>'; |
46 | 46 | echo '<th width="400px">'; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | unset($plugin_region_list['course_tool_plugin']); |
64 | 64 | |
65 | 65 | foreach ($installed_plugins as $plugin) { |
66 | - $plugin_info_file = api_get_path(SYS_PLUGIN_PATH) . $plugin . '/plugin.php'; |
|
66 | + $plugin_info_file = api_get_path(SYS_PLUGIN_PATH).$plugin.'/plugin.php'; |
|
67 | 67 | |
68 | 68 | if (file_exists($plugin_info_file)) { |
69 | 69 | $plugin_info = array(); |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | echo '<tr>'; |
75 | 75 | } |
76 | 76 | echo '<td>'; |
77 | - echo '<h4>' . $plugin_info['title'] . ' <small>v' . $plugin_info['version'] . '</small></h4>'; |
|
78 | - echo '<p>' . $plugin_info['comment'] . '</p>'; |
|
77 | + echo '<h4>'.$plugin_info['title'].' <small>v'.$plugin_info['version'].'</small></h4>'; |
|
78 | + echo '<p>'.$plugin_info['comment'].'</p>'; |
|
79 | 79 | echo '</td><td>'; |
80 | 80 | $selected_plugins = $plugin_obj->get_areas_by_plugin($plugin); |
81 | 81 | |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | } else { |
85 | 85 | $region_list = $plugin_region_list; |
86 | 86 | } |
87 | - echo Display::select('plugin_' . $plugin . '[]', $region_list, $selected_plugins, |
|
87 | + echo Display::select('plugin_'.$plugin.'[]', $region_list, $selected_plugins, |
|
88 | 88 | array('multiple' => 'multiple', 'style' => 'width:500px'), true, get_lang('None')); |
89 | 89 | echo '</td></tr>'; |
90 | 90 | } |
91 | 91 | } |
92 | 92 | echo '</table>'; |
93 | 93 | echo '<br />'; |
94 | - echo '<button class="btn btn-success" type="submit" name="submit_plugins">' . get_lang('EnablePlugins') . '</button></form>'; |
|
94 | + echo '<button class="btn btn-success" type="submit" name="submit_plugins">'.get_lang('EnablePlugins').'</button></form>'; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | function handle_extensions() |
98 | 98 | { |
99 | 99 | echo Display::page_subheader(get_lang('ConfigureExtensions')); |
100 | - echo '<a class="btn btn-success" href="configure_extensions.php?display=ppt2lp" role="button">' . get_lang('Ppt2lp') . '</a>'; |
|
100 | + echo '<a class="btn btn-success" href="configure_extensions.php?display=ppt2lp" role="button">'.get_lang('Ppt2lp').'</a>'; |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | //Plugins NOT installed |
133 | 133 | echo Display::page_subheader(get_lang('Plugins')); |
134 | - echo '<form class="form-horizontal" name="plugins" method="post" action="' . api_get_self() . '?category=' . Security::remove_XSS($_GET['category']) . '&sec_token=' . $token . '">'; |
|
134 | + echo '<form class="form-horizontal" name="plugins" method="post" action="'.api_get_self().'?category='.Security::remove_XSS($_GET['category']).'&sec_token='.$token.'">'; |
|
135 | 135 | echo '<table class="data_table">'; |
136 | 136 | echo '<tr>'; |
137 | 137 | echo '<th width="20px">'; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | foreach ($all_plugins as $plugin) { |
151 | - $plugin_info_file = api_get_path(SYS_PLUGIN_PATH) . $plugin . '/plugin.php'; |
|
151 | + $plugin_info_file = api_get_path(SYS_PLUGIN_PATH).$plugin.'/plugin.php'; |
|
152 | 152 | |
153 | 153 | if (file_exists($plugin_info_file)) { |
154 | 154 | $plugin_info = array(); |
@@ -162,29 +162,29 @@ discard block |
||
162 | 162 | echo '<td>'; |
163 | 163 | //Checkbox |
164 | 164 | if (in_array($plugin, $installed_plugins)) { |
165 | - echo '<input type="checkbox" name="plugin_' . $plugin . '[]" checked="checked">'; |
|
165 | + echo '<input type="checkbox" name="plugin_'.$plugin.'[]" checked="checked">'; |
|
166 | 166 | |
167 | 167 | } else { |
168 | - echo '<input type="checkbox" name="plugin_' . $plugin . '[]">'; |
|
168 | + echo '<input type="checkbox" name="plugin_'.$plugin.'[]">'; |
|
169 | 169 | } |
170 | 170 | echo '</td><td>'; |
171 | 171 | |
172 | - echo '<h4>' . $plugin_info['title'] . ' <small>v ' . $plugin_info['version'] . '</small></h4>'; |
|
173 | - echo '<p>' . $plugin_info['comment'] . '</p>'; |
|
174 | - echo '<p>' . get_lang('Author') . ': ' . $plugin_info['author'] . '</p>'; |
|
172 | + echo '<h4>'.$plugin_info['title'].' <small>v '.$plugin_info['version'].'</small></h4>'; |
|
173 | + echo '<p>'.$plugin_info['comment'].'</p>'; |
|
174 | + echo '<p>'.get_lang('Author').': '.$plugin_info['author'].'</p>'; |
|
175 | 175 | |
176 | 176 | echo '<div class="btn-group">'; |
177 | 177 | if (in_array($plugin, $installed_plugins)) { |
178 | - echo Display::url('<em class="fa fa-cogs"></em> ' . get_lang('Configure'), |
|
179 | - 'configure_plugin.php?name=' . $plugin, array('class' => 'btn btn-default')); |
|
180 | - echo Display::url('<em class="fa fa-th-large"></em> ' . get_lang('Regions'), |
|
181 | - 'settings.php?category=Regions&name=' . $plugin, array('class' => 'btn btn-default')); |
|
178 | + echo Display::url('<em class="fa fa-cogs"></em> '.get_lang('Configure'), |
|
179 | + 'configure_plugin.php?name='.$plugin, array('class' => 'btn btn-default')); |
|
180 | + echo Display::url('<em class="fa fa-th-large"></em> '.get_lang('Regions'), |
|
181 | + 'settings.php?category=Regions&name='.$plugin, array('class' => 'btn btn-default')); |
|
182 | 182 | } |
183 | 183 | |
184 | - if (file_exists(api_get_path(SYS_PLUGIN_PATH) . $plugin . '/readme.txt')) { |
|
184 | + if (file_exists(api_get_path(SYS_PLUGIN_PATH).$plugin.'/readme.txt')) { |
|
185 | 185 | echo Display::url( |
186 | 186 | "<em class='fa fa-file-text-o'></em> readme.txt", |
187 | - api_get_path(WEB_PLUGIN_PATH) . $plugin . "/readme.txt", |
|
187 | + api_get_path(WEB_PLUGIN_PATH).$plugin."/readme.txt", |
|
188 | 188 | [ |
189 | 189 | 'class' => 'btn btn-default ajax', |
190 | 190 | 'data-title' => $plugin_info['title'], |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | echo '</table>'; |
201 | 201 | |
202 | 202 | echo '<div class="form-actions bottom_actions">'; |
203 | - echo '<button class="btn btn-success" type="submit" name="submit_plugins">' . |
|
204 | - get_lang('EnablePlugins') . '</button>'; |
|
203 | + echo '<button class="btn btn-success" type="submit" name="submit_plugins">'. |
|
204 | + get_lang('EnablePlugins').'</button>'; |
|
205 | 205 | echo '</div>'; |
206 | 206 | echo '</form>'; |
207 | 207 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | 'woff2' |
256 | 256 | ); |
257 | 257 | |
258 | - $form->addRule('new_stylesheet', get_lang('InvalidExtension') . ' (' . implode(',', $allowed_file_types) . ')', |
|
258 | + $form->addRule('new_stylesheet', get_lang('InvalidExtension').' ('.implode(',', $allowed_file_types).')', |
|
259 | 259 | 'filetype', $allowed_file_types); |
260 | 260 | $form->addRule('new_stylesheet', get_lang('ThisFieldIsRequired'), 'required'); |
261 | 261 | $form->addButtonUpload(get_lang('Upload'), 'stylesheet_upload'); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $show_upload_form = false; |
264 | 264 | |
265 | 265 | if (!is_writable(CSS_UPLOAD_PATH)) { |
266 | - Display::display_error_message(CSS_UPLOAD_PATH . get_lang('IsNotWritable')); |
|
266 | + Display::display_error_message(CSS_UPLOAD_PATH.get_lang('IsNotWritable')); |
|
267 | 267 | } else { |
268 | 268 | // Uploading a new stylesheet. |
269 | 269 | if ($_configuration['access_url'] == 1) { |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $form_change = new FormValidator( |
305 | 305 | 'stylesheet_upload', |
306 | 306 | 'post', |
307 | - api_get_self() . '?category=Stylesheets', |
|
307 | + api_get_self().'?category=Stylesheets', |
|
308 | 308 | null, |
309 | 309 | array('id' => 'stylesheets_id') |
310 | 310 | ); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | // Skip directories starting with a '.' |
322 | 322 | continue; |
323 | 323 | } |
324 | - $dirpath = CSS_UPLOAD_PATH . $style_dir; |
|
324 | + $dirpath = CSS_UPLOAD_PATH.$style_dir; |
|
325 | 325 | |
326 | 326 | if (is_dir($dirpath)) { |
327 | 327 | if ($style_dir != '.' && $style_dir != '..') { |
@@ -368,15 +368,15 @@ discard block |
||
368 | 368 | Display::display_normal_message(get_lang('Saved')); |
369 | 369 | } |
370 | 370 | if (isset($_POST['download'])) { |
371 | - $arch = api_get_path(SYS_ARCHIVE_PATH) . $safe_style_dir . '.zip'; |
|
372 | - $dir = api_get_path(SYS_CSS_PATH) . 'themes/' . $safe_style_dir; |
|
371 | + $arch = api_get_path(SYS_ARCHIVE_PATH).$safe_style_dir.'.zip'; |
|
372 | + $dir = api_get_path(SYS_CSS_PATH).'themes/'.$safe_style_dir; |
|
373 | 373 | if (is_dir($dir)) { |
374 | 374 | $zip = new PclZip($arch); |
375 | 375 | // Remove path prefix except the style name and put file on disk |
376 | 376 | $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir, 0, -strlen($safe_style_dir))); |
377 | 377 | //@TODO: use more generic script to download. |
378 | - $str = '<a class="btn btn-primary btn-large" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/download.php?archive=' . str_replace(api_get_path(SYS_ARCHIVE_PATH), |
|
379 | - '', $arch) . '">' . get_lang('ClickHereToDownloadTheFile') . '</a>'; |
|
378 | + $str = '<a class="btn btn-primary btn-large" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.str_replace(api_get_path(SYS_ARCHIVE_PATH), |
|
379 | + '', $arch).'">'.get_lang('ClickHereToDownloadTheFile').'</a>'; |
|
380 | 380 | Display::display_normal_message($str, false); |
381 | 381 | } else { |
382 | 382 | Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning')); |
@@ -393,33 +393,33 @@ discard block |
||
393 | 393 | $logoForm->addHtml(Display::return_message(sprintf(get_lang('TheLogoMustBeSizeXAndFormatY'), '250 x 70', 'PNG'), |
394 | 394 | 'info')); |
395 | 395 | |
396 | - $dir = api_get_path(SYS_PUBLIC_PATH) . 'css/themes/' . $selected . '/images/'; |
|
397 | - $url = api_get_path(WEB_CSS_PATH) . 'themes/' . $selected . '/images/'; |
|
396 | + $dir = api_get_path(SYS_PUBLIC_PATH).'css/themes/'.$selected.'/images/'; |
|
397 | + $url = api_get_path(WEB_CSS_PATH).'themes/'.$selected.'/images/'; |
|
398 | 398 | $logoFileName = 'header-logo.png'; |
399 | 399 | $newLogoFileName = 'header-logo-custom.png'; |
400 | 400 | |
401 | - if (is_file($dir . $newLogoFileName)) { |
|
401 | + if (is_file($dir.$newLogoFileName)) { |
|
402 | 402 | $logoForm->addLabel(get_lang('CurrentLogo'), |
403 | - '<img id="header-logo-custom" src="' . $url . $newLogoFileName . '?' . time() . '">'); |
|
403 | + '<img id="header-logo-custom" src="'.$url.$newLogoFileName.'?'.time().'">'); |
|
404 | 404 | } else { |
405 | 405 | $logoForm->addLabel(get_lang('CurrentLogo'), |
406 | - '<img id="header-logo-custom" src="' . $url . $logoFileName . '?' . time() . '">'); |
|
406 | + '<img id="header-logo-custom" src="'.$url.$logoFileName.'?'.time().'">'); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | $logoForm->addFile('new_logo', get_lang('UpdateLogo')); |
410 | 410 | $allowedFileTypes = ['png']; |
411 | 411 | |
412 | 412 | if (isset($_POST['logo_reset'])) { |
413 | - if (is_file($dir . $newLogoFileName)) { |
|
414 | - unlink($dir . $newLogoFileName); |
|
413 | + if (is_file($dir.$newLogoFileName)) { |
|
414 | + unlink($dir.$newLogoFileName); |
|
415 | 415 | Display::display_normal_message(get_lang('ResetToTheOriginalLogo')); |
416 | 416 | echo '<script>' |
417 | - . '$("#header-logo").attr("src","' . $url . $logoFileName . '");' |
|
417 | + . '$("#header-logo").attr("src","'.$url.$logoFileName.'");' |
|
418 | 418 | . '</script>'; |
419 | 419 | } |
420 | 420 | } elseif (isset($_POST['logo_upload'])) { |
421 | 421 | |
422 | - $logoForm->addRule('new_logo', get_lang('InvalidExtension') . ' (' . implode(',', $allowedFileTypes) . ')', |
|
422 | + $logoForm->addRule('new_logo', get_lang('InvalidExtension').' ('.implode(',', $allowedFileTypes).')', |
|
423 | 423 | 'filetype', $allowedFileTypes); |
424 | 424 | $logoForm->addRule('new_logo', get_lang('ThisFieldIsRequired'), 'required'); |
425 | 425 | |
@@ -429,22 +429,22 @@ discard block |
||
429 | 429 | $width = $imageInfo[0]; |
430 | 430 | $height = $imageInfo[1]; |
431 | 431 | if ($width <= 250 && $height <= 70) { |
432 | - if (is_file($dir . $newLogoFileName)) { |
|
433 | - unlink($dir . $newLogoFileName); |
|
432 | + if (is_file($dir.$newLogoFileName)) { |
|
433 | + unlink($dir.$newLogoFileName); |
|
434 | 434 | } |
435 | 435 | |
436 | - $status = move_uploaded_file($_FILES['new_logo']['tmp_name'], $dir . $newLogoFileName); |
|
436 | + $status = move_uploaded_file($_FILES['new_logo']['tmp_name'], $dir.$newLogoFileName); |
|
437 | 437 | |
438 | 438 | if ($status) { |
439 | 439 | Display::display_normal_message(get_lang('NewLogoUpdated')); |
440 | 440 | echo '<script>' |
441 | - . '$("#header-logo").attr("src","' . $url . $newLogoFileName . '");' |
|
441 | + . '$("#header-logo").attr("src","'.$url.$newLogoFileName.'");' |
|
442 | 442 | . '</script>'; |
443 | 443 | } else { |
444 | - Display::display_error_message('Error - ' . get_lang('UplNoFileUploaded')); |
|
444 | + Display::display_error_message('Error - '.get_lang('UplNoFileUploaded')); |
|
445 | 445 | } |
446 | 446 | } else { |
447 | - Display::display_error_message('Error - ' . get_lang('InvalidImageDimensions')); |
|
447 | + Display::display_error_message('Error - '.get_lang('InvalidImageDimensions')); |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | } |
@@ -482,11 +482,11 @@ discard block |
||
482 | 482 | //Little hack to update the logo image in update form when submiting |
483 | 483 | if (isset($_POST['logo_reset'])) { |
484 | 484 | echo '<script>' |
485 | - . '$("#header-logo-custom").attr("src","' . $url . $logoFileName . '");' |
|
485 | + . '$("#header-logo-custom").attr("src","'.$url.$logoFileName.'");' |
|
486 | 486 | . '</script>'; |
487 | - } elseif (isset($_POST['logo_upload']) && is_file($dir . $newLogoFileName)) { |
|
487 | + } elseif (isset($_POST['logo_upload']) && is_file($dir.$newLogoFileName)) { |
|
488 | 488 | echo '<script>' |
489 | - . '$("#header-logo-custom").attr("src","' . $url . $newLogoFileName . '");' |
|
489 | + . '$("#header-logo-custom").attr("src","'.$url.$newLogoFileName.'");' |
|
490 | 490 | . '</script>'; |
491 | 491 | } |
492 | 492 | } else { |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | |
514 | 514 | // Create the folder if needed. |
515 | 515 | |
516 | - if (!is_dir($cssToUpload . $style_name . '/')) { |
|
517 | - mkdir($cssToUpload . $style_name . '/', api_get_permissions_for_new_directories()); |
|
516 | + if (!is_dir($cssToUpload.$style_name.'/')) { |
|
517 | + mkdir($cssToUpload.$style_name.'/', api_get_permissions_for_new_directories()); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | $info = pathinfo($picture['name']); |
@@ -561,21 +561,21 @@ discard block |
||
561 | 561 | if (!$valid) { |
562 | 562 | $error_string = '<ul>'; |
563 | 563 | foreach ($invalid_files as $invalid_file) { |
564 | - $error_string .= '<li>' . $invalid_file . '</li>'; |
|
564 | + $error_string .= '<li>'.$invalid_file.'</li>'; |
|
565 | 565 | } |
566 | 566 | $error_string .= '</ul>'; |
567 | 567 | Display::display_error_message( |
568 | - get_lang('ErrorStylesheetFilesExtensionsInsideZip') . $error_string, |
|
568 | + get_lang('ErrorStylesheetFilesExtensionsInsideZip').$error_string, |
|
569 | 569 | false |
570 | 570 | ); |
571 | 571 | } else { |
572 | 572 | // If the zip does not contain a single directory, extract it. |
573 | 573 | if (!$single_directory) { |
574 | 574 | // Extract zip file. |
575 | - $zip->extractTo($cssToUpload . $style_name . '/'); |
|
575 | + $zip->extractTo($cssToUpload.$style_name.'/'); |
|
576 | 576 | $result = true; |
577 | 577 | } else { |
578 | - $extraction_path = $cssToUpload . $style_name . '/'; |
|
578 | + $extraction_path = $cssToUpload.$style_name.'/'; |
|
579 | 579 | for ($i = 0; $i < $num_files; $i++) { |
580 | 580 | $entry = $zip->getNameIndex($i); |
581 | 581 | if (substr($entry, -1) == '/') { |
@@ -586,14 +586,14 @@ discard block |
||
586 | 586 | $entry_without_first_dir = substr($entry, $pos_slash + 1); |
587 | 587 | // If there is still a slash, we need to make sure the directories are created. |
588 | 588 | if (strpos($entry_without_first_dir, '/') !== false) { |
589 | - if (!is_dir($extraction_path . dirname($entry_without_first_dir))) { |
|
589 | + if (!is_dir($extraction_path.dirname($entry_without_first_dir))) { |
|
590 | 590 | // Create it. |
591 | - @mkdir($extraction_path . dirname($entry_without_first_dir), $mode = 0777, true); |
|
591 | + @mkdir($extraction_path.dirname($entry_without_first_dir), $mode = 0777, true); |
|
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | 595 | $fp = $zip->getStream($entry); |
596 | - $ofp = fopen($extraction_path . dirname($entry_without_first_dir) . '/' . basename($entry), |
|
596 | + $ofp = fopen($extraction_path.dirname($entry_without_first_dir).'/'.basename($entry), |
|
597 | 597 | 'w'); |
598 | 598 | |
599 | 599 | while (!feof($fp)) { |
@@ -608,17 +608,17 @@ discard block |
||
608 | 608 | } |
609 | 609 | $zip->close(); |
610 | 610 | } else { |
611 | - Display::display_error_message(get_lang('ErrorReadingZip') . $info['extension'], false); |
|
611 | + Display::display_error_message(get_lang('ErrorReadingZip').$info['extension'], false); |
|
612 | 612 | } |
613 | 613 | } else { |
614 | 614 | // Simply move the file. |
615 | - move_uploaded_file($picture['tmp_name'], $cssToUpload . $style_name . '/' . $picture['name']); |
|
615 | + move_uploaded_file($picture['tmp_name'], $cssToUpload.$style_name.'/'.$picture['name']); |
|
616 | 616 | $result = true; |
617 | 617 | } |
618 | 618 | |
619 | 619 | if ($result) { |
620 | 620 | $fs = new Filesystem(); |
621 | - $fs->mirror($cssToUpload, api_get_path(SYS_PATH) . 'web/css/themes/'); |
|
621 | + $fs->mirror($cssToUpload, api_get_path(SYS_PATH).'web/css/themes/'); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | return $result; |
@@ -647,8 +647,8 @@ discard block |
||
647 | 647 | $plugin_list = $plugin_obj->read_plugins_from_path(); |
648 | 648 | |
649 | 649 | foreach ($plugin_list as $plugin) { |
650 | - if (isset($_POST['plugin_' . $plugin])) { |
|
651 | - $areas_to_installed = $_POST['plugin_' . $plugin]; |
|
650 | + if (isset($_POST['plugin_'.$plugin])) { |
|
651 | + $areas_to_installed = $_POST['plugin_'.$plugin]; |
|
652 | 652 | if (!empty($areas_to_installed)) { |
653 | 653 | $plugin_obj->remove_all_regions($plugin); |
654 | 654 | foreach ($areas_to_installed as $region) { |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | $installed_plugins = array(); |
676 | 676 | |
677 | 677 | foreach ($plugin_list as $plugin) { |
678 | - if (isset($_POST['plugin_' . $plugin])) { |
|
678 | + if (isset($_POST['plugin_'.$plugin])) { |
|
679 | 679 | $appPlugin->install($plugin); |
680 | 680 | $installed_plugins[] = $plugin; |
681 | 681 | } |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | $dir = CSS_UPLOAD_PATH; |
723 | 723 | $dirs = scandir($dir); |
724 | 724 | $style = str_replace(array('/', '\\'), array('', ''), $style); // Avoid slashes or backslashes. |
725 | - if (in_array($style, $dirs) && is_dir($dir . $style)) { |
|
725 | + if (in_array($style, $dirs) && is_dir($dir.$style)) { |
|
726 | 726 | return true; |
727 | 727 | } |
728 | 728 | return false; |
@@ -737,10 +737,10 @@ discard block |
||
737 | 737 | { |
738 | 738 | global $SettingsStored, $_configuration; |
739 | 739 | |
740 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
740 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
741 | 741 | $search_enabled = api_get_setting('search_enabled'); |
742 | 742 | |
743 | - $form = new FormValidator('search-options', 'post', api_get_self() . '?category=Search'); |
|
743 | + $form = new FormValidator('search-options', 'post', api_get_self().'?category=Search'); |
|
744 | 744 | $values = api_get_settings_options('search_enabled'); |
745 | 745 | $form->addElement('header', null, get_lang('SearchEnabledTitle')); |
746 | 746 | |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | echo '</div>'; |
809 | 809 | |
810 | 810 | if ($search_enabled == 'true') { |
811 | - $xapian_path = api_get_path(SYS_UPLOAD_PATH) . 'plugins/xapian/searchdb'; |
|
811 | + $xapian_path = api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb'; |
|
812 | 812 | |
813 | 813 | /* |
814 | 814 | @todo Test the Xapian connection |
@@ -857,8 +857,8 @@ discard block |
||
857 | 857 | } |
858 | 858 | |
859 | 859 | $data[] = array(get_lang('XapianModuleInstalled'), $xapian_loaded); |
860 | - $data[] = array(get_lang('DirectoryExists') . ' - ' . $xapian_path, $dir_exists); |
|
861 | - $data[] = array(get_lang('IsWritable') . ' - ' . $xapian_path, $dir_is_writable); |
|
860 | + $data[] = array(get_lang('DirectoryExists').' - '.$xapian_path, $dir_exists); |
|
861 | + $data[] = array(get_lang('IsWritable').' - '.$xapian_path, $dir_is_writable); |
|
862 | 862 | $data[] = array(get_lang('SpecificSearchFieldsAvailable'), $specific_fields_exists); |
863 | 863 | |
864 | 864 | echo Display::tag('h3', get_lang('Settings')); |
@@ -916,8 +916,8 @@ discard block |
||
916 | 916 | |
917 | 917 | if ($action != 'add') { |
918 | 918 | echo '<div class="actions" style="margin-left: 1px;">'; |
919 | - echo '<a href="settings.php?category=Templates&action=add">' . |
|
920 | - Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
919 | + echo '<a href="settings.php?category=Templates&action=add">'. |
|
920 | + Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
921 | 921 | echo '</div>'; |
922 | 922 | } |
923 | 923 | |
@@ -1039,10 +1039,10 @@ discard block |
||
1039 | 1039 | */ |
1040 | 1040 | function actions_filter($id) |
1041 | 1041 | { |
1042 | - $return = '<a href="settings.php?category=Templates&action=edit&id=' . Security::remove_XSS($id) . '">' . Display::return_icon('edit.png', |
|
1043 | - get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>'; |
|
1044 | - $return .= '<a href="settings.php?category=Templates&action=delete&id=' . Security::remove_XSS($id) . '" onClick="javascript:if(!confirm(' . "'" . get_lang('ConfirmYourChoice') . "'" . ')) return false;">' . Display::return_icon('delete.png', |
|
1045 | - get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; |
|
1042 | + $return = '<a href="settings.php?category=Templates&action=edit&id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.png', |
|
1043 | + get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'; |
|
1044 | + $return .= '<a href="settings.php?category=Templates&action=delete&id='.Security::remove_XSS($id).'" onClick="javascript:if(!confirm('."'".get_lang('ConfirmYourChoice')."'".')) return false;">'.Display::return_icon('delete.png', |
|
1045 | + get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
1046 | 1046 | return $return; |
1047 | 1047 | } |
1048 | 1048 | |
@@ -1059,9 +1059,9 @@ discard block |
||
1059 | 1059 | function image_filter($image) |
1060 | 1060 | { |
1061 | 1061 | if (!empty($image)) { |
1062 | - return '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/' . $image . '" alt="' . get_lang('TemplatePreview') . '"/>'; |
|
1062 | + return '<img src="'.api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/'.$image.'" alt="'.get_lang('TemplatePreview').'"/>'; |
|
1063 | 1063 | } else { |
1064 | - return '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/noimage.gif" alt="' . get_lang('NoTemplatePreview') . '"/>'; |
|
1064 | + return '<img src="'.api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/noimage.gif" alt="'.get_lang('NoTemplatePreview').'"/>'; |
|
1065 | 1065 | } |
1066 | 1066 | } |
1067 | 1067 | |
@@ -1076,9 +1076,9 @@ discard block |
||
1076 | 1076 | function add_edit_template() |
1077 | 1077 | { |
1078 | 1078 | // Initialize the object. |
1079 | - $id = isset($_GET['id']) ? '&id=' . Security::remove_XSS($_GET['id']) : ''; |
|
1079 | + $id = isset($_GET['id']) ? '&id='.Security::remove_XSS($_GET['id']) : ''; |
|
1080 | 1080 | $form = new FormValidator('template', 'post', |
1081 | - 'settings.php?category=Templates&action=' . Security::remove_XSS($_GET['action']) . $id); |
|
1081 | + 'settings.php?category=Templates&action='.Security::remove_XSS($_GET['action']).$id); |
|
1082 | 1082 | |
1083 | 1083 | // Setting the form elements: the header. |
1084 | 1084 | if ($_GET['action'] == 'add') { |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | if ($_GET['action'] == 'edit') { |
1106 | 1106 | // Database table definition. |
1107 | 1107 | $table_system_template = Database:: get_main_table('system_template'); |
1108 | - $sql = "SELECT * FROM $table_system_template WHERE id = " . intval($_GET['id']) . ""; |
|
1108 | + $sql = "SELECT * FROM $table_system_template WHERE id = ".intval($_GET['id']).""; |
|
1109 | 1109 | $result = Database::query($sql); |
1110 | 1110 | $row = Database::fetch_array($result); |
1111 | 1111 | |
@@ -1120,10 +1120,10 @@ discard block |
||
1120 | 1120 | // Adding an extra field: a preview of the image that is currently used. |
1121 | 1121 | if (!empty($row['image'])) { |
1122 | 1122 | $form->addElement('static', 'template_image_preview', '', |
1123 | - '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/' . $row['image'] . '" alt="' . get_lang('TemplatePreview') . '"/>'); |
|
1123 | + '<img src="'.api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/'.$row['image'].'" alt="'.get_lang('TemplatePreview').'"/>'); |
|
1124 | 1124 | } else { |
1125 | 1125 | $form->addElement('static', 'template_image_preview', '', |
1126 | - '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/noimage.gif" alt="' . get_lang('NoTemplatePreview') . '"/>'); |
|
1126 | + '<img src="'.api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/noimage.gif" alt="'.get_lang('NoTemplatePreview').'"/>'); |
|
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | // Setting the information of the template that we are editing. |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | $_FILES['template_image']['type']); |
1155 | 1155 | |
1156 | 1156 | // The upload directory. |
1157 | - $upload_dir = api_get_path(SYS_APP_PATH) . 'home/default_platform_document/template_thumb/'; |
|
1157 | + $upload_dir = api_get_path(SYS_APP_PATH).'home/default_platform_document/template_thumb/'; |
|
1158 | 1158 | |
1159 | 1159 | // Create the directory if it does not exist. |
1160 | 1160 | if (!is_dir($upload_dir)) { |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | if ($picture_info['width'] > $max_width_for_picture) { |
1171 | 1171 | $temp->resize($max_width_for_picture); |
1172 | 1172 | } |
1173 | - $temp->send_image($upload_dir . $new_file_name); |
|
1173 | + $temp->send_image($upload_dir.$new_file_name); |
|
1174 | 1174 | } |
1175 | 1175 | } |
1176 | 1176 | |
@@ -1187,15 +1187,15 @@ discard block |
||
1187 | 1187 | |
1188 | 1188 | // Display a feedback message. |
1189 | 1189 | Display::display_confirmation_message(get_lang('TemplateAdded')); |
1190 | - echo '<a href="settings.php?category=Templates&action=add">' . Display::return_icon('new_template.png', |
|
1191 | - get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
1190 | + echo '<a href="settings.php?category=Templates&action=add">'.Display::return_icon('new_template.png', |
|
1191 | + get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1192 | 1192 | } else { |
1193 | - $content_template = '<head>{CSS}<style type="text/css">.text{font-weight: normal;}</style></head><body>' . Database::escape_string($values['template_text']) . '</body>'; |
|
1194 | - $sql = "UPDATE $table_system_template set title = '" . Database::escape_string($values['title']) . "', content = '" . $content_template . "'"; |
|
1193 | + $content_template = '<head>{CSS}<style type="text/css">.text{font-weight: normal;}</style></head><body>'.Database::escape_string($values['template_text']).'</body>'; |
|
1194 | + $sql = "UPDATE $table_system_template set title = '".Database::escape_string($values['title'])."', content = '".$content_template."'"; |
|
1195 | 1195 | if (!empty($new_file_name)) { |
1196 | - $sql .= ", image = '" . Database::escape_string($new_file_name) . "'"; |
|
1196 | + $sql .= ", image = '".Database::escape_string($new_file_name)."'"; |
|
1197 | 1197 | } |
1198 | - $sql .= " WHERE id = " . intval($_GET['id']) . ""; |
|
1198 | + $sql .= " WHERE id = ".intval($_GET['id']).""; |
|
1199 | 1199 | Database::query($sql); |
1200 | 1200 | |
1201 | 1201 | // Display a feedback message. |
@@ -1226,15 +1226,15 @@ discard block |
||
1226 | 1226 | { |
1227 | 1227 | // First we remove the image. |
1228 | 1228 | $table_system_template = Database:: get_main_table('system_template'); |
1229 | - $sql = "SELECT * FROM $table_system_template WHERE id = " . intval($id) . ""; |
|
1229 | + $sql = "SELECT * FROM $table_system_template WHERE id = ".intval($id).""; |
|
1230 | 1230 | $result = Database::query($sql); |
1231 | 1231 | $row = Database::fetch_array($result); |
1232 | 1232 | if (!empty($row['image'])) { |
1233 | - @unlink(api_get_path(SYS_APP_PATH) . 'home/default_platform_document/template_thumb/' . $row['image']); |
|
1233 | + @unlink(api_get_path(SYS_APP_PATH).'home/default_platform_document/template_thumb/'.$row['image']); |
|
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | // Now we remove it from the database. |
1237 | - $sql = "DELETE FROM $table_system_template WHERE id = " . intval($id) . ""; |
|
1237 | + $sql = "DELETE FROM $table_system_template WHERE id = ".intval($id).""; |
|
1238 | 1238 | Database::query($sql); |
1239 | 1239 | |
1240 | 1240 | // Display a feedback message. |
@@ -1309,7 +1309,7 @@ discard block |
||
1309 | 1309 | global $_configuration, $settings_to_avoid, $convert_byte_to_mega_list; |
1310 | 1310 | $table_settings_current = Database:: get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
1311 | 1311 | |
1312 | - $form = new FormValidator('settings', 'post', 'settings.php?category=' . Security::remove_XSS($_GET['category'])); |
|
1312 | + $form = new FormValidator('settings', 'post', 'settings.php?category='.Security::remove_XSS($_GET['category'])); |
|
1313 | 1313 | |
1314 | 1314 | $form->addElement('hidden', 'search_field', |
1315 | 1315 | (!empty($_GET['search_field']) ? Security::remove_XSS($_GET['search_field']) : null)); |
@@ -1344,23 +1344,23 @@ discard block |
||
1344 | 1344 | if ($url_id == 1) { |
1345 | 1345 | if ($row['access_url_changeable'] == '1') { |
1346 | 1346 | $form->addElement('html', |
1347 | - '<div style="float: right;"><a class="share_this_setting" data_status = "0" data_to_send = "' . $row['variable'] . '" href="javascript:void(0);">' . |
|
1347 | + '<div style="float: right;"><a class="share_this_setting" data_status = "0" data_to_send = "'.$row['variable'].'" href="javascript:void(0);">'. |
|
1348 | 1348 | Display::return_icon('shared_setting.png', |
1349 | - get_lang('ChangeSharedSetting')) . '</a></div>'); |
|
1349 | + get_lang('ChangeSharedSetting')).'</a></div>'); |
|
1350 | 1350 | } else { |
1351 | 1351 | $form->addElement('html', |
1352 | - '<div style="float: right;"><a class="share_this_setting" data_status = "1" data_to_send = "' . $row['variable'] . '" href="javascript:void(0);">' . |
|
1352 | + '<div style="float: right;"><a class="share_this_setting" data_status = "1" data_to_send = "'.$row['variable'].'" href="javascript:void(0);">'. |
|
1353 | 1353 | Display::return_icon('shared_setting_na.png', |
1354 | - get_lang('ChangeSharedSetting')) . '</a></div>'); |
|
1354 | + get_lang('ChangeSharedSetting')).'</a></div>'); |
|
1355 | 1355 | } |
1356 | 1356 | } else { |
1357 | 1357 | if ($row['access_url_changeable'] == '1') { |
1358 | - $form->addElement('html', '<div style="float: right;">' . |
|
1359 | - Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')) . '</div>'); |
|
1358 | + $form->addElement('html', '<div style="float: right;">'. |
|
1359 | + Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')).'</div>'); |
|
1360 | 1360 | } else { |
1361 | - $form->addElement('html', '<div style="float: right;">' . |
|
1361 | + $form->addElement('html', '<div style="float: right;">'. |
|
1362 | 1362 | Display::return_icon('shared_setting_na.png', |
1363 | - get_lang('ChangeSharedSetting')) . '</div>'); |
|
1363 | + get_lang('ChangeSharedSetting')).'</div>'); |
|
1364 | 1364 | } |
1365 | 1365 | } |
1366 | 1366 | } |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | break; |
1446 | 1446 | case 'textarea': |
1447 | 1447 | if ($row['variable'] == 'header_extra_content') { |
1448 | - $file = api_get_path(SYS_PATH) . api_get_home_path() . 'header_extra_content.txt'; |
|
1448 | + $file = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt'; |
|
1449 | 1449 | $value = ''; |
1450 | 1450 | if (file_exists($file)) { |
1451 | 1451 | $value = file_get_contents($file); |
@@ -1454,7 +1454,7 @@ discard block |
||
1454 | 1454 | array(get_lang($row['title']), get_lang($row['comment'])), array('rows' => '10'), $hideme); |
1455 | 1455 | $default_values[$row['variable']] = $value; |
1456 | 1456 | } elseif ($row['variable'] == 'footer_extra_content') { |
1457 | - $file = api_get_path(SYS_PATH) . api_get_home_path() . 'footer_extra_content.txt'; |
|
1457 | + $file = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt'; |
|
1458 | 1458 | $value = ''; |
1459 | 1459 | if (file_exists($file)) { |
1460 | 1460 | $value = file_get_contents($file); |
@@ -1498,7 +1498,7 @@ discard block |
||
1498 | 1498 | case 'checkbox'; |
1499 | 1499 | // 1. We collect all the options of this variable. |
1500 | 1500 | $sql = "SELECT * FROM $table_settings_current |
1501 | - WHERE variable='" . $row['variable'] . "' AND access_url = 1"; |
|
1501 | + WHERE variable='".$row['variable']."' AND access_url = 1"; |
|
1502 | 1502 | |
1503 | 1503 | $result = Database::query($sql); |
1504 | 1504 | $group = array(); |
@@ -1530,9 +1530,9 @@ discard block |
||
1530 | 1530 | } |
1531 | 1531 | $sql = "SELECT selected_value FROM $table_settings_current |
1532 | 1532 | WHERE |
1533 | - variable='" . $rowkeys['variable'] . "' AND |
|
1534 | - subkey='" . $rowkeys['subkey'] . "' AND |
|
1535 | - subkeytext='" . $rowkeys['subkeytext'] . "' AND |
|
1533 | + variable='".$rowkeys['variable']."' AND |
|
1534 | + subkey='" . $rowkeys['subkey']."' AND |
|
1535 | + subkeytext='" . $rowkeys['subkeytext']."' AND |
|
1536 | 1536 | access_url = $access_url"; |
1537 | 1537 | $result_access = Database::query($sql); |
1538 | 1538 | $row_access = Database::fetch_array($result_access); |
@@ -1558,7 +1558,7 @@ discard block |
||
1558 | 1558 | break; |
1559 | 1559 | case 'link': |
1560 | 1560 | $form->addElement('static', null, array(get_lang($row['title']), get_lang($row['comment'])), |
1561 | - get_lang('CurrentValue') . ' : ' . $row['selected_value'], $hideme); |
|
1561 | + get_lang('CurrentValue').' : '.$row['selected_value'], $hideme); |
|
1562 | 1562 | break; |
1563 | 1563 | case 'select': |
1564 | 1564 | /* |
@@ -1566,7 +1566,7 @@ discard block |
||
1566 | 1566 | * The functions being called must be added to the file settings.lib.php. |
1567 | 1567 | */ |
1568 | 1568 | $form->addElement('select', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), |
1569 | - call_user_func('select_' . $row['variable']), $hideme); |
|
1569 | + call_user_func('select_'.$row['variable']), $hideme); |
|
1570 | 1570 | $default_values[$row['variable']] = $row['selected_value']; |
1571 | 1571 | break; |
1572 | 1572 | case 'custom': |
@@ -1578,16 +1578,16 @@ discard block |
||
1578 | 1578 | $url = PDF::get_watermark(null); |
1579 | 1579 | |
1580 | 1580 | if ($url != false) { |
1581 | - $delete_url = '<a href="?delete_watermark">' . get_lang('DelImage') . ' ' . Display::return_icon('delete.png', |
|
1582 | - get_lang('DelImage')) . '</a>'; |
|
1581 | + $delete_url = '<a href="?delete_watermark">'.get_lang('DelImage').' '.Display::return_icon('delete.png', |
|
1582 | + get_lang('DelImage')).'</a>'; |
|
1583 | 1583 | $form->addElement('html', |
1584 | - '<div style="max-height:100px; max-width:100px; margin-left:162px; margin-bottom:10px; clear:both;"><img src="' . $url . '" style="margin-bottom:10px;" />' . $delete_url . '</div>'); |
|
1584 | + '<div style="max-height:100px; max-width:100px; margin-left:162px; margin-bottom:10px; clear:both;"><img src="'.$url.'" style="margin-bottom:10px;" />'.$delete_url.'</div>'); |
|
1585 | 1585 | } |
1586 | 1586 | |
1587 | 1587 | $form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark')); |
1588 | 1588 | $allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif'); |
1589 | 1589 | $form->addRule('pdf_export_watermark_path', |
1590 | - get_lang('OnlyImagesAllowed') . ' (' . implode(',', $allowed_picture_types) . ')', 'filetype', |
|
1590 | + get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', |
|
1591 | 1591 | $allowed_picture_types); |
1592 | 1592 | |
1593 | 1593 | break; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * @param string ISO code (fr_FR, ...) |
29 | 29 | * @param int Whether the sublanguage is published (0=unpublished, 1=published) |
30 | 30 | * @param int ID del idioma padre |
31 | - * @return int New sub language ID or false on error |
|
31 | + * @return false|string New sub language ID or false on error |
|
32 | 32 | */ |
33 | 33 | function add_sub_language ($original_name,$english_name,$isocode,$sublanguage_available,$parent_id) { |
34 | 34 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | $sublanguage_available = Database::escape_string($sublanguage_available); |
40 | 40 | $parent_id = intval($parent_id); |
41 | 41 | |
42 | - $sql = 'INSERT INTO ' . $tbl_admin_languages . '(original_name,english_name,isocode,dokeos_folder,available,parent_id) |
|
43 | - VALUES ("' . $original_name . '","' . $english_name . '","' . $isocode . '","' . $english_name . '","' . $sublanguage_available . '","' . $parent_id . '")'; |
|
42 | + $sql = 'INSERT INTO '.$tbl_admin_languages.'(original_name,english_name,isocode,dokeos_folder,available,parent_id) |
|
43 | + VALUES ("' . $original_name.'","'.$english_name.'","'.$isocode.'","'.$english_name.'","'.$sublanguage_available.'","'.$parent_id.'")'; |
|
44 | 44 | $res = Database::query($sql); |
45 | 45 | if ($res === false) { |
46 | 46 | return false; |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | function check_if_language_exist($original_name, $english_name, $isocode, $sublanguage_available) |
66 | 66 | { |
67 | 67 | $tbl_admin_languages = Database:: get_main_table(TABLE_MAIN_LANGUAGE); |
68 | - $sql_original_name = 'SELECT count(*) AS count_original_name FROM ' . $tbl_admin_languages . ' WHERE original_name="' . Database::escape_string($original_name) . '" '; |
|
69 | - $sql_english_name = 'SELECT count(*) AS count_english_name FROM ' . $tbl_admin_languages . ' WHERE english_name="' . Database::escape_string($english_name) . '" '; |
|
68 | + $sql_original_name = 'SELECT count(*) AS count_original_name FROM '.$tbl_admin_languages.' WHERE original_name="'.Database::escape_string($original_name).'" '; |
|
69 | + $sql_english_name = 'SELECT count(*) AS count_english_name FROM '.$tbl_admin_languages.' WHERE english_name="'.Database::escape_string($english_name).'" '; |
|
70 | 70 | //$sql_isocode='SELECT count(*) AS count_isocode FROM '.$tbl_admin_languages.' WHERE isocode="'.Database::escape_string($isocode).'" '; |
71 | 71 | $rs_original_name = Database::query($sql_original_name); |
72 | 72 | $rs_english_name = Database::query($sql_english_name); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function ckeck_if_is_parent_of_sub_language($parent_id) |
124 | 124 | { |
125 | - $sql = 'SELECT count(*) AS count FROM language WHERE parent_id= ' . intval($parent_id) . ''; |
|
125 | + $sql = 'SELECT count(*) AS count FROM language WHERE parent_id= '.intval($parent_id).''; |
|
126 | 126 | $rs = Database::query($sql); |
127 | 127 | if (Database::num_rows($rs) > 0 && Database::result($rs, 0, 'count') == 1) { |
128 | 128 | return true; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | -$language_name = get_lang('CreateSubLanguageForLanguage') . ' ( ' . strtolower($language_name) . ' )'; |
|
186 | +$language_name = get_lang('CreateSubLanguageForLanguage').' ( '.strtolower($language_name).' )'; |
|
187 | 187 | |
188 | 188 | if (ckeck_if_is_parent_of_sub_language($parent_id) === true && isset($_GET['action']) && $_GET['action'] == 'deletesublanguage') { |
189 | 189 | $language_name = get_lang('DeleteSubLanguage'); |
@@ -204,15 +204,15 @@ discard block |
||
204 | 204 | foreach ($check_information as $index_information => $value_information) { |
205 | 205 | $allow_insert_info = false; |
206 | 206 | if ($index_information == 'original_name') { |
207 | - $msg .= Display::return_message(get_lang('AlreadyExists') . ' "' . get_lang('OriginalName') . '" ' . '(' . $original_name . ')', |
|
207 | + $msg .= Display::return_message(get_lang('AlreadyExists').' "'.get_lang('OriginalName').'" '.'('.$original_name.')', |
|
208 | 208 | 'error'); |
209 | 209 | } |
210 | 210 | if ($index_information == 'english_name') { |
211 | - $msg .= Display::return_message(get_lang('AlreadyExists') . ' "' . get_lang('EnglishName') . '" ' . '(' . $english_name . ')', |
|
211 | + $msg .= Display::return_message(get_lang('AlreadyExists').' "'.get_lang('EnglishName').'" '.'('.$english_name.')', |
|
212 | 212 | 'error'); |
213 | 213 | } |
214 | 214 | if ($index_information == 'isocode') { |
215 | - $msg .= Display::return_message(get_lang('CodeDoesNotExists') . ': ' . $isocode . '', 'error'); |
|
215 | + $msg .= Display::return_message(get_lang('CodeDoesNotExists').': '.$isocode.'', 'error'); |
|
216 | 216 | } |
217 | 217 | if ($index_information == 'execute_add' && $value_information === true) { |
218 | 218 | $allow_insert_info = true; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $english_name = api_strtolower($english_name); |
227 | 227 | |
228 | 228 | $isocode = str_replace(' ', '_', $isocode); |
229 | - $str_info = '<br/>' . get_lang('OriginalName') . ' : ' . $original_name . '<br/>' . get_lang('EnglishName') . ' : ' . $english_name . '<br/>' . get_lang('PlatformCharsetTitle') . ' : ' . $isocode; |
|
229 | + $str_info = '<br/>'.get_lang('OriginalName').' : '.$original_name.'<br/>'.get_lang('EnglishName').' : '.$english_name.'<br/>'.get_lang('PlatformCharsetTitle').' : '.$isocode; |
|
230 | 230 | |
231 | 231 | $mkdir_result = SubLanguageManager::add_language_directory($english_name); |
232 | 232 | if ($mkdir_result) { |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $msg .= Display::return_message(get_lang('LanguageDirectoryNotWriteableContactAdmin'), 'error'); |
237 | 237 | } else { |
238 | 238 | // Here we build the confirmation message and we send the user to the sub language terms definition page, using a little hack - see #3712 |
239 | - $_SESSION['msg'] = Display::return_message(get_lang('TheNewSubLanguageHasBeenAdded') . $str_info . 'confirm', |
|
239 | + $_SESSION['msg'] = Display::return_message(get_lang('TheNewSubLanguageHasBeenAdded').$str_info.'confirm', |
|
240 | 240 | false); |
241 | 241 | unset($interbreadcrumb); |
242 | 242 | $_GET['sub_language_id'] = $_REQUEST['sub_language_id'] = $sl_id; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | if (isset($_GET['action']) && $_GET['action'] == 'definenewsublanguage') { |
274 | 274 | $text = $language_name; |
275 | 275 | $form = new FormValidator('addsublanguage', 'post', |
276 | - 'sub_language_add.php?id=' . Security::remove_XSS($_GET['id']) . '&action=definenewsublanguage'); |
|
276 | + 'sub_language_add.php?id='.Security::remove_XSS($_GET['id']).'&action=definenewsublanguage'); |
|
277 | 277 | $class = 'add'; |
278 | 278 | $form->addElement('header', '', $text); |
279 | 279 | $form->addElement('text', 'original_name', get_lang('OriginalName'), 'class="input_titles"'); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $form->addElement('checkbox', 'sub_language_is_visible', '', get_lang('Visibility')); |
287 | 287 | $form->addButtonCreate(get_lang('CreateSubLanguage'), 'SubmitAddNewLanguage'); |
288 | 288 | //$values['original_name'] = $language_details['original_name'].'...'; -> cannot be used because of quickform filtering (freeze) |
289 | - $values['english_name'] = $language_details['english_name'] . '2'; |
|
289 | + $values['english_name'] = $language_details['english_name'].'2'; |
|
290 | 290 | $values['isocode'] = $language_details['isocode']; |
291 | 291 | $form->setDefaults($values); |
292 | 292 | $form->display(); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | if (isset($_GET['action']) && $_GET['action'] == 'deletesublanguage') { |
295 | 295 | $text = $language_name; |
296 | 296 | $form = new FormValidator('deletesublanguage', 'post', |
297 | - 'sub_language_add.php?id=' . Security::remove_XSS($_GET['id']) . '&sub_language_id=' . Security::remove_XSS($_GET['sub_language_id'])); |
|
297 | + 'sub_language_add.php?id='.Security::remove_XSS($_GET['id']).'&sub_language_id='.Security::remove_XSS($_GET['sub_language_id'])); |
|
298 | 298 | $class = 'minus'; |
299 | 299 | $form->addElement('header', '', $text); |
300 | 300 | $form->addElement('static', '', get_lang('OriginalName'), $original_name); |
@@ -128,7 +128,7 @@ |
||
128 | 128 | /** |
129 | 129 | * Update users from the imported data |
130 | 130 | * @param array $users List of users |
131 | - * @return void |
|
131 | + * @return false|null |
|
132 | 132 | * @uses global variable $inserted_in_course, which returns the list of courses the user was inserted in |
133 | 133 | */ |
134 | 134 |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | // We are sure that the extra field exists. |
216 | 216 | foreach ($extra_fields as $extras) { |
217 | 217 | if (isset($user[$extras[1]])) { |
218 | - $key = $extras[1]; |
|
219 | - $value = $user[$extras[1]]; |
|
218 | + $key = $extras[1]; |
|
219 | + $value = $user[$extras[1]]; |
|
220 | 220 | UserManager::update_extra_field_value($user_id, $key, $value); |
221 | 221 | } |
222 | 222 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | global $current_tag; |
254 | 254 | switch ($data) { |
255 | 255 | case 'Contact': |
256 | - $user = array (); |
|
256 | + $user = array(); |
|
257 | 257 | break; |
258 | 258 | default: |
259 | 259 | $current_tag = $data; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | if (in_array($ext_import_file, $allowed_file_mimetype)) { |
352 | 352 | if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) { |
353 | - $users = parse_csv_data($_FILES['import_file']['tmp_name']); |
|
353 | + $users = parse_csv_data($_FILES['import_file']['tmp_name']); |
|
354 | 354 | $errors = validate_data($users); |
355 | 355 | $error_kind_file = false; |
356 | 356 | } elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) { |
@@ -454,7 +454,10 @@ |
||
454 | 454 | <blockquote> |
455 | 455 | <pre> |
456 | 456 | <b>UserName</b>;LastName;FirstName;Email;NewUserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;Active;Language;Courses;ClassId; |
457 | - xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;0/1;xxx;<span style="color:red;"><?php if (count($list_reponse) > 0) echo implode(';', $list_reponse).';'; ?></span>xxx1|xxx2|xxx3;1;<br /> |
|
457 | + xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;0/1;xxx;<span style="color:red;"><?php if (count($list_reponse) > 0) { |
|
458 | + echo implode(';', $list_reponse).';'; |
|
459 | +} |
|
460 | +?></span>xxx1|xxx2|xxx3;1;<br /> |
|
458 | 461 | </pre> |
459 | 462 | </blockquote> |
460 | 463 | <p><?php |
@@ -60,8 +60,8 @@ |
||
60 | 60 | $user['error'] = get_lang('UserNameNotAvailable'); |
61 | 61 | $errors[] = $user; |
62 | 62 | } |
63 | - } |
|
64 | - } |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | // 3. Check status. |
67 | 67 | if (isset($user['Status']) && !api_status_exists($user['Status'])) { |
@@ -206,7 +206,7 @@ |
||
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Restores an attendance entry and fallback to attendances rendering |
209 | - * @param int $attendanceId |
|
209 | + * @param int $attendance_id |
|
210 | 210 | */ |
211 | 211 | public function attendance_restore($attendance_id) |
212 | 212 | { |
@@ -636,11 +636,11 @@ |
||
636 | 636 | } |
637 | 637 | $formToDisplay = $form->returnForm(); |
638 | 638 | } else { |
639 | - if (!empty($sessionId)) { |
|
640 | - $sessionInfo = api_get_session_info($sessionId); |
|
641 | - $startDate = $sessionInfo['access_start_date']; |
|
642 | - $endDate = $sessionInfo['access_end_date']; |
|
643 | - } |
|
639 | + if (!empty($sessionId)) { |
|
640 | + $sessionInfo = api_get_session_info($sessionId); |
|
641 | + $startDate = $sessionInfo['access_start_date']; |
|
642 | + $endDate = $sessionInfo['access_end_date']; |
|
643 | + } |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | $attendance = new Attendance(); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $attendance->set_attendance_qualify_title($_POST['attendance_qualify_title']); |
61 | 61 | $attendance->set_attendance_weight($_POST['attendance_weight']); |
62 | 62 | $link_to_gradebook = false; |
63 | - if ( isset($_POST['attendance_qualify_gradebook']) && $_POST['attendance_qualify_gradebook'] == 1 ) { |
|
63 | + if (isset($_POST['attendance_qualify_gradebook']) && $_POST['attendance_qualify_gradebook'] == 1) { |
|
64 | 64 | $link_to_gradebook = true; |
65 | 65 | } |
66 | 66 | $attendance->category_id = $_POST['category_id']; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | ) { |
113 | 113 | $link_to_gradebook = true; |
114 | 114 | } |
115 | - $attendance->attendance_edit($attendance_id,$link_to_gradebook); |
|
115 | + $attendance->attendance_edit($attendance_id, $link_to_gradebook); |
|
116 | 116 | Security::clear_token(); |
117 | 117 | header('location:index.php?action=attendance_list&'.api_get_cidreq()); |
118 | 118 | exit; |
@@ -543,17 +543,17 @@ discard block |
||
543 | 543 | } |
544 | 544 | } |
545 | 545 | $max_cols_per_page = 12; //10 dates + 2 name and number |
546 | - $max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2;//10 |
|
546 | + $max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2; //10 |
|
547 | 547 | $rows = count($data_table); |
548 | 548 | |
549 | 549 | if ($cols > $max_cols_per_page) { |
550 | - $number_tables = round(($cols-2)/$max_dates_per_page); |
|
550 | + $number_tables = round(($cols - 2) / $max_dates_per_page); |
|
551 | 551 | $headers = $data_table[0]; |
552 | 552 | $all = array(); |
553 | 553 | $tables = array(); |
554 | 554 | $changed = 1; |
555 | 555 | |
556 | - for ($i= 0; $i <= $rows; $i++) { |
|
556 | + for ($i = 0; $i <= $rows; $i++) { |
|
557 | 557 | $row = isset($data_table[$i]) ? $data_table[$i] : null; |
558 | 558 | $key = 1; |
559 | 559 | $max_dates_per_page = 10; |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | foreach ($item as $value) { |
565 | 565 | if ($count_j >= $max_dates_per_page) { |
566 | 566 | $key++; |
567 | - $max_dates_per_page = $max_dates_per_page_original*$key; |
|
567 | + $max_dates_per_page = $max_dates_per_page_original * $key; |
|
568 | 568 | //magic hack |
569 | 569 | $tables[$key][$i][] = $tables[1][$i][0]; |
570 | 570 | $tables[$key][$i][] = $tables[1][$i][1]; |
@@ -622,8 +622,8 @@ discard block |
||
622 | 622 | $form = new FormValidator( |
623 | 623 | 'search', |
624 | 624 | 'post', |
625 | - api_get_self() . '?' . api_get_cidreq( |
|
626 | - ) . '&action=calendar_logins' |
|
625 | + api_get_self().'?'.api_get_cidreq( |
|
626 | + ).'&action=calendar_logins' |
|
627 | 627 | ); |
628 | 628 | $form->addDateRangePicker('range', get_lang('DateRange')); |
629 | 629 | $form->addButton('submit', get_lang('Submit')); |
@@ -529,10 +529,11 @@ |
||
529 | 529 | $result['full_name'] = api_get_person_name($user['firstname'], $user['lastname']); |
530 | 530 | foreach ($data_array['attendant_calendar'] as $class_day) { |
531 | 531 | if ($class_day['done_attendance'] == 1) { |
532 | - if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1) |
|
533 | - $result[$class_day['id']] = get_lang('UserAttendedSymbol'); |
|
534 | - else |
|
535 | - $result[$class_day['id']] = '<span style="color:red">'.get_lang('UserNotAttendedSymbol').'</span>'; |
|
532 | + if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1) { |
|
533 | + $result[$class_day['id']] = get_lang('UserAttendedSymbol'); |
|
534 | + } else { |
|
535 | + $result[$class_day['id']] = '<span style="color:red">'.get_lang('UserNotAttendedSymbol').'</span>'; |
|
536 | + } |
|
536 | 537 | } else { |
537 | 538 | $result[$class_day['id']] = " "; |
538 | 539 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * This method returns the PEAR DB URL to use to connect to the database. |
64 | 64 | * |
65 | - * @return a PEAR DB URL |
|
65 | + * @return string PEAR DB URL |
|
66 | 66 | * |
67 | 67 | * @private |
68 | 68 | */ |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | /** |
106 | 106 | * This method returns the name of the table where PGT's are stored. |
107 | 107 | * |
108 | - * @return the name of a table. |
|
108 | + * @return string name of a table. |
|
109 | 109 | * |
110 | 110 | * @private |
111 | 111 | */ |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * This method returns an informational string giving the type of storage |
123 | 123 | * used by the object (used for debugging purposes). |
124 | 124 | * |
125 | - * @return an informational string. |
|
125 | + * @return string informational string. |
|
126 | 126 | * @public |
127 | 127 | */ |
128 | 128 | function getStorageType() |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | /** |
149 | 149 | * The class constructor, called by CASClient::SetPGTStorageDB(). |
150 | 150 | * |
151 | - * @param $cas_parent the CASClient instance that creates the object. |
|
151 | + * @param CASClient $cas_parent the CASClient instance that creates the object. |
|
152 | 152 | * @param $user the user to access the data with |
153 | 153 | * @param $password the user's password |
154 | 154 | * @param $database_type the type of the database hosting the data |
@@ -57,7 +57,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -166,11 +166,21 @@ discard block |
||
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 |
||
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 |
@@ -45,175 +45,175 @@ |
||
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 |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * This method returns an informational string giving the type of storage |
99 | 99 | * used by the object (used for debugging purposes). |
100 | 100 | * |
101 | - * @return an informational string. |
|
101 | + * @return string informational string. |
|
102 | 102 | * @public |
103 | 103 | */ |
104 | 104 | function getStorageType() |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * This method returns an informational string giving informations on the |
111 | 111 | * parameters of the storage.(used for debugging purposes). |
112 | 112 | * |
113 | - * @return an informational string. |
|
113 | + * @return string informational string. |
|
114 | 114 | * @public |
115 | 115 | */ |
116 | 116 | function getStorageInfo() |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * The class constructor, called by CASClient::SetPGTStorageFile(). |
127 | 127 | * |
128 | - * @param $cas_parent the CASClient instance that creates the object. |
|
129 | - * @param $format the format used to store the PGT's (`plain' and `xml' allowed). |
|
130 | - * @param $path the path where the PGT's should be stored |
|
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 | 131 | * |
132 | 132 | * @public |
133 | 133 | */ |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @param $pgt_iou the PGT iou. |
204 | 204 | * |
205 | - * @return a filename |
|
205 | + * @return string filename |
|
206 | 206 | * @private |
207 | 207 | */ |
208 | 208 | function getPGTIouFilename($pgt_iou) |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @param $pgt_iou the PGT iou |
245 | 245 | * |
246 | - * @return the corresponding PGT, or FALSE on error |
|
246 | + * @return false|string corresponding PGT, or FALSE on error |
|
247 | 247 | * |
248 | 248 | * @public |
249 | 249 | */ |
@@ -163,12 +163,12 @@ |
||
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 | } |
@@ -131,17 +131,17 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -137,8 +137,12 @@ discard block |
||
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 |
||
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 |
||
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(); |
@@ -44,231 +44,231 @@ |
||
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 an 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 an 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 an 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 an 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 $cas_parent the CASClient instance that creates the object. |
|
129 | - * @param $format the format used to store the PGT's (`plain' and `xml' allowed). |
|
130 | - * @param $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 $cas_parent the CASClient instance that creates the object. |
|
129 | + * @param $format the format used to store the PGT's (`plain' and `xml' allowed). |
|
130 | + * @param $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 a 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 a 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 the 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 the 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 |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | /** |
127 | 127 | * This method returns an error message set by PGTStorage::setErrorMessage(). |
128 | 128 | * |
129 | - * @return an error message when set by PGTStorage::setErrorMessage(), FALSE |
|
129 | + * @return boolean error message when set by PGTStorage::setErrorMessage(), FALSE |
|
130 | 130 | * otherwise. |
131 | 131 | * |
132 | 132 | * @public |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | /** |
154 | 154 | * This method tells if the storage has already been intialized. |
155 | 155 | * |
156 | - * @return a boolean |
|
156 | + * @return boolean boolean |
|
157 | 157 | * |
158 | 158 | * @protected |
159 | 159 | */ |
@@ -44,167 +44,167 @@ |
||
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 an 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 an 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 a 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 a 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 |
@@ -63,7 +63,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -33,6 +33,7 @@ discard block |
||
33 | 33 | * render to courses_list view |
34 | 34 | * @param string action |
35 | 35 | * @param string confirmation message(optional) |
36 | + * @param string $action |
|
36 | 37 | */ |
37 | 38 | public function courses_list($action, $message = '') |
38 | 39 | { |
@@ -79,7 +80,7 @@ discard block |
||
79 | 80 | /** |
80 | 81 | * It's used for listing courses with categories, |
81 | 82 | * render to courses_categories view |
82 | - * @param $action |
|
83 | + * @param string $action |
|
83 | 84 | * @param string $category_code |
84 | 85 | * @param string $message |
85 | 86 | * @param string $error |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param string $message confirmation message(optional) |
62 | 62 | * @param string $error error message(optional) |
63 | 63 | */ |
64 | - public function categories_list($action, $message='', $error='') |
|
64 | + public function categories_list($action, $message = '', $error = '') |
|
65 | 65 | { |
66 | 66 | $data = array(); |
67 | 67 | $data['user_course_categories'] = $this->model->get_user_course_categories(); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | // we need only the course codes as these will be used to match against the courses of the category |
118 | 118 | if ($user_courses != '') { |
119 | - foreach($user_courses as $key => $value) { |
|
119 | + foreach ($user_courses as $key => $value) { |
|
120 | 120 | $user_coursecodes[] = $value['code']; |
121 | 121 | } |
122 | 122 | } |
@@ -385,13 +385,13 @@ discard block |
||
385 | 385 | $html .= '</strong>'; |
386 | 386 | } else { |
387 | 387 | if (!empty($categoryCourses)) { |
388 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
388 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
389 | 389 | 1, |
390 | 390 | $limit['length'], |
391 | 391 | $categoryCode, |
392 | 392 | $hiddenLinks, |
393 | 393 | $action |
394 | - ) . '">'; |
|
394 | + ).'">'; |
|
395 | 395 | $html .= "$categoryName ($categoryCourses)"; |
396 | 396 | $html .= '</a>'; |
397 | 397 | } else { |
@@ -412,13 +412,13 @@ discard block |
||
412 | 412 | if ($code == $subCategory1Code) { |
413 | 413 | $html .= "<strong>$subCategory1Name ($subCategory1Courses)</strong>"; |
414 | 414 | } else { |
415 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
415 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
416 | 416 | 1, |
417 | 417 | $limit['length'], |
418 | 418 | $categoryCode, |
419 | 419 | $hiddenLinks, |
420 | 420 | $action |
421 | - ) . '">'; |
|
421 | + ).'">'; |
|
422 | 422 | $html .= "$subCategory1Name ($subCategory1Courses)"; |
423 | 423 | $html .= '</a>'; |
424 | 424 | } |
@@ -436,13 +436,13 @@ discard block |
||
436 | 436 | if ($code == $subCategory2Code) { |
437 | 437 | $html .= "<strong>$subCategory2Name ($subCategory2Courses)</strong>"; |
438 | 438 | } else { |
439 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
439 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
440 | 440 | 1, |
441 | 441 | $limit['length'], |
442 | 442 | $categoryCode, |
443 | 443 | $hiddenLinks, |
444 | 444 | $action |
445 | - ) . '">'; |
|
445 | + ).'">'; |
|
446 | 446 | $html .= "$subCategory2Name ($subCategory2Courses)"; |
447 | 447 | $html .= '</a>'; |
448 | 448 | } |
@@ -460,13 +460,13 @@ discard block |
||
460 | 460 | if ($code == $subCategory3Code) { |
461 | 461 | $html .= "<strong>$subCategory3Name ($subCategory3Courses)</strong>"; |
462 | 462 | } else { |
463 | - $html .= '<a href="' . getCourseCategoryUrl( |
|
463 | + $html .= '<a href="'.getCourseCategoryUrl( |
|
464 | 464 | 1, |
465 | 465 | $limit['length'], |
466 | 466 | $categoryCode, |
467 | 467 | $hiddenLinks, |
468 | 468 | $action |
469 | - ) . '">'; |
|
469 | + ).'">'; |
|
470 | 470 | $html .= "$subCategory3Name ($subCategory3Courses)"; |
471 | 471 | $html .= '</a>'; |
472 | 472 | } |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | $icon = '<em class="fa fa-smile-o"></em>'; |
594 | 594 | |
595 | 595 | return Display::div( |
596 | - $icon . ' ' . get_lang("AlreadyRegisteredToSession"), |
|
596 | + $icon.' '.get_lang("AlreadyRegisteredToSession"), |
|
597 | 597 | array('class' => 'info-catalog') |
598 | 598 | ); |
599 | 599 | } |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | */ |
606 | 606 | public function getSessionIcon($sessionName) |
607 | 607 | { |
608 | - return Display::return_icon('window_list.png', $sessionName, null,ICON_SIZE_MEDIUM); |
|
608 | + return Display::return_icon('window_list.png', $sessionName, null, ICON_SIZE_MEDIUM); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | /** |
@@ -626,8 +626,7 @@ discard block |
||
626 | 626 | $pageTotal = intval(ceil(intval($countSessions) / $limit['length'])); |
627 | 627 | // Do NOT show pagination if only one page or less |
628 | 628 | $cataloguePagination = $pageTotal > 1 ? |
629 | - getCataloguePagination($limit['current'], $limit['length'], $pageTotal) : |
|
630 | - ''; |
|
629 | + getCataloguePagination($limit['current'], $limit['length'], $pageTotal) : ''; |
|
631 | 630 | $sessionsBlocks = $this->getFormatedSessionsBlock($sessions); |
632 | 631 | |
633 | 632 | // Get session list catalogue URL |
@@ -638,13 +637,13 @@ discard block |
||
638 | 637 | $tpl = new Template(); |
639 | 638 | $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses()); |
640 | 639 | $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions()); |
641 | - $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); |
|
640 | + $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); |
|
642 | 641 | $tpl->assign('course_url', $courseUrl); |
643 | 642 | $tpl->assign('catalog_pagination', $cataloguePagination); |
644 | 643 | $tpl->assign('hidden_links', $hiddenLinks); |
645 | 644 | $tpl->assign('search_token', Security::get_token()); |
646 | 645 | $tpl->assign('search_date', $date); |
647 | - $tpl->assign('web_session_courses_ajax_url', api_get_path(WEB_AJAX_PATH) . 'course.ajax.php'); |
|
646 | + $tpl->assign('web_session_courses_ajax_url', api_get_path(WEB_AJAX_PATH).'course.ajax.php'); |
|
648 | 647 | $tpl->assign('sessions', $sessionsBlocks); |
649 | 648 | $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel()); |
650 | 649 | |
@@ -671,7 +670,7 @@ discard block |
||
671 | 670 | |
672 | 671 | $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses()); |
673 | 672 | $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions()); |
674 | - $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); |
|
673 | + $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); |
|
675 | 674 | $tpl->assign('course_url', $courseUrl); |
676 | 675 | $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel()); |
677 | 676 | $tpl->assign('hidden_links', $hiddenLinks); |
@@ -702,7 +701,7 @@ discard block |
||
702 | 701 | $tpl = new Template(); |
703 | 702 | $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses()); |
704 | 703 | $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions()); |
705 | - $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); |
|
704 | + $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); |
|
706 | 705 | $tpl->assign('course_url', $courseUrl); |
707 | 706 | $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel()); |
708 | 707 | $tpl->assign('hidden_links', $hiddenLinks); |