@@ -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 |
@@ -973,8 +973,7 @@ discard block |
||
973 | 973 | <?php echo get_lang('Error'); ?>!<br /> |
974 | 974 | Chamilo <?php echo implode('|', $update_from_version_8).' '.get_lang('HasNotBeenFoundInThatDir'); ?>. |
975 | 975 | </div> |
976 | - <?php } |
|
977 | - else { |
|
976 | + <?php } else { |
|
978 | 977 | echo '<br />'; |
979 | 978 | } |
980 | 979 | ?> |
@@ -1060,14 +1059,19 @@ discard block |
||
1060 | 1059 | <button type="submit" name="step1" class="btn btn-default" onclick="javascript: window.location='index.php'; return false;" value="<?php echo get_lang('Previous'); ?>" > |
1061 | 1060 | <em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?> |
1062 | 1061 | </button> |
1063 | - <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) echo 'disabled="disabled"'; ?> > |
|
1062 | + <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) { |
|
1063 | + echo 'disabled="disabled"'; |
|
1064 | +} |
|
1065 | +?> > |
|
1064 | 1066 | <em class="fa fa-forward"> </em> <?php echo get_lang('NewInstallation'); ?> |
1065 | 1067 | </button> |
1066 | 1068 | <input type="hidden" name="is_executable" id="is_executable" value="-" /> |
1067 | 1069 | <?php |
1068 | 1070 | // Real code |
1069 | 1071 | echo '<button type="submit" class="btn btn-default" name="step2_update_8" value="Upgrade from Chamilo 1.9.x"'; |
1070 | - if ($error) echo ' disabled="disabled"'; |
|
1072 | + if ($error) { |
|
1073 | + echo ' disabled="disabled"'; |
|
1074 | + } |
|
1071 | 1075 | echo ' ><em class="fa fa-forward"> </em> '.get_lang('UpgradeFromLMS19x').'</button>'; |
1072 | 1076 | |
1073 | 1077 | echo '</p>'; |
@@ -1350,7 +1354,7 @@ discard block |
||
1350 | 1354 | <input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /><?php echo $dbHostForm; ?> |
1351 | 1355 | </div> |
1352 | 1356 | <div class="col-sm-3"></div> |
1353 | - <?php }else{ ?> |
|
1357 | + <?php } else{ ?> |
|
1354 | 1358 | <div class="col-sm-5"> |
1355 | 1359 | <input type="text" class="form-control" size="25" maxlength="50" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /> |
1356 | 1360 | </div> |
@@ -1364,7 +1368,7 @@ discard block |
||
1364 | 1368 | <input type="hidden" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /><?php echo $dbPortForm; ?> |
1365 | 1369 | </div> |
1366 | 1370 | <div class="col-sm-3"></div> |
1367 | - <?php }else{ ?> |
|
1371 | + <?php } else{ ?> |
|
1368 | 1372 | <div class="col-sm-5"> |
1369 | 1373 | <input type="text" class="form-control" size="25" maxlength="50" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /> |
1370 | 1374 | </div> |
@@ -1446,9 +1450,12 @@ discard block |
||
1446 | 1450 | Database port: <strong><?php echo $manager->getConnection()->getPort(); ?></strong><br/> |
1447 | 1451 | Database driver: <strong><?php echo $manager->getConnection()->getDriver()->getName(); ?></strong><br/> |
1448 | 1452 | </div> |
1449 | - <?php else: ?> |
|
1453 | + <?php else { |
|
1454 | + : ?> |
|
1450 | 1455 | <div id="db_status" class="alert alert-danger"> |
1451 | - <p><?php echo get_lang('FailedConectionDatabase'); ?></strong></p> |
|
1456 | + <p><?php echo get_lang('FailedConectionDatabase'); |
|
1457 | +} |
|
1458 | +?></strong></p> |
|
1452 | 1459 | <code><?php echo $database_exists_text ?></code> |
1453 | 1460 | </div> |
1454 | 1461 | <?php endif; ?> |
@@ -65,8 +65,7 @@ |
||
65 | 65 | if (strpos($filename, "svg")){ |
66 | 66 | $new_sizes['width'] = 60; |
67 | 67 | $new_sizes['height'] = 60; |
68 | - } |
|
69 | - else { |
|
68 | + } else { |
|
70 | 69 | $new_sizes = api_resize_image($image, 60, 60); |
71 | 70 | } |
72 | 71 |