@@ -1662,8 +1662,8 @@ discard block |
||
1662 | 1662 | ); |
1663 | 1663 | |
1664 | 1664 | $RSAPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" . |
1665 | - chunk_split(base64_encode($encapsulated)) . |
|
1666 | - '-----END PUBLIC KEY-----'; |
|
1665 | + chunk_split(base64_encode($encapsulated)) . |
|
1666 | + '-----END PUBLIC KEY-----'; |
|
1667 | 1667 | |
1668 | 1668 | $plaintext = str_pad($this->toBytes(), strlen($n->toBytes(true)) - 1, "\0", STR_PAD_LEFT); |
1669 | 1669 | |
@@ -3245,7 +3245,7 @@ discard block |
||
3245 | 3245 | |
3246 | 3246 | if (!$t) { |
3247 | 3247 | // see HAC 4.49 "Note (controlling the error probability)" |
3248 | - if ($length >= 163) { $t = 2; } // floor(1300 / 8) |
|
3248 | + if ($length >= 163) { $t = 2; } // floor(1300 / 8) |
|
3249 | 3249 | else if ($length >= 106) { $t = 3; } // floor( 850 / 8) |
3250 | 3250 | else if ($length >= 81 ) { $t = 4; } // floor( 650 / 8) |
3251 | 3251 | else if ($length >= 68 ) { $t = 5; } // floor( 550 / 8) |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | array(60 => 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'), |
823 | 823 | array(60 => 'NET_SSH2_MSG_USERAUTH_PK_OK'), |
824 | 824 | array(60 => 'NET_SSH2_MSG_USERAUTH_INFO_REQUEST', |
825 | - 61 => 'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE') |
|
825 | + 61 => 'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE') |
|
826 | 826 | ); |
827 | 827 | |
828 | 828 | $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 |
@@ -970,7 +970,7 @@ discard block |
||
970 | 970 | 'twofish192-cbc', // OPTIONAL Twofish with a 192-bit key |
971 | 971 | 'twofish256-cbc', |
972 | 972 | 'twofish-cbc', // OPTIONAL alias for "twofish256-cbc" |
973 | - // (this is being retained for historical reasons) |
|
973 | + // (this is being retained for historical reasons) |
|
974 | 974 | '3des-ctr', // RECOMMENDED Three-key 3DES in SDCTR mode |
975 | 975 | |
976 | 976 | '3des-cbc', // REQUIRED three-key 3DES in CBC mode |
@@ -1000,8 +1000,8 @@ discard block |
||
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | static $str_kex_algorithms, $str_server_host_key_algorithms, |
1003 | - $encryption_algorithms_server_to_client, $mac_algorithms_server_to_client, $compression_algorithms_server_to_client, |
|
1004 | - $encryption_algorithms_client_to_server, $mac_algorithms_client_to_server, $compression_algorithms_client_to_server; |
|
1003 | + $encryption_algorithms_server_to_client, $mac_algorithms_server_to_client, $compression_algorithms_server_to_client, |
|
1004 | + $encryption_algorithms_client_to_server, $mac_algorithms_client_to_server, $compression_algorithms_client_to_server; |
|
1005 | 1005 | |
1006 | 1006 | if (empty($str_kex_algorithms)) { |
1007 | 1007 | $str_kex_algorithms = implode(',', $kex_algorithms); |
@@ -1171,20 +1171,20 @@ discard block |
||
1171 | 1171 | // http://tools.ietf.org/html/rfc2412, appendex E |
1172 | 1172 | case 'diffie-hellman-group1-sha1': |
1173 | 1173 | $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . |
1174 | - '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . |
|
1175 | - '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . |
|
1176 | - 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF'; |
|
1174 | + '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . |
|
1175 | + '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . |
|
1176 | + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF'; |
|
1177 | 1177 | break; |
1178 | 1178 | // see http://tools.ietf.org/html/rfc3526#section-3 |
1179 | 1179 | case 'diffie-hellman-group14-sha1': |
1180 | 1180 | $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . |
1181 | - '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . |
|
1182 | - '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . |
|
1183 | - 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . |
|
1184 | - '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . |
|
1185 | - '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . |
|
1186 | - 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . |
|
1187 | - '3995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF'; |
|
1181 | + '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . |
|
1182 | + '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . |
|
1183 | + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . |
|
1184 | + '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . |
|
1185 | + '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . |
|
1186 | + 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . |
|
1187 | + '3995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF'; |
|
1188 | 1188 | break; |
1189 | 1189 | } |
1190 | 1190 | |
@@ -2413,7 +2413,7 @@ discard block |
||
2413 | 2413 | $current = strtok(microtime(), ' ') + strtok(''); |
2414 | 2414 | $message_number = isset($this->message_numbers[ord($payload[0])]) ? $this->message_numbers[ord($payload[0])] : 'UNKNOWN (' . ord($payload[0]) . ')'; |
2415 | 2415 | $message_number = '<- ' . $message_number . |
2416 | - ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)'; |
|
2416 | + ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)'; |
|
2417 | 2417 | $this->_append_log($message_number, $payload); |
2418 | 2418 | $this->last_packet = $current; |
2419 | 2419 | } |
@@ -2782,7 +2782,7 @@ discard block |
||
2782 | 2782 | $current = strtok(microtime(), ' ') + strtok(''); |
2783 | 2783 | $message_number = isset($this->message_numbers[ord($data[0])]) ? $this->message_numbers[ord($data[0])] : 'UNKNOWN (' . ord($data[0]) . ')'; |
2784 | 2784 | $message_number = '-> ' . $message_number . |
2785 | - ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)'; |
|
2785 | + ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)'; |
|
2786 | 2786 | $this->_append_log($message_number, $data); |
2787 | 2787 | $this->last_packet = $current; |
2788 | 2788 | } |
@@ -3024,12 +3024,12 @@ discard block |
||
3024 | 3024 | } |
3025 | 3025 | $fragment = $this->_string_shift($current_log, $short_width); |
3026 | 3026 | $hex = substr( |
3027 | - preg_replace( |
|
3028 | - '#(.)#es', |
|
3029 | - '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)', |
|
3030 | - $fragment), |
|
3031 | - strlen($boundary) |
|
3032 | - ); |
|
3027 | + preg_replace( |
|
3028 | + '#(.)#es', |
|
3029 | + '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)', |
|
3030 | + $fragment), |
|
3031 | + strlen($boundary) |
|
3032 | + ); |
|
3033 | 3033 | // replace non ASCII printable characters with dots |
3034 | 3034 | // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters |
3035 | 3035 | // also replace < with a . since < messes up the output on web browsers |
@@ -413,8 +413,8 @@ discard block |
||
413 | 413 | if ($response === false) { |
414 | 414 | // from PuTTY's psftp.exe |
415 | 415 | $command = "test -x /usr/lib/sftp-server && exec /usr/lib/sftp-server\n" . |
416 | - "test -x /usr/local/lib/sftp-server && exec /usr/local/lib/sftp-server\n" . |
|
417 | - "exec sftp-server"; |
|
416 | + "test -x /usr/local/lib/sftp-server && exec /usr/local/lib/sftp-server\n" . |
|
417 | + "exec sftp-server"; |
|
418 | 418 | // we don't do $this->exec($command, false) because exec() operates on a different channel and plus the SSH_MSG_CHANNEL_OPEN that exec() does |
419 | 419 | // is redundant |
420 | 420 | $packet = pack('CNNa*CNa*', |
@@ -2055,7 +2055,7 @@ discard block |
||
2055 | 2055 | |
2056 | 2056 | if (defined('NET_SFTP_LOGGING')) { |
2057 | 2057 | $packet_type = '-> ' . $this->packet_types[$type] . |
2058 | - ' (' . round($stop - $start, 4) . 's)'; |
|
2058 | + ' (' . round($stop - $start, 4) . 's)'; |
|
2059 | 2059 | if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) { |
2060 | 2060 | echo "<pre>\r\n" . $this->_format_log(array($data), array($packet_type)) . "\r\n</pre>\r\n"; |
2061 | 2061 | flush(); |
@@ -2131,7 +2131,7 @@ discard block |
||
2131 | 2131 | |
2132 | 2132 | if (defined('NET_SFTP_LOGGING')) { |
2133 | 2133 | $packet_type = '<- ' . $this->packet_types[$this->packet_type] . |
2134 | - ' (' . round($stop - $start, 4) . 's)'; |
|
2134 | + ' (' . round($stop - $start, 4) . 's)'; |
|
2135 | 2135 | if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) { |
2136 | 2136 | echo "<pre>\r\n" . $this->_format_log(array($packet), array($packet_type)) . "\r\n</pre>\r\n"; |
2137 | 2137 | flush(); |
@@ -1364,12 +1364,12 @@ |
||
1364 | 1364 | } |
1365 | 1365 | $fragment = $this->_string_shift($current_log, $short_width); |
1366 | 1366 | $hex = substr( |
1367 | - preg_replace( |
|
1368 | - '#(.)#es', |
|
1369 | - '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)', |
|
1370 | - $fragment), |
|
1371 | - strlen($boundary) |
|
1372 | - ); |
|
1367 | + preg_replace( |
|
1368 | + '#(.)#es', |
|
1369 | + '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)', |
|
1370 | + $fragment), |
|
1371 | + strlen($boundary) |
|
1372 | + ); |
|
1373 | 1373 | // replace non ASCII printable characters with dots |
1374 | 1374 | // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters |
1375 | 1375 | // also replace < with a . since < messes up the output on web browsers |
@@ -18,7 +18,6 @@ discard block |
||
18 | 18 | * if (!$ssh->login('username', 'password')) { |
19 | 19 | * exit('bad login'); |
20 | 20 | * } |
21 | - |
|
22 | 21 | * $scp = new Net_SCP($ssh); |
23 | 22 | * $scp->put('abcd', str_repeat('x', 1024*1024)); |
24 | 23 | * ?> |
@@ -284,7 +283,7 @@ discard block |
||
284 | 283 | case NET_SCP_SSH1: |
285 | 284 | $data = pack('CNa*', NET_SSH1_CMSG_STDIN_DATA, strlen($data), $data); |
286 | 285 | $this->ssh->_send_binary_packet($data); |
287 | - } |
|
286 | + } |
|
288 | 287 | } |
289 | 288 | |
290 | 289 | /** |
@@ -320,7 +319,7 @@ discard block |
||
320 | 319 | return false; |
321 | 320 | } |
322 | 321 | } |
323 | - } |
|
322 | + } |
|
324 | 323 | } |
325 | 324 | |
326 | 325 | /** |
@@ -336,6 +335,6 @@ discard block |
||
336 | 335 | break; |
337 | 336 | case NET_SCP_SSH1: |
338 | 337 | $this->ssh->disconnect(); |
339 | - } |
|
338 | + } |
|
340 | 339 | } |
341 | 340 | } |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
342 | - * This function shows the content of a table in a grid. |
|
343 | - * Should not be use to edit information (edit/delete rows) only. |
|
344 | - **/ |
|
342 | + * This function shows the content of a table in a grid. |
|
343 | + * Should not be use to edit information (edit/delete rows) only. |
|
344 | + **/ |
|
345 | 345 | public function display_grid() |
346 | 346 | { |
347 | 347 | |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction']; |
791 | 791 | $my_get_direction = $_GET[$tablename.'_direction']; |
792 | 792 | if (!in_array($my_get_direction, array('ASC', 'DESC'))) { |
793 | - $param[$tablename.'_direction'] = 'ASC'; |
|
793 | + $param[$tablename.'_direction'] = 'ASC'; |
|
794 | 794 | } else { |
795 | 795 | $param[$tablename.'_direction'] = $my_get_direction; |
796 | 796 | } |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | if (is_array($row)) { |
918 | 918 | foreach ($row as & $value) { |
919 | 919 | if (empty($value)) { |
920 | - $value = '-'; |
|
920 | + $value = '-'; |
|
921 | 921 | } |
922 | 922 | } |
923 | 923 | } |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * Displays the title + grid |
52 | 52 | */ |
53 | - public function display() |
|
53 | + public function display() |
|
54 | 54 | { |
55 | - // action links |
|
56 | - echo '<div class="actions" style="margin-bottom:20px">'; |
|
55 | + // action links |
|
56 | + echo '<div class="actions" style="margin-bottom:20px">'; |
|
57 | 57 | echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
58 | - echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png',get_lang('Add'),'','32').'</a>'; |
|
59 | - echo '</div>'; |
|
58 | + echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png',get_lang('Add'),'','32').'</a>'; |
|
59 | + echo '</div>'; |
|
60 | 60 | echo Display::grid_html('grade_model'); |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Returns a Form validator Obj |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | $form->addElement('hidden', 'maxvalue', '100'); |
118 | - $form->addElement('hidden', 'minvalue', '0'); |
|
118 | + $form->addElement('hidden', 'minvalue', '0'); |
|
119 | 119 | $renderer = & $form->defaultRenderer(); |
120 | 120 | |
121 | 121 | $component_array = array(); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $form->addElement('text', 'components['.$i.'][title]', null); |
128 | 128 | $form->addElement('hidden', 'components['.$i.'][id]', null); |
129 | 129 | |
130 | - $template_percentage = |
|
130 | + $template_percentage = |
|
131 | 131 | '<div id=' . $i . ' style="display: '.(($i<=$nr_items)?'inline':'none').';" class="control-group"> |
132 | 132 | <p> |
133 | 133 | <label class="control-label">{label}</label> |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | // Setting the rules |
193 | 193 | $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); |
194 | 194 | |
195 | - return $form; |
|
195 | + return $form; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | public function get_components($id) |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | |
207 | 207 | public function save($params, $show_query = false) |
208 | 208 | { |
209 | - $id = parent::save($params, $show_query); |
|
210 | - if (!empty($id)) { |
|
209 | + $id = parent::save($params, $show_query); |
|
210 | + if (!empty($id)) { |
|
211 | 211 | foreach ($params['components'] as $component) { |
212 | 212 | if (!empty($component['title']) && !empty($component['percentage']) && !empty($component['acronym'])) { |
213 | 213 | $obj = new GradeModelComponents(); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
221 | - return $id; |
|
221 | + return $id; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | |
245 | 245 | public function delete($id) |
246 | 246 | { |
247 | - parent::delete($id); |
|
248 | - //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
247 | + parent::delete($id); |
|
248 | + //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', $default_value = null) |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | public $table; |
291 | 291 | public $columns = array('id', 'title', 'percentage', 'acronym', 'grade_model_id'); |
292 | 292 | |
293 | - public function __construct() |
|
293 | + public function __construct() |
|
294 | 294 | { |
295 | 295 | $this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS); |
296 | - } |
|
296 | + } |
|
297 | 297 | |
298 | 298 | public function save($params, $show_query = false) |
299 | 299 | { |
300 | - $id = parent::save($params, $show_query); |
|
300 | + $id = parent::save($params, $show_query); |
|
301 | 301 | return $id; |
302 | 302 | } |
303 | 303 | } |
@@ -12,13 +12,13 @@ |
||
12 | 12 | switch ($_SESSION['whereami']) { |
13 | 13 | |
14 | 14 | |
15 | - case 'lp/build' : |
|
16 | - case 'document/create' : |
|
17 | - case 'document/edit' : |
|
18 | - $autostart = 'false'; |
|
19 | - break; |
|
20 | - default : |
|
21 | - $autostart = 'true'; |
|
15 | + case 'lp/build' : |
|
16 | + case 'document/create' : |
|
17 | + case 'document/edit' : |
|
18 | + $autostart = 'false'; |
|
19 | + break; |
|
20 | + default : |
|
21 | + $autostart = 'true'; |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | echo utf8_encode('autostart='.$autostart); |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | */ |
167 | 167 | function LoginDelete($user_id) |
168 | 168 | { |
169 | - $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
169 | + $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
170 | 170 | $user_id = intval($user_id); |
171 | - $query = "DELETE FROM " . $online_table . " WHERE login_user_id = $user_id"; |
|
172 | - Database::query($query); |
|
171 | + $query = "DELETE FROM " . $online_table . " WHERE login_user_id = $user_id"; |
|
172 | + Database::query($query); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -178,17 +178,17 @@ discard block |
||
178 | 178 | */ |
179 | 179 | function user_is_online($user_id) |
180 | 180 | { |
181 | - $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
182 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
181 | + $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
182 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
183 | 183 | |
184 | - $access_url_id = api_get_current_access_url_id(); |
|
185 | - $time_limit = api_get_setting('time_limit_whosonline'); |
|
184 | + $access_url_id = api_get_current_access_url_id(); |
|
185 | + $time_limit = api_get_setting('time_limit_whosonline'); |
|
186 | 186 | |
187 | 187 | $online_time = time() - $time_limit*60; |
188 | 188 | $limit_date = api_get_utc_datetime($online_time); |
189 | 189 | $user_id = intval($user_id); |
190 | 190 | |
191 | - $query = " SELECT login_user_id,login_date |
|
191 | + $query = " SELECT login_user_id,login_date |
|
192 | 192 | FROM $track_online_table track |
193 | 193 | INNER JOIN $table_user u ON (u.id=track.login_user_id) |
194 | 194 | WHERE |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | u.id = $user_id |
198 | 198 | LIMIT 1 "; |
199 | 199 | |
200 | - $result = Database::query($query); |
|
201 | - if (Database::num_rows($result)) { |
|
200 | + $result = Database::query($query); |
|
201 | + if (Database::num_rows($result)) { |
|
202 | 202 | |
203 | - return true; |
|
204 | - } |
|
203 | + return true; |
|
204 | + } |
|
205 | 205 | |
206 | - return false; |
|
206 | + return false; |
|
207 | 207 | |
208 | 208 | } |
209 | 209 | /** |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | |
240 | 240 | $online_time = time() - $time_limit * 60; |
241 | 241 | $current_date = api_get_utc_datetime($online_time); |
242 | - $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
243 | - $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
244 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
242 | + $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
243 | + $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
244 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
245 | 245 | |
246 | - if ($friends) { |
|
247 | - // who friends from social network is online |
|
248 | - $query = "SELECT DISTINCT login_user_id, login_date |
|
246 | + if ($friends) { |
|
247 | + // who friends from social network is online |
|
248 | + $query = "SELECT DISTINCT login_user_id, login_date |
|
249 | 249 | FROM $track_online_table INNER JOIN $friend_user_table |
250 | 250 | ON (friend_user_id = login_user_id) |
251 | 251 | WHERE |
@@ -255,21 +255,21 @@ discard block |
||
255 | 255 | user_id = '".api_get_user_id()."' |
256 | 256 | ORDER BY $column $direction |
257 | 257 | LIMIT $from, $number_of_items"; |
258 | - } else { |
|
259 | - $query = "SELECT DISTINCT login_user_id, login_date |
|
258 | + } else { |
|
259 | + $query = "SELECT DISTINCT login_user_id, login_date |
|
260 | 260 | FROM ".$track_online_table ." e |
261 | 261 | INNER JOIN ".$table_user ." u ON (u.id = e.login_user_id) |
262 | 262 | WHERE u.status != ".ANONYMOUS." AND login_date >= '".$current_date."' |
263 | 263 | ORDER BY $column $direction |
264 | 264 | LIMIT $from, $number_of_items"; |
265 | - } |
|
266 | - |
|
267 | - if (api_get_multiple_access_url()) { |
|
268 | - $access_url_id = api_get_current_access_url_id(); |
|
269 | - if ($access_url_id != -1) { |
|
270 | - if ($friends) { |
|
271 | - // friends from social network is online |
|
272 | - $query = "SELECT distinct login_user_id, login_date |
|
265 | + } |
|
266 | + |
|
267 | + if (api_get_multiple_access_url()) { |
|
268 | + $access_url_id = api_get_current_access_url_id(); |
|
269 | + if ($access_url_id != -1) { |
|
270 | + if ($friends) { |
|
271 | + // friends from social network is online |
|
272 | + $query = "SELECT distinct login_user_id, login_date |
|
273 | 273 | FROM $track_online_table track INNER JOIN $friend_user_table |
274 | 274 | ON (friend_user_id = login_user_id) |
275 | 275 | WHERE track.access_url_id = $access_url_id AND |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | relation_type='".USER_RELATION_TYPE_FRIEND."' |
279 | 279 | ORDER BY $column $direction |
280 | 280 | LIMIT $from, $number_of_items"; |
281 | - } else { |
|
282 | - // all users online |
|
283 | - $query = "SELECT login_user_id, login_date |
|
281 | + } else { |
|
282 | + // all users online |
|
283 | + $query = "SELECT login_user_id, login_date |
|
284 | 284 | FROM ".$track_online_table ." track |
285 | 285 | INNER JOIN ".$table_user ." u |
286 | 286 | ON (u.id=track.login_user_id) |
@@ -288,26 +288,26 @@ discard block |
||
288 | 288 | login_date >= '".$current_date."' |
289 | 289 | ORDER BY $column $direction |
290 | 290 | LIMIT $from, $number_of_items"; |
291 | - } |
|
292 | - } |
|
293 | - } |
|
291 | + } |
|
292 | + } |
|
293 | + } |
|
294 | 294 | |
295 | - //This query will show all registered users. Only for dev purposes. |
|
296 | - /*$query = "SELECT DISTINCT u.id as login_user_id, login_date FROM ".$track_online_table ." e , $table_user u |
|
295 | + //This query will show all registered users. Only for dev purposes. |
|
296 | + /*$query = "SELECT DISTINCT u.id as login_user_id, login_date FROM ".$track_online_table ." e , $table_user u |
|
297 | 297 | GROUP by u.id |
298 | 298 | ORDER BY $column $direction |
299 | 299 | LIMIT $from, $number_of_items";*/ |
300 | 300 | |
301 | - $result = Database::query($query); |
|
302 | - if ($result) { |
|
303 | - $users_online = array(); |
|
304 | - while (list($login_user_id, $login_date) = Database::fetch_row($result)) { |
|
301 | + $result = Database::query($query); |
|
302 | + if ($result) { |
|
303 | + $users_online = array(); |
|
304 | + while (list($login_user_id, $login_date) = Database::fetch_row($result)) { |
|
305 | 305 | $users_online[] = $login_user_id; |
306 | - } |
|
307 | - return $users_online; |
|
308 | - } else { |
|
309 | - return false; |
|
310 | - } |
|
306 | + } |
|
307 | + return $users_online; |
|
308 | + } else { |
|
309 | + return false; |
|
310 | + } |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | function who_is_online_count($time_limit = null, $friends = false) |
@@ -317,15 +317,15 @@ discard block |
||
317 | 317 | } else { |
318 | 318 | $time_limit = intval($time_limit); |
319 | 319 | } |
320 | - $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
321 | - $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
322 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
323 | - $online_time = time() - $time_limit * 60; |
|
324 | - $current_date = api_get_utc_datetime($online_time); |
|
325 | - |
|
326 | - if ($friends) { |
|
327 | - // who friends from social network is online |
|
328 | - $query = "SELECT DISTINCT count(login_user_id) as count |
|
320 | + $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
321 | + $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
322 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
323 | + $online_time = time() - $time_limit * 60; |
|
324 | + $current_date = api_get_utc_datetime($online_time); |
|
325 | + |
|
326 | + if ($friends) { |
|
327 | + // who friends from social network is online |
|
328 | + $query = "SELECT DISTINCT count(login_user_id) as count |
|
329 | 329 | FROM $track_online_table INNER JOIN $friend_user_table |
330 | 330 | ON (friend_user_id = login_user_id) |
331 | 331 | WHERE |
@@ -333,20 +333,20 @@ discard block |
||
333 | 333 | friend_user_id <> '".api_get_user_id()."' AND |
334 | 334 | relation_type='".USER_RELATION_TYPE_FRIEND."' AND |
335 | 335 | user_id = '".api_get_user_id()."' "; |
336 | - } else { |
|
337 | - // All users online |
|
338 | - $query = "SELECT count(login_id) as count |
|
336 | + } else { |
|
337 | + // All users online |
|
338 | + $query = "SELECT count(login_id) as count |
|
339 | 339 | FROM $track_online_table track INNER JOIN $table_user u |
340 | 340 | ON (u.id=track.login_user_id) |
341 | 341 | WHERE u.status != ".ANONYMOUS." AND login_date >= '$current_date' "; |
342 | - } |
|
343 | - |
|
344 | - if (api_get_multiple_access_url()) { |
|
345 | - $access_url_id = api_get_current_access_url_id(); |
|
346 | - if ($access_url_id != -1) { |
|
347 | - if ($friends) { |
|
348 | - // friends from social network is online |
|
349 | - $query = "SELECT DISTINCT count(login_user_id) as count |
|
342 | + } |
|
343 | + |
|
344 | + if (api_get_multiple_access_url()) { |
|
345 | + $access_url_id = api_get_current_access_url_id(); |
|
346 | + if ($access_url_id != -1) { |
|
347 | + if ($friends) { |
|
348 | + // friends from social network is online |
|
349 | + $query = "SELECT DISTINCT count(login_user_id) as count |
|
350 | 350 | FROM $track_online_table track |
351 | 351 | INNER JOIN $friend_user_table ON (friend_user_id = login_user_id) |
352 | 352 | WHERE |
@@ -354,29 +354,29 @@ discard block |
||
354 | 354 | login_date >= '".$current_date."' AND |
355 | 355 | friend_user_id <> '".api_get_user_id()."' AND |
356 | 356 | relation_type='".USER_RELATION_TYPE_FRIEND."' "; |
357 | - } else { |
|
358 | - // all users online |
|
359 | - $query = "SELECT count(login_id) as count FROM $track_online_table track |
|
357 | + } else { |
|
358 | + // all users online |
|
359 | + $query = "SELECT count(login_id) as count FROM $track_online_table track |
|
360 | 360 | INNER JOIN $table_user u ON (u.id=track.login_user_id) |
361 | 361 | WHERE |
362 | 362 | u.status != ".ANONYMOUS." AND |
363 | 363 | track.access_url_id = $access_url_id AND |
364 | 364 | login_date >= '$current_date' "; |
365 | - } |
|
366 | - } |
|
367 | - } |
|
365 | + } |
|
366 | + } |
|
367 | + } |
|
368 | 368 | |
369 | 369 | // Dev purposes show all users online |
370 | 370 | /*$table_user = Database::get_main_table(TABLE_MAIN_USER); |
371 | 371 | $query = "SELECT count(*) as count FROM ".$table_user;*/ |
372 | 372 | |
373 | - $result = Database::query($query); |
|
374 | - if (Database::num_rows($result) > 0) { |
|
375 | - $row = Database::fetch_array($result); |
|
376 | - return $row['count']; |
|
377 | - } else { |
|
378 | - return false; |
|
379 | - } |
|
373 | + $result = Database::query($query); |
|
374 | + if (Database::num_rows($result) > 0) { |
|
375 | + $row = Database::fetch_array($result); |
|
376 | + return $row['count']; |
|
377 | + } else { |
|
378 | + return false; |
|
379 | + } |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | */ |
390 | 390 | function who_is_online_in_this_course($from, $number_of_items, $uid, $time_limit, $course_code) |
391 | 391 | { |
392 | - if (empty($course_code)) return false; |
|
392 | + if (empty($course_code)) return false; |
|
393 | 393 | |
394 | 394 | if (empty($time_limit)) { |
395 | 395 | $time_limit = api_get_setting('time_limit_whosonline'); |
@@ -401,56 +401,56 @@ discard block |
||
401 | 401 | $current_date = api_get_utc_datetime($online_time); |
402 | 402 | $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
403 | 403 | $course_code = Database::escape_string($course_code); |
404 | - $courseInfo = api_get_course_info($course_code); |
|
405 | - $courseId = $courseInfo['real_id']; |
|
404 | + $courseInfo = api_get_course_info($course_code); |
|
405 | + $courseId = $courseInfo['real_id']; |
|
406 | 406 | |
407 | 407 | $from = intval($from); |
408 | 408 | $number_of_items = intval($number_of_items); |
409 | 409 | |
410 | - $query = "SELECT login_user_id, login_date FROM $track_online_table |
|
410 | + $query = "SELECT login_user_id, login_date FROM $track_online_table |
|
411 | 411 | WHERE login_user_id <> 2 AND c_id = $courseId AND login_date >= '$current_date' |
412 | 412 | LIMIT $from, $number_of_items "; |
413 | 413 | |
414 | - $result = Database::query($query); |
|
415 | - if ($result) { |
|
416 | - $users_online = array(); |
|
414 | + $result = Database::query($query); |
|
415 | + if ($result) { |
|
416 | + $users_online = array(); |
|
417 | 417 | |
418 | - while(list($login_user_id, $login_date) = Database::fetch_row($result)) { |
|
418 | + while(list($login_user_id, $login_date) = Database::fetch_row($result)) { |
|
419 | 419 | $users_online[] = $login_user_id; |
420 | - } |
|
421 | - return $users_online; |
|
422 | - } else { |
|
423 | - return false; |
|
424 | - } |
|
420 | + } |
|
421 | + return $users_online; |
|
422 | + } else { |
|
423 | + return false; |
|
424 | + } |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null) |
428 | 428 | { |
429 | - if (empty($coursecode)) { |
|
430 | - return false; |
|
431 | - } |
|
432 | - $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
433 | - $coursecode = Database::escape_string($coursecode); |
|
434 | - $time_limit = Database::escape_string($time_limit); |
|
429 | + if (empty($coursecode)) { |
|
430 | + return false; |
|
431 | + } |
|
432 | + $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
433 | + $coursecode = Database::escape_string($coursecode); |
|
434 | + $time_limit = Database::escape_string($time_limit); |
|
435 | 435 | |
436 | 436 | $online_time = time() - $time_limit * 60; |
437 | 437 | $current_date = api_get_utc_datetime($online_time); |
438 | - $courseId = api_get_course_int_id($coursecode); |
|
438 | + $courseId = api_get_course_int_id($coursecode); |
|
439 | 439 | |
440 | - if (empty($courseId)) { |
|
441 | - return false; |
|
442 | - } |
|
440 | + if (empty($courseId)) { |
|
441 | + return false; |
|
442 | + } |
|
443 | 443 | |
444 | - $query = "SELECT count(login_user_id) as count |
|
444 | + $query = "SELECT count(login_user_id) as count |
|
445 | 445 | FROM $track_online_table |
446 | 446 | WHERE login_user_id <> 2 AND c_id = $courseId AND login_date >= '$current_date' "; |
447 | - $result = Database::query($query); |
|
448 | - if (Database::num_rows($result) > 0) { |
|
449 | - $row = Database::fetch_array($result); |
|
450 | - return $row['count']; |
|
451 | - } else { |
|
452 | - return false; |
|
453 | - } |
|
447 | + $result = Database::query($query); |
|
448 | + if (Database::num_rows($result) > 0) { |
|
449 | + $row = Database::fetch_array($result); |
|
450 | + return $row['count']; |
|
451 | + } else { |
|
452 | + return false; |
|
453 | + } |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | /** |
@@ -460,17 +460,17 @@ discard block |
||
460 | 460 | * @deprecated user api_get_user_info($user_id) |
461 | 461 | */ |
462 | 462 | function GetFullUserName($uid) { |
463 | - $uid = (int) $uid; |
|
464 | - $uid = intval($uid); |
|
465 | - $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
466 | - $query = "SELECT firstname, lastname FROM ".$user_table." WHERE id=$uid"; |
|
467 | - $result = @Database::query($query); |
|
468 | - if (count($result)>0) { |
|
469 | - while(list($firstname,$lastname)= Database::fetch_array($result)) { |
|
470 | - $str = str_replace(' ', ' ', api_get_person_name($firstname, $lastname)); |
|
471 | - return $str; |
|
472 | - } |
|
473 | - } |
|
463 | + $uid = (int) $uid; |
|
464 | + $uid = intval($uid); |
|
465 | + $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
466 | + $query = "SELECT firstname, lastname FROM ".$user_table." WHERE id=$uid"; |
|
467 | + $result = @Database::query($query); |
|
468 | + if (count($result)>0) { |
|
469 | + while(list($firstname,$lastname)= Database::fetch_array($result)) { |
|
470 | + $str = str_replace(' ', ' ', api_get_person_name($firstname, $lastname)); |
|
471 | + return $str; |
|
472 | + } |
|
473 | + } |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -482,44 +482,44 @@ discard block |
||
482 | 482 | $_cid = api_get_course_id(); |
483 | 483 | $_user = api_get_user_info(); |
484 | 484 | |
485 | - if (!$_user['user_id']) { |
|
486 | - return (false); |
|
487 | - } |
|
485 | + if (!$_user['user_id']) { |
|
486 | + return (false); |
|
487 | + } |
|
488 | 488 | $userId = intval($_user['user_id']); |
489 | - $track_user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
490 | - $sql="SELECT chatcall_user_id, chatcall_date FROM $track_user_table |
|
489 | + $track_user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
490 | + $sql="SELECT chatcall_user_id, chatcall_date FROM $track_user_table |
|
491 | 491 | WHERE ( id = $userId )"; |
492 | - $result=Database::query($sql); |
|
493 | - $row=Database::fetch_array($result); |
|
494 | - |
|
495 | - $login_date=$row['chatcall_date']; |
|
496 | - $hour = substr($login_date,11,2); |
|
497 | - $minute = substr($login_date,14,2); |
|
498 | - $second = substr($login_date,17,2); |
|
499 | - $month = substr($login_date,5,2); |
|
500 | - $day = substr($login_date,8,2); |
|
501 | - $year = substr($login_date,0,4); |
|
502 | - $calltime = mktime($hour,$minute,$second,$month,$day,$year); |
|
503 | - |
|
504 | - $time = api_get_utc_datetime(); |
|
505 | - $minute_passed=5; //within this limit, the chat call request is valid |
|
506 | - $limittime = mktime(date("H"),date("i")-$minute_passed,date("s"),date("m"),date("d"),date("Y")); |
|
507 | - |
|
508 | - if (($row['chatcall_user_id']) and ($calltime>$limittime)) { |
|
509 | - $webpath=api_get_path(WEB_CODE_PATH); |
|
510 | - $message=get_lang('YouWereCalled').' : '.GetFullUserName($row['chatcall_user_id'],'').'<br>'.get_lang('DoYouAccept') |
|
511 | - ."<p>" |
|
512 | - ."<a href=\"".$webpath."chat/chat.php?cidReq=".$_cid."&origin=whoisonlinejoin\">" |
|
513 | - . get_lang("Yes") |
|
514 | - ."</a>" |
|
515 | - ." | " |
|
516 | - ."<a href=\"".api_get_path(WEB_PATH)."webchatdeny.php\">" |
|
517 | - . get_lang("No") |
|
518 | - ."</a>" |
|
519 | - ."</p>"; |
|
520 | - |
|
521 | - return($message); |
|
522 | - } else { |
|
523 | - return false; |
|
524 | - } |
|
492 | + $result=Database::query($sql); |
|
493 | + $row=Database::fetch_array($result); |
|
494 | + |
|
495 | + $login_date=$row['chatcall_date']; |
|
496 | + $hour = substr($login_date,11,2); |
|
497 | + $minute = substr($login_date,14,2); |
|
498 | + $second = substr($login_date,17,2); |
|
499 | + $month = substr($login_date,5,2); |
|
500 | + $day = substr($login_date,8,2); |
|
501 | + $year = substr($login_date,0,4); |
|
502 | + $calltime = mktime($hour,$minute,$second,$month,$day,$year); |
|
503 | + |
|
504 | + $time = api_get_utc_datetime(); |
|
505 | + $minute_passed=5; //within this limit, the chat call request is valid |
|
506 | + $limittime = mktime(date("H"),date("i")-$minute_passed,date("s"),date("m"),date("d"),date("Y")); |
|
507 | + |
|
508 | + if (($row['chatcall_user_id']) and ($calltime>$limittime)) { |
|
509 | + $webpath=api_get_path(WEB_CODE_PATH); |
|
510 | + $message=get_lang('YouWereCalled').' : '.GetFullUserName($row['chatcall_user_id'],'').'<br>'.get_lang('DoYouAccept') |
|
511 | + ."<p>" |
|
512 | + ."<a href=\"".$webpath."chat/chat.php?cidReq=".$_cid."&origin=whoisonlinejoin\">" |
|
513 | + . get_lang("Yes") |
|
514 | + ."</a>" |
|
515 | + ." | " |
|
516 | + ."<a href=\"".api_get_path(WEB_PATH)."webchatdeny.php\">" |
|
517 | + . get_lang("No") |
|
518 | + ."</a>" |
|
519 | + ."</p>"; |
|
520 | + |
|
521 | + return($message); |
|
522 | + } else { |
|
523 | + return false; |
|
524 | + } |
|
525 | 525 | } |