@@ -338,7 +338,7 @@ |
||
338 | 338 | |
339 | 339 | if (empty($certificatesItem) && empty($searchItem)) { |
340 | 340 | return null; |
341 | - }else{ |
|
341 | + } else{ |
|
342 | 342 | $content.= $certificatesItem; |
343 | 343 | $content.= $searchItem; |
344 | 344 | } |
@@ -1009,8 +1009,9 @@ discard block |
||
1009 | 1009 | $blog_post_actions .= '</a>'; |
1010 | 1010 | } |
1011 | 1011 | |
1012 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) |
|
1013 | - $rating_select = Blog::display_rating_form('post',$blog_id,$post_id); |
|
1012 | + if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) { |
|
1013 | + $rating_select = Blog::display_rating_form('post',$blog_id,$post_id); |
|
1014 | + } |
|
1014 | 1015 | |
1015 | 1016 | $blog_post_text=stripslashes($blog_post_text); |
1016 | 1017 | |
@@ -1654,8 +1655,9 @@ discard block |
||
1654 | 1655 | |
1655 | 1656 | $arrPermissions = array(); |
1656 | 1657 | |
1657 | - while ($row = Database::fetch_array($result)) |
|
1658 | - $arrPermissions[] = $row['action']; |
|
1658 | + while ($row = Database::fetch_array($result)) { |
|
1659 | + $arrPermissions[] = $row['action']; |
|
1660 | + } |
|
1659 | 1661 | |
1660 | 1662 | echo '<tr>'; |
1661 | 1663 | echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ': </td>'; |
@@ -2332,8 +2334,9 @@ discard block |
||
2332 | 2334 | //Handle leap year |
2333 | 2335 | $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
2334 | 2336 | |
2335 | - if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
2336 | - $numberofdays[2] = 29; |
|
2337 | + if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) { |
|
2338 | + $numberofdays[2] = 29; |
|
2339 | + } |
|
2337 | 2340 | |
2338 | 2341 | //Get the first day of the month |
2339 | 2342 | $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
@@ -2363,8 +2366,9 @@ discard block |
||
2363 | 2366 | if( Database::num_rows($result) > 0) { |
2364 | 2367 | while($blog_post = Database::fetch_array($result)) { |
2365 | 2368 | // If the day of this post is not yet in the array, add it. |
2366 | - if (!in_array($blog_post['post_day'], $posts)) |
|
2367 | - $posts[] = $blog_post['post_day']; |
|
2369 | + if (!in_array($blog_post['post_day'], $posts)) { |
|
2370 | + $posts[] = $blog_post['post_day']; |
|
2371 | + } |
|
2368 | 2372 | } |
2369 | 2373 | } |
2370 | 2374 | |
@@ -2403,8 +2407,9 @@ discard block |
||
2403 | 2407 | |
2404 | 2408 | echo "<tr>\n"; |
2405 | 2409 | |
2406 | - for($ii = 1; $ii < 8; $ii ++) |
|
2407 | - echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>"; |
|
2410 | + for($ii = 1; $ii < 8; $ii ++) { |
|
2411 | + echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>"; |
|
2412 | + } |
|
2408 | 2413 | |
2409 | 2414 | echo "</tr>"; |
2410 | 2415 | |
@@ -2414,8 +2419,9 @@ discard block |
||
2414 | 2419 | while ($curday <= $numberofdays[$month]) { |
2415 | 2420 | echo "<tr>"; |
2416 | 2421 | for ($ii = 0; $ii < 7; $ii ++) { |
2417 | - if (($curday == -1) && ($ii == $startdayofweek)) |
|
2418 | - $curday = 1; |
|
2422 | + if (($curday == -1) && ($ii == $startdayofweek)) { |
|
2423 | + $curday = 1; |
|
2424 | + } |
|
2419 | 2425 | |
2420 | 2426 | if (($curday > 0) && ($curday <= $numberofdays[$month])) { |
2421 | 2427 | $bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\""; |
@@ -2429,10 +2435,11 @@ discard block |
||
2429 | 2435 | echo "<td " . $class.">"; |
2430 | 2436 | |
2431 | 2437 | // If there are posts on this day, create a filter link. |
2432 | - if(in_array($curday, $posts)) |
|
2433 | - echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>'; |
|
2434 | - else |
|
2435 | - echo $dayheader; |
|
2438 | + if(in_array($curday, $posts)) { |
|
2439 | + echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>'; |
|
2440 | + } else { |
|
2441 | + echo $dayheader; |
|
2442 | + } |
|
2436 | 2443 | |
2437 | 2444 | if (count($tasks) > 0) { |
2438 | 2445 | if (isset($tasks[$curday]) && is_array($tasks[$curday])) { |
@@ -2446,8 +2453,9 @@ discard block |
||
2446 | 2453 | |
2447 | 2454 | echo "</td>"; |
2448 | 2455 | $curday ++; |
2449 | - } else |
|
2450 | - echo "<td> </td>"; |
|
2456 | + } else { |
|
2457 | + echo "<td> </td>"; |
|
2458 | + } |
|
2451 | 2459 | } |
2452 | 2460 | echo "</tr>"; |
2453 | 2461 | } |
@@ -29,14 +29,16 @@ |
||
29 | 29 | { |
30 | 30 | foreach ( $_POST as $key => $value ) |
31 | 31 | { |
32 | - if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) |
|
33 | - continue; |
|
32 | + if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) { |
|
33 | + continue; |
|
34 | + } |
|
34 | 35 | |
35 | - if ( get_magic_quotes_gpc() ) |
|
36 | - $value = htmlspecialchars( stripslashes((string)$value) ); |
|
37 | - else |
|
38 | - $value = htmlspecialchars( (string)$value ); |
|
39 | -?> |
|
36 | + if ( get_magic_quotes_gpc() ) { |
|
37 | + $value = htmlspecialchars( stripslashes((string)$value) ); |
|
38 | + } else { |
|
39 | + $value = htmlspecialchars( (string)$value ); |
|
40 | + } |
|
41 | + ?> |
|
40 | 42 | <tr> |
41 | 43 | <th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th> |
42 | 44 | <td><pre class="samples"><?php echo $value; ?></pre></td> |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | require_once(api_get_path(LIBRARY_PATH).'fileManage.lib.php'); |
4 | 4 | |
5 | -if (!defined('CHAMILO_INTERNAL')) die('You cannot use this script this way'); |
|
5 | +if (!defined('CHAMILO_INTERNAL')) { |
|
6 | + die('You cannot use this script this way'); |
|
7 | +} |
|
6 | 8 | |
7 | 9 | if ($data->what == 'addinstance' || $data->what == 'registerinstance') { |
8 | 10 |
@@ -74,8 +74,14 @@ discard block |
||
74 | 74 | |
75 | 75 | $content = file($options['config']); |
76 | 76 | foreach($content as $l) { |
77 | - if (preg_match('/^\s+$/', $l)) continue; // Empty lines. |
|
78 | - if (preg_match('/^[#\/!;]/', $l)) continue; // Comments (any form). |
|
77 | + if (preg_match('/^\s+$/', $l)) { |
|
78 | + continue; |
|
79 | + } |
|
80 | + // Empty lines. |
|
81 | + if (preg_match('/^[#\/!;]/', $l)) { |
|
82 | + continue; |
|
83 | + } |
|
84 | + // Comments (any form). |
|
79 | 85 | if (preg_match('/^(.*?)=(.*)$/', $l, $matches)) { |
80 | 86 | if (in_array($matches[1], $expectedoptions)){ |
81 | 87 | $options[trim($matches[1])] = trim($matches[2]); |
@@ -90,16 +96,22 @@ discard block |
||
90 | 96 | require_once($_configuration['root_sys'] . '/plugin/vchamilo/lib/vchamilo_plugin.class.php'); |
91 | 97 | |
92 | 98 | global $DB; |
93 | -if ($options['verbose']) echo "building database manager\n"; |
|
99 | +if ($options['verbose']) { |
|
100 | + echo "building database manager\n"; |
|
101 | +} |
|
94 | 102 | $DB = new DatabaseManager(); |
95 | -if ($options['verbose']) echo "building plugin vchamilo\n"; |
|
103 | +if ($options['verbose']) { |
|
104 | + echo "building plugin vchamilo\n"; |
|
105 | +} |
|
96 | 106 | $plugininstance = VChamiloPlugin::create(); |
97 | 107 | |
98 | 108 | if (empty($options['nodes'])) { |
99 | 109 | cli_error('Missing node definition. Halt.'); |
100 | 110 | } |
101 | 111 | |
102 | -if ($options['verbose']) echo "parsing nodelist\n"; |
|
112 | +if ($options['verbose']) { |
|
113 | + echo "parsing nodelist\n"; |
|
114 | +} |
|
103 | 115 | $nodes = vchamilo_parse_csv_nodelist($options['nodes'], $plugininstance); |
104 | 116 | |
105 | 117 | if ($options['lint']) { |
@@ -133,7 +133,9 @@ discard block |
||
133 | 133 | $key = $headers[$f]; |
134 | 134 | if (preg_match('/\|/', $key)) { |
135 | 135 | list($plugin, $variable) = explode('|', str_replace('plugin_', '', $key)); |
136 | - if (empty($variable)) die("Key error in CSV : $key "); |
|
136 | + if (empty($variable)) { |
|
137 | + die("Key error in CSV : $key "); |
|
138 | + } |
|
137 | 139 | if (!isset($vnode->$plugin)) { |
138 | 140 | $vnode->$plugin = new StdClass(); |
139 | 141 | } |
@@ -170,8 +172,13 @@ discard block |
||
170 | 172 | static $first = true; |
171 | 173 | |
172 | 174 | // We may have a risk the BOM is present on first line |
173 | - if ($resetfirst) $first = true; |
|
174 | - if (!isset($textlib)) $textlib = new textlib(); // Singleton |
|
175 | + if ($resetfirst) { |
|
176 | + $first = true; |
|
177 | + } |
|
178 | + if (!isset($textlib)) { |
|
179 | + $textlib = new textlib(); |
|
180 | + } |
|
181 | + // Singleton |
|
175 | 182 | $text = $textlib->trim_utf8_bom($text); |
176 | 183 | $first = false; |
177 | 184 |
@@ -91,25 +91,39 @@ |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | require_once($_configuration['root_sys'].'local/classes/database.class.php'); // cli only functions |
94 | -if ($options['verbose']) echo "loaded dbclass\n"; |
|
94 | +if ($options['verbose']) { |
|
95 | + echo "loaded dbclass\n"; |
|
96 | +} |
|
95 | 97 | require_once($_configuration['root_sys'].'local/classes/textlib.class.php'); // cli only functions |
96 | -if ($options['verbose']) echo "loaded textlib\n"; |
|
98 | +if ($options['verbose']) { |
|
99 | + echo "loaded textlib\n"; |
|
100 | +} |
|
97 | 101 | require_once($_configuration['root_sys'].'local/classes/mootochamlib.php'); // moodle like API |
98 | -if ($options['verbose']) echo "loaded moodle wrapping\n"; |
|
102 | +if ($options['verbose']) { |
|
103 | + echo "loaded moodle wrapping\n"; |
|
104 | +} |
|
99 | 105 | require_once($_configuration['root_sys'] . '/plugin/vchamilo/lib/vchamilo_plugin.class.php'); |
100 | -if ($options['verbose']) echo "loaded vchamilo plugin\n"; |
|
106 | +if ($options['verbose']) { |
|
107 | + echo "loaded vchamilo plugin\n"; |
|
108 | +} |
|
101 | 109 | |
102 | 110 | global $DB; |
103 | -if ($options['verbose']) echo "building database manager\n"; |
|
111 | +if ($options['verbose']) { |
|
112 | + echo "building database manager\n"; |
|
113 | +} |
|
104 | 114 | $DB = new DatabaseManager(); |
105 | -if ($options['verbose']) echo "building plugin vchamilo\n"; |
|
115 | +if ($options['verbose']) { |
|
116 | + echo "building plugin vchamilo\n"; |
|
117 | +} |
|
106 | 118 | $plugininstance = VChamiloPlugin::create(); |
107 | 119 | |
108 | 120 | if (empty($options['nodes'])) { |
109 | 121 | cli_error(get_string('climissingnodes', 'block_vmoodle')); |
110 | 122 | } |
111 | 123 | |
112 | -if ($options['verbose']) echo "parsing nodelist\n"; |
|
124 | +if ($options['verbose']) { |
|
125 | + echo "parsing nodelist\n"; |
|
126 | +} |
|
113 | 127 | $nodes = vchamilo_parse_csv_nodelist($options['nodes'], $plugininstance); |
114 | 128 | |
115 | 129 | if ($options['lint']) { |
@@ -95,30 +95,43 @@ |
||
95 | 95 | * */ |
96 | 96 | function external_add_user($u) { |
97 | 97 | //Setting default |
98 | - if (empty($u['password'])) |
|
99 | - $u['password'] = null; |
|
100 | - if (empty($u['status'])) |
|
101 | - $u['status'] = 5; |
|
102 | - if (!isset($u['official_code'])) |
|
103 | - $u['official_code'] = ''; |
|
104 | - if (!isset($u['language'])) |
|
105 | - $u['language'] = ''; |
|
106 | - if (!isset($u['phone'])) |
|
107 | - $u['phone'] = ''; |
|
108 | - if (!isset($u['picture_uri'])) |
|
109 | - $u['picture_uri'] = ''; |
|
110 | - if (!isset($u['auth_source'])) |
|
111 | - $u['auth_source'] = PLATFORM_AUTH_SOURCE; |
|
112 | - if (!isset($u['expiration_date'])) |
|
113 | - $u['expiration_date'] = ''; |
|
114 | - if (!isset($u['active'])) |
|
115 | - $u['active'] = 1; |
|
116 | - if (!isset($u['hr_dept_id'])) |
|
117 | - $u['hr_dept_id'] = 0; //id of responsible HR |
|
118 | - if (!isset($u['extra'])) |
|
119 | - $u['extra'] = null; |
|
120 | - if (!isset($u['encrypt_method'])) |
|
121 | - $u['encrypt_method'] = ''; |
|
98 | + if (empty($u['password'])) { |
|
99 | + $u['password'] = null; |
|
100 | + } |
|
101 | + if (empty($u['status'])) { |
|
102 | + $u['status'] = 5; |
|
103 | + } |
|
104 | + if (!isset($u['official_code'])) { |
|
105 | + $u['official_code'] = ''; |
|
106 | + } |
|
107 | + if (!isset($u['language'])) { |
|
108 | + $u['language'] = ''; |
|
109 | + } |
|
110 | + if (!isset($u['phone'])) { |
|
111 | + $u['phone'] = ''; |
|
112 | + } |
|
113 | + if (!isset($u['picture_uri'])) { |
|
114 | + $u['picture_uri'] = ''; |
|
115 | + } |
|
116 | + if (!isset($u['auth_source'])) { |
|
117 | + $u['auth_source'] = PLATFORM_AUTH_SOURCE; |
|
118 | + } |
|
119 | + if (!isset($u['expiration_date'])) { |
|
120 | + $u['expiration_date'] = ''; |
|
121 | + } |
|
122 | + if (!isset($u['active'])) { |
|
123 | + $u['active'] = 1; |
|
124 | + } |
|
125 | + if (!isset($u['hr_dept_id'])) { |
|
126 | + $u['hr_dept_id'] = 0; |
|
127 | + } |
|
128 | + //id of responsible HR |
|
129 | + if (!isset($u['extra'])) { |
|
130 | + $u['extra'] = null; |
|
131 | + } |
|
132 | + if (!isset($u['encrypt_method'])) { |
|
133 | + $u['encrypt_method'] = ''; |
|
134 | + } |
|
122 | 135 | |
123 | 136 | $chamilo_uid = UserManager::create_user($u['firstname'], $u['lastname'], $u['status'], $u['email'], $u['username'], $u['password'], $u['official_code'], $u['language'], $u['phone'], $u['picture_uri'], $u['auth_source'], $u['expiration_date'], $u['active'], $u['hr_dept_id'], $u['extra'], $u['encrypt_method']); |
124 | 137 | return $chamilo_uid; |
@@ -701,7 +701,9 @@ discard block |
||
701 | 701 | |
702 | 702 | if (!isset($strings)) { |
703 | 703 | $lang = api_get_language_from_type('platform_lang'); |
704 | - if (empty($lang)) $lang = 'english'; |
|
704 | + if (empty($lang)) { |
|
705 | + $lang = 'english'; |
|
706 | + } |
|
705 | 707 | $path = $_configuration['root_sys'].'local/ent_installer/lang/'.$lang.'/local_ent_installer.php'; |
706 | 708 | |
707 | 709 | if (!file_exists($path)) { |
@@ -791,10 +793,14 @@ discard block |
||
791 | 793 | } |
792 | 794 | |
793 | 795 | function ctrace($str) { |
794 | - if (!defined('CLI_SCRIPT')) echo "<pre>"; |
|
796 | + if (!defined('CLI_SCRIPT')) { |
|
797 | + echo "<pre>"; |
|
798 | + } |
|
795 | 799 | Display::addFlash(Display::return_message($str)); |
796 | - if (!defined('CLI_SCRIPT')) echo "</pre>"; |
|
797 | -} |
|
800 | + if (!defined('CLI_SCRIPT')) { |
|
801 | + echo "</pre>"; |
|
802 | + } |
|
803 | + } |
|
798 | 804 | |
799 | 805 | /** |
800 | 806 | * Sets a platform configuration setting to a given value, creating it if necessary |