Odyssey
ShowColors.prg
1 <?php
2  $monLibrary= dirname(__FILE__) . "/../library";
3  require_once("$monLibrary/cu_top.i");
4  require_once("$monLibrary/ck_hticket.i");
5 
6 
7  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
8  // ** Permissions failed
9  // ** redirect to new page
10  header("Location: /hcuadm/hcu_noperm.prg");
11  exit;
12  }
13 
14  // ** This is done to limit the changes needed, but in reality, I only want one
15  // ** Database connection used for this script... $link is set in cu_top
16  // ** 9.12.2006 mws
17  $dbh = $link;
18 
19 
20  $sql = "select cu, user_name from cuadmin order by cu";
21 
22  $sth = db_query($sql, $dbh);
23  if ($sth) {
24  echo "<html><head><title>Credit Union Color Settings</title></head>";
25  echo "<body background='#FFFFFF'>";
26  echo "<table border=1 cellpadding=1 cellspacing=1 align=center>";
27  echo "<tr><td colspan=9 align=center>COLOR SHEET</td></tr>";
28  echo "<tr>
29  <th>CU</th><th>user</th><th>Body</th><th>Bar</th><th>Mat</th>
30  <th>Hdr</th><th>Dtl</th>
31  <th>Odd</th><th>Even</th>
32  </tr>\n";
33  for ($row=0; list($cu, $user_name) =
34  db_fetch_array($sth,$row); $row++) {
35  $cu = trim($cu);
36  $user_name = trim($user_name);
37  print "<tr><td bgcolor=white>$cu</td><td bgcolor=white>$user_name</td>";
38 
39 # get the mindex.css file
40  if (is_readable("/home/$user_name/public_html/mindex.css")) {
41  $cssfile = file("/home/$user_name/public_html/mindex.css");
42  $cssfile = implode("",$cssfile);
43  $matches=array();
44 
45 # grep out the stuff we want to see ...
46  preg_match("/BODY[^}]*background: (#?......)/",$cssfile,$matches);
47  $bodytag = $matches[1];
48  preg_match("/BODY[^}]*color: (#?......)/",$cssfile,$matches);
49  $bodycolor = ("${matches[1]}" == "" ? "#000000" : $matches[1]);
50  preg_match("/\.bar[^}]*background: (#?......)/",$cssfile,$matches);
51  $bartag = $matches[1];
52  preg_match("/.bar[^}]*color: (#?......)/",$cssfile,$matches);
53  $barcolor = ("${matches[1]}" == "" ? "#000000" : $matches[1]);
54  preg_match("/\.matce[^}]*background: (#?......)/",$cssfile,$matches);
55  $mattag = $matches[1];
56  preg_match("/.mat[^}]*color: (#?......)/",$cssfile,$matches);
57  $matcolor = ("${matches[1]}" == "" ? "#000000" : $matches[1]);
58  preg_match("/\.odd[^}]*background: (#?......)/",$cssfile,$matches);
59  $oddtag = $matches[1];
60  preg_match("/.odd[^}]*color: (#?......)/",$cssfile,$matches);
61  $oddcolor = ("${matches[1]}" == "" ? "#000000" : $matches[1]);
62  preg_match("/\.even[^}]*background: (#?......)/",$cssfile,$matches);
63  $eventag = $matches[1];
64  preg_match("/.even[^}]*color: (#?......)/",$cssfile,$matches);
65  $evencolor = ("${matches[1]}" == "" ? "#000000" : $matches[1]);
66  preg_match("/\.hdrl[^}]*background: (#?......)/",$cssfile,$matches);
67  $hdrtag = $matches[1];
68  preg_match("/.hdr[^}]*color: (#?......)/",$cssfile,$matches);
69  $hdrcolor = ("${matches[1]}" == "" ? "#000000" : $matches[1]);
70  preg_match("/\.dtll[^}]*background: (#?......)/",$cssfile,$matches);
71  $dtltag = $matches[1];
72  preg_match("/.dtl[^}]*color: (#?......)/",$cssfile,$matches);
73  $dtlcolor = ("${matches[1]}" == "" ? "#000000" : $matches[1]);
74 
75 # ... and print it
76 
77  print "<td bgcolor=$bodytag>$bodytag</td>
78  <td bgcolor=$bartag><font color=$barcolor>$bartag</font></td>
79  <td bgcolor=$mattag><font color=$matcolor>$mattag</font></td>
80  <td bgcolor=$hdrtag><font color=$hdrcolor>$hdrtag</font></td>
81  <td bgcolor=$dtltag><font color=$dtlcolor>$dtltag</font></td>
82  <td bgcolor=$oddtag><font color=$oddcolor>$oddtag</font></td>
83  <td bgcolor=$eventag><font color=$evencolor>$eventag</font></td>";
84 }
85  print "</tr>\n";
86  }
87 
88  echo "</table></body></html>";
89 
90  }
91 ?>