Changeset 18880 for trunk/www/dch/shiftinfo.php
- Timestamp:
- 06/17/17 14:05:57 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/dch/shiftinfo.php
r18841 r18880 3 3 <meta name="Author" content="The FACT Group" /> 4 4 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 5 <title>FACT Project</title>5 <title>FACT Contact Info</title> 6 6 <link rel="StyleSheet" type="text/css" href="../style.css" /> 7 7 </head> … … 18 18 <?php 19 19 20 if ($argv) 20 //find out if php was started with command-line or on browswer 21 //echo php_sapi_name(); 22 //echo PHP_SAPI; 23 if (strcmp(php_sapi_name(), "cli")==0 && $argv) 24 { 21 25 parse_str(implode('&', array_slice($argv, 1)), $_GET); 26 $_SERVER["REMOTE_USER"]="FACT"; 27 } 22 28 23 29 if (isset($_GET['date'])) … … 46 52 { 47 53 // this is getting exactly one entry from the DB, since we get only 48 // one username, which is unique in the DB. 49 $query="SELECT username as login, usertitle as name, email, fid5 as mobile, fid7 as skype 54 // one username, which is unique in the DB. 55 // contactinfo and availability need to be queried as else PHP complains 56 // in the function userinfo_to_string(), but for shifter they can/should be empty 57 $query="SELECT username as login, usertitle as name, email, fid5 as mobile, fid7 as skype, '' as contactinfo, '' as availability 50 58 FROM logbook.userfields 51 59 LEFT JOIN logbook.users … … 61 69 function get_expertinfo($db) 62 70 { 63 $query="SELECT username as login, usertitle as name, email, fid5 as mobile, fid7 as skype 71 $query="SELECT username as login, usertitle as name, email, fid5 as mobile, fid7 as skype, fid8 as contactinfo, fid6 as availability 64 72 FROM logbook.userfields 65 73 LEFT JOIN logbook.users ON (uid=ufid) … … 76 84 { 77 85 $s = $userinfo['name'] . "[" .$userinfo['login']."]" . ": <br>"; 78 $s .= " email:" . $userinfo['email'] . "<br>"; 79 $s .= " mobile:" . $userinfo['mobile'] . "<br>"; 80 $s .= " skype:" . $userinfo['skype'] . "<br>"; 86 if (str_replace(' ', '', $userinfo['contactinfo'])) 87 $s .= $userinfo['contactinfo']."<br>"; 88 else 89 { 90 $s .= " email:" . $userinfo['email'] . "<br>"; 91 $s .= " mobile:" . $userinfo['mobile'] . "<br>"; 92 $s .= " skype:" . $userinfo['skype'] . "<br>"; 93 } 94 if ((strcmp($_SERVER['REMOTE_USER'], "FACT")==0) && str_replace(' ', '', $userinfo['availability'])) 95 $s .= "availability information: <br>".$userinfo['availability']."<br>"; 81 96 return $s; 82 97 } … … 105 120 while ($row = $result->fetch_assoc()) 106 121 { 107 108 122 $userinfo = get_userinfo($db, $row['u']); 109 if ($userinfo['name']){ 123 if ($userinfo['name']) 124 { 110 125 echo "<li>".userinfo_to_string($userinfo)."</li>\n"; 111 126 if (!$userinfo['mobile']) … … 118 133 echo "Expert-On-Call Contact Info: <br>\n <ul>\n"; 119 134 120 foreach (get_expertinfo($db) as $expertinfo) { 135 foreach (get_expertinfo($db) as $expertinfo) 136 { 121 137 echo "<li>".userinfo_to_string($expertinfo)."</li><br>\n"; 122 138
Note:
See TracChangeset
for help on using the changeset viewer.