changed git call from https to git readonly
[atutor.git] / mods / atalker / message_reader.php
1 <?php
2 /****************************************************************/
3 /* ATalker                                                                                                      */
4 /****************************************************************/
5 /* Copyright (c) 2002-2005 by Greg Gay         */
6 /* Adaptive Technology Resource Centre / University of Toronto  */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License  */
11 /* as published by the Free Software Foundation.                                */
12 /****************************************************************/
13 // $Id: message_reader.php 5123 2005-07-12 14:59:03Z greg $
14
15 /*
16 Add a require statement to the end of a theme header template to have ATalker
17 read error and feedback messages out loud. add to:
18          themes/theme_name/include/header.tmpl.php
19 e.g.
20          require(AT_INCLUDE_PATH."../mods/atalker/message_reader.php");
21 */
22
23 $file_recieve = '';
24
25  require_once(AT_INCLUDE_PATH."../mods/atalker/atalkerlib.inc.php");
26
27  if( $_SESSION['messages_on'] == '1'){ 
28         if($_SESSION['message'] ){
29
30                 define('AT_MSGS_DIR', AT_CONTENT_DIR.'/msgs/');
31                 define('AT_MSGS_URL', $this->base_href.'content/msgs/');
32                 
33                 //See if the messages (msgs) directory exists and if it does,  open it, otherwise create it, then open it
34                 if(@!opendir(AT_MSGS_DIR)){
35                                 mkdir(AT_MSGS_DIR, 0700);
36                 }
37
38                 $i = '0';
39                 
40                 if($_SESSION['message']['feedback'] != ''){
41                         foreach($_SESSION['message']['feedback'] as $var => $val){
42                 
43                                 if(is_array($val)){
44                                         $messages[$i]= $val[0];
45                                         $vals[$val[$i]] = $val[1];
46                                 }else{
47                                         $messages[$i] = $val;
48                                 }
49                                 $i++;
50         
51                         }
52                 }
53
54                 $i = '0';
55
56                 if($_SESSION['message']['error'] != ''){
57                         foreach($_SESSION['message']['error'] as $var => $val){
58                                 if(is_array($val)){
59                                         $messages[$i]= $val[0];
60                                         $vals[$val[$i]] = $val[1];
61                                 }else{
62                                         $messages[$i] = $val;
63                                 }
64                                 $i++;
65                         }
66                 }
67
68                 if($messages){
69                         if(!$vals){
70                                 $vals = '';
71                         }
72                         read_messages($messages, $vals);
73                         $messages = '';
74                 }
75         }
76 }
77 ?>