summaryrefslogtreecommitdiff
blob: f04046f03d88aad8fce63b3749999361aae73c17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<?php
# Adopt a Developer
#
# Copyright (C) 2004, 2005, 2006 Thomas Cort
# Copyright (C) 2004 Adam Beaumont, Thomas Cort, Patrick McLean, Scott Stoddard
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

$called_footers = 0;
$called_headers = 0;

class html_headers extends actor {
	function execute() {
		global $called_headers;

    $site_title = "Welcome to the Adopt a Developer Admin Page";
    $title_size = "6"; # range 1-7 (1 is the biggest)
	
    # html_headers is a singleton
		if (!$called_headers) {
			$called_headers = 1;
			
      # print some headers
			?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title>
   <?php echo "$site_title"; ?>
  </title>
  <link href="style.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <!-- body table -->
  <table align="center" border="0" cellpadding="8" cellspacing="0" width="85%">
   <!-- top header -->
   <tr>
    <td valign="middle" width="25%" colspan="2">
     <!-- title table -->
     <table align="center" bgcolor="#000000" border="0" cellpadding="1" cellspacing="0" width="100%">
      <tr>
       <td valign="middle">
        <table bgcolor="#ffffff" border="0" cellpadding="8" cellspacing="0" width="100%">
         <tr>
          <td align="center" valign="middle">
           <a href="./?a=default"><?php echo "$site_title"; ?></a>
          </td>
         </tr>
        </table>
       </td>
      </tr>
     </table>
     <!-- end title table -->
    </td>
   </tr>
   <!-- end top header -->

   <tr>

    <!-- right column -->
    <td valign="top" width="75%">
     <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr>
       <td valign="top" width="100%">

			<?php
		}
		return new return_result(true);
  }
}

class html_footers extends actor {
  function execute() {
    global $called_footers, $username;
    $copyright = "&copy; 2004, 2005, 2006 Thomas Cort."
    . "<br>&copy; 2004 Thomas Cort, Patrick McLean, Scott Stoddard, Adam Beaumont.";

    # make html_footers a singleton
    if (!$called_footers) {
      $called_footers = 1;
      echo "<br>";

?>
       </td>
      </tr>
     </table>
    </td>
    <!-- end right column -->

    <!-- left column -->
    <td valign="top" width="25%">


    <?php if ($username == "guest") { ?>

     <!-- sidebox -->
     <table bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr>
       <td>
        <table border="0" cellpadding="3" cellspacing="1" width="100%">
         <tr>
          <td bgcolor="#cccccc">
           &nbsp;<span class="title">Login</span>
          </td>
         </tr>
         <tr>
          <td bgcolor="#ffffff">
           <?php trigger("display_login");
           ?>
          </td>
         </tr>
        </table>
       </td>
      </tr>
     </table>
     <!-- end sidebox -->

     <br>

     <?php } else { ?>

     <table bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr>
       <td>
        <table border="0" cellpadding="3" cellspacing="1" width="100%">
         <tr>
          <td bgcolor="#cccccc">
           &nbsp;<span class="title">Menu</span>
          </td>
         </tr>
         <tr>
          <td bgcolor="#ffffff">
           <?php trigger("display_menu");
           ?>
          </td>
         </tr>
        </table>
       </td>
      </tr>
     </table>


     <?php } ?>
    </td>
    <!-- end left column -->

   </tr>

   <tr>
    <td align="center" colspan="2">
     <!-- footer -->
       <span class="footer">
       <?php echo $copyright; ?>
       </span>
     <!-- end footer -->
    </td>
   </tr>
  </table>
  <!-- end body table -->
 </body>
</html>

<?php
    }
    return new return_result(true);
  }
}

class begin_story extends actor{
  function execute() {
  ?>
        <!-- story -->
        <table align="center" bgcolor="#000000" border="0" cellPadding="0" cellSpacing="0" width="100%">
         <tr>
          <td>
           <table border="0" cellpadding="8" cellspacing="1" width="100%">
            <tr>
             <td bgcolor="#ffffff" colspan="2">
              <table border="0" cellpadding="4" cellspacing="0" width="100%">
               <tr>
                <td valign="top" width="100%">
    <?php
    return new return_result(true);
  }
}

class end_story extends actor{
  function execute() {
  ?>
                </td>
               </tr>
              </table>
             </td>
            </tr>
           </table>
          </td>
         </tr>
        </table>
        <!-- end story -->

    <?php
    return new return_result(true);
  }
}

class menu_event extends actor {
  function execute() {
    global $accesslevel;

    # get the menu items for the user's access level
    $db_result = db_query("select * from menu,accesslevels where accesslevels.levelid = '$accesslevel' and accesslevels.levelid = menu.accesslevel order by menu.priority;");

    echo "<ul class=\"navbar\">";

    # print them all out
    while ($db_result->has_next()) {
      $row = $db_result->get_row();
      echo "<li><a href=\"./?a=$row[2]\"><b>$row[3]</b></a></li>";
    }
	
    echo "</ul>";
	
    return new return_result(true);
  }
}

class search_action extends actor {
  function execute() {
    global $accesslevel, $username;
    trigger("html_headers");
    trigger("display_search");
    trigger("html_footers");
    return new return_result(true);
  }
}

class display_search_event extends actor {
  function execute() {

    echo "<br><div align=\"center\"><form action=\"./\" method=\"post\"><table>";
    echo "<tr><td colspan=\"3\">";
    echo "<input type=\"text\" name=\"query\"></td></tr><tr><td>";
    echo "<input type=\"hidden\" name=\"a\" value=\"default\">";
    echo "<input type=\"hidden\" name=\"search\" value=\"1\">";
    echo "&nbsp;</td><td><input type=\"submit\" id=\"button\" style=\"font-size:8pt;background-color:#cccccc;color:#000000\" value=\"search\">";
    echo "</td><td><input type=\"reset\" id=\"button\" style=\"font-size:8pt;background-color:#cccccc;color:#000000\" value=\"clear\"></td></tr>";
    echo "</table>";
    echo "</form></div>";

    return new return_result(true);
  }
}

class blogroll_event extends actor {
  function execute() {
    $result = db_query("SELECT url,name FROM links WHERE UPPER(name) LIKE '%BLOG%' ORDER BY name");

    echo "<ul class=\"navbar\">";

    while($result->has_next()) {
      $row = $result->get_row();
      $row[1] = preg_split("/\'/",$row[1]);
      echo "<li><a href=\"$row[0]\"><b>".$row[1][0]."</b></a></li>";
    }

    echo "</ul>";
    return new return_result(true);
  }
}

register_handler(new blogroll_event("blogroll",50));
register_handler(new begin_story("begin_story",50));
register_handler(new end_story("end_story",50));
register_handler(new html_headers("html_headers",50));
register_handler(new html_footers("html_footers",50));
register_handler(new display_search_event("display_search",50));
register_action(new search_action("search",50));
register_handler(new menu_event("menu",50));

?>