$iUser = htmlspecialchars_adv($_GET['iUser']);
}
if (isset($_POST['check']) && is_array($_POST['check'])) {
    foreach ($_POST['check'] as $iKey => $iVal) {
        switch (true) {
            case isset($_POST['Delete']):
                deleteItem((int) $iVal);
                break;
            case isset($_POST['Approve']):
                approveItem((int) $iVal);
                break;
        }
    }
}
TopCodeAdmin();
ContentBlockHead("Profile media");
echo getPostModMediaPage($sType, $sStatus, $iUser);
ContentBlockFoot();
BottomCode();
function getPostModMediaPage($sType = 'photo', $sStatus = 'passive', $iUser = 0)
{
    global $dir;
    global $site, $max_thumb_width, $max_thumb_height, $max_photo_width, $max_photo_height;
    $ret = '';
    $aFiles = getUnapprovedFilesArray($sType, $sStatus, $iUser);
    $style = '
		float:left;
		margin:5px 11px;
		padding:5px;
		border:1px solid silver;
		text-align:center;
			<td align="right">
				<input name="s_nickname" type="submit" value="Search by Nickname" />
			</td>
		    <td align="center">
				<input name="s_mail" type="submit" value="Search by Email" />
			</td>
		    <td align="left">
				<input name="s_id" type="submit" value="Search by ID" />
			</td>
		</tr>
	</table>
</form>

<?php 
ContentBlockFoot();
ContentBlockHead("Profiles");
?>


<center>
	<?php 
echo ResNavigationRet('ProfilesUpper', 0);
?>
</center>

<form action="profiles.php<?php 
echo substr(get_vars(), 0, strlen($get_vars) - 1);
?>
" method="post" name="prf_form">
	<table cellspacing="1" cellpadding="0" class="small1" style="border: none; background-color: #eee; width: 590px; text-align: center;">
	
        $action_result .= "News deleting failed";
    }
}
$_page['header'] = "News";
$_page['header_text'] = "News compose";
TopCodeAdmin();
ContentBlockHead("News");
if (strlen($action_result)) {
    echo "<br><center><div class=\"err\">{$action_result}</div></center><br>\n";
}
MemberPrintNews();
if ((int) $_GET['edit_id'] != 0) {
    $news_arr = db_arr("SELECT `ID`, DATE_FORMAT(`Date`, '{$short_date_format}' ) AS 'Date', `Header`, `Snippet`, `Text` FROM `News` WHERE `ID` = " . (int) $_GET['edit_id']);
}
ContentBlockFoot();
ContentBlockHead("News compose");
?>

<form method="post" action="news.php">

<table style="border:1px solid gray;background-color:#EEEEEE;margin:0px auto;">
	<tr>
		<td style="text-align:right;font-weight:bold;padding:3px;">Header:</td>
		<td style="padding:3px;">
			<input name="header" style="width:380px;" value="<?php 
echo htmlspecialchars($news_arr['Header']);
?>
">
		</td>
	</tr>
	<div id="helpTypeId" style="position: relative; margin: 2px; padding: 1px; white-space: nowrap;">CONTENT</div>
	<div id="helpDescId" style="position: relative; margin: 2px; padding: 1px;">CONTENT</div>
	<div id="helpNoteId" style="position: relative; margin: 2px; padding: 1px; text-align: justify;">CONTENT</div>
</div>

<?php 
$helpDivCode = ob_get_contents();
ob_end_clean();
/*
if ( $logged['admin'] )
	TopCodeAdmin( $helpDivCode );
else
	TopCodeAff( $helpDivCode );
*/
TopCodeAdmin($helpDivCode);
ContentBlockHead("Finance " . $sHead);
if (strlen($tr['error_text'])) {
    echo "<br><center><div class=\"err\">{$tr['error_text']}</div></center><br>";
}
?>
<br>
<center>

<script type="text/javascript">
<!--
	function updateControls()
	{
		document.forms['calculations_form'].elements['tr_order_num'].disabled = !(document.getElementById('id_order').checked);
		document.forms['calculations_form'].elements['tr_last_days'].disabled = !(document.getElementById('id_last').checked);
		document.forms['calculations_form'].elements['tr_exact_date'].disabled = !(document.getElementById('id_date').checked);
		document.getElementById('exact_choose').disabled = !(document.getElementById('id_date').checked);
echo $enable_recurring ? 'checked="checked"' : '';
?>
 />
			</td>
		</tr>
		<tr>
			<td align="center" colspan="2"><input type="submit" class="no" name="settings_save" value="Save" style="width: 60px;" /></td>
		</tr>
	</table>
</div>
</form>
</center>

<?php 
ContentBlockFoot();
ContentBlockHead("Manage payment providers");
if (strlen($status_text)) {
    echo "\r\n<center>\r\n\t<div class=\"err\">{$status_text}</div>\r\n</center>";
}
?>

<center>

<?php 
$payments_res = db_res("SELECT `ID`, `Name`, `Caption`, `Active`, `Mode`, `Debug`, `SupportsRecurring`, `LogoFilename` FROM `PaymentProviders`");
while ($payment_arr = mysql_fetch_assoc($payments_res)) {
    PPShowProviderBox($payment_arr);
}
?>

</center>
ContentBlockHead('Version', 0, 'version');
echo "Installed - {$site['ver']}.{$site['build']}<br />\n";
echo "Latest - {$sDolVerLatest}<br />\n";
echo '<a href="http://www.boonex.com/products/dolphin/download/">Check For Updates</a>';
ContentBlockFoot();
ContentBlockHead('Links', 0, 'links');
showAdminLinks();
ContentBlockFoot();
?>
			</div>
			
			<div style="width:400px;float:left;">
	<?php 
if ($news_enable) {
    if ($oNews = new BxRSS('http://www.boonex.com/unity/blog/featured_posts/?rss=1')) {
        ContentBlockHead('BoonEx News Feed', 0, 'news_feed');
        $iNewsNum = 0;
        foreach ($oNews->items as $oItem) {
            ?>
				<div class="news_block">
					<div class="news_title"><a href="<?php 
            echo $oItem->link;
            ?>
"><?php 
            echo $oItem->title;
            ?>
</a></div>
					<div class="news_date"><?php 
            echo date('j F Y', strtotime($oItem->pubDate));
            ?>
</div>
</table>
</center>
<?php 
}
?>
</form>

<center>
<?php 
echo ResNavigationRet('AffBannersLower', 0);
?>
</center>
<?php 
ContentBlockFoot();
if ((int) $_GET['EditBanner']) {
    ContentBlockHead("Edit Banner");
    ?>
<form method="POST" action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
">
<table align="center" cellspacing=1 cellpadding=4 class="text" width=90%>
	<tr class=panel>
		<td align=center width=10%>&nbsp;ID&nbsp;</td>
		<td align=center width=10%>&nbsp;XSize&nbsp;</td>
		<td align=center width=10%>&nbsp;YSize&nbsp;</td>
		<td align=center width=50%>&nbsp;Banner file&nbsp;</td>
		<td align=center width=20%>&nbsp;Status&nbsp;</td>
	</tr>
	<tr>
		<td align=center width=10%><?php 
$iPerPage = 10;
$iTotalPages = ceil($iTotalNum / $iPerPage);
$iCurPage = (int) $_GET['page'];
if ($iCurPage > $iTotalPages) {
    $iCurPage = $iTotalPages;
}
if ($iCurPage < 1) {
    $iCurPage = 1;
}
$sLimitFrom = ($iCurPage - 1) * $iPerPage;
$sqlOrder = " ORDER BY `medDate` DESC ";
$sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
$sQuery = "\r\n\tSELECT\r\n\t\t`a`.`medID`,\r\n\t\t`a`.`medProfId`,\r\n\t\t`a`.`medTitle`,\r\n\t\tUNIX_TIMESTAMP(`a`.`medDate`) as `medDate`,\r\n\t\t`a`.`medExt`,\r\n\t\t`a`.`medViews`,\r\n        `a`.`Approved`,\r\n\t\t`b`.`NickName`\r\n\tFROM `share" . $sType . "Files` as `a`\r\n\tLEFT JOIN `Profiles` `b` ON\r\n\t\t`b`.`ID` = `a`.`medProfId`\r\n\t{$sqlWhere}\r\n\t{$sqlOrder}\r\n\t{$sqlLimit}\r\n\t";
$rData = db_res($sQuery);
TopCodeAdmin();
ContentBlockHead("List of Photo files");
echo browseCode();
ContentBlockFoot();
BottomCode();
function browseCode()
{
    global $site;
    global $rData;
    global $iTotalPages;
    global $iCurPage;
    $sCode = '<div id = "browseMain">';
    $sCode .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
    if (mysql_num_rows($rData)) {
        while ($aData = mysql_fetch_array($rData)) {
            $sStyle = $aData['Approved'] == 'true' ? ' style="border: 2px solid #00CC00;"' : ' style="border: 2px solid #CC0000;"';
            $sImage = $site['sharingImages'] . $aData['medID'] . '_t.' . $aData['medExt'];
* http://creativecommons.org/licenses/by/3.0/
*
* Dolphin 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 Creative Commons Attribution 3.0 License for more details. 
* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, 
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once '../inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
$logged['admin'] = member_auth(1, true, true);
$_page['css_name'] = 'links.css';
TopCodeAdmin();
ContentBlockHead("Manage links");
if (!$demo_mode && 'add' == $_GET['action']) {
    echo GetLinkForm();
} elseif (!$demo_mode && 'addnew' == $_POST['action']) {
    if (1 > strlen($_POST['title'])) {
        echo GetActionText('Please enter title');
        echo GetLinkForm(false, 0, true);
    } elseif (1 > strlen($_POST['URL'])) {
        echo GetActionText('Please enter URL');
        echo GetLinkForm(false, 0, true);
    } elseif (1 > strlen($_POST['desc'])) {
        echo GetActionText('Please enter description');
        echo GetLinkForm(false, 0, true);
    } else {
        if (db_res("INSERT INTO `Links` SET `Title` = '" . $_POST['title'] . "', `URL` = '" . $_POST['URL'] . "', `Description` = '" . $_POST['desc'] . "';")) {
            echo GetActionText('link successfully added', 1);
    $iCurPage = $iTotalPages;
}
if ($iCurPage < 1) {
    $iCurPage = 1;
}
$sLimitFrom = ($iCurPage - 1) * $iPerPage;
$aSqlQuery['sqlLimit'] = "LIMIT {$sLimitFrom}, {$iPerPage}";
$aSqlQuery['sqlOrder'] = "ORDER BY `{$oNew->aTableFields['medDate']}` DESC";
$aManage = array('medID', 'medProfId', 'medTitle', 'medUri', 'medDate', 'medViews', 'medExt', 'Approved');
if ($iTotalNum > 0) {
    $aCount = array('total' => $iTotalPages, 'current' => $iCurPage, 'per_page' => $iPerPage);
    $rData = $oNew->getFilesList($aSqlQuery, $aManage);
    $sCode = browseCode($oNew, $rData, $aCount);
}
TopCodeAdmin();
ContentBlockHead("List of {$sBigType} files");
echo $sCode;
ContentBlockFoot();
BottomCode();
function browseCode($oNew, $rData, $aCount)
{
    $sCode = '<div id="browseMain"><form method="post" action="">';
    $iCount = mysql_num_rows($rData);
    $sCheckAll = $iCount > 1 ? '<input type="checkbox" name=\\"ch_all" onclick="checkAll( \'Check[]\', this.checked )" />Check all' : '';
    if ($iCount) {
        while ($aData = mysql_fetch_array($rData)) {
            $sCode .= $oNew->showBrowseUnit($aData, true);
        }
    } else {
        $sCode .= '<div>There is are files</div>';
    }
    $p_per_page = 10;
}
// ------------------------------
$sql = "SELECT COUNT(*) FROM ProfilesPolls WHERE `poll_approval` = '0'";
$p_num = db_arr($sql);
$p_num = $p_num[0];
$pages_num = ceil($p_num / $p_per_page);
$real_first_p = (int) ($page - 1) * $p_per_page;
$page_first_p = $real_first_p + 1;
$result = db_res("SELECT `id_profile`, `id_poll` FROM ProfilesPolls WHERE `poll_approval` = 0 LIMIT {$real_first_p}, {$p_per_page};");
$_page['header'] = "Polls PostModeration";
$_page['header_text'] = "Polls that need to be checked by admin";
$_page['js'] = 1;
$_page['js_name'] = 'profile_poll.js';
TopCodeAdmin();
ContentBlockHead("Created (and not yet approved) profile polls:");
?>

<center>
<?php 
echo ResNavigationRet('PollsUpper', 0);
?>
</center>

<form name="prf_form" method="post" action="post_mod_ppolls.php<?php 
$get_vars = get_vars();
echo substr($get_vars, 0, strlen($get_vars) - 1);
?>
">

<?php 
}
$_page['header'] = "Polls administration";
$_page['header_text'] = "";
TopCodeAdmin();
ContentBlockHead("Polls administration");
if (strlen($action_result)) {
    echo "<br><center><div class=\"err\">{$action_result}</div></center><br>\n";
}
MemberPrintPolls();
$m_per_row = 1;
if ((int) $_GET['edit_id'] != 0) {
    $poll_arr = db_arr("SELECT * FROM `polls_q` WHERE `ID` = " . (int) $_GET['edit_id']);
    $res_answers = db_res("SELECT `IDanswer`, `ID`, `Answer`, `Votes` FROM `polls_a` WHERE `ID` = " . (int) $_GET['edit_id'] . " ORDER BY `IDanswer` ASC");
}
ContentBlockFoot();
ContentBlockHead("Polls");
?>

<form method=post action="polls.php">

<table border=0 cellspacing=1 cellpadding=0 width=100% class="text">
	<tr>
		<td colspan=<?php 
echo $m_per_row;
?>
>
			<table cellspacing=0 class=text width=100%>
				<td class=panel><img src="<?php 
echo $site['icons'];
?>
artic_papr.gif"></td>
$iPerPage = 10;
$iTotalPages = ceil($iTotalNum / $iPerPage);
$iCurPage = (int) $_GET['page'];
if ($iCurPage > $iTotalPages) {
    $iCurPage = $iTotalPages;
}
if ($iCurPage < 1) {
    $iCurPage = 1;
}
$sLimitFrom = ($iCurPage - 1) * $iPerPage;
$sqlOrder = " ORDER BY `medDate` DESC ";
$sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
$sQuery = "\r\n\tSELECT\r\n\t\t`a`.`ID` as `medID`,\r\n\t\t`a`.`Owner` as `medProfId`,\r\n\t\t`a`.`Title` as `medTitle`,\r\n\t\t`a`.`Date` as `medDate`,\r\n\t\t`a`.`Views` as `medViews`,\r\n        `a`.`Approved`,\r\n\t\t`b`.`NickName`\r\n\tFROM `RayMovieFiles` as `a`\r\n\tLEFT JOIN `Profiles` as `b` ON\r\n\t\t`b`.`ID` = `a`.`Owner`\r\n\t{$sqlWhere}\r\n\t{$sqlOrder}\r\n\t{$sqlLimit}\r\n\t";
$rData = db_res($sQuery);
TopCodeAdmin();
ContentBlockHead("List of Video files");
echo browseCode();
ContentBlockFoot();
BottomCode();
function browseCode()
{
    global $site;
    global $rData;
    global $iTotalPages;
    global $iCurPage;
    $sCode = '<div id = "browseMain">';
    $sCode .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
    if (mysql_num_rows($rData)) {
        while ($aData = mysql_fetch_array($rData)) {
            $sStyle = $aData['Approved'] == 'true' ? ' style="border: 2px solid #00CC00;"' : ' style="border: 2px solid #CC0000;"';
            $sProf = '<a href="' . $site['url'] . 'profile_edit.php?ID=' . $aData['medProfId'] . '">' . $aData['NickName'] . '</a>';
    // Process deleting
    delete_item($_GET['ID'], $res);
    compileMenus();
    header('location:' . $_SERVER['PHP_SELF']);
}
if (isset($_POST['Add'])) {
    add_or_edit_item();
    compileMenus();
}
if ('reset' == $_GET['action']) {
    reset_menu();
    compileMenus();
    header('location:' . $_SERVER['PHP_SELF']);
}
TopCodeAdmin();
ContentBlockHead("Member Menu");
// Get a list of all fields.
$query_str = "SELECT * FROM `MemberMenu` ORDER BY `MenuOrder` ASC";
$res = db_res($query_str);
if ($_GET['action'] == 'upload') {
    display_form((int) $_GET['ID']);
} else {
    echo "<p class=text><a href=\"{$_SERVER['PHP_SELF']}?action=upload\">Add new item</a></p>\n";
    echo "<p class=text><a href=\"{$_SERVER['PHP_SELF']}?action=reset\">Reset items</a></p>\n";
    display_menu($res);
}
ContentBlockFoot();
BottomCode();
//display all current menu items
function display_menu($res)
{
</tr>
<tr>
    <td colspan=7 align="center"><input class=no type=submit name="prf_form_submit" value="Send Message"></td>
</tr>
</table>
</form>

<center>
<?php 
echo ResNavigationRet('ProfilesLower', 0);
?>
</center>

<?php 
ContentBlockFoot();
ContentBlockHead("Legend");
?>
		<center>
			<table cellpadding="1" cellspacing="2" border="0" width="40%" align="center" class="brd">
			  <tr><td colspan="2" class="panel" align="right">Status of profile</td></tr>
			  <tr>
				<td class="prof_stat_Unconfirmed" width="30" style="border: 1px solid silver;">&nbsp;</td>
				<td class="brd" align="right">Unconfirmed</td>
              </tr>
			  <tr>
				<td class="prof_stat_Approval" width="30" style="border: 1px solid silver;">&nbsp;</td>
				<td class="brd" align="right">Approval</td>
              </tr>
			  <tr>
				<td bgcolor="#ffffff" width="30" style="border: 1px solid silver;">&nbsp;</td>
				<td class="brd" align="right">Active</td>
    ?>
</textarea>
		</fieldset>
		
		<div style="text-align:center;margin-top:10px;">
			<input type="submit" name="doSavePromoSett" value="Save" />
		</div>
	</form>
	<?php 
}
ContentBlockFoot();
$saveSettings = 'yes' == $_POST['save_settings'];
if (FALSE != $saveSettings) {
    saveIndexPageSettings();
}
ContentBlockHead("Index page settings");
displayIndexPageSettings();
ContentBlockFoot();
BottomCode();
function setNewMainLogo($filename, $ext)
{
    global $dir;
    $newFileName = "{$dir['mediaImages']}logo_tmp.{$ext}";
    $sLogoName = "{$dir['mediaImages']}logo.{$ext}";
    if (!move_uploaded_file($filename, $newFileName)) {
        echo 'Couldn\'t move file.';
    } else {
        if ($_REQUEST['resize']) {
            $width = (int) $_REQUEST['new_width'];
            $height = (int) $_REQUEST['new_height'];
            if (!($width > 0 and $height > 0)) {
    // Display log in form if user is not logged in.
    login_form('', 3);
}
$logged['moderator'] = member_auth(3);
$_page['header'] = 'Moderator Panel';
TopCodeAdmin();
// Get number of total registered members.
$total_members = db_arr('SELECT COUNT(*) FROM `Profiles`;');
$total_members = $total_members[0];
//
$status_arr[0] = "Unconfirmed";
$status_arr[1] = "Approval";
$status_arr[2] = "Active";
$status_arr[3] = "Rejected";
$status_arr[4] = "Suspended";
ContentBlockHead("Total registered members");
?>
								<center>
								<table cellspacing=1 cellpadding=3 border=0 width="70%" align="center" bgcolor="#cccccc" >
									<tr>
										<td bgcolor="E5E5E5" class="text" align="left"><a href="<?php 
echo $site['url'];
?>
moderators/profiles.php">Total registered members:</a></td>
										<td bgcolor="E5E5E5" width=50 class="text" align="right"><b><?php 
echo $total_members;
?>
</b></td>
									</tr>
<?php 
$i = 0;
function membershipActions($membershipID)
{
    global $IDNonMember;
    global $site;
    $membershipID = (int) $membershipID;
    if ($membershipID <= 0) {
        return '';
    }
    ob_start();
    ContentBlockHead("Membership Actions");
    ?>
<!-- <div class="sectionHeader">Membership Actions</div>
<div class="sectionBody"><div style="padding: 10px"> -->
<?php 
    $resActions = db_res("SELECT ID, Name FROM MemActions ORDER BY Name");
    $arrActions = array();
    while (list($ID, $desc) = mysql_fetch_row($resActions)) {
        $arrActions[(int) $ID] = $desc;
    }
    ?>
	<div align="left">
		<?php 
    echo $_POST['add_action'] ? addMembershipAction($membershipID, $_POST['add_action_id']) : '';
    ?>
		<?php 
    echo $_POST['update_action'] ? updateMembershipAction($membershipID, $_POST['update_action_id'], $_POST['allowedCnt'], $_POST['period'], $_POST['dateStart'], $_POST['dateEnd'], $_POST['additionalParamValue']) : '';
    ?>
		<?php 
    echo $_POST['delete_action'] ? deleteMembershipAction($membershipID, $_POST['delete_action_id']) : '';
    ?>
	</div>
<?php 
    $resLevelActions = db_res("\r\n\t\tSELECT\tIDAction,\r\n\t\t\t\tAllowedCount,\r\n\t\t\t\tAllowedPeriodLen,\r\n\t\t\t\tAllowedPeriodStart,\r\n\t\t\t\tAllowedPeriodEnd,\r\n\t\t\t\tAdditionalParamName,\r\n\t\t\t\tAdditionalParamValue\r\n\t\tFROM\tMemLevelActions\r\n\t\t\t\tINNER JOIN MemActions\r\n\t\t\t\tON MemLevelActions.IDAction = MemActions.ID\r\n\t\tWHERE MemLevelActions.IDLevel = {$membershipID}\r\n\t\tORDER BY MemActions.Name");
    $arrLevelActions = array();
    while ($arr = mysql_fetch_assoc($resLevelActions)) {
        $ID = $arr['IDAction'];
        unset($arr['IDAction']);
        $arrLevelActions[(int) $ID] = $arr;
    }
    $optionsText = "";
    foreach ($arrActions as $ID => $desc) {
        if (!$arrLevelActions[$ID]) {
            $optionsText .= "\n<option value=\"{$ID}\">{$desc}</option>";
        }
    }
    if (strlen($optionsText)) {
        ?>
	<div align="right">
		<form action="<?php 
        echo $_SERVER['SCRIPT_NAME'];
        ?>
?edit=actions&edit_level=<?php 
        echo $membershipID;
        ?>
" method="POST">
			<input type="hidden" name="add_action" value="yes" />
			<select name="add_action_id">
				<?php 
        echo $optionsText;
        ?>
			</select>
			<input type="submit" value="Add action" />
		</form>
	</div>
<?php 
    }
    foreach ($arrLevelActions as $ID => $arrAction) {
        ?>
	<div class="actionRowHeader">
		<table width="100%" style="height: 100%" cellpadding="0" cellspacing="0">
			<tr>
				<td valign="middle" align="left" width="100%"><b><?php 
        echo $arrActions[$ID];
        ?>
</b></td>
				<td valign="middle" align="right" style="padding-right: 5px;">
					<a id="showHide<?php 
        echo $ID;
        ?>
" href="" onclick="showHide('showHide<?php 
        echo $ID;
        ?>
', 'actionRow<?php 
        echo $ID;
        ?>
'); return false;">Show</a>
				</td>
				<td>
					<form action="<?php 
        echo $_SERVER['SCRIPT_NAME'];
        ?>
?edit=actions&edit_level=<?php 
        echo $membershipID;
        ?>
" method="POST" style="padding:0; margin:0;">
						<input type="hidden" name="delete_action" value="yes" />
						<input type="hidden" name="delete_action_id" value="<?php 
        echo $ID;
        ?>
" />
						<input style="width: 57px" type="submit" value="Delete" />
					</form>
				</td>
			</tr>
		</table>
	</div>
	<div class="actionRow" id="actionRow<?php 
        echo $ID;
        ?>
">
		<form id="updateActionForm<?php 
        echo $ID;
        ?>
" action="<?php 
        echo $_SERVER['SCRIPT_NAME'];
        ?>
?edit=actions&edit_level=<?php 
        echo $membershipID;
        ?>
" method="POST" style="padding:0; margin:0">
		<input type="hidden" name="update_action" value="yes" />
		<input type="hidden" name="update_action_id" value="<?php 
        echo $ID;
        ?>
" />
		<table class="actionForm">
			<tr>
				<td class="caption">Number of allowed actions:</td>
				<td class="allowedCnt">
					<input id="allowedCnt<?php 
        echo $ID;
        ?>
" name="allowedCnt" value="<?php 
        echo $arrAction['AllowedCount'] ? $arrAction['AllowedCount'] : 'no limit';
        ?>
" onfocus="clearUnlimited('allowedCnt<?php 
        echo $ID;
        ?>
')" onblur="fillUnlimited('allowedCnt<?php 
        echo $ID;
        ?>
')" <?php 
        echo $membershipID == $IDNonMember ? 'disabled' : '';
        ?>
 />
				</td>
			</tr>
			<tr>
				<td class="caption">Number of actions is reset every:</td>
				<td class="period">
					<input id="period<?php 
        echo $ID;
        ?>
" name="period" value="<?php 
        echo $arrAction['AllowedPeriodLen'] ? $arrAction['AllowedPeriodLen'] : 'no limit';
        ?>
" onfocus="clearUnlimited('period<?php 
        echo $ID;
        ?>
')" onblur="fillUnlimited('period<?php 
        echo $ID;
        ?>
')" <?php 
        echo $membershipID == $IDNonMember ? 'disabled' : '';
        ?>
 />
					&nbsp;hours
				</td>
			</tr>
			<tr>
				<td class="caption">This action is available since:</td>
				<td class="dateStart">
					<table cellpadding="0" cellspacing="0" border="0">
						<tr>
							<td>
								<input style="width: 130px" id="dateStart<?php 
        echo $ID;
        ?>
" name="dateStart" value="<?php 
        echo $arrAction['AllowedPeriodStart'] ? $arrAction['AllowedPeriodStart'] : 'no limit';
        ?>
" onfocus="clearUnlimited('dateStart<?php 
        echo $ID;
        ?>
')" onblur="fillUnlimited('dateStart<?php 
        echo $ID;
        ?>
')" />
							</td>
							<td>
								<input style="width: 70px" type="button" id="dateStart<?php 
        echo $ID;
        ?>
trigger" value="Choose"/>
							</td>
							<td>
								<input style="width: 70px" type="button" onclick="document.getElementById('dateStart<?php 
        echo $ID;
        ?>
').value = 'no limit'" value="Clear"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td class="caption">This action is available until:</td>
				<td class="dateEnd">
					<table cellpadding="0" cellspacing="0" border="0">
						<tr>
							<td>
								<input style="width: 130px" id="dateEnd<?php 
        echo $ID;
        ?>
" name="dateEnd" value="<?php 
        echo $arrAction['AllowedPeriodEnd'] ? $arrAction['AllowedPeriodEnd'] : 'no limit';
        ?>
" onfocus="clearUnlimited('dateEnd<?php 
        echo $ID;
        ?>
')" onblur="fillUnlimited('dateEnd<?php 
        echo $ID;
        ?>
')" />
							</td>
							<td>
								<input style="width: 70px" type="button" id="dateEnd<?php 
        echo $ID;
        ?>
trigger" value="Choose"/>
							</td>
							<td>
								<input style="width: 70px" type="button" onclick="document.getElementById('dateEnd<?php 
        echo $ID;
        ?>
').value = 'no limit'" value="Clear"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
<?php 
        if (!is_null($arrAction['AdditionalParamName'])) {
            ?>
			<tr>
				<td class="caption"><?php 
            echo htmlspecialchars($arrAction['AdditionalParamName']);
            ?>
</td>
				<td class="additionalParam">
					<input style="width: 130px" type="text" name="additionalParamValue" value="<?php 
            echo htmlspecialchars($arrAction['AdditionalParamValue']);
            ?>
" />
				</td>
			</tr>
<?php 
        }
        ?>
		<tr>
			<td colspan="2" align="center">
				<input style="width: 160px" type="submit" value="Save action settings" onclick="clearFormUnlimited('updateActionForm<?php 
        echo $ID;
        ?>
')"/>
			</td>
		</tr>
		</table>
	</div>
<script type="text/javascript">
//<![CDATA[
      Zapatec.Calendar.setup({
        firstDay          : 1,
        weekNumbers       : true,
        showOthers        : true,
        showsTime         : true,
        timeFormat        : "24",
        step              : 2,
        range             : [1900.01, 2999.12],
        electric          : false,
        singleClick       : true,
        inputField        : "dateStart<?php 
        echo $ID;
        ?>
",
        button            : "dateStart<?php 
        echo $ID;
        ?>
trigger",
        ifFormat          : "%Y-%m-%d %H:%M:%S",
        daFormat          : "%Y/%m/%d",
        align             : "Br"
      });
      Zapatec.Calendar.setup({
        firstDay          : 1,
        weekNumbers       : true,
        showOthers        : true,
        showsTime         : true,
        timeFormat        : "24",
        step              : 2,
        range             : [1900.01, 2999.12],
        electric          : false,
        singleClick       : true,
        inputField        : "dateEnd<?php 
        echo $ID;
        ?>
",
        button            : "dateEnd<?php 
        echo $ID;
        ?>
trigger",
        ifFormat          : "%Y-%m-%d %H:%M:%S",
        daFormat          : "%Y/%m/%d",
        align             : "Br"
      });
//]]>
</script>
	</form>
<?php 
    }
    if (!count($arrLevelActions)) {
        ?>
		<div align="center">No actions allowed for this membership</div>
<?php 
    }
    ?>
<!--
</div></div>
<div style="padding: 0"><img src="images/foot_block_green.gif" height="6" width="602"></div>
-->
<?php 
    ContentBlockFoot();
    $contents = ob_get_contents();
    ob_end_clean();
    return $contents;
}
" method="POST">
					<input type="hidden" name="action" value="add_cat" />
					<input type="text" name="Categ_Name" style="width:200px;" />
					<input type="submit" value="Add" />
				</form>
			</div>
<?php 
ContentBlockFoot();
// if selected category - view it's groups.
if ($_REQUEST['view_cat']) {
    $cat = (int) $_REQUEST['view_cat'];
    $aCateg = db_arr("SELECT * FROM `GroupsCateg` WHERE `ID`={$cat}");
    if ($aCateg['ID']) {
        ?>
<a name="view_cat"></a><?php 
        ContentBlockHead("Groups of category &quot;" . htmlspecialchars_adv($aCateg['Name']) . "&quot;");
        ?>
<div style="text-align:right;"><a href="#">Top</a></div><?php 
        $aGroupsNum = db_arr("SELECT COUNT(*) FROM `Groups` WHERE `categID`={$cat}");
        $iGroupsNum = (int) $aGroupsNum[0];
        if ($iGroupsNum) {
            $resPerPage = 10;
            $pagesNum = ceil($iGroupsNum / $resPerPage);
            $page = (int) $_REQUEST['page'];
            if ($page < 1) {
                $page = 1;
            }
            if ($page > $pagesNum) {
                $page = $pagesNum;
            }
            $sqlFrom = ($page - 1) * $resPerPage;
	</tr>
</table>
<br />
<input type="submit" class="no" value="Show" />
<input type="hidden" name="action" value="show" />
<input type="hidden" name="from" value="0" />
</form>

</center>
<?php 
ContentBlockFoot();
/**
 * Shows div with results of event search form
 */
if (strlen($show_query)) {
    ContentBlockHead("Events");
    ?>

<center>

<script language="JavaScript" type="text/javascript">
<!--
	function navigationSubmit( fromParam )
	{
		document.forms['showEventsForm'].elements['from'].value = fromParam;
		document.forms['showEventsForm'].submit();
	}
-->
</script>
<?php 
    if ($show_num == 0) {
	<tr>
		<td colspan="2"><?php 
    echo $status_text;
    ?>
</td>
	</tr>
		<?php 
}
?>
</table>
</form>	
</center>

<?php 
ContentBlockFoot();
ContentBlockHead('Database Restore');
?>

<center>
<table width="100%" border="0" cellspacing="2" cellpadding="3" class="text">
	<form style="padding: 0px; margin: 0px;" method="post" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
">
	<tr>
		<td align="center">
			Select dump file:
			<select name="dump_file">
			
			<?php 
if ($handle = @opendir($dir['root'] . 'backup/')) {
function PreviewMessage()
{
    global $site;
    $body_html = process_pass_data($_POST['body_html']);
    ContentBlockHead("Preview");
    ?>
		<center>
			<iframe id="IFramePreview" name="IFramePreview" frameborder="1" scrolling="yes" height="200" width="500" src="<?php 
    echo $site['url_admin'];
    ?>
notify_preview.php">
			</iframe>
		</center>

		<form name="form_preview" action="<?php 
    echo $site['url_admin'];
    ?>
notify_preview.php" method="POST" target="IFramePreview">
			<input type="hidden" name="post_data" value="<?php 
    echo htmlspecialchars($body_html);
    ?>
">
		</form>

		<script language="JavaScript">
			<!--
			document.forms['form_preview'].submit();
			-->
		</script>
<?php 
    ContentBlockFoot();
}
		<td align="center"><input class="no" size="60" value="<?php 
echo $site['url'];
?>
?idAff=<?php 
echo $AFF;
?>
" readonly /></td>
	</tr>
</table>

<?php 
ContentBlockFoot();
$respd = db_res("SELECT * FROM `aff_banners` WHERE `Added` = '1' AND `Status` = 'Active' ORDER BY `ID` DESC");
$rows_num = mysql_num_rows($respd);
if ($rows_num > 0) {
    ContentBlockHead("Banners");
    ?>
<table class="text" align="center" cellpadding="4" cellspacing="2" width="500">
<?php 
    while ($arrpd = mysql_fetch_array($respd)) {
        if (strpos($arrpd['Banner'], 'swf') === false) {
            $link_code = "<div align=\"center\">\r\n<!-- Start link code -->\r\n<a href=\"{$site['url']}?idAff={$AFF}\"><img src=\"{$site['banners']}{$arrpd['Banner']}\" width=\"{$arrpd['XSize']}\" height=\"{$arrpd['YSize']}\" border=\"0\"></a><br />\r\n<a href=\"{$site['url']}?idAff={$AFF}\">{$arrpd['Text']}</a>\r\n<!-- End link code -->\r\n</div>";
        } else {
            $size = getimagesize("{$site['banners']}{$arrpd['Banner']}");
            $link_code = "<div align=\"center\">\r\n<!-- Start link code -->\r\n<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" {$size[3]}>\r\n\t<param name=\"movie\" value=\"{$site['banners']}{$arrpd['Banner']}\" />\r\n\t<param name=\"quality\" value=\"high\" />\r\n\t<embed src=\"{$site['banners']}{$arrpd['Banner']}\" quality=\"high\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" {$size[3]} />\r\n</object><br />\r\n<a href=\"{$site['url']}?idAff={$AFF}\">{$arrpd['Text']}</a>\r\n<!-- End link code -->\r\n</div>";
        }
        ?>
	<tr>
		<td align=center>
			<b><?php 
        echo $arrpd['BannerName'] . ' ' . $arrpd['XSize'] . 'x' . $arrpd['YSize'];
    }
    echo "</table>\n";
}
echo '<br><br>';
if (!$action) {
    $action = "new";
    $Title = "";
    $Url = "";
    $Active = "";
    $Text = "";
    $Position = "";
    $start_date = '';
    $end_date = '';
}
ContentBlockFoot();
ContentBlockHead("Manage banners");
?>

<form action="banners.php" method="POST">
<center>
<table cellspacing=2 cellpadding=2 class=text border="0">
	<tr class=table>
		<td align="left">&nbsp;Banner Title&nbsp;</td>
		<td align="left"><input class=no type=text size=40 name=Title value="<?php 
echo htmlspecialchars($Title);
?>
"></td>
	</tr>
	<tr class=table>
		<td align="left">&nbsp;Banner Url&nbsp;</td>
		<td align="left"><input class=no type=text size=40 name=Url value="<?php 
function panelSection($header, $content, $padding = 10)
{
    ob_start();
    ContentBlockHead("{$header}");
    echo $content;
    ContentBlockFoot();
    $ret = ob_get_contents();
    ob_end_clean();
    return $ret;
}
    $missedProfiles = array();
    while ($profileInfo = mysql_fetch_assoc($dbresult)) {
        if (!array_key_exists(strtolower($profileInfo['NickName']), $phpBBUsers) || $profileInfo['Email'] != $phpBBUsers[strtolower($profileInfo['NickName'])]) {
            $profileInfo['RegisteredEMail'] = $phpBBUsers[strtolower($profileInfo['NickName'])];
            $missedProfiles[] = $profileInfo;
        }
    }
    sort($missedProfiles);
    foreach ($missedProfiles as $profile) {
        debugPrintProfileInfo($profile['ID'], $profile['NickName'], $profile['Email'], $profile['RegisteredEMail'], $profile['Status']);
    }
    $bottom_result .= "</table><br />";
    return count($missedProfiles) > 0 ? 1 : 0;
}
/* Output */
ContentBlockHead("");
$result = '';
if ($_POST['MODULE_UPLOAD'] == "YES" && $_FILES['file_module']['name']) {
    if (ModuleUpload()) {
        $result .= "Module was uploaded";
    } else {
        $result .= "Module upload failed";
    }
}
if ($_POST['MODULES_REFRESH'] == "YES") {
    modulesRefresh();
    $result .= "All profiles were updated.";
}
if ((int) $_POST['CONF_ID'] != 0 && $_POST['text']) {
    if (ModuleConfigure()) {
        $result .= "Module was configured";
require_once '../inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'admin.inc.php';
require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolBlogs.php';
$logged['admin'] = member_auth(1, true, true);
$_page['header'] = _t("_Blogs");
$_page['header_text'] = _t("_Blogs");
$path = "{$dir['root']}templates/tmpl_{$tmpl}/css/";
$cssPath = "../../templates/tmpl_{$tmpl}/css/";
$cssBasePath = "../../templates/base/css/";
$_page['css_name'] = $cssPath . "blogs.css";
$_page['css_name2'] = $cssBasePath . "general.css";
$_page['extra_js'] = $oTemplConfig->sTinyMceEditorJS;
TopCodeAdmin();
ContentBlockHead('');
Main();
function Main()
{
    global $site;
    global $tmpl;
    global $date_format;
    $sRetHtml = '';
    $oBlogs = new BxDolBlogs(true);
    $oBlogs->bAdminMode = true;
    $oBlogs->sCommonCSS = <<<EOF
<link href="{$site['url']}templates/tmpl_{$tmpl}/css/blogs_common.css" rel="stylesheet" type="text/css" />
EOF;
    $sRetHtml .= $oBlogs->GenCommandForms();
    switch ($_REQUEST['action']) {
        //print functions
		theme_advanced_resize_horizontal : false,
		theme_advanced_link_targets : "_something=My somthing;_something2=My somthing2;_something3=My somthing3;",
		paste_auto_cleanup_on_paste : true,
		paste_convert_headers_to_strong : false,
		paste_strip_class_attributes : "all",
		paste_remove_spans : false,
		paste_remove_styles : false

		});
	</script>
	<!-- /tinyMCE -->

';
$logged['admin'] = member_auth(1, true, true);
TopCodeAdmin();
ContentBlockHead("Articles");
print getArticlesAdminContent($logged);
ContentBlockFoot();
BottomCode();
function getArticlesAdminContent($logged)
{
    global $site;
    global $sActionText;
    $oArticles = new BxDolArticles($logged);
    $sRet = '';
    $sActions = $oArticles->ActionAddUpdateElements();
    $sRet .= $sActions;
    switch ($_GET['action']) {
        case 'addcategory':
            $sRet .= $oArticles->getArticlesCategoryEditForm();
            break;
$iPerPage = 10;
$iTotalPages = ceil($iTotalNum / $iPerPage);
$iCurPage = (int) $_GET['page'];
if ($iCurPage > $iTotalPages) {
    $iCurPage = $iTotalPages;
}
if ($iCurPage < 1) {
    $iCurPage = 1;
}
$sLimitFrom = ($iCurPage - 1) * $iPerPage;
$sqlOrder = " ORDER BY `medDate` DESC ";
$sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
$sQuery = "\r\n\tSELECT\r\n\t\t`a`.`ID` as `medID`,\r\n\t\t`a`.`Owner` as `medProfId`,\r\n\t\t`a`.`Title` as `medTitle`,\r\n\t\t`a`.`Date` as `medDate`,\r\n\t\t`a`.`Listens` as `medListens`,\r\n\t\t`a`.`Approved`,\r\n\t\t`b`.`NickName`\r\n\tFROM `Ray" . $sType . "Files` as `a`\r\n\tLEFT JOIN `Profiles` as `b` ON\r\n\t\t`b`.`ID` = `a`.`Owner`\r\n\t{$sqlWhere}\r\n\t{$sqlOrder}\r\n\t{$sqlLimit}\r\n\t";
$rData = db_res($sQuery);
TopCodeAdmin();
ContentBlockHead("List of music files");
echo browseCode();
ContentBlockFoot();
BottomCode();
function browseCode()
{
    global $site;
    global $rData;
    global $iTotalPages;
    global $iCurPage;
    $sCode = '<div id = "browseMain">';
    $sCode .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
    if (mysql_num_rows($rData)) {
        while ($aData = mysql_fetch_array($rData)) {
            $sStyle = $aData['Approved'] == 'true' ? ' style="border: 2px solid #00CC00;"' : ' style="border: 2px solid #CC0000;"';
            $sProf = '<a href="' . $site['url'] . 'profile_edit.php?ID=' . $aData['medProfId'] . '">' . $aData['NickName'] . '</a>';
/***************************************************************************
*                            Dolphin Smart Community Builder
*                              -----------------
*     begin                : Mon Mar 23 2006
*     copyright            : (C) 2006 BoonEx Group
*     website              : http://www.boonex.com/
* This file is part of Dolphin - Smart Community Builder
*
* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License. 
* http://creativecommons.org/licenses/by/3.0/
*
* Dolphin 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 Creative Commons Attribution 3.0 License for more details. 
* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, 
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once '../inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php';
$logged['admin'] = member_auth(1, true, true);
$_page['header'] = 'aeDirectory';
TopCodeAdmin();
ContentBlockHead("&nbsp;");
?>
  Directory has not been installed. <br>You can get more information about aeDirectory at http://www.aewebworks.com/aedirectory.htm<br>
			        Alternatively You may visit aeDirectory Support Forum at http://www.aewebworks.com/download/forum

<?php 
ContentBlockFoot();
BottomCode();