Don't put HTML and text files through clean_text.
[moodle.git] / mod / chat / chatd.php
CommitLineData
8e7eec60 1#!./php -q
2<?php
3
4echo "Moodle chat daemon v1.0\n\n";
5
6
7
8/// Set up all the variables we need /////////////////////////////////////
9
10/// $CFG variables are now defined in database by chat/lib.php
11
12$_SERVER['PHP_SELF'] = "dummy";
13$_SERVER['SERVER_NAME'] = "dummy";
14
15include('../../config.php');
16include('lib.php');
17
18$_SERVER['SERVER_NAME'] = $CFG->chat_serverhost;
19$_SERVER['PHP_SELF'] = "http://$CFG->chat_serverhost:$CFG->chat_serverport/mod/chat/chatd.php";
20
21$safemode = ini_get('safe_mode');
22
23if(!empty($safemode)) {
24 die("Error: Cannot run with PHP safe_mode = On. Turn off safe_mode.\n");
25}
26
27@set_time_limit (0);
28set_magic_quotes_runtime(0);
29
30error_reporting(E_ALL);
31
32function chat_empty_connection() {
33 return array('sid' => NULL, 'handle' => NULL, 'ip' => NULL, 'port' => NULL, 'groupid' => NULL);
34}
35
36class ChatConnection {
37 var $sid = NULL;
38 var $handle = NULL;
39 var $ip = NULL;
40 var $port = NULL;
41 var $groupid = NULL;
42 var $lastmessages = array();
43 var $lastmsgindex = 0;
44 var $type = NULL;
45}
46
47class ChatMessage {
48 var $chatid = NULL;
49 var $userid = NULL;
50 var $groupid = NULL;
51 var $system = NULL;
52 var $message = NULL;
53 var $timestamp = NULL;
54
55 var $text_ = '';
56 var $html_ = '';
57 var $beep_ = false;
58
59}
60
61class ChatDaemon {
62 var $conn_ufo = array(); // Connections not identified yet
63 var $conn_side = array(); // Sessions with sidekicks waiting for the main connection to be processed
64 var $conn_half = array(); // Sessions that have valid connections but not all of them
65 var $conn_sets = array(); // Sessions with complete connection sets sets
66 var $sets_info = array(); // Keyed by sessionid exactly like conn_sets, one of these for each of those
67
68 var $message_queue = array(); // Holds messages that we haven't committed to the DB yet
69
70 function new_ufo_id() {
71 static $id = 0;
72 if($id++ === 0x1000000) { // Cycling very very slowly to prevent overflow
73 $id = 0;
74 }
75 return $id;
76 }
77
78 function process_sidekicks($sessionid) {
79 if(empty($this->conn_side[$sessionid])) {
80 return true;
81 }
82 foreach($this->conn_side[$sessionid] as $sideid => $sidekick) {
83 $this->dispatch_sidekick($sidekick['handle'], $sidekick['type'], $sessionid, $sidekick['customdata']);
84 unset($this->conn_side[$sessionid][$sideid]);
85 }
86 return true;
87 }
88
89 function dispatch_sidekick($handle, $type, $sessionid, $customdata) {
90 global $CFG;
91
92 switch($type) {
93 case CHAT_SIDEKICK_USERS:
94 $x = pusers($this->sets_info[$sessionid]['chat'], $this->sets_info[$sessionid]['groupid']);
95 //$x = "<html>Lalalala! ".time()."</html>";
96
97 $header = "HTTP/1.1 200 OK\n";
98 $header .= "Connection: close\n";
99 $header .= "Date: ".date('r')."\n";
100 $header .= "Server: Moodle\n";
101 $header .= "Content-Type: text/html\n";
102 $header .= "Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT\n";
103 $header .= "Cache-Control: no-cache, must-revalidate\n";
104 $header .= "Expires: Wed, 4 Oct 1978 09:32:45 GMT\n";
105 $header .= "Refresh: 3; url=http://$CFG->chat_serverhost:$CFG->chat_serverport?win=users&".
106 "chat_sid=".$sessionid."&groupid=".$this->sets_info[$sessionid]['groupid']."\n";
107 $header .= "\n";
108
109 $x = $header.$x;
110
111 trace('Outputting user list('.strlen($x).' chars)');
112 //trace($x);
113
114 chat_socket_write($handle, $x);
115 break;
116 case CHAT_SIDEKICK_MESSAGE:
117 // Incoming message
118 $msg = &New ChatMessage;
119 $msg->chatid = $this->sets_info[$sessionid]['chatid'];
120 $msg->userid = $this->sets_info[$sessionid]['userid'];
121 $msg->groupid = $this->sets_info[$sessionid]['groupid'];
122 $msg->system = 0;
123 $msg->message = urldecode($customdata['message']); // have to undo the browser's encoding
124 $msg->timestamp = time();
125
126 if(empty($msg->message)) {
127 // Someone just hit ENTER, send them on their way
128 break;
129 }
130
131 // Format the message object here
132 $output = chat_format_message($msg);
133
134 $msg->message = $output->text; // This is for writing into the DB
135 $msg->text_ = $output->text;
136 $msg->html_ = $output->html;
137 $msg->beep_ = $output->beep;
138
139 // OK, now push it out to all users
140 $this->message_broadcast($msg);
141
142 // Put it on the uncommitted queue
143 // TODO: error checking!!!
144 //$message_queue[] = $msg;
145 insert_record('chat_messages', $msg);
146
147 // Update that user's lastmessageping
148 // TODO: this can and should be written as a single UPDATE query
149 $user = get_record('chat_users', 'sid', $sessionid);
150 if($user !== false) {
151 $user->lastmessageping = $msg->timestamp;
152 update_record('chat_users', $user);
153 }
154
155 // All done
156 break;
157 }
158
159 socket_shutdown($handle);
160 socket_close($handle);
161 }
162
163 function promote_final($sessionid, $groupid) {
164 if(isset($this->conn_sets[$sessionid])) {
165 trace('Set cannot be finalized: Session '.$sessionid.' is already active');
166 return false;
167 }
168
169 $chatuser = get_record('chat_users', 'sid', $sessionid);
170 if($chatuser === false) {
171 $this->dismiss_half($sessionid);
172 return false;
173 }
174 $chat = get_record('chat', 'id', $chatuser->chatid);
175 if($chat === false) {
176 $this->dismiss_half($sessionid);
177 return false;
178 }
179
180 global $CHAT_HTMLHEAD_JS;
181
182 $this->conn_sets[$sessionid] = $this->conn_half[$sessionid];
183 $this->sets_info[$sessionid] = array('chatid' => $chatuser->chatid, 'userid' => $chatuser->userid, 'groupid' => $groupid, 'lastmessages' => array(), 'lastmsgindex' => 0);
184 $this->dismiss_half($sessionid, false);
185 chat_socket_write($this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL], $CHAT_HTMLHEAD_JS);
186 trace('Finalized client: sid: '.$sessionid.' uid: '.$chatuser->userid.' gid: '.intval($groupid));
187
188 // Finally, broadcast the "entered the chat" message
189
190 $msg = &New ChatMessage;
191 $msg->chatid = $chatuser->chatid;
192 $msg->userid = $chatuser->userid;
193 $msg->groupid = 0;
194 $msg->system = 1;
195 $msg->message = 'enter';
196 $msg->timestamp = time();
197
198 insert_record('chat_messages', $msg);
199
200 // Format the message object here
201 $output = chat_format_message($msg);
202
203 $msg->message = $output->text; // This is for writing into the DB
204 $msg->text_ = $output->text;
205 $msg->html_ = $output->html;
206 $msg->beep_ = $output->beep;
207
208 $this->message_broadcast($msg);
209
210 return true;
211 }
212
213 function promote_ufo($handle, $type, $sessionid, $groupid, $customdata) {
214 if(empty($this->conn_ufo)) {
215 return false;
216 }
217 foreach($this->conn_ufo as $id => $ufo) {
218 if($ufo == $handle) {
219 // OK, got the id of the UFO, but what is it?
220
221 if($type & CHAT_SIDEKICK) {
222 // Is the main connection ready?
223 if(isset($this->conn_sets[$sessionid])) {
224 // Yes, so dispatch this sidekick now and be done with it
225 trace('Dispatching sidekick immediately');
226 $this->dispatch_sidekick($handle, $type, $sessionid, $customdata);
227 $this->dismiss_ufo($handle, false);
228 }
229 else {
230 // No, so put it in the waiting list
231 trace('sidekick waiting');
232 $this->conn_side[$sessionid][] = array('type' => $type, 'handle' => $handle, 'customdata' => $customdata);
233 }
234 return true;
235 }
236
237 // If it's not a sidekick, at this point it can only be da man
238
239 if($type & CHAT_CONNECTION) {
240 // This forces a new connection right now...
241
242 // Do we have such a connection active?
243 if(isset($this->conn_sets[$sessionid])) {
244 // Yes, so regrettably we cannot promote you
245 trace('UFO #'.$id.' with '.$ufo.' cannot be promoted: session '.$sessionid.' is already final');
246 $this->dismiss_ufo($handle);
247 return false;
248 }
249
250 // Join this with what we may have already
251 $this->conn_half[$sessionid][$type] = $handle;
252
253 // Do the bookkeeping
254 $this->promote_final($sessionid, $groupid);
255
256 // It's not an UFO anymore
257 $this->dismiss_ufo($handle, false);
258
259 // Dispatch waiting sidekicks
260 $this->process_sidekicks($sessionid);
261
262 return true;
263 }
264
265 /*
266 // It's the first one for that sessionid, so it will start an incomplete connection
267 $this->conn_half[$sessionid] = array($type => $handle);
268 unset($this->conn_ufo[$id]);
269 trace('UFO #'.$id.': identified session '.$sessionid.' wintype '.$type);
270 return true;
271 */
272 }
273 }
274 return false;
275 }
276
277 function dismiss_half($sessionid, $disconnect = true) {
278 if(!isset($this->conn_half[$sessionid])) {
279 return false;
280 }
281 if($disconnect) {
282 foreach($this->conn_half[$sessionid] as $handle) {
283 socket_shutdown($handle);
284 socket_close($handle);
285 }
286 }
287 unset($this->conn_half[$sessionid]);
288 return true;
289 }
290
291 function dismiss_set($sessionid) {
292 if(!isset($this->conn_sets[$sessionid])) {
293 return false;
294 }
295 foreach($this->conn_sets[$sessionid] as $handle) {
296 socket_shutdown($handle);
297 socket_close($handle);
298 }
299 unset($this->conn_sets[$sessionid]);
300 unset($this->sets_info[$sessionid]);
301 return true;
302 }
303
304
305 function dismiss_ufo($handle, $disconnect = true) {
306 if(empty($this->conn_ufo)) {
307 return false;
308 }
309 foreach($this->conn_ufo as $id => $ufo) {
310 if($ufo == $handle) {
311 unset($this->conn_ufo[$id]);
312 if($disconnect) {
313 chat_socket_write($handle, "You don't seem to be a valid client.\n");
314 socket_shutdown($handle);
315 socket_close($handle);
316 }
317 return true;
318 }
319 }
320 return false;
321 }
322
323 function conn_accept() {
324 $handle = @socket_accept($this->listen_socket);
325 if(!$handle) {
326 return false;
327 }
328
329 $newconn = &New ChatConnection;
330 $newconn->handle = $handle;
331 socket_getpeername($newconn->handle, &$newconn->ip, &$newconn->port);
332
333 $id = $this->new_ufo_id();
334 trace('UFO #'.$id.': connection from '.$newconn->ip.' on port '.$newconn->port.', '.$newconn->handle);
335
336 $this->conn_ufo[$id] = $newconn->handle;
337 }
338
339 function conn_activity_ufo (&$handles) {
340 $monitor = array();
341 if(!empty($this->conn_ufo)) {
342 foreach($this->conn_ufo as $ufoid => $ufo) {
343 $monitor[$ufoid] = $ufo;
344 }
345 }
346
347 if(empty($monitor)) {
348 $handles = array();
349 return 0;
350 }
351
352 $retval = socket_select($monitor, $a = NULL, $b = NULL, NULL);
353 $handles = $monitor;
354
355 return $retval;
356 }
357
358 function message_broadcast($message) {
359 if(empty($this->conn_sets)) {
360 return true;
361 }
362
363 //trace('Broadcasting message');
364 foreach($this->sets_info as $sessionid => $info) {
365 // We need to get handles from users that are in the same chatroom, same group
366 if($info['chatid'] == $message->chatid &&
367 ($info['groupid'] == $message->groupid || $message->groupid == 0))
368 {
369
370 // Simply give them the message
371
372 if(!chat_socket_write($this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL], $message->html_)) {
373
374 // Send failed! We must now disconnect/forget about the user FIRST
375 // and THEN broadcast a message to all others... otherwise, infinite recursion.
376
377 delete_records('chat_users', 'sid', $sessionid);
378 $msg = &New ChatMessage;
379 $msg->chatid = $info['chatid'];
380 $msg->userid = $info['userid'];
381 $msg->groupid = 0;
382 $msg->system = 1;
383 $msg->message = 'exit';
384 $msg->timestamp = time();
385
386 trace('Client socket write failed, destroying uid '.$info['userid'].' with SID '.$sessionid);
387 insert_record('chat_messages', $msg);
388
389 // Format the message object here
390 $output = chat_format_message($msg);
391
392 $msg->message = $output->text; // This is for writing into the DB
393 $msg->text_ = $output->text;
394 $msg->html_ = $output->html;
395 $msg->beep_ = $output->beep;
396
397 // Kill him before broadcasting!!
398 $this->dismiss_set($sessionid);
399 $this->message_broadcast($msg);
400 }
401 //trace('Sent to UID '.$this->sets_info[$sessionid]['userid'].': '.$message->text_);
402 }
403 }
404 }
405
406 function message_commit() {
407 }
408
409}
410
411// Connection telltale
412define('CHAT_CONNECTION', 0x10);
413// Connections: Incrementing sequence, 0x10 to 0x1f
414define('CHAT_CONNECTION_CHANNEL', 0x11);
415
416// Sidekick telltale
417define('CHAT_SIDEKICK', 0x20);
418// Sidekicks: Incrementing sequence, 0x21 to 0x2f
419define('CHAT_SIDEKICK_USERS', 0x21);
420define('CHAT_SIDEKICK_MESSAGE', 0x22);
421
422
423$DAEMON = New ChatDaemon;
424$DAEMON->socket_active = false;
425$DAEMON->trace_level = E_ALL;
426$DAEMON->socketserver_refresh = 10;
427$DAEMON->rememberlast = 10;
428$DAEMON->can_daemonize = function_exists('pcntl_fork');
429
430$logfile = fopen('chatd.log', 'a+');
431
432
433/// Check the parameters //////////////////////////////////////////////////////
434
435 $param = trim(strtolower($argv[1]));
436
437 if (empty($param) || eregi('^(\-\-help|\-h)$', $param)) {
438 echo 'Starts the Moodle chat socket server on port '.$CFG->chat_serverport;
439 echo "\n\n";
440 echo "Usage: chatd.php [-h|--start]\n\n";
441 echo "Example:\n";
442 echo " chatd.php --start\n\n";
443 echo "Options:\n";
444 echo " --start Starts the daemon\n";
445 echo " -h, --help Show this help\n";
446 echo "\n";
447 die();
448 }
449
450
451
452/// Try to set up all the sockets ////////////////////////////////////////////////
453
454trace('Setting up sockets');
455
456if (!function_exists('socket_set_option')) {
457 // PHP < 4.3
458 if (!function_exists('socket_setopt')) {
459 // No socket_setopt!
460 echo "Error: Neither socket_setopt() nor socket_set_option() exists.\n";
461 echo "Possibly PHP has not been compiled with --enable-sockets.\n\n";
462 die();
463 }
464 function socket_set_option($socket, $level, $name, $val) {
465 return socket_setopt($socket, $level, $name, $val);
466 }
467}
468
469// Creating socket
470
471if(false === ($DAEMON->listen_socket = socket_create(AF_INET, SOCK_STREAM, 0))) {
472 // Failed to create socket
473 $DAEMON->last_error = socket_last_error();
474 echo "Error: socket_create() failed: ". socket_strerror(socket_last_error($DAEMON->last_error)).' ['.$DAEMON->last_error."]\n";
475 die();
476}
477
478//socket_close($DAEMON->listen_socket);
479//die();
480
481if(!socket_bind($DAEMON->listen_socket, $CFG->chat_serverip, $CFG->chat_serverport)) {
482 // Failed to bind socket
483 $DAEMON->last_error = socket_last_error();
484 echo "Error: socket_bind() failed: ". socket_strerror(socket_last_error($DAEMON->last_error)).' ['.$DAEMON->last_error."]\n";
485 die();
486}
487if(!socket_listen($DAEMON->listen_socket, $CFG->chat_servermax)) {
488 // Failed to get socket to listen
489 $DAEMON->last_error = socket_last_error();
490 echo "Error: socket_listen() failed: ". socket_strerror(socket_last_error($DAEMON->last_error)).' ['.$DAEMON->last_error."]\n";
491 die();
492}
493
494// Socket has been initialized and is ready
495trace('Socket opened on port '.$CFG->chat_serverport);
496$DAEMON->socket_active = true;
497
498// [pj]: I really must have a good read on sockets. What exactly does this do?
499// http://www.unixguide.net/network/socketfaq/4.5.shtml is still not enlightening enough for me.
500socket_set_option($DAEMON->listen_socket, SOL_SOCKET, SO_REUSEADDR, 1);
501socket_set_nonblock($DAEMON->listen_socket);
502
503/// Sockets all set up! Now we loop and process incoming data.
504/*
505declare(ticks=1);
506
507$pid = pcntl_fork();
508if ($pid == -1) {
509 die("could not fork");
510} else if ($pid) {
511 exit(); // we are the parent
512} else {
513 // we are the child
514}
515
516// detatch from the controlling terminal
517if (!posix_setsid()) {
518 die("could not detach from terminal");
519}
520
521// setup signal handlers
522pcntl_signal(SIGTERM, "sig_handler");
523pcntl_signal(SIGHUP, "sig_handler");
524*/
525
526if($DAEMON->can_daemonize) {
527 trace('Unholy spirit possession: daemonizing');
528 $DAEMON->pid = pcntl_fork();
529 if($pid == -1) {
530 trace('Process fork failed, terminating');
531 die();
532 }
533 else if($pid) {
534 // We are the parent
535 trace('Successfully forked the daemon with PID '.$pid);
536 die();
537 }
538 else {
539 // We are the daemon! :P
540 }
541
542 // FROM NOW ON, IT'S THE DAEMON THAT'S RUNNING!
543
544 // Detach from controlling terminal
545 if(!posix_setsid()) {
546 trace('Could not detach daemon process from terminal!');
547 }
548}
549else {
550 // Cannot go demonic
551 trace('Unholy spirit possession failed: PHP is not compiled with --enable-pcntl');
552}
553
554trace('Started Moodle chatd on port '.$CFG->chat_serverport.', listening socket '.$DAEMON->listen_socket, E_USER_WARNING);
555
556while(true) {
557 $active = array();
558
559 // First of all, let's see if any of our UFOs has identified itself
560 if($DAEMON->conn_activity_ufo($active)) {
561 foreach($active as $handle) {
562 $read_socket = array($handle);
563 $changed = socket_select($read_socket, $write = NULL, $except = NULL, 0, 0);
564
565 if($changed > 0) {
566 // Let's see what it has to say
567
568 $data = socket_read($handle, 512);
569 if(empty($data)) {
570 continue;
571 }
572
573 if(!ereg('win=(chat|users|message).*&chat_sid=([a-zA-Z0-9]*)&groupid=([0-9]*) HTTP', $data, $info)) {
574 // Malformed data
575 trace('UFO with '.$handle.': Request with malformed data; connection closed', E_USER_WARNING);
576 $DAEMON->dismiss_ufo($handle);
577 continue;
578 }
579
580 $type = $info[1];
581 $sessionid = $info[2];
582 $groupid = $info[3];
583
584 $customdata = array();
585
586 switch($type) {
587 case 'chat':
588 $type = CHAT_CONNECTION_CHANNEL;
589 break;
590 case 'users':
591 $type = CHAT_SIDEKICK_USERS;
592 break;
593 case 'message':
594 $type = CHAT_SIDEKICK_MESSAGE;
595 if(!ereg('chat_message=([^&]*)[& ]', $data, $info)) {
596 trace('Message sidekick did not contain a valid message', E_USER_WARNING);
597 $DAEMON->dismiss_ufo($handle);
598 continue;
599 }
600 else {
601 $customdata = array('message' => $info[1]);
602 }
603 break;
604 default:
605 trace('UFO with '.$handle.': Request with unknown type; connection closed', E_USER_WARNING);
606 $DAEMON->dismiss_ufo($handle);
607 continue;
608 break;
609 }
610
611 // OK, now we know it's something good... promote it and pass it all the data it needs
612 $DAEMON->promote_ufo($handle, $type, $sessionid, $groupid, $customdata);
613 continue;
614 }
615 }
616 }
617
618 // Finally, accept new connections
619 $DAEMON->conn_accept();
620
621 usleep($DAEMON->socketserver_refresh);
622}
623
624@socket_shutdown($DAEMON->listen_socket, 0);
625die("\n\n-- terminated --\n");
626
627
628function trace($message, $level = E_USER_NOTICE) {
629 global $DAEMON, $logfile;
630
631 $date = date('[Y-m-d H:i:s] ');
632 $severity = '';
633
634 switch($level) {
635 case E_USER_WARNING: $severity = '*IMPORTANT* '; break;
636 case E_USER_ERROR: $severity = ' *CRITICAL* '; break;
637 }
638
639 $message = $date.$severity.$message."\n";
640
641 if ($DAEMON->trace_level & $level) {
642 if($level & E_USER_ERROR) {
643 fwrite(STDERR, $message);
644 }
645 fwrite(STDOUT, $message);
646 fwrite($logfile, $message);
647 fflush($logfile);
648 }
649 flush();
650}
651
652function chat_socket_write($connection, $text) {
653 $check_socket = array($connection);
654 $socket_changed = socket_select($read = NULL, $check_socket, $except = NULL, 0, 0);
655 if($socket_changed > 0) {
656 socket_write($connection, $text, strlen($text));
657 return true;
658 }
659 return false;
660}
661
662function pusers($chat, $groupid) {
663/// Delete users who are using text version and are old
664
665global $CFG, $str;
666
667//chat_delete_old_users();
668
669
670/// Print headers
671ob_start();
672
673//print_header();
674
675$timenow = time();
676
677if (empty($str)) {
678 $str->idle = get_string("idle", "chat");
679 $str->beep = get_string("beep", "chat");
680 $str->day = get_string("day");
681 $str->days = get_string("days");
682 $str->hour = get_string("hour");
683 $str->hours = get_string("hours");
684 $str->min = get_string("min");
685 $str->mins = get_string("mins");
686 $str->sec = get_string("sec");
687 $str->secs = get_string("secs");
688}
689
690/// Get list of users
691
692if (!$chatusers = chat_get_users($chat->id, $groupid)) {
693 print_string("errornousers", "chat");
694 die('no users');
695 //return ob_get_clean();
696 //exit;
697}
698
699echo "<html>\n";
700echo "<head>\n";
701echo "<script lang=\"Javascript\">\n";
702echo " function reloadme() {\n";
703echo " return false;\n";
704echo " window.location.reload();\n";
705echo " }\n";
706echo "</script></head>\n";
707echo '<body onload="setTimeout(\'reloadme()\', 5000);">'."\n\n";
708for ($i = 0; $i < 100; ++$i) {
709 echo "<!-- nix -->\n";
710}
711
712echo "<table width=\"100%\">";
713foreach ($chatusers as $chatuser) {
714 $lastping = $timenow - $chatuser->lastmessageping;
715 echo "<tr><td width=35>";
716 echo "<a target=\"_new\" onClick=\"return openpopup('/user/view.php?id=$chatuser->id&course=$chat->course','user$chatuser->id','');\" href=\"$CFG->wwwroot/user/view.php?id=$chatuser->id&course=$chat->course\">";
717 print_user_picture($chatuser->id, 0, $chatuser->picture, false, false, false);
718 echo "</a></td><td valign=center>";
719 echo "<p><font size=1>";
720 echo fullname($chatuser)."<br />";
721 echo "<font color=\"#888888\">$str->idle: ".format_time($lastping, $str)."</font>";
722 echo " <a href=\"users.php?chat_sid=$chat_sid&beep=$chatuser->id&groupid=$groupid\">$str->beep</a>";
723 echo "</font></p>";
724 echo "<td></tr>";
725}
726echo "</table>";
727
728//window.setTimeout('reloadme', 1000)
729echo '</body></html>';
730return ob_get_clean();
731
732}
733
734?>