Location: PHPKode > scripts > Orca Ringmaker > orca-ringmaker/orm3/body.php
<?php /* ***** Orca Ringmaker - Body File *************************** */


?><div id="orm_main">

	<!-- <?php echo $_SDATA['useragent']; ?> -->

	<style type="text/css">@import url(/<?php echo $_SDATA['directory']; ?>/themes/<?php echo (isset($_VDATA)) ? $_VDATA['display.theme'] : "grey"; ?>/style.css);</style>

	<div id="orm_control">
		<h3><?php echo $_LANG['0b0']; ?></h3><?php
		if ($_DDATA['online'] && $_VDATA['display.announcement']) { ?> 
			<p id="orm_control_announcement"><?php
				echo nl2br($_VDATA['display.announcement']); ?> 
			</p><?php
		} ?> 

		<ul class="orm_control_linklist">
			<li><?php ORM_controlLink($_LANG['0b1'], "", $_USER['action']); ?></li><?php
			if (!$_USER['level']) { ?> 
				<li><?php ORM_controlLink($_LANG['0b2'], "Join", $_USER['action'] != "Join"); ?></li><?php
			}
			if ($_SDATA['actcount'] > 2) { ?> 
				<li><a href="<?php echo $_SERVER['PHP_SELF']; ?>?Go&amp;Rand&amp;0"><?php echo $_LANG['0b3']; ?></a></li><?php
			}
			if (@file_exists("{$_SERVER['DOCUMENT_ROOT']}/{$_SDATA['directory']}/help.html")) { ?> 
				<li><?php ORM_controlLink($_LANG['0b4'], "Help", $_USER['action'] != "Help"); ?></li><?php
			} ?> 
			<li><?php ORM_controlLink($_LANG['0b5'], "Stats", $_USER['action'] != "Stats"); ?></li>
		</ul>

		<table cellspacing="0" border="0" id="orm_control_statistics">
			<thead>
				<tr>
					<th><?php echo $_LANG['0b6']; ?></th>
					<td><?php echo $_SDATA['actcount']; ?></td>
				</tr>
			</thead>
			<tbody>
				<tr><th colspan="2" class="division"><?php echo $_LANG['0b7']; ?></th></tr><?php
				foreach ($_LANG['range'] as $key => $range) { ?> 
					<tr>
						<th><?php echo htmlspecialchars($range); ?></th>
						<td><?php echo (!isset($_CACHE)) ? "&ndash;" : $_XDATA['ring']['days']['hits']['total'][$key]; ?></td>
					</tr><?php
				} ?> 
			</tbody>
		</table>

		<?php if (!$_USER['level']) { ?> 
			<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Login" method="post" id="orm_control_login">
				<fieldset>
					<legend><?php echo $_LANG['0b8']; ?></legend>
					<label>
						<?php echo $_LANG['0b9']; ?>: <input type="text" size="10" name="username" />
					</label>
					<label>
						<?php echo $_LANG['0ba']; ?>: <input type="password" size="10" name="password" />
					</label>
					<input type="submit" value="<?php echo $_LANG['0b8']; ?>" />
				</fieldset>
			</form><?php
		} else { ?> 
			<div id="orm_control_logged">
				<?php printf($_LANG['0bb'], $_USER['username']); ?> 
			</div>

			<ul class="orm_control_linklist"><?php
				if ($_USER['level'] > 1) { ?> 
					<li><?php ORM_controlLink($_LANG['0bc'], "Setup", $_USER['action'] != "Setup"); ?></li>
					<li><?php ORM_controlLink($_LANG['0bd'], "Email", $_USER['action'] != "Email"); ?></li><?php
				}
				if ($_USER['level'] > 0) { ?> 
					<li><?php ORM_controlLink($_LANG['0be'], "Account&amp;id={$_USER['id']}", $_USER['action'] != "Account" || !isset($_EDIT['id']) || $_EDIT['id'] != $_USER['id']); ?></li><?php
					if ($_USER['level'] > 1) { ?> 
						<li><?php ORM_controlLink($_LANG['0bf'], "Account", $_USER['action'] != "Account" || (isset($_EDIT['id']) && $_EDIT['id'] == $_USER['id'])); ?></li><?php
					}
					if ($_SDATA['allcount']) { ?> 
						<li><?php ORM_controlLink($_LANG['0bg'], "Edit", $_USER['action'] != "Edit"); ?></li><?php
					}
				} ?> 
				<li><?php ORM_controlLink($_LANG['0bh'], "Add", $_USER['action'] != "Add"); ?></li>
				<li><a href="<?php echo $_SERVER['PHP_SELF']; ?>?Logout"><?php echo $_LANG['0bi']; ?></a></li>
			</ul><?php
		} ?> 
	</div>

	<div id="orm_content"><?php
		if ($_DDATA['online']) {

			switch ($_USER['action']) {

				/* ***** Ring Setup ***************************************** */
				case "Setup": ?> 
					<h2><?php echo $_LANG['0bj']; ?></h2>
					<?php ORM_errorSuccess(); ?>

					<h3><?php echo $_LANG['0bk']; ?></h3>
					<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Setup" method="post">
						<table cellspacing="1" border="0" class="orm_table">
							<tfoot>
								<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
								<tr>
									<th>&nbsp;</th>
									<td>
										<input type="hidden" name="action" value="Edit" />
										<input type="submit" value="<?php echo $_LANG['0by']; ?>" />
									</td>
								</tr>
							</tfoot>
							<tbody>
								<tr>
									<th><?php echo $_LANG['0bl']; ?></th>
									<td><input type="text" name="ring_name" value="<?php echo htmlspecialchars($_VDATA['name']); ?>" size="40" /></td>
								</tr>
								<tr>
									<th><?php echo $_LANG['0bm']; ?></th>
									<td><textarea rows="7" cols="30" name="ring_display_announcement"><?php echo htmlspecialchars($_VDATA['display.announcement']); ?></textarea></td>
								</tr>
								<tr>
									<th><?php echo $_LANG['0bn']; ?></th>
									<td><input type="text" name="ring_display_sitelimit" size="5" maxlength="4" value="<?php echo htmlspecialchars($_VDATA['display.sitelimit']); ?>" /></td>
								</tr>
								<tr>
									<th><?php echo $_LANG['0bo']; ?></th>
									<td><input type="text" name="ring_display_charset" value="<?php echo htmlspecialchars($_VDATA['display.charset']); ?>" /></td>
								</tr>
								<tr>
									<th><?php echo $_LANG['0bp']; ?></th>
									<td>
										<select name="ring_display_theme" size="1"><?php
											foreach ($_SDATA['themes'] as $theme) { ?> 
												<option value="<?php echo $theme; ?>"<?php
													if ($theme == $_VDATA['display.theme']) echo " selected=\"selected\"";
												?>><?php echo $theme; ?></option><?php
											} ?> 
										</select>
									</td>
								</tr>
								<tr><th colspan="2" class="orm_table_division">PHPMailer</th></tr>
								<tr>
									<th><?php echo $_LANG['0bq']; ?></th>
									<td>
										<select name="ring_mail_method" size="1" onchange="orcaAlterSMTPRow(this.value);"><?php
											foreach ($_LANG['mail.method'] as $key => $value) { ?> 
												<option value="<?php echo $key; ?>"<?php
													if ($_VDATA['mail.method'] == $key) echo " selected=\"selected\"";
												?>><?php echo htmlspecialchars($value); ?></option><?php
											} ?> 
										</select>
									</td>
								</tr>
								<tr>
									<th>SMTP</th>
									<td>
										<label><?php echo $_LANG['0br']; ?>: <input type="text" name="ring_mail_smtp_server" size="30" value="<?php echo htmlspecialchars($_VDATA['mail.smtp.server']); ?>" /></label>
										<label><?php echo $_LANG['0b9']; ?>: <input type="text" name="ring_mail_smtp_username" value="<?php echo htmlspecialchars($_VDATA['mail.smtp.username']); ?>" /></label>
										<label><?php echo $_LANG['0ba']; ?>: <input type="text" name="ring_mail_smtp_password" value="<?php echo htmlspecialchars($_VDATA['mail.smtp.password']); ?>" /></label>
									</td>
								</tr>
								<tr><th colspan="2" class="orm_table_division"><?php echo $_LANG['0b5']; ?></th></tr>
								<tr>
									<th><?php echo $_LANG['0bs']; ?></th>
									<td>
										<select name="ring_stats_type" size="1"><?php
											foreach ($_LANG['stats.type'] as $key => $value) { ?> 
												<option value="<?php echo $key; ?>"<?php
													if ($_VDATA['stats.type'] == $key) echo " selected=\"selected\"";
												?>><?php echo htmlspecialchars($value); ?></option><?php
											} ?> 
										</select>
									</td>
								</tr>
								<tr>
									<th><?php echo $_LANG['0bt']; ?></th>
									<td>
										<label><?php echo $_LANG['0bu']; ?>: <input type="text" name="ring_stats_timezone_name" size="5" maxlength="5" value="<?php echo htmlspecialchars($_VDATA['stats.timezone.name']); ?>" /></label>
										<label><?php echo $_LANG['0bv']; ?>: <input type="text" name="ring_stats_timezone_offset" size="5" maxlength="5" value="<?php echo htmlspecialchars($_VDATA['stats.timezone.offset']); ?>" /></label>
									</td>
								</tr>
								<tr>
									<th><?php echo $_LANG['0bw']; ?></th>
									<td><input type="text" name="ring_stats_toplimit" size="5" maxlength="4" value="<?php echo htmlspecialchars($_VDATA['stats.toplimit']); ?>" /></td>
								</tr><?php
								if ($_SDATA['browsers']) { ?> 
									<tr>
										<th><?php echo $_LANG['0bx']; ?></th>
										<td><input type="checkbox" name="ring_stats_colbots"<?php if ($_VDATA['stats.colbots'] == "yes") echo " checked=\"checked\""; ?> /></td>
									</tr><?php
								} ?> 
							</tbody>
						</table>
						<script type="text/javascript"><!--
							if (document.getElementsByName('ring_mail_method')[0].value != "smtp") {
								document.getElementsByName('ring_mail_smtp_server')[0].disabled = "disabled";
								document.getElementsByName('ring_mail_smtp_username')[0].disabled = "disabled";
								document.getElementsByName('ring_mail_smtp_password')[0].disabled = "disabled";
							}

							function orcaAlterSMTPRow(method) {
								document.getElementsByName('ring_mail_smtp_server')[0].disabled = (method != "smtp") ? "disabled" : "";
								document.getElementsByName('ring_mail_smtp_username')[0].disabled = (method != "smtp") ? "disabled" : "";
								document.getElementsByName('ring_mail_smtp_password')[0].disabled = (method != "smtp") ? "disabled" : "";
							}
						// --></script>
					</form>

					<?php if ($_SDATA['actcount'] > 1) { ?> 
						<h3><?php echo $_LANG['0bz']; ?></h3>
						<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Setup" method="post">
							<table cellspacing="1" border="0" class="orm_table">
								<tfoot>
									<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
									<tr>
										<th>&nbsp;</th>
										<td>
											<input type="hidden" name="action" value="Order" />
											<input type="submit" value="<?php echo $_LANG['0cb']; ?>" />
										</td>
									</tr>
								</tfoot>
								<tbody>
									<tr>
										<th><?php echo $_LANG['0c0']; ?></th>
										<td>
											<select name="order_method" size="1">
												<option value="random"><?php echo $_LANG['0c1']; ?></option>
												<option value="alpha_asc"><?php echo $_LANG['0c2']; ?></option>
												<option value="alpha_des"><?php echo $_LANG['0c3']; ?></option>
												<option value="sid_asc"><?php echo $_LANG['0c4']; ?></option>
												<option value="sid_des"><?php echo $_LANG['0c5']; ?></option>
												<option value="join_asc"><?php echo $_LANG['0c6']; ?></option>
												<option value="join_des"><?php echo $_LANG['0c7']; ?></option>
												<option value="pop_asc"><?php echo $_LANG['0c8']; ?></option>
												<option value="pop_des"><?php echo $_LANG['0c9']; ?></option>
												<option value="pop_int"><?php echo $_LANG['0ca']; ?></option>
											</select>
										</td>
									</tr>
								</tbody>
							</table>
						</form><?php
					} ?> 

					<h3><?php echo $_LANG['0cc']; ?></h3>
					<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Setup" method="post">
						<table cellspacing="1" border="0" class="orm_table">
							<tfoot>
								<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
								<tr>
									<th>&nbsp;</th>
									<td>
										<input type="hidden" name="action" value="Navbar" />
										<input type="submit" value="<?php echo $_LANG['0by']; ?>" />
									</td>
								</tr>
							</tfoot>
							<tbody>
								<tr>
									<th><?php echo $_LANG['0cd']; ?></th>
									<td>
										<label><?php echo $_LANG['0ce']; ?>: <input type="radio" name="navbar_type" value="html"<?php if ($_VDATA['navbar.type'] == "html") echo " checked=\"checked\""; ?> onfocus="orcaAlterJNBRow('html');" /></label>
										<label><?php echo $_LANG['0cf']; ?>: <input type="radio" name="navbar_type" value="script"<?php if ($_VDATA['navbar.type'] == "script") echo " checked=\"checked\""; ?> onfocus="orcaAlterJNBRow('script');" /></label>
									</td>
								</tr>
								<tr><th colspan="2" class="orm_table_division"><?php echo $_LANG['0he']; ?></th></tr>
								<tr>
									<th><?php echo $_LANG['0cg']; ?></th>
									<td>
										<?php echo ORM_navbarCodes($_VDATA['navbar.html']); ?> 
									</td>
								</tr>
								<tr>
									<td colspan="2" class="orm_table_double">
										<div>
											<?php echo $_LANG['0ch']; ?>: &nbsp;
											<button type="button" name="navbar_html_default" onclick="document.getElementsByName('navbar_html')[0].value='<?php echo ORM_html2js($_SDATA['navbar']['default']); ?>';" disabled="disabled"><?php echo $_LANG['0ci']; ?></button>
											<button type="button" name="navbar_html_minimal" onclick="document.getElementsByName('navbar_html')[0].value='<?php echo ORM_html2js($_SDATA['navbar']['minimal']); ?>';" disabled="disabled"><?php echo $_LANG['0cj']; ?></button>
											<button type="button" name="navbar_html_reset" onclick="document.getElementsByName('navbar_html')[0].value='<?php echo ORM_html2js($_VDATA['navbar.html']); ?>';" disabled="disabled"><?php echo $_LANG['0ck']; ?></button>
										</div>
										<textarea name="navbar_html" rows="15" cols="45"><?php
											echo htmlspecialchars($_VDATA['navbar.html']);
										?></textarea>
									</td>
								</tr>
								<tr><th colspan="2" class="orm_table_division"><?php echo $_LANG['0cl']; ?></th></tr>
								<tr>
									<th><?php echo $_LANG['0cg']; ?></th>
									<td><?php echo ORM_navbarCodes($_VDATA['navbar.script']); ?></td>
								</tr>
								<tr>
									<td colspan="2" class="orm_table_double">
										<textarea name="navbar_script" rows="5" cols="45"><?php
											echo htmlspecialchars($_VDATA['navbar.script']);
										?></textarea>
									</td>
								</tr>
							</tbody>
						</table>
						<script type="text/javascript"><!--
							if (document.getElementsByName('navbar_type')[0].checked)
								document.getElementsByName('navbar_script')[0].disabled = "disabled";

							document.getElementsByName('navbar_html_default')[0].disabled = "";
							document.getElementsByName('navbar_html_minimal')[0].disabled = "";
							document.getElementsByName('navbar_html_reset')[0].disabled = "";

							function orcaAlterJNBRow(method) {
								document.getElementsByName('navbar_script')[0].disabled = (method == "html") ? "disabled" : "";
							}
						// --></script>
					</form><?php
					break;

				/* ***** Email Ring Members ********************************* */
				case "Email": ?> 
					<h2><?php echo $_LANG['0cm']; ?></h2>
					<?php ORM_errorSuccess(); ?>

					<h3><?php echo $_LANG['0cn']; ?></h3>
					<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Email" method="post">
						<table cellspacing="1" border="0" class="orm_table">
							<tfoot>
								<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
								<tr>
									<th>&nbsp;</th>
									<td>
										<input type="hidden" name="action" value="Send" />
										<input type="submit" value="<?php echo $_LANG['0cx']; ?>" />
									</td>
								</tr>
							</tfoot>
							<tbody>
								<tr>
									<th><?php echo $_LANG['0co']; ?></th>
									<td>
										<select name="email_recipients" size="1" onchange="document.getElementsByName('email_accounts[]')[0].disabled=(this.value=='selected')?'':'disabled';">
											<option value="all"><?php echo $_LANG['0cp']; ?></option>
											<option value="administrators"><?php echo $_LANG['0cq']; ?></option>
											<option value="selected" selected="selected"><?php echo $_LANG['0cr']; ?></option>
										</select>
									</td>
								</tr>
								<tr>
									<th><?php echo $_LANG['0cs']; ?></th>
									<td><?php
										$optgroup = 5;
										$select = mysql_query("SELECT `id`, `username`, `level` FROM `{$_DDATA['tableuser']}` WHERE `level`>'0' ORDER BY `level` DESC, `username`;", $_DDATA['link']); ?> 
										<select name="email_accounts[]" multiple="multiple" size="7"><?php
											while ($row = mysql_fetch_assoc($select)) {
												if ($row['level'] != $optgroup) {
													if (($optgroup = (int)$row['level']) < 3) { ?> 
														</optgroup><?php
													} ?> 
													<optgroup label="<?php echo htmlspecialchars($_LANG['level'][$optgroup]); ?>"><?php
												} ?> 
												<option value="<?php echo $row['id']; ?>"><?php echo htmlspecialchars($row['username']); ?></option><?php
											} ?> 
											</optgroup>
										</select>
									</td>
								</tr>
								<tr><th colspan="2" class="orm_table_division"><?php echo $_LANG['0ct']; ?></th></tr>
								<tr>
									<th><?php echo $_LANG['0cu']; ?></th>
									<td><input type="text" name="email_subject" value="<?php printf($_LANG['0cv'] ,htmlspecialchars($_VDATA['name'])); ?>" size="40" /></td>
								</tr>
								<tr>
									<th><?php echo $_LANG['0cw']; ?></th>
									<td><textarea rows="8" cols="30" name="email_message" class="orm_textarea_nice"></textarea></td>
								</tr>
							</tbody>
						</table>
					</form>

					<?php switch ($_USER['subaction']) {
						case "View": ?> 
							<h3 id="orm_email_view"><?php echo $_LANG['0h4']; ?></h3>
							<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Email" method="post">
								<table cellspacing="1" border="0" class="orm_table">
									<tfoot>
										<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
										<tr>
											<th>&nbsp;</th>
											<td>&nbsp;<?php
												if ($_USER['level'] == 3) { ?> 
													<input type="hidden" name="message_id[]" value="<?php echo $row['id']; ?>" />
													<input type="hidden" name="action" value="Delete" />
													<input type="submit" onclick="return confirm('<?php echo addcslashes($_LANG['0h8'], "\0..\37!@\177..\377"); ?>');" value="<?php echo $_LANG['0db']; ?>" /><?php
												} ?> 
											</td>
										</tr>
									</tfoot>
									<tbody class="orm_message">
										<tr>
											<th><?php echo $_LANG['0h5']; ?></th>
											<td><?php echo date("d/m/Y", $_EDIT['date']); ?></td>
										</tr>
										<tr>
											<th><?php echo $_LANG['0h6']; ?></th>
											<td>
												<strong><?php echo htmlspecialchars($_EDIT['to']); ?></strong>:<br />
												<?php echo htmlspecialchars($_EDIT['adds']); ?> 
											</td>
										</tr>
										<tr>
											<th><?php echo $_LANG['0h7']; ?></th>
											<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?Profile&amp;id=<?php echo $_EDIT['userid']; ?>"><?php echo htmlspecialchars($_EDIT['sender']); ?></td>
										</tr>
										<tr><th colspan="2" class="orm_table_division"><?php echo htmlspecialchars($_EDIT['subject']); ?></th></tr>
										<tr>
											<td colspan="2">
												<?php echo nl2br(htmlspecialchars($_EDIT['message'])); ?> 
												<p><br />
													--<br />
													<a href="<?php echo htmlspecialchars($_SDATA['huburi']); ?>"><?php echo htmlspecialchars($_SDATA['huburi']); ?></a><br />
													<?php echo htmlspecialchars($_VDATA['name']); ?>
												</p>
											</td>
										</tr>
									</tbody>
								</table>
							</form>
							<?php break;

						default:
					}

					$select = mysql_query("
						SELECT
							`mail`.`id` as `id`,
							`user`.`username` as `sender`,
							`mail`.`date` as `date`,
							`mail`.`to` as `to`,
							`mail`.`subject` as `subject`
							FROM
								`{$_DDATA['tablemail']}` as `mail`,
								`{$_DDATA['tableuser']}` as `user`
								WHERE
									`mail`.`sentby`=`user`.`id`
									ORDER BY
										`date` DESC
					;", $_DDATA['link']);
					if (mysql_num_rows($select)) { ?> 
						<h3><?php echo $_LANG['0h9']; ?></h3>
						<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Email" method="post" id="orm_email_table" onsubmit="return ORM_verifyDelete();">
							<table cellspacing="1" border="0" class="orm_table orm_list">
								<thead>
									<tr>
										<th><?php echo $_LANG['0h5']; ?></th>
										<th><?php echo $_LANG['0ha']; ?></th>
										<th><?php echo $_LANG['0h7']; ?></th>
										<th><?php echo $_LANG['0h6']; ?></th><?php
										if ($_USER['level'] == 3) { ?> 
											<th>&nbsp;</th><?php
										} ?> 
									</tr>
								</thead>
								<tfoot>
									<tr><th colspan="<?php echo ($_USER['level'] == 3) ? 5 : 4; ?>" class="orm_table_division">&nbsp;</th></tr>
									<tr>
										<th>&nbsp;</th><?php
										if ($_USER['level'] == 3) { ?> 
											<td colspan="4" class="orm_right">
												<input type="hidden" name="action" value="Delete" />
												<input type="submit" value="<?php echo $_LANG['0hf']; ?>" />
											</td><?php
										} else { ?> 
											<td colspan="3">&nbsp;</td><?php
										} ?> 
									</tr>
								</tfoot>
								<tbody><?php
									while ($row = mysql_fetch_assoc($select)) { ?> 
										<tr>
											<th><?php echo date("d/m/Y", $row['date']); ?></th>
											<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?Email&amp;action=View&amp;message_id=<?php echo $row['id']; ?>#orm_email_view"><?php echo htmlspecialchars($row['subject']); ?></a></td>
											<td><?php echo htmlspecialchars($row['sender']); ?></td>
											<td><?php echo htmlspecialchars($row['to']); ?></td><?php
											if ($_USER['level'] == 3) { ?> 
												<td class="orm_center"><input type="checkbox" name="message_id[]" value="<?php echo $row['id']; ?>" /></td><?php
											} ?> 
										</tr><?php
									} ?> 
								</tbody>
							</table><?php
							if ($_USER['level'] == 3) { ?> 
								<script type="text/javascript"><!--
									function ORM_verifyDelete() {
										var boxen = document.getElementById('orm_email_table').getElementsByTagName('input');
										for (var x = 0, empty = true; x < boxen.length; x++)
											if (boxen[x].type == "checkbox" && boxen[x].checked) empty = false;
										if (!empty && confirm('<?php echo addcslashes($_LANG['0hb'], "\0..\37!@\177..\377"); ?>')) return true;
										return false;
									}
								// --></script><?php
							} ?> 
						</form><?php
					}
					break;

				/* ***** Edit Account Information *************************** */
				case "Account": ?> 
					<h2><?php echo $_LANG['0cy']; ?></h2>
					<?php ORM_errorSuccess(); ?>

					<?php switch ($_USER['subaction']) {
						case "Select": ?> 
							<h3><?php printf($_LANG['0cz'], htmlspecialchars($_EDIT['username'])); ?></h3>
							<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Account" method="post">
								<table cellspacing="1" border="0" class="orm_table">
									<tfoot>
										<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
										<tr>
											<th>&nbsp;</th>
											<td>
												<input type="hidden" name="user_id" value="<?php echo $_EDIT['id']; ?>" />
												<input type="hidden" name="action" value="Edit" />
												<input type="submit" value="<?php echo $_LANG['0by']; ?>" />
											</td>
										</tr>
									</tfoot>
									<tbody>
										<tr>
											<th><?php echo $_LANG['0b9']; ?></th>
											<td><?php
												if ($_USER['level'] > 1) { ?> 
													<input type="text" name="user_username" value="<?php echo htmlspecialchars($_EDIT['username']); ?>" /><?php
												} else { ?> 
													<big><strong><?php echo htmlspecialchars($_EDIT['username']); ?></strong></big>
													<input type="hidden" name="user_username" value="<?php echo htmlspecialchars($_EDIT['username']); ?>" /><?php
												} ?> 
											</td>
										</tr>
										<tr>
											<th><?php echo $_LANG['0d0']; ?></th>
											<td>
												<input type="password" name="user_password1" /><br />
												<input type="password" name="user_password2" />
											</td>
										</tr>
										<tr>
											<th><?php echo $_LANG['0d1']; ?></th>
											<td>
												<input type="text" name="user_email_new" value="<?php echo htmlspecialchars($_EDIT['email']); ?>" size="30" /><?php
												if ($_EDIT['email.new']) { ?><br />
													<?php echo $_LANG['0d2']; ?>: <strong><?php echo htmlspecialchars($_EDIT['email.new']); ?></strong><?php
												} ?> 
											</td>
										</tr>
										<tr>
											<th><?php echo ($_USER['level'] > 1) ? $_LANG['0d3'] : $_LANG['0d4']; ?></th>
											<td><textarea rows="4" cols="30" name="user_description" class="orm_textarea_nice"><?php echo htmlspecialchars($_EDIT['description']); ?></textarea></td>
										</tr>
										<tr>
											<th><?php echo $_LANG['0d5']; ?></th>
											<td><?php
												if ($_EDIT['level'] < 3 && $_USER['level'] == 3) { ?> 
													<select name="user_level" size="1" onchange="if(this.value==3)alert('<?php echo addcslashes($_LANG['0d6'], "\0..\37!@\177..\377"); ?>');"><?php
														for ($x = 1; $x < 4; $x++) { ?> 
															<option value="<?php echo $x; ?>"<?php
																if ($_EDIT['level'] == $x) echo " selected=\"selected\"";
															?>><?php echo htmlspecialchars($_LANG['level'][$x]); ?></option><?php
														} ?> 
													</select><?php
												} else { ?> 
													<big><strong><?php echo htmlspecialchars($_LANG['level'][$_EDIT['level']]); ?></strong></big><?php
												} ?> 
											</td>
										</tr>
									</tbody>
								</table>
							</form>

							<?php if ($_EDIT['level'] < 3 && ($_EDIT['id'] == $_USER['id'] || $_USER['level'] == 3 || ($_USER['level'] == 2 && $_EDIT['level'] == 1))) { ?> 
								<h3><?php printf($_LANG['0d7'], htmlspecialchars($_EDIT['username'])); ?></h3>
								<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Account" method="post">
									<table cellspacing="1" border="0" class="orm_table">
										<tfoot>
											<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
											<tr>
												<th>&nbsp;</th>
												<td>
													<span class="orm_warning"><?php echo $_LANG['0da']; ?></span> &nbsp;
													<input type="hidden" name="user_id" value="<?php echo $_EDIT['id']; ?>" />
													<input type="hidden" name="action" value="Delete" />
													<input type="submit" value="<?php echo $_LANG['0db']; ?>" />
												</td>
											</tr>
										</tfoot>
										<tbody><?php
											if ($_USER['level'] > 1 && $_EDIT['id'] != $_USER['id']) { ?> 
												<tr>
													<th><?php echo $_LANG['0d8']; ?></th>
													<td><input type="text" name="delete_reason" value="" size="50" /></td>
												</tr><?php
											} ?> 
											<tr>
												<th><?php echo $_LANG['0d9']; ?></th>
												<td>
													<input type="checkbox" name="delete_check1" value="check1" />
													<input type="checkbox" name="delete_check2" value="check2" />
													<input type="checkbox" name="delete_check3" value="check3" />
												</td>
											</tr>
										</tbody>
									</table>
								</form><?php
							}

							if ($_USER['level'] > 1) { ?> 
								<hr /><?php
							}
							break;
					} ?> 

					<?php if ($_USER['level'] > 1) { ?> 
						<h3><?php echo $_LANG['0dc']; ?></h3>
						<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Account" method="post">
							<input type="hidden" name="action" value="Select" /><?php

							// Filters
							$filter = "";
							if ($_USER['filters']->accoFilter[0])
								$filter .= " AND `user`.`username` LIKE '%".addslashes($_USER['filters']->accoFilter[0])."%'";

							if (strlen($_USER['filters']->accoFilter[1]))
								$filter .= " AND `user`.`level`='{$_USER['filters']->accoFilter[1]}'";

							// Ordering
							$order = " ORDER BY ";
							foreach ($_USER['filters']->accoOrder as $value)
								if ($value[0] == "sites") {
									$order .= " `sites` ".(($value[1]) ? "" : "DESC").", ";
								} else $order .= " `user`.`{$value[0]}` ".(($value[1]) ? "DESC" : "").", ";
							$order = preg_replace("/, $/", "", $order);

							// SQL Deep Magic
							$select = mysql_query("
								SELECT
									`user`.`id` as `id`,
									`user`.`email` as `email`,
									`user`.`username` as `username`,
									`user`.`level` as `level`,
									COUNT(`site`.`owner`) as `sites`
									FROM
										`{$_DDATA['tableuser']}` as `user`
										LEFT JOIN	`{$_DDATA['tablesite']}` as `site`
										ON `user`.`id`=`site`.`owner` 
										WHERE
											1=1
											$filter
											GROUP BY
												`user`.`id`
												$order
							;", $_DDATA['link']); ?> 
							<table cellspacing="1" border="0" class="orm_table orm_list">
								<thead>
									<tr>
										<th><?php
											if ($_SDATA['usrcount'] > 1) { ?> 
												<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Account&amp;sort=id"<?php
													if ($_USER['filters']->accoOrder[0][0] == "id") echo " class=\"orm_table_sorter\"";
												?>><?php echo $_LANG['0dk']; ?></a><?php
											} else echo $_LANG['0dk']; ?> 
										</th>
										<th style="width:99%;"><?php
											if ($_SDATA['usrcount'] > 1) { ?> 
												<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Account&amp;sort=username"<?php
													if ($_USER['filters']->accoOrder[0][0] == "username") echo " class=\"orm_table_sorter\"";
												?>><?php echo $_LANG['0b9']; ?></a><?php
											} else echo $_LANG['0b9']; ?> 
										</th>
										<th><?php
											if ($_SDATA['usrcount'] > 1) { ?> 
												<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Account&amp;sort=level"<?php
													if ($_USER['filters']->accoOrder[0][0] == "level") echo " class=\"orm_table_sorter\"";
												?>><?php echo $_LANG['0d5']; ?></a><?php
											} else echo $_LANG['0d5']; ?> 
										</th>
										<th><?php
											if ($_SDATA['usrcount'] > 1) { ?> 
												<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Account&amp;sort=sites"<?php
													if ($_USER['filters']->accoOrder[0][0] == "sites") echo " class=\"orm_table_sorter\"";
												?>><?php echo $_LANG['0dd']; ?></a><?php
											} else echo $_LANG['0dd']; ?> 
										</th>
										<th><?php echo $_LANG['0de']; ?></th>
									</tr><?php
									if ($_SDATA['usrcount'] > 1) { ?> 
										<tr class="orm_table_filters">
											<th></th>
											<th>
												<input type="text" name="Filter_username" class="orm_expand" size="15" value="<?php echo htmlspecialchars($_USER['filters']->accoFilter[0]); ?>" />
											</th>
											<th>
												<select name="Filter_level" size="1">
													<option value=""><?php echo $_LANG['0df']; ?></option><?php
													foreach ($_LANG['level'] as $key => $value) {
														if ($key) { ?> 
															<option value="<?php echo $key; ?>"<?php
																if ($_USER['filters']->accoFilter[1] === (string)$key) echo " selected=\"selected\"";
															?>><?php echo $value; ?></option><?php
														}
													} ?> 
												</select>
											</th>
											<th></th>
											<th><input type="submit" name="Filter" value="<?php echo $_LANG['0dg']; ?>" /></th>
										</tr><?php
									} ?> 
								</thead>
								<tbody><?php
									if (mysql_num_rows($select)) {
										while ($row = mysql_fetch_assoc($select)) { ?> 
											<tr>
												<th><?php echo $row['id']; ?></th>
												<td><?php echo htmlspecialchars($row['username']); ?></td>
												<td><?php echo htmlspecialchars($_LANG['level'][$row['level']]); ?></td>
												<td><?php echo $row['sites']; ?></td>
												<td><?php
													if ($_USER['level'] > $row['level'] || $_USER['username'] == $row['username']) { ?> 
														<input type="submit" name="Edit_<?php echo $row['id']; ?>" value="<?php echo $_LANG['0de']; ?>" /><?php
													} ?> 
												</td>
											</tr><?php
										}
									} else { ?> 
										<tr><td colspan="5"><strong><?php echo $_LANG['0dh']; ?></strong></td></tr><?php
									} ?> 
								</tbody>
							</table>
						</form><?php
					}
					break;

				/* ***** Edit a Site **************************************** */
				case "Edit": ?> 
					<h2><?php echo $_LANG['0di']; ?></h2>
					<?php ORM_errorSuccess(); ?>

					<?php switch ($_USER['subaction']) {
						case "Select": ?> 
							<h3><?php printf($_LANG['0dj'], htmlspecialchars($_EDIT['title'])); ?></h3>
							<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Edit" method="post">
								<table cellspacing="1" border="0" class="orm_table">
									<tfoot>
										<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
										<tr>
											<th>&nbsp;</th>
											<td>
												<input type="hidden" name="site_id" value="<?php echo $_EDIT['id']; ?>" />
												<input type="hidden" name="action" value="Edit" />
												<input type="submit" value="<?php echo $_LANG['0by']; ?>" />
											</td>
										</tr>
									</tfoot>
									<tbody>
										<tr>
											<th><?php echo $_LANG['0dk']; ?></th>
											<td><big><strong><?php echo $_EDIT['id']; ?></strong></big></td>
										</tr>
										<tr>
											<th><?php echo $_LANG['0dl']; ?></th>
											<td><?php
												$select = mysql_query("SELECT `id`, `username` FROM `{$_DDATA['tableuser']}` ORDER BY `username`;", $_DDATA['link']);
												if (($_USER['level'] > 1 || $_USER['id'] == $_EDIT['id']) && mysql_num_rows($select) > 1) { ?> 
													<select name="site_owner" size="1"><?php
														while ($row = mysql_fetch_assoc($select)) { ?> 
															<option value="<?php echo $row['id']; ?>"<?php
																if ($_EDIT['owner'] == $row['id']) echo " selected=\"selected\"";
															?>><?php echo htmlspecialchars($row['username']); ?></option><?php
														} ?> 
													</select><?php
												} else { ?> 
													<big><strong><?php echo $_EDIT['username']; ?></big></strong><?php
												} ?> 
											</td>
										</tr>
										<tr>
											<th><?php echo $_LANG['0dm']; ?></th>
											<td><?php
												if ($_USER['level'] <= 1) {
													if ($_EDIT['status'] == "hibernating" || $_EDIT['status'] == "active") { ?> 
														<label><?php echo $_LANG['status']['active']; ?>: <input type="radio" name="site_status" value="active"<?php if ($_EDIT['status'] == "active") echo " checked=\"checked\""; ?> /></label>
														<label><?php echo $_LANG['status']['hibernating']; ?>: <input type="radio" name="site_status" value="hibernating"<?php if ($_EDIT['status'] == "hibernating") echo " checked=\"checked\""; ?> /></label><?php
													} else echo $_LANG['status'][$_EDIT['status']];
												} else { ?> 
													<select name="site_status" size="1"><?php
														foreach ($_LANG['status'] as $key => $value) {
															if ($key != "inactive" || $_EDIT['status'] == "inactive") { ?> 
																<option value="<?php echo $key; ?>"<?php
																	if ($_EDIT['status'] == $key) echo " selected=\"selected\"";
																?>><?php echo $value; ?></option><?php
															}
														} ?> 
													</select><?php
												} ?> 
											</td>
										</tr><?php
										if ($_USER['level'] > 1 || $_EDIT['owner'] == $_USER['id']) { ?> 
											<tr>
												<th><?php echo $_LANG['0dn']; ?></th>
												<td><input type="checkbox" name="site_lookahead"<?php if ($_EDIT['lookahead'] == "yes") echo " checked=\"checked\""; ?> /></td>
											</tr><?php
										} ?> 
										<tr>
											<th><?php echo $_LANG['0do']; ?></th>
											<td><input type="text" name="site_uri" value="<?php echo htmlspecialchars($_EDIT['uri']); ?>" size="50" /></td>
										</tr>
										<tr>
											<th><?php echo $_LANG['0dp']; ?></th>
											<td><input type="text" name="site_title" value="<?php echo htmlspecialchars($_EDIT['title']); ?>" size="50" /></td>
										</tr>
										<tr>
											<th><?php echo $_LANG['0d3']; ?></th>
											<td><textarea rows="4" cols="30" name="site_description" class="orm_textarea_nice"><?php echo htmlspecialchars($_EDIT['description']); ?></textarea></td>
										</tr>
									</tbody>
								</table>
							</form>

							<h3><?php echo $_LANG['0dq']; ?></h3>
							<div class="orm_code_server">
								<div><?php
									echo htmlspecialchars(ORM_navbarCodes(($_VDATA['navbar.type'] == "script") ? "<script type=\"text/javascript\" src=\"__hubURI__?Nav&amp;__id__\"></script>\n<noscript>{$_VDATA['navbar.script']}</noscript>" : $_VDATA['navbar.html'], $_EDIT['id']));
								?></div>
							</div>

							<h3><?php printf($_LANG['0dr'], htmlspecialchars($_EDIT['title'])); ?></h3>
							<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Edit" method="post">
								<table cellspacing="1" border="0" class="orm_table">
									<tfoot>
										<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
										<tr>
											<th>&nbsp;</th>
											<td>
												<span class="orm_warning"><?php echo $_LANG['0da']; ?></span> &nbsp;
												<input type="hidden" name="site_id" value="<?php echo $_EDIT['id']; ?>" />
												<input type="hidden" name="action" value="Delete" />
												<input type="submit" value="<?php echo $_LANG['0db']; ?>" />
											</td>
										</tr>
									</tfoot>
									<tbody><?php
										if ($_USER['level'] > 1 && $_EDIT['owner'] != $_USER['id']) { ?> 
											<tr>
												<th><?php echo $_LANG['0d8']; ?></th>
												<td><input type="text" name="delete_reason" value="" size="50" /></td>
											</tr><?php
										} ?> 
										<tr>
											<th><?php echo $_LANG['0d9']; ?></th>
											<td>
												<input type="checkbox" name="delete_check1" value="check1" />
												<input type="checkbox" name="delete_check2" value="check2" />
												<input type="checkbox" name="delete_check3" value="check3" />
											</td>
										</tr>
									</tbody>
								</table>
							</form>

							<hr /><?php
							break;
					} ?> 

					<h3><?php echo ($_USER['level'] > 1) ? $_LANG['0ds'] : $_LANG['0dt']; ?></h3>
					<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Edit" method="post">
						<input type="hidden" name="action" value="Select" /><?php

						// Filters
						$filter = "";
						if ($_USER['filters']->siteFilter[0])
							$filter .= " AND `site`.`title` LIKE '%".addslashes($_USER['filters']->siteFilter[0])."%'";

						if ($_USER['level'] > 1) {
							if ($_USER['filters']->siteFilter[1])
								$filter .= " AND `user`.`username`='{$_USER['filters']->siteFilter[1]}'";
						} else $filter .= " AND `site`.`owner`='{$_USER['id']}'";

						if ($_USER['filters']->siteFilter[2])
							$filter .= " AND `site`.`status`='{$_USER['filters']->siteFilter[2]}' ";

						// Ordering
						$order = " ORDER BY ";
						foreach ($_USER['filters']->siteOrder as $value)
							if ($value[0] != "errors") $order .= " `site`.`{$value[0]}` ".(($value[1]) ? "DESC" : "").", ";
						$order = preg_replace("/, $/", "", $order);

						// SQL Deep Magic
						$select = mysql_query("
							SELECT
								`site`.`id` as `id`,
								`site`.`owner` as `owner`,
								`site`.`uri` as `uri`,
								`site`.`title` as `title`,
								`site`.`status` as `status`,
								`user`.`username` as `username`,
								`user`.`level` as `level`
								FROM
									`{$_DDATA['tableuser']}` as `user`,
									`{$_DDATA['tablesite']}` as `site`
									WHERE
										`site`.`owner`=`user`.`id`
										$filter
										GROUP BY
											`site`.`id`
											$order
						;", $_DDATA['link']); ?> 
						<table cellspacing="1" border="0" class="orm_table orm_list">
							<thead>
								<tr>
									<th><?php
										if ($_SDATA['allcount'] > 1) { ?> 
											<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Edit&amp;sort=id"<?php
												if ($_USER['filters']->siteOrder[0][0] == "id") echo " class=\"orm_table_sorter\"";
											?>><?php echo $_LANG['0dk']; ?></a><?php
										} else echo $_LANG['0dk']; ?> 
									</th>
									<th><?php
										if ($_SDATA['allcount'] > 1) { ?> 
											<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Edit&amp;sort=title"<?php
												if ($_USER['filters']->siteOrder[0][0] == "title") echo " class=\"orm_table_sorter\"";
											?>><?php echo $_LANG['0dp'], " / ", $_LANG['0do']; ?></a><?php
										} else echo $_LANG['0dp'], " / ", $_LANG['0do']; ?> 
									</th><?php
									if ($_USER['level'] > 1) { ?> 
										<th><?php
											if ($_SDATA['allcount'] > 1) { ?> 
												<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Edit&amp;sort=owner"<?php
													if ($_USER['filters']->siteOrder[0][0] == "owner") echo " class=\"orm_table_sorter\"";
												?>><?php echo $_LANG['0dl']; ?></a><?php
											} else echo $_LANG['0dl']; ?> 
										</th><?php
									} ?> 
									<th><?php echo $_LANG['0dm']; ?></th>
									<th title="<?php echo $_LANG['0h1']; ?>"><?php
										if ($_SDATA['allcount'] > 1) { ?> 
											<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Edit&amp;sort=errors"<?php
												if ($_USER['filters']->siteOrder[0][0] == "errors") echo " class=\"orm_table_sorter\"";
											?>><?php echo $_LANG['0h0']; ?></a><?php
										} else echo $_LANG['0h0']; ?> 
									</th>
									<th><?php echo $_LANG['0de']; ?></th>
								</tr><?php
								if ($_SDATA['allcount'] > 1) { ?> 
									<tr class="orm_table_filters">
										<th></th>
										<th>
											<input type="text" name="Filter_title" class="orm_expand" size="40" value="<?php echo htmlspecialchars($_USER['filters']->siteFilter[0]); ?>" />
										</th><?php
										if ($_USER['level'] > 1) {
											$users = mysql_query("SELECT `username` FROM `{$_DDATA['tableuser']}` WHERE `level`>0 ORDER BY `username`;", $_DDATA['link']); ?> 
											<th>
												<select name="Filter_owner" size="1">
													<option value=""><?php echo $_LANG['0df']; ?></option><?php
													while ($row = mysql_fetch_assoc($users)) { ?> 
														<option value="<?php echo htmlspecialchars($row['username']); ?>"<?php
															if ($row['username'] == $_USER['filters']->siteFilter[1]) echo " selected=\"selected\"";
														?>><?php echo htmlspecialchars($row['username']); ?></option><?php
													} ?> 
												</select>
											</th><?php
										} ?> 
										<th>
											<select name="Filter_status" size="1">
												<option value=""><?php echo $_LANG['0df']; ?></option><?php
												foreach ($_LANG['status'] as $key => $value) { ?> 
													<option value="<?php echo $key; ?>"<?php
														if ($_USER['filters']->siteFilter[2] == $key) echo " selected=\"selected\"";
													?>><?php echo $value; ?></option><?php
												} ?> 
											</select>
										</th>
										<th></th>
										<th><input type="submit" name="Filter" value="<?php echo $_LANG['0dg']; ?>" /></th>
									</tr><?php
								} ?> 
							</thead>
							<tbody><?php
								if (mysql_num_rows($select)) {
									$rows = array();
									while ($row = mysql_fetch_assoc($select)) {
										$row['errors'] = (isset($_XDATA['site'][$row['id']])) ? $_XDATA['site'][$row['id']]['days']['errr'][3] : 0;
										$rows[] = $row;
									}
									if ($_USER['filters']->siteOrder[0][0] == "errors")
										usort($rows, create_function('$a, $b', 'if ($a["errors"] == $b["errors"]) return 0; return ($a["errors"] > $b["errors"]) ? '.(($_USER['filters']->siteOrder[0][1]) ? "1 : -1" : "-1 : 1").';'));

									foreach ($rows as $row) { ?> 
										<tr>
											<th><?php echo $row['id']; ?></th>
											<td><a href="<?php echo htmlspecialchars($row['uri']); ?>"><?php echo htmlspecialchars($row['title']); ?></a></td><?php
											if ($_USER['level'] > 1) { ?> 
												<td><?php echo htmlspecialchars($row['username']); ?></td><?php
											} ?> 
											<td><?php echo $_LANG['status'][$row['status']]; ?></td>
											<td class="orm_right"><?php echo $row['errors']; ?></td>
											<td><?php
												if ($_USER['level'] > $row['level'] || $_USER['username'] == $row['username']) { ?> 
													<input type="submit" name="Edit_<?php echo $row['id']; ?>" value="<?php echo $_LANG['0de']; ?>" /><?php
												} ?> 
											</td>
										</tr><?php
									}
								} else { ?> 
									<tr><td colspan="<?php echo ($_USER['level'] > 1) ? 6 : 5; ?>"><strong><?php echo $_LANG['0du']; ?></td></tr><?php
								} ?> 
							</tbody>
						</table>
					</form><?php
					break;

				/* ***** Add Site ******************************************* */
				case "Add": ?> 
					<h2><?php echo $_LANG['0dv']; ?></h2>
					<?php ORM_errorSuccess(); ?>

					<h3><?php echo $_LANG['0dw']; ?></h3>
					<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Add" method="post">
						<table cellspacing="1" border="0" class="orm_table">
							<tfoot>
								<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
								<tr>
									<th>&nbsp;</th>
									<td><input type="submit" value="<?php echo $_LANG['0by']; ?>" /></td>
								</tr>
							</tfoot>
							<tbody><?php
								if ($_USER['level'] > 1) { ?> 
									<tr>
										<th><?php echo $_LANG['0dl']; ?></th>
										<td><?php
											$select = mysql_query("SELECT `id`, `username` FROM `{$_DDATA['tableuser']}` ORDER BY `username`;", $_DDATA['link']);
											if (mysql_num_rows($select) > 1) { ?> 
												<select name="site_owner" size="1"><?php
													while ($row = mysql_fetch_assoc($select)) { ?> 
														<option value="<?php echo $row['id']; ?>"<?php
															if ($_USER['id'] == $row['id']) echo " selected=\"selected\"";
														?>><?php echo htmlspecialchars($row['username']); ?></option><?php
													} ?> 
												</select><?php
											} else echo $_USER['username']; ?> 
										</td>
									</tr><?php
								} ?> 
								<tr>
									<th><?php echo $_LANG['0do']; ?></th>
									<td><input type="text" name="site_uri" value="<?php
										echo (isset($_POST['site_uri'])) ? htmlspecialchars($_POST['site_uri']) : "http://";
									?>" size="50" /></td>
								</tr><?php
								if (!$_SDATA['allowfopen']) { ?> 
									<tr>
										<th><?php echo $_LANG['0dp']; ?></th>
										<td><input type="text" name="site_title" value="<?php
											if (isset($_POST['site_title'])) echo htmlspecialchars($_POST['site_title']);
										?>" size="50" /></td>
									</tr><?php
								} ?> 
								<tr>
									<th><?php echo $_LANG['0d3']; ?></th>
									<td><textarea rows="4" cols="30" name="site_description" class="orm_textarea_nice"><?php
										if (isset($_POST['site_description'])) echo htmlspecialchars($_POST['site_description']);
									?></textarea></td>
								</tr>
							</tbody>
						</table>
					</form>
					<?php break;

				/* ***** Join Ring ****************************************** */
				case "Join": ?> 
					<h2><?php echo $_LANG['0dx']; ?></h2>
					<?php ORM_errorSuccess(); ?>

					<h3><?php echo $_LANG['0dy']; ?></h3>
					<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Join" method="post">
						<table cellspacing="1" border="0" class="orm_table">
							<tfoot>
								<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
								<tr>
									<th>&nbsp;</th>
									<td><input type="submit" value="<?php echo $_LANG['0by']; ?>" /></td>
								</tr>
							</tfoot>
							<tbody>
								<tr>
									<th><?php echo $_LANG['0b9']; ?></th>
									<td><input type="text" name="user_username"<?php
										if (isset($_POST['user_username'])) echo " value=\"".htmlspecialchars($_POST['user_username'])."\"";
									?> /></td>
								</tr>
								<tr>
									<th><?php echo $_LANG['0ba']; ?></th>
									<td>
										<input type="password" name="user_password1" /><br />
										<input type="password" name="user_password2" />
									</td>
								</tr>
								<tr>
									<th><?php echo $_LANG['0d1']; ?></th>
									<td><input type="text" name="user_email_new" size="30"<?php
										if (isset($_POST['user_email_new'])) echo " value=\"".htmlspecialchars($_POST['user_email_new'])."\"";
									?> /></td>
								</tr>
								<tr>
									<th><?php echo $_LANG['0d4']; ?></th>
									<td><textarea rows="4" cols="30" name="user_description" class="orm_textarea_nice"><?php
										if (isset($_POST['user_description'])) echo htmlspecialchars($_POST['user_description']);
									?></textarea></td>
								</tr>
								<tr><th colspan="2" class="orm_table_division"><?php echo $_LANG['0dz']; ?></th></tr>
								<tr>
									<th><?php echo $_LANG['0do']; ?></th>
									<td><input type="text" name="site_uri" value="<?php
										echo (isset($_POST['site_uri'])) ? htmlspecialchars($_POST['site_uri']) : "http://";
									?>" size="50" /></td>
								</tr><?php
								if (!$_SDATA['allowfopen']) { ?> 
									<tr>
										<th><?php echo $_LANG['0dp']; ?></th>
										<td><input type="text" name="site_title" size="50"<?php
											if (isset($_POST['site_title'])) echo " value=\"".htmlspecialchars($_POST['site_title'])."\"";
										?> /></td>
									</tr><?php
								} ?> 
								<tr>
									<th><?php echo $_LANG['0d3']; ?></th>
									<td><textarea rows="4" cols="30" name="site_description" class="orm_textarea_nice"><?php
										if (isset($_POST['site_description'])) echo htmlspecialchars($_POST['site_description']);
									?></textarea></td>
								</tr><?php
								if ($_SDATA['captcha']) {
									for ($i = 0, $captcha = ""; $i < 5; $i++) $captcha .= chr(rand(97, 122));
									do {
										$code = mt_rand(10000, 99999);
										$select = mysql_query("SELECT `code` FROM `{$_DDATA['tableauth']}` WHERE `code`='$code';", $_DDATA['link']);
									} while (mysql_num_rows($select));
									$insert = mysql_query("INSERT INTO `{$_DDATA['tableauth']}` VALUES ('$captcha', '$code', UNIX_TIMESTAMP());", $_DDATA['link']); ?> 
									<tr><th colspan="2" class="orm_table_division">&nbsp;</th></tr>
									<tr>
										<th>CAPTCHA</th>
										<td>
											<img src="/<?php echo $_SDATA['directory']; ?>/captcha.php?code=<?php echo $code; ?>" alt="" /><br />
											<input type="text" name="auth_captcha" size="10" />
										</td>
									</tr><?php
								} ?> 
							</tbody>
						</table>
					</form>
					<?php break;

				/* ***** Display Help Text ********************************** */
				case "Help": ?> 
					<h2><?php echo $_LANG['0e0']; ?></h2>
					<?php ORM_errorSuccess(); ?>

					<?php readfile("{$_SERVER['DOCUMENT_ROOT']}/{$_SDATA['directory']}/help.html");
					break;

				/* ***** Display Statistics ********************************* */
				case "Stats": ?> 
					<h2><?php echo $_LANG['0b5']; ?></h2>
					<?php ORM_errorSuccess(); ?>

					<?php if ($_SDATA['actcount']) {
						$_XDATA['idok'] = (isset($_GET['id']) && $_GET['id'] && in_array($_GET['id'], $_CACHE->ids)) ? true : false;
						if ($_XDATA['idok']) {
							$_XDATA['this'] = $_GET['id'];
							$_XDATA['resource'] = mysql_query("SELECT `date`, `uri` FROM `{$_DDATA['tablesite']}` WHERE `id`='{$_XDATA['this']}' LIMIT 1;", $_DDATA['link']);
						} else $_XDATA['this'] = 0;

						if ($_XDATA['idok']) { ?> 
							<table cellspacing="1" border="0" class="orm_table orm_data" id="orm_data_member">
								<thead>
									<tr>
										<th colspan="4" class="orm_data_title">
											<a href="<?php echo htmlspecialchars(mysql_result($_XDATA['resource'], 0, "uri")); ?>"><?php echo htmlspecialchars($_CACHE->site[$_XDATA['this']]['title']); ?></a><br />
											<small><?php printf($_LANG['0e1'], date("F j, Y", mysql_result($_XDATA['resource'], 0, "date"))); ?></small>
										</th>
									</tr>
									<tr>
										<th colspan="2"><?php echo $_LANG['range'][3]; ?></th>
										<th><?php echo $_LANG['range'][14]; ?></th>
										<th><?php echo $_LANG['range'][56]; ?></th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<th><strong><?php echo $_LANG['0b7']; ?></strong> / <?php echo $_LANG['0e2']; ?></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><strong><?php echo $_XDATA['site'][$_XDATA['this']]['days']['hits']['total'][$key]; ?></strong> / <?php echo $_XDATA['ring']['days']['hits']['total'][$key]; ?></td><?php
										} ?> 
									</tr>
									<tr class="orm_drow">
										<th class="orm_indent"><?php echo $_LANG['0e3']; ?></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><?php ($_XDATA['ring']['days']['hits']['total'][$key]) ? printf("%1.1f", 100 * $_XDATA['site'][$_XDATA['this']]['days']['hits']['total'][$key] / $_XDATA['ring']['days']['hits']['total'][$key]) : print("0.0"); ?>%</td><?php
										} ?> 
									</tr>
									<tr>
										<th class="orm_indent"><strong><?php echo $_LANG['00m']; ?></strong></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><strong><?php echo $_XDATA['site'][$_XDATA['this']]['days']['hits']['prev'][$key]; ?></strong> / <?php echo $_XDATA['ring']['days']['hits']['prev'][$key]; ?></td><?php
										} ?> 
									</tr>
									<tr class="orm_drow">
										<th class="orm_indent"><strong><?php echo $_LANG['00q']; ?></strong></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><strong><?php echo $_XDATA['site'][$_XDATA['this']]['days']['hits']['next'][$key]; ?></strong> / <?php echo $_XDATA['ring']['days']['hits']['next'][$key]; ?></td><?php
										} ?> 
									</tr>
									<tr>
										<th class="orm_indent"><strong><?php echo $_LANG['00p']; ?></strong></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><strong><?php echo $_XDATA['site'][$_XDATA['this']]['days']['hits']['rand'][$key]; ?></strong> / <?php echo $_XDATA['ring']['days']['hits']['rand'][$key]; ?></td><?php
										} ?> 
									</tr>
									<tr class="orm_drow">
										<th class="orm_indent"><strong><?php echo $_LANG['0e4']; ?></strong></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><strong><?php echo $_XDATA['site'][$_XDATA['this']]['days']['hits']['site'][$key]; ?></strong> / <?php echo $_XDATA['ring']['days']['hits']['site'][$key]; ?></td><?php
										} ?> 
									</tr>

									<tr><th colspan="4" class="orm_table_division">&nbsp;</td></tr>
									<tr>
										<th><strong><?php echo $_LANG['0e5']; ?></strong> / <?php echo $_LANG['0e2']; ?></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><strong><?php echo $_XDATA['site'][$_XDATA['this']]['days']['clks']['total'][$key]; ?></strong> / <?php echo $_XDATA['ring']['days']['clks']['total'][$key]; ?></td><?php
										} ?> 
									</tr>
									<tr class="orm_drow">
										<th class="orm_indent"><?php echo $_LANG['0e3']; ?></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><?php ($_XDATA['ring']['days']['clks']['total'][$key]) ? printf("%1.1f", 100 * $_XDATA['site'][$_XDATA['this']]['days']['clks']['total'][$key] / $_XDATA['ring']['days']['clks']['total'][$key]) : print("0.0"); ?>%</td><?php
										} ?> 
									</tr>
									<tr>
										<th class="orm_indent"><strong><?php echo $_LANG['00m']; ?></strong></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><strong><?php echo $_XDATA['site'][$_XDATA['this']]['days']['clks']['prev'][$key]; ?></strong> / <?php echo $_XDATA['ring']['days']['clks']['prev'][$key]; ?></td><?php
										} ?> 
									</tr>
									<tr class="orm_drow">
										<th class="orm_indent"><strong><?php echo $_LANG['00q']; ?></strong></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><strong><?php echo $_XDATA['site'][$_XDATA['this']]['days']['clks']['next'][$key]; ?></strong> / <?php echo $_XDATA['ring']['days']['clks']['next'][$key]; ?></td><?php
										} ?> 
									</tr>
									<tr>
										<th class="orm_indent"><strong><?php echo $_LANG['00p']; ?></strong></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><strong><?php echo $_XDATA['site'][$_XDATA['this']]['days']['clks']['rand'][$key]; ?></strong> / <?php echo $_XDATA['ring']['days']['clks']['rand'][$key]; ?></td><?php
										} ?> 
									</tr>

									<tr><th colspan="4" class="orm_table_division">&nbsp;</td></tr>
									<tr>
										<th><strong><?php echo $_LANG['0h0']; ?></strong> / <?php echo $_LANG['0e2']; ?></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><strong><?php echo $_XDATA['site'][$_XDATA['this']]['days']['errr'][$key]; ?></strong> / <?php echo $_XDATA['ring']['days']['errr'][$key]; ?></td><?php
										} ?> 
									</tr>
									<tr class="orm_drow">
										<th class="orm_indent"><?php echo $_LANG['0e3']; ?></th><?php
										foreach ($_LANG['range'] as $key => $range) { ?> 
											<td><?php ($_XDATA['ring']['days']['errr'][$key]) ? printf("%1.2f", 100 * $_XDATA['site'][$_XDATA['this']]['days']['errr'][$key] / $_XDATA['ring']['days']['errr'][$key]) : print("0.00"); ?></td><?php
										} ?> 
									</tr>
								</tbody>
							</table>
						<?php } ?> 

						<script type="text/javascript"><!--<?php
							if ($_XDATA['idok'] && $_SDATA['actcount'] > 1) { ?> 
								var curr = "<?php echo $_XDATA['this']; ?>";
								var aids = [<?php echo implode($_CACHE->ids, ','); ?>];
								var labe = document.createElement('label');
										labe.appendChild(document.createTextNode('<?php echo $_LANG['0eg']; ?>: '));
									var sele = document.createElement('select');
											sele.size = "1";
											sele.onchange = function(e) { window.location.href = '<?php echo $_SERVER['PHP_SELF']; ?>?Stats&id=' + this.value; }
										for (var x = 0; x < aids.length; x++) {
											var opti = document.createElement('option');
													opti.value = aids[x];
													opti.appendChild(document.createTextNode(opti.value));
												sele.appendChild(opti);
										} sele.value = curr;
										labe.appendChild(sele);
								var head = document.getElementById('orm_data_member').getElementsByTagName('th')[0];
								head.insertBefore(labe, head.firstChild);<?php
							} ?> 

							function sprintf(num, decimalNum, bolLeadingZero, bolParens) {
								var tmpNum = num;
								tmpNum *= Math.pow(10, decimalNum);
								tmpNum = Math.round(tmpNum);
								tmpNum /= Math.pow(10, decimalNum);
								var tmpStr = new String(tmpNum);
								if (!bolLeadingZero && num < 1 && num > -1 && num !=0)
									tmpStr = (num > 0) ? tmpStr.substring(1, tmpStr.length) : "-" + tmpStr.substring(2, tmpStr.length);
								if (bolParens && num < 0) tmpStr = "(" + tmpStr.substring(1, tmpStr.length) + ")";
								return tmpStr;
							}
							function orcaGraph(id, rec, gen, k, title, digits) {
								this.id = id;
								this.limit = rec.length;
								this.arr = new Array();
								this.arr['hits'] = rec;
								this.arr['clks'] = gen;
								this.max = new Array();
								this.max['hits'] = 0;
								this.max['clks'] = 0;
								for (var x = 0; x < rec.length; x++) {
									this.max['hits'] = Math.max(this.max['hits'], rec[x]);
									this.max['clks'] = Math.max(this.max['clks'], gen[x]);
								}
								this.maximum = Math.max(this.max['hits'], this.max['clks']);
								this.k = k;
								this.title = title;
								this.digits = digits;
							}
							var orcaDataGraphs = new Array();
							var orcaDay = ["<?php echo implode($_LANG['days'], '","'); ?>"];
							var orcaDataGraphsType = "hits";

							<?php if ($_XDATA['idok']) { ?> 
								orcaDataGraphs[orcaDataGraphs.length] = new orcaGraph("site", [<?php
									echo implode(array_reverse($_CACHE->site[$_XDATA['this']]['days']->hits['total']), ',');
								?>], [<?php
									echo implode(array_reverse($_CACHE->site[$_XDATA['this']]['days']->clks['total']), ',');
								?>], 0, "orcaDataGraphs[x].arr[orcaDataGraphsType][k]", 0);<?php
							} ?> 

							orcaDataGraphs[orcaDataGraphs.length] = new orcaGraph("ring", [<?php
								echo implode(array_reverse($_CACHE->ring['days']->hits['total']), ',');
							?>], [<?php
								echo implode(array_reverse($_CACHE->ring['days']->clks['total']), ',');
							?>], 0, "orcaDataGraphs[x].arr[orcaDataGraphsType][k]", 0);

							orcaDataGraphs[orcaDataGraphs.length] = new orcaGraph("day", [<?php
								echo implode(array_reverse($_XDATA['ring']['days']['avg']['hits']), ',');
							?>], [<?php
								echo implode(array_reverse($_XDATA['ring']['days']['avg']['clks']), ',');
							?>], <?php echo gmdate("w", $_CACHE->now); ?> + 1, "orcaDay[(j > 6) ? 0 : j] + \": \" + sprintf(orcaDataGraphs[x].arr[orcaDataGraphsType][k], orcaDataGraphs[x].digits, false, false)", 1);

							orcaDataGraphs[orcaDataGraphs.length] = new orcaGraph("hour", [<?php
								echo implode(array_reverse($_XDATA['ring']['hours']['avg']['hits']), ',');
							?>], [<?php
								echo implode(array_reverse($_XDATA['ring']['hours']['avg']['clks']), ',');
							?>], <?php echo gmdate("G", $_CACHE->now); ?> + 1, "j + \":00 - \" + sprintf(orcaDataGraphs[x].arr[orcaDataGraphsType][k], orcaDataGraphs[x].digits, false, false)", 1);

							function orcaDataGraphsSwitch() {
								document.getElementById("orm_data_graphs_title").firstChild.nodeValue = (orcaDataGraphsType == "clks") ? "<?php echo $_LANG['0eb']; ?>" : "<?php echo $_LANG['0ec']; ?>";
								document.getElementById("orm_data_graphs_switcher").value = (orcaDataGraphsType == "clks") ? "<?php echo $_LANG['0e5']; ?>" : "<?php echo $_LANG['0b7']; ?>";
								orcaDataGraphsType = (orcaDataGraphsType == "clks") ? "hits" : "clks";

								for (var x = 0; x < orcaDataGraphs.length; x++) {
									var orcaDataGraphsBars = document.getElementById("orca_" + orcaDataGraphs[x].id).tBodies[0].rows[0].getElementsByTagName('div');
									for (var j = 0; j < orcaDataGraphs[x].limit; j++) {
										var k = j - orcaDataGraphs[x].k;
										if (k < 0) k += orcaDataGraphs[x].limit;
										orcaDataGraphsBars[j].style.height = ((orcaDataGraphs[x].maximum) ? Math.max(0, parseInt(orcaDataGraphs[x].arr[orcaDataGraphsType][k] * 100 / orcaDataGraphs[x].maximum)) : 0) + "px";
										if (isIEQuirks) orcaDataGraphsBars[j].style.visibility = (orcaDataGraphsBars[j].style.height == "0px") ? "hidden" : "visible";
										orcaDataGraphsBars[j].className = (orcaDataGraphs[x].max[orcaDataGraphsType] && (orcaDataGraphs[x].arr[orcaDataGraphsType][k] == orcaDataGraphs[x].max[orcaDataGraphsType])) ? "orm_graphs_max" : "";
										eval("orcaDataGraphsBars[j].title = " + orcaDataGraphs[x].title + ";");
									}
								}
							}
						// --></script>

						<table cellspacing="1" border="0" class="orm_table orm_data" id="orm_data_graphs">
							<thead>
								<tr>
									<th class="orm_data_title">
										<span id="orm_data_graphs_title"><?php echo $_LANG['0eb']; ?></span>
									</th>
								</tr>
							</thead>
							<tbody><?php
								if ($_XDATA['idok']) {
									$_GRAPH = array();
									$_GRAPH['now'] = gmdate("w", $_CACHE->now);
									$_GRAPH['hits'] = $_CACHE->site[$_XDATA['this']]['days']->hits['total'];
									$_GRAPH['hmax'] = max($_GRAPH['hits']);
									$_GRAPH['max'] = max($_GRAPH['hmax'], max($_CACHE->site[$_XDATA['this']]['days']->clks['total']));
									$_GRAPH['scale'] = ($_GRAPH['max']) ? 100 / $_GRAPH['max'] : -1; ?> 
									<tr>
										<td>
											<h4><?php echo htmlspecialchars($_CACHE->site[$_XDATA['this']]['title']); ?></h4>
											<table cellspacing="0" border="0" class="orm_graph" id="orca_site">
												<tfoot>
													<tr>
														<td></td>
														<td colspan="28" class="orm_left"><?php echo $_LANG['0e6']; ?></td>
														<td colspan="28" class="orm_right"><?php echo $_LANG['0e7'], " (", $_LANG['days'][gmdate("w", time() + $_VDATA['stats.timezone.offset'] * 3600)], ")"; ?></td>
													</tr>
												</tfoot>
												<tbody class="orm_graph_fiftysix">
													<tr>
														<th><?php echo $_GRAPH['max']; ?></th><?php
														for ($j = 55; $j >= 0; $j--) {
															$k = $j - $_GRAPH['now'];
															if ($k >= 56) { $k -= 56; } else if ($k < 0) $k += 56; ?> 
															<td rowspan="2"<?php
																if (!($k % 7) && $j != 55) echo ' class="orm_division"';
																?>><div<?php
																	if ($_GRAPH['hmax'] && $_GRAPH['hits'][$j] == $_GRAPH['hmax']) echo ' class="orm_graphs_max"';
																	?> style="height:<?php
																		echo max(0, (int)($_GRAPH['hits'][$j] * $_GRAPH['scale']));
																	?>px;" title="<?php
																		echo $_GRAPH['hits'][$j];
															?>"></div></td><?php
														} ?> 
													</tr>
													<tr><th class="orm_graph_zero">0</th></tr>
												</tbody>
											</table>
										</td>
									</tr><?php
								}

								$_GRAPH = array();
								$_GRAPH['now'] = gmdate("w", $_CACHE->now);
								$_GRAPH['hits'] = $_CACHE->ring['days']->hits['total'];
								$_GRAPH['hmax'] = max($_GRAPH['hits']);
								$_GRAPH['max'] = max($_GRAPH['hmax'], max($_CACHE->ring['days']->clks['total']));
								$_GRAPH['scale'] = ($_GRAPH['max']) ? 100 / $_GRAPH['max'] : -1; ?> 
								<tr>
									<td>
										<h4><?php echo $_LANG['0hc']; ?></h4>
										<table cellspacing="0" border="0" class="orm_graph" id="orca_ring">
											<tfoot>
												<tr>
													<td></td>
													<td colspan="28" class="orm_left"><?php echo $_LANG['0e6']; ?></td>
													<td colspan="28" class="orm_right"><?php echo $_LANG['0e7'], " (", $_LANG['days'][gmdate("w", time() + $_VDATA['stats.timezone.offset'] * 3600)], ")"; ?></td>
												</tr>
											</tfoot>
											<tbody class="orm_graph_fiftysix">
												<tr>
													<th><?php echo $_GRAPH['max']; ?></th><?php
													for ($j = 55; $j >= 0; $j--) {
														$k = $j - $_GRAPH['now'];
														if ($k >= 56) { $k -= 56; } else if ($k < 0) $k += 56; ?> 
														<td rowspan="2"<?php
															if (!($k % 7) && $j != 55) echo ' class="orm_division"';
															?>><div<?php
																if ($_GRAPH['hmax'] && $_GRAPH['hits'][$j] == $_GRAPH['hmax']) echo ' class="orm_graphs_max"';
																?> style="height:<?php
																	echo max(0, (int)($_GRAPH['hits'][$j] * $_GRAPH['scale']));
																?>px;" title="<?php
																	echo $_GRAPH['hits'][$j];
														?>"></div></td><?php
													} ?> 
												</tr>
												<tr><th class="orm_graph_zero">0</th></tr>
											</tbody>
										</table>
									</td>
								</tr><?php

								$_GRAPH = array();
								$_GRAPH['now'] = gmdate("w", $_CACHE->now) + 1;
								$_GRAPH['hits'] = $_XDATA['ring']['days']['avg']['hits'];
								$_GRAPH['hmax'] = max($_GRAPH['hits']);
								$_GRAPH['max'] = max($_GRAPH['hmax'], max($_XDATA['ring']['days']['avg']['clks']));
								$_GRAPH['scale'] = ($_GRAPH['max']) ? 100 / $_GRAPH['max'] : -1; ?> 
								<tr>
									<td>
										<h4><?php echo $_LANG['0e8']; ?></h4>
										<table cellspacing="0" border="0" class="orm_graph" id="orca_day">
											<tfoot>
												<tr>
													<td></td>
													<td colspan="3" class="orm_left"><?php echo $_LANG['00c']; ?></td>
													<td colspan="4" class="orm_right"><?php echo $_LANG['00i']; ?></td>
												</tr>
											</tfoot>
											<tbody class="orm_graph_seven">
												<tr>
													<th><?php printf("%01.1f", $_GRAPH['max']); ?></th><?php
													for ($j = 6, $day = 0; $j >= 0; $j--, $day++) {
														$k = $j + $_GRAPH['now'];
														if ($k >= 7) { $k -= 7; } else if ($k < 0) $k += 7; ?> 
														<td rowspan="2"<?php
															?>><div<?php
																if ($_GRAPH['hmax'] && $_GRAPH['hits'][$k] == $_GRAPH['hmax']) echo ' class="orm_graphs_max"';
																?> style="height:<?php
																	echo max(0, (int)($_GRAPH['hits'][$k] * $_GRAPH['scale']));
																?>px;" title="<?php
																	printf("%s: %01.1f", $_LANG['days'][$day], $_GRAPH['hits'][$k]);
														?>"></div></td><?php
													} ?> 
												</tr>
												<tr><th class="orm_graph_zero">0</th></tr>
											</tbody>
										</table>
									</td>
								</tr><?php

								$_GRAPH = array();
								$_GRAPH['now'] = gmdate("G", $_CACHE->now) + 1;
								$_GRAPH['hits'] = $_XDATA['ring']['hours']['avg']['hits'];
								$_GRAPH['hmax'] = max($_GRAPH['hits']);
								$_GRAPH['max'] = max($_GRAPH['hmax'], max($_XDATA['ring']['hours']['avg']['clks']));
								$_GRAPH['scale'] = ($_GRAPH['max']) ? 100 / $_GRAPH['max'] : -1; ?> 
								<tr>
									<td>
										<h4><?php printf($_LANG['0e9'], $_VDATA['stats.timezone.name']); ?></h4>
										<table cellspacing="0" border="0" class="orm_graph" id="orca_hour">
											<tfoot>
												<tr>
													<td></td>
													<td colspan="6" class="orm_left">0:00</td>
													<td colspan="6" class="orm_right">12:00</td>
													<td colspan="6" class="orm_left">&nbsp;<?php echo $_LANG['0ea']; ?></td>
													<td colspan="6" class="orm_right">23:59</td>
												</tr>
											</tfoot>
											<tbody class="orm_graph_twentyfour">
												<tr>
													<th><?php printf("%01.1f", $_GRAPH['max']); ?></th><?php
													for ($j = 23; $j >= 0; $j--) {
														$k = $j + $_GRAPH['now'];
														if ($k >= 24) { $k -= 24; } else if ($k < 0) $k += 24; ?> 
														<td rowspan="2"<?php
															if (!(($j + 1) % 3) && $j != 23) echo ' class="orm_division"';
															?>><div<?php
																if ($_GRAPH['hmax'] && $_GRAPH['hits'][$k] == $_GRAPH['hmax']) echo ' class="orm_graphs_max"';
																?> style="height:<?php
																	echo max(0, (int)($_GRAPH['hits'][$k] * $_GRAPH['scale']));
																?>px;" title="<?php
																	printf((23 - $j).":00 - %01.1f", $_GRAPH['hits'][$k]);
														?>"></div></td><?php
													} ?> 
												</tr>
												<tr><th class="orm_graph_zero">0</th></tr>
											</tbody>
										</table>
									</td>
								</tr>
							</tbody>
						</table>
						<script type="text/javascript"><!--
							var isIEQuirks = false;
							/*@cc_on
							@if (1)
								if (document.compatMode == "BackCompat") {
									isIEquirks = true;
									for (var x = 0; x < orcaDataGraphs.length; x++) {
										var orcaDataGraphsBars = document.getElementById("orca_" + orcaDataGraphs[x].id).tBodies[0].rows[0].getElementsByTagName('div');
										for (var j = 0; j < orcaDataGraphs[x].limit; j++)
											if (orcaDataGraphsBars[j].style.height == "0px") orcaDataGraphsBars[j].style.visibility = "hidden";
									}
								}
							@end @*/

							var labe = document.createElement('label');
								var inpu = document.createElement('input');
										inpu.type = "button";
										inpu.id = "orm_data_graphs_switcher";
										inpu.value = "<?php echo $_LANG['0e5']; ?>";
										inpu.onclick = orcaDataGraphsSwitch;
									labe.appendChild(inpu);
							var head = document.getElementById('orm_data_graphs').tHead.getElementsByTagName('th')[0];
							head.insertBefore(labe, head.firstChild);
						// --></script>

						<?php if ($_SDATA['actcount'] > 1) { ?> 
							<script type="text/javascript"><!--
								var orcaDataToplistType = true;
								var orcaDataToplistSelectedColumn = 56;

								<?php $depart = 0; reset($_XDATA['site']);
								if ($_XDATA['idok']) $_CACHE->site[$_XDATA['this']]['title'] = " ".$_CACHE->site[$_XDATA['this']]['title']; ?> 
								var orcaDataToplist = [<?php while (list($key, $value) = each($_XDATA['site'])) echo (($depart++) ? "," : "")."\n[$key,'".addslashes($_CACHE->site[$key]['title'])."',{$value['days']['hits']['total'][3]},{$value['days']['hits']['total'][14]},{$value['days']['hits']['total'][56]},{$value['days']['clks']['total'][3]},{$value['days']['clks']['total'][14]},{$value['days']['clks']['total'][56]}]"; ?>];

								function orcaDataToplistSwitch() {
									document.getElementById("orm_data_toplist_title").firstChild.nodeValue = (!orcaDataToplistType) ? "<?php printf($_LANG['0ed'], $_VDATA['stats.toplimit']); ?>" : "<?php printf($_LANG['0ee'], $_VDATA['stats.toplimit']); ?>";
									document.getElementById("orm_data_toplist_switcher").value = (!orcaDataToplistType) ? "<?php echo $_LANG['0e5']; ?>" : "<?php echo $_LANG['0b7']; ?>";
									orcaDataToplistType = !orcaDataToplistType;
									orcaDataToplistSort(orcaDataToplistSelectedColumn, true);
								}

								function orcaDataToplistSort(column, force) {
									if (orcaDataToplistSelectedColumn != column || force) {
										document.getElementById("orm_data_sort" + orcaDataToplistSelectedColumn).className = "";
										document.getElementById("orm_data_sort" + column).className = "orm_data_sortcol";

										var x = (orcaDataToplistType) ? 1 : 4;
										if (column == 56) {
											var sorton = 3 + x;
										} else if (column == 14) {
											var sorton = 2 + x;
										} else var sorton = 1 + x;
										orcaDataToplist.sort(new Function("a, b", "return b[" + sorton + "] - a[" + sorton + "];"));

										var y = (orcaDataToplist.length > <?php echo $_VDATA['stats.toplimit']; ?>) ? <?php echo $_VDATA['stats.toplimit']; ?> : orcaDataToplist.length;
										for (var j = 0; j < y; j++) {
											var a1 = document.createElement('a');
													a1.href = "<?php echo $_SERVER['PHP_SELF']; ?>?Stats&id=" + orcaDataToplist[j][0];
												var img = document.createElement('img');
														img.src = "/<?php echo $_SDATA['directory']; ?>/themes/<?php echo $_VDATA['display.theme']; ?>/stats.png";
														img.alt = "<?php echo $_LANG['0b5']; ?>";
													a1.appendChild(img);
											var a2 = document.createElement('a');
													a2.href = "<?php echo $_SERVER['PHP_SELF']; ?>?Go&Site&" + orcaDataToplist[j][0];
												if (orcaDataToplist[j][1].indexOf(" ") === 0) {
													var stro = document.createElement('strong');
															stro.appendChild(document.createTextNode(orcaDataToplist[j][1].substr(1)));
														a2.appendChild(stro);
												} else a2.appendChild(document.createTextNode(orcaDataToplist[j][1]));

											for (var k = 0; k < 4; k++)
												while (document.getElementById("orm_data_toplist").rows[j + 2].cells[k].childNodes.length)
													document.getElementById("orm_data_toplist").rows[j + 2].cells[k].removeChild(document.getElementById("orm_data_toplist").rows[j + 2].cells[k].firstChild);

											document.getElementById("orm_data_toplist").rows[j + 2].cells[0].appendChild(a1);
											document.getElementById("orm_data_toplist").rows[j + 2].cells[0].appendChild(document.createTextNode(" "));
											document.getElementById("orm_data_toplist").rows[j + 2].cells[0].appendChild(a2);

											for (var k = 1; k < 4; k++)
												document.getElementById("orm_data_toplist").rows[j + 2].cells[k].appendChild(document.createTextNode(orcaDataToplist[j][k + x]));

										} orcaDataToplistSelectedColumn = column;
									}
								}
							// --></script>

							<?php uasort($_XDATA['site'], create_function('$a, $b', 'if ($a["days"]["hits"]["total"][56] == $b["days"]["hits"]["total"][56]) return 0; return ($a["days"]["hits"]["total"][56] > $b["days"]["hits"]["total"][56]) ? -1 : 1;')); ?> 
							<table cellspacing="1" border="0" class="orm_table orm_data" id="orm_data_toplist">
								<thead>
									<tr>
										<th colspan="4" class="orm_data_title">
											<span id="orm_data_toplist_title"><?php printf($_LANG['0ed'], $_VDATA['stats.toplimit']); ?></span>
										</th>
									</tr>
									<tr class="orm_data_sort">
										<th class="orm_data_sort_labels"><?php echo $_LANG['0ef']; ?></th><?php
											foreach ($_LANG['range'] as $key => $range) { ?> 
												<th id="orm_data_sort<?php echo $key; ?>" onclick="return orcaDataToplistSort(<?php echo $key; ?>, false);"<?php if ($key == 56) echo " class=\"orm_data_sortcol\""; ?>><?php echo htmlspecialchars($range); ?></th><?php
											} ?> 
									</tr>
								</thead>
								<tbody>
									<?php $total = 0; reset($_XDATA['site']);
									while (list($key, $value) = each($_XDATA['site'])) {
										if ($total < $_VDATA['stats.toplimit']) { ?> 
											<tr<?php if ($total++ % 2) echo " class=\"orm_drow\""; ?>>
												<th>
													<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Stats&amp;id=<?php echo $key; ?>"><img src="/<?php echo $_SDATA['directory']; ?>/themes/<?php echo $_VDATA['display.theme']; ?>/stats.png" alt="<?php echo $_LANG['0b5']; ?>" /></a>
													<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Go&amp;Site&amp;<?php echo $key; ?>"><?php
														echo ($key == $_XDATA['this']) ? "<strong>{$_CACHE->site[$key]['title']}</strong>" : $_CACHE->site[$key]['title'];
													?></a>
												</th><?php
													foreach ($_LANG['range'] as $key => $range) { ?> 
														<td><?php echo $value['days']['hits']['total'][$key]; ?></td><?php
													} ?> 
											</tr>
										<?php }
									} ?> 
								</tbody>
							</table>
							<script type="text/javascript"><!--
								var labe = document.createElement('label');
									var inpu = document.createElement('input');
											inpu.type = "button";
											inpu.id = "orm_data_toplist_switcher";
											inpu.value = "<?php echo $_LANG['0e5']; ?>";
											inpu.onclick = orcaDataToplistSwitch;
										labe.appendChild(inpu);
								var head = document.getElementById('orm_data_toplist').tHead.getElementsByTagName('th')[0];
								head.insertBefore(labe, head.firstChild);
							// --></script><?php
						}

						if (count($_CACHE->ring['browsers'])) {
							if ($_VDATA['stats.colbots'] == "yes") {
								$collHits = array(1 => 0, 2 => 0);
								foreach ($_CACHE->ring['browsers'] as $browser => $value) {
									if ($value[1]) {
										$collHits[(int)$value[1]] += $value[2];
										unset($_CACHE->ring['browsers'][$browser]);
									}
								}
								$_CACHE->ring['browsers'][$_LANG['0ez']] = array("", 1, $collHits[1]);
								$_CACHE->ring['browsers'][$_LANG['0hg']] = array("", 2, $collHits[2]);
							}
							uasort($_CACHE->ring['browsers'], create_function('$a, $b', 'if ($a[2] == $b[2]) return 0; return ($a[2] > $b[2]) ? -1 : 1;'));

							reset($_CACHE->ring['browsers']);
							list($key, $value) = each($_CACHE->ring['browsers']);
							if ($value[1]) { ?> 
								<table cellspacing="1" border="0" class="orm_table orm_data">
									<thead>
										<tr>
											<th colspan="2" class="orm_data_title"><?php echo $_LANG['0eh']; ?></th>
										</tr>
									</thead>
									<tbody><?php
										$bkg = 0; reset($_CACHE->ring['browsers']);
										while (list($key, $value) = each($_CACHE->ring['browsers'])) {
											if ($value[2]) { ?> 
												<tr<?php if ($bkg++ % 2) echo " class=\"orm_drow\""; ?>>
													<th><?php echo $key; ?></th>
													<td><?php echo $value[2]; ?></td>
												</tr><?php
											}
										} ?> 
									</tbody>
								</table><?php
							}
						}

						if ($_VDATA['stats.type'] != "none") {
							$now = time() - $_VDATA['stats.date'];
							$hours = floor($now / 3600);
								$now %= 3600;
							$minutes = floor($now / 60);
							$seconds = $now % 60; ?> 
							<table cellspacing="1" border="0" class="orm_table orm_data">
								<thead>
									<tr>
										<th class="orm_data_title"><?php echo $_LANG['0ei']; ?></th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td>
											<?php echo $_LANG['0ej']; ?>: &nbsp;
											<strong id="orm_cache_time_hours" title="<?php echo $_LANG['0ek']; ?>"><?php printf("%02s", $hours); ?></strong>:<strong
															id="orm_cache_time_minutes" title="<?php echo $_LANG['0el']; ?>"><?php printf("%02s", $minutes); ?></strong>:<strong
															id="orm_cache_time_seconds" title="<?php echo $_LANG['0em']; ?>"><?php printf("%02s", $seconds); ?></strong>

											<script type="text/javascript"><!--
												var orcaCacheTime = ["<?php echo $hours; ?>", "<?php echo $minutes; ?>", "<?php echo $seconds; ?>"];
												var orcaCacheTimeUnits = ["hours", "minutes", "seconds"];
												function orcaCacheTimeIncrement() {
													if (++orcaCacheTime[2] > 59) {
														orcaCacheTime[2] = 0;
														orcaCacheTime[1]++;
													}
													if (orcaCacheTime[1] > 59) {
														orcaCacheTime[1] = 0;
														orcaCacheTime[0]++;
													}
													for (var x = 0; x < orcaCacheTimeUnits.length; x++)
														document.getElementById('orm_cache_time_' + orcaCacheTimeUnits[x]).firstChild.nodeValue = ((orcaCacheTime[x] < 10) ? "0" : "") + orcaCacheTime[x];
												}
												setInterval("orcaCacheTimeIncrement();", 1000);
											// --></script>
										</td>
									</tr>
								</tbody>
							</table>
						<?php }

					} else echo $_LANG['0en'];
					break;

				/* ***** Display a Profile ********************************** */
				case "Profile": ?> 
					<h2><?php echo $_LANG['0eo']; ?></h2>
					<?php ORM_errorSuccess(); ?>

					<h3><?php printf($_LANG['0ep'], htmlspecialchars($_PROFILE['username'])); ?></h3>
					<dl>
						<dt><?php echo $_LANG['0eq']; ?></dt><dd><?php echo date("F j, Y", $_PROFILE['date']); ?></dd>
						<dt><?php echo $_LANG['0d5']; ?></dt><dd><?php echo $_LANG['level'][$_PROFILE['level']]; ?></dd>
						<dt><?php echo $_LANG['0er']; ?></dt><dd><?php echo htmlspecialchars($_PROFILE['description']); ?></dd>
					</dl>

					<?php if ($_USER['level'] > 0 && $_USER['id'] == $_PROFILE['id']) { ?> 
						<form action="<?php echo $_SERVER['PHP_SELF']; ?>?Account" method="post">
							<input type="hidden" name="action" value="Select" />
							<input type="submit" name="Edit_<?php echo $_PROFILE['id']; ?>" value="<?php echo $_LANG['0es']; ?>" /></td>
						</form><?php
					} ?> 

					<h3><?php printf($_LANG['0et'], htmlspecialchars($_PROFILE['username'])); ?></h3>
					<?php $select = mysql_query("SELECT `id`, `uri`, `title`, `description`, `date` FROM `{$_DDATA['tablesite']}` WHERE `owner`='{$_PROFILE['id']}' AND `status`='active' ORDER BY `order`;", $_DDATA['link']);

					if (mysql_num_rows($select)) { ?> 
						<ul class="orm_listing"><?php
							while ($row = mysql_fetch_assoc($select)) { ?> 
								<li>
									<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Stats&amp;id=<?php echo $row['id']; ?>" class="orm_statlink"><img src="/<?php echo $_SDATA['directory']; ?>/themes/<?php echo $_VDATA['display.theme']; ?>/stats.png" alt="<?php echo $_LANG['0b5']; ?>" /></a>
									<h3><a href="<?php echo $_SERVER['PHP_SELF']; ?>?Go&amp;Site&amp;<?php echo $row['id']; ?>" title="<?php echo htmlspecialchars($row['uri']); ?>"><?php echo htmlspecialchars($row['title']); ?></a></h3><?php
									if ($row['description'] = trim($row['description'])) { ?> 
										<p><?php echo htmlspecialchars($row['description']); ?></p><?php
									} ?> 
									<div><?php printf($_LANG['0e1'], date("F j, Y", $row['date'])); ?></div>
								</li><?php
							} ?> 
						</ul><?php

					} else echo $_LANG['0eu'];
					break;

				/* ***** Display the Welcome Page *************************** */
				case "Welcome":
					$select = mysql_query("SELECT `id`, `title`, `uri` FROM `{$_DDATA['tablesite']}` WHERE `owner`='{$_USER['id']}' ORDER BY `date`;", $_DDATA['link']);
					if (mysql_num_rows($select)) {
						$_USER['owned'] = mysql_fetch_assoc($select); ?>
						<h2><?php printf($_LANG['0ev'], htmlspecialchars($_VDATA['name'])); ?></h2>
						<?php ORM_errorSuccess(); ?>

						<p>
							<?php printf($_LANG['0ew'], "<a href=\"".htmlspecialchars($_USER['owned']['uri'])."\">".htmlspecialchars($_USER['owned']['title'])."</a>", $_USER['owned']['id']); ?> 
						</p>
						<p>
							<?php echo $_LANG['0ex']; ?> 
						</p>

						<h3><?php echo $_LANG['0dq']; ?></h3>
						<div class="orm_code_server">
							<div><?php
								echo htmlspecialchars(ORM_navbarCodes(($_VDATA['navbar.type'] == "script") ? "<script type=\"text/javascript\" src=\"__hubURI__?Nav&amp;__id__\"></script>\n<noscript>{$_VDATA['navbar.script']}</noscript>" : $_VDATA['navbar.html'], $_USER['owned']['id']));
							?></div>
						</div><?php
					}
					break;

				/* ***** Display a Blank Page ******************************* */
				case "Blank":
					ORM_errorSuccess();
					break;

				/* ***** Display the Ring Hub ******************************* */
				default: ?> 
					<h2><?php echo htmlspecialchars($_VDATA['name']); ?></h2>
					<?php ORM_errorSuccess(); ?>

					<?php $select = mysql_query("SELECT `id`, `username` FROM `{$_DDATA['tableuser']}`;", $_DDATA['link']);
					while ($row = mysql_fetch_assoc($select)) $_OWNERS[$row['id']] = $row['username'];

					$_GET['start'] = (isset($_GET['start'])) ? min($_SDATA['actcount'] - 1, max(0, (int)$_GET['start'])) : mt_rand(0, $_SDATA['actcount'] - 1);

					$query = "
						SELECT
							`site`.`id` as `id`,
							`site`.`owner` as `owner`,
							`site`.`uri` as `uri`,
							`site`.`title` as `title`,
							`site`.`description` as `description`,
							`site`.`date` as `date`,
							`user`.`username` as `username`
							FROM
								`{$_DDATA['tablesite']}` as `site`,
								`{$_DDATA['tableuser']}` as `user`
								WHERE
									`site`.`owner`=`user`.`id`
									AND `site`.`status`='active'
									ORDER BY
										`site`.`order`
										LIMIT ";

					$select = mysql_query($query."{$_GET['start']}, {$_VDATA['display.sitelimit']};", $_DDATA['link']);
					if (mysql_num_rows($select)) {
						$_SITES = array();
						while ($row = mysql_fetch_assoc($select)) $_SITES[] = $row;
						if (count($_SITES) < $_VDATA['display.sitelimit'] && $_SDATA['actcount'] > count($_SITES)) {
							$select = mysql_query($query."0, ".($_VDATA['display.sitelimit'] - count($_SITES)).";", $_DDATA['link']);
							$_SITES[] = false;
							while ($row = mysql_fetch_assoc($select)) {
								if ($row['id'] == $_SITES[0]['id']) break;
								$_SITES[] = $row;
							}
						} ?> 

						<ul class="orm_listing"><?php
							foreach ($_SITES as $site) {
								if (is_array($site)) { ?> 
									<li>
										<a href="<?php echo $_SERVER['PHP_SELF']; ?>?Stats&amp;id=<?php echo $site['id']; ?>" class="orm_statlink"><img src="/<?php echo $_SDATA['directory']; ?>/themes/<?php echo $_VDATA['display.theme']; ?>/stats.png" alt="<?php echo $_LANG['0b5']; ?>" /></a>
										<h3><a href="<?php echo $_SERVER['PHP_SELF']; ?>?Go&amp;Site&amp;<?php echo $site['id']; ?>" title="<?php echo htmlspecialchars($site['uri']); ?>"><?php echo htmlspecialchars($site['title']); ?></a></h3><?php
										if ($site['description'] = trim($site['description'])) { ?> 
											<p><?php echo htmlspecialchars($site['description']); ?></p><?php
										} ?> 
										<div><?php printf($_LANG['0ey'], "<a href=\"{$_SERVER['PHP_SELF']}?Profile&amp;id={$site['owner']}\">".htmlspecialchars($site['username'])."</a>"); ?></div>
									</li><?php
								} else { ?> 
									</ul><hr /><ul class="orm_listing"><?php
								}
							} ?> 
						</ul><?php

						if ($_SDATA['actcount'] > $_VDATA['display.sitelimit']) { ?> 
							<table id="orm_pagination">
								<tr>
									<td><?php
										$pstart = $_GET['start'] - $_VDATA['display.sitelimit'];
										if ($pstart < 0) $pstart += $_SDATA['actcount']; ?> 
										<a href="<?php echo $_SERVER['PHP_SELF']."?start=$pstart"; ?>">&lt;&lt; <?php echo $_LANG['00m']; ?></a>
									</td>
									<td><?php
										for ($x = 0; $x < ceil($_SDATA['actcount'] / $_VDATA['display.sitelimit']); $x++) {
											if ($x * $_VDATA['display.sitelimit'] == $_GET['start']) { ?> 
												<strong><?php echo ($x + 1); ?></strong><?php
											} else { ?> 
												<a href="<?php echo $_SERVER['PHP_SELF']."?start=".($x * $_VDATA['display.sitelimit']); ?>"><?php echo ($x + 1); ?></a><?php
											}
										} ?> 
									</td>
									<td><?php
										$nstart = $_GET['start'] + $_VDATA['display.sitelimit'];
										if ($nstart >= $_SDATA['actcount']) $nstart -= $_SDATA['actcount']; ?> 
										<a href="<?php echo $_SERVER['PHP_SELF']."?start=$nstart"; ?>"><?php echo $_LANG['00q']; ?> &gt;&gt;</a>
									</td>
								</tr>
							</table>
						<?php }

					} else echo $_LANG['0du'];
					break;

			}
		} else { ?> 
			<h2>Database Error</h2><?php
			ORM_errorSuccess();
		} ?> 
	</div>

	<div style="text-align:center;font:italic 10px Arial,sans-serif;clear:right;padding-top:10px;">
		<hr style="width:60%;margin:0px auto 2px auto;" />
		An <a href="http://www.greywyvern.com/" title="GreyWyvern.com">Orca</a> Script
	</div>

</div>
Return current item: Orca Ringmaker