Esempio n. 1
0
function displayUserSection()
{
    global $cfg, $db;
    echo "<table width=\"760\" border=1 bordercolor=\"" . $cfg["table_admin_border"] . "\" cellpadding=\"2\" cellspacing=\"0\" bgcolor=\"" . $cfg["table_data_bg"] . "\">";
    echo "<tr><td colspan=6 bgcolor=\"" . $cfg["table_header_bg"] . "\" background=\"themes/" . $cfg["theme"] . "/images/bar.gif\"><img src=\"images/user_group.gif\" width=17 height=14 border=0>&nbsp;&nbsp;<font class=\"title\">" . _USERDETAILS . "</font></div></td></tr>";
    echo "<tr>";
    echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\" width=\"15%\"><div align=center class=\"title\">" . _USER . "</div></td>";
    echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\" width=\"6%\"><div align=center class=\"title\">" . _HITS . "</div></td>";
    echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\"><div align=center class=\"title\">" . _UPLOADACTIVITY . " (" . $cfg["days_to_keep"] . " " . _DAYS . ")</div></td>";
    echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\" width=\"6%\"><div align=center class=\"title\">" . _JOINED . "</div></td>";
    echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\" width=\"15%\"><div align=center class=\"title\">" . _LASTVISIT . "</div></td>";
    echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\" width=\"8%\"><div align=center class=\"title\">" . _ADMIN . "</div></td>";
    echo "</tr>";
    $total_activity = GetActivityCount();
    $sql = "SELECT user_id, hits, last_visit, time_created, user_level FROM tf_users ORDER BY user_id";
    $result = $db->Execute($sql);
    while (list($user_id, $hits, $last_visit, $time_created, $user_level) = $result->FetchRow()) {
        $user_activity = GetActivityCount($user_id);
        if ($user_activity == 0) {
            $user_percent = 0;
        } else {
            $user_percent = number_format($user_activity / $total_activity * 100);
        }
        $user_icon = "images/user_offline.gif";
        if (IsOnline($user_id)) {
            $user_icon = "images/user.gif";
        }
        echo "<tr>";
        if (IsUser($user_id)) {
            echo "<td><a href=\"message.php?to_user="******"\"><img src=\"" . $user_icon . "\" width=17 height=14 title=\"" . _SENDMESSAGETO . " " . $user_id . "\" border=0 align=\"bottom\">" . $user_id . "</a></td>";
        } else {
            echo "<td><img src=\"" . $user_icon . "\" width=17 height=14 title=\"n/a\" border=0 align=\"bottom\">" . $user_id . "</td>";
        }
        echo "<td><div class=\"tiny\" align=\"right\">" . $hits . "</div></td>";
        echo "<td><div align=center>";
        ?>
		<table width="310" border="0" cellpadding="0" cellspacing="0">
		<tr>
		<td width="200">
			<table width="200" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td background="themes/<?php 
        echo $cfg["theme"];
        ?>
/images/proglass.gif" width="<?php 
        echo $user_percent * 2;
        ?>
"><img src="images/blank.gif" width="1" height="12" border="0"></td>
				<td background="themes/<?php 
        echo $cfg["theme"];
        ?>
/images/noglass.gif" width="<?php 
        echo 200 - $user_percent * 2;
        ?>
"><img src="images/blank.gif" width="1" height="12" border="0"></td>
			</tr>
			</table>
		</td>
		<td align="right" width="40"><div class="tiny" align="right"><?php 
        echo $user_activity;
        ?>
</div></td>
		<td align="right" width="40"><div class="tiny" align="right"><?php 
        echo $user_percent;
        ?>
%</div></td>
		<td align="right"><a href="admin.php?op=showUserActivity&user_id=<?php 
        echo $user_id;
        ?>
"><img src="images/properties.png" width="18" height="13" title="<?php 
        echo $user_id . "'s " . _USERSACTIVITY;
        ?>
" border="0"></a></td>
		</tr>
		</table>
<?php 
        echo "</td>";
        echo "<td><div class=\"tiny\" align=\"center\">" . date(_DATEFORMAT, $time_created) . "</div></td>";
        echo "<td><div class=\"tiny\" align=\"center\">" . date(_DATETIMEFORMAT, $last_visit) . "</div></td>";
        echo "<td><div align=\"right\" class=\"tiny\">";
        $user_image = "images/user.gif";
        $type_user = _NORMALUSER;
        if ($user_level == 1) {
            $user_image = "images/admin_user.gif";
            $type_user = _ADMINISTRATOR;
        }
        if ($user_level == 2) {
            $user_image = "images/superadmin.gif";
            $type_user = _SUPERADMIN;
        }
        if ($user_level <= 1 || IsSuperAdmin()) {
            echo "<a href=\"admin.php?op=editUser&user_id=" . $user_id . "\"><img src=\"images/edit.png\" width=12 height=13 title=\"" . _EDIT . " " . $user_id . "\" border=0></a>";
        }
        echo "<img src=\"" . $user_image . "\" title=\"" . $user_id . " - " . $type_user . "\">";
        if ($user_level <= 1) {
            echo "<a href=\"admin.php?op=deleteUser&user_id=" . $user_id . "\"><img src=\"images/delete_on.gif\" border=0 width=16 height=16 title=\"" . _DELETE . " " . $user_id . "\" onclick=\"return ConfirmDeleteUser('" . $user_id . "')\"></a>";
        } else {
            echo "<img src=\"images/delete_off.gif\" width=16 height=16 title=\"n/a\">";
        }
        echo "</div></td>";
        echo "</tr>";
    }
    echo "</table>";
    ?>
	<script language="JavaScript">
	function ConfirmDeleteUser(user)
	{
		return confirm("<?php 
    echo _WARNING . ": " . _ABOUTTODELETE;
    ?>
: " + user)
	}
	</script>
<?php 
}
/**
 * performAuthentication
 *
 */
function performAuthentication($message = "")
{
    if (!IsSuperAdmin()) {
        header("Content-Type: text/plain");
        echo "\nAccess Error" . "\n\n";
        if (isset($message) && $message != "") {
            echo $message . "\n";
        } else {
            echo "Only SuperAdmin can access superadmin-page.\n";
        }
        exit;
    }
}
        }
    }
} else {
    // try to auth with supplied credentials
    $credentials = getCredentials();
    if ($credentials !== false) {
        if (performAuthentication($credentials['username'], $credentials['password'], $credentials['md5pass']) == 1) {
            if (isAuthenticated() != 1) {
                @header('location: login.php');
                exit;
            }
            $currentUser = $cfg["user"];
            // check if we are locked
            if ($cfg["webapp_locked"] == 1) {
                // only superadmin can login when we are locked
                if (!IsSuperAdmin()) {
                    @header('location: locked.php');
                    exit;
                }
            }
        } else {
            @header('location: login.php');
            exit;
        }
    } else {
        @header('location: login.php');
        exit;
    }
}
// log the hit
AuditAction($cfg["constants"]["hit"], $_SERVER['PHP_SELF']);
Esempio n. 4
0
 //******************************************************************************
 // showIndex -- main view
 //******************************************************************************
 $tmpl->setvar('showIndex', 1);
 $hideChecked = "";
 if ($cfg["hide_offline"] == 1) {
     $hideChecked = "checked=\"checked\"";
 }
 $total_activity = GetActivityCount();
 $sql = "SELECT user_id, email_address, hits, last_visit, time_created, user_level FROM tf_users WHERE user_id=" . $db->qstr($cfg["user"]);
 list($user_id, $email_address, $hits, $last_visit, $time_created, $user_level) = $db->GetRow($sql);
 $user_type = $cfg['_NORMALUSER'];
 if ($cfg['isAdmin']) {
     $user_type = $cfg['_ADMINISTRATOR'];
 }
 if (IsSuperAdmin()) {
     $user_type = $cfg['_SUPERADMIN'];
 }
 $user_activity = GetActivityCount($cfg["user"]);
 if ($user_activity == 0) {
     $user_percent = 0;
 } else {
     $user_percent = number_format($user_activity / $total_activity * 100);
 }
 $tmpl->setvar('time_created1', date($cfg['_DATETIMEFORMAT'], $time_created));
 $tmpl->setvar('width1', $user_percent * 2);
 $tmpl->setvar('width2', 200 - $user_percent * 2);
 $tmpl->setvar('user_activity', $user_activity);
 $tmpl->setvar('user_percent', $user_percent);
 $tmpl->setvar('days_to_keep', $cfg["days_to_keep"]);
 $tmpl->setvar('hits', $hits);
Esempio n. 5
0
function showIndex()
{
    global $cfg, $db;
    $hideChecked = "";
    if ($cfg["hide_offline"] == 1) {
        $hideChecked = "checked";
    }
    DisplayHead($cfg["user"] . "'s " . _PROFILE);
    echo "<div align=\"center\">";
    echo "<table border=1 bordercolor=\"" . $cfg["table_admin_border"] . "\" cellpadding=\"2\" cellspacing=\"0\" width=\"760\">";
    echo "<tr><td colspan=6 bgcolor=\"" . $cfg["table_data_bg"] . "\" background=\"themes/" . $cfg["theme"] . "/images/bar.gif\">";
    echo "<img src=\"images/properties.png\" width=18 height=13 border=0>&nbsp;&nbsp;<font class=\"title\">" . $cfg["user"] . "'s " . _PROFILE . "</font>";
    echo "</td></tr><tr><td align=\"center\">";
    $total_activity = GetActivityCount();
    $sql = "SELECT user_id, hits, last_visit, time_created, user_level FROM tf_users WHERE user_id=" . $db->qstr($cfg["user"]);
    list($user_id, $hits, $last_visit, $time_created, $user_level) = $db->GetRow($sql);
    $user_type = _NORMALUSER;
    if (IsAdmin()) {
        $user_type = _ADMINISTRATOR;
    }
    if (IsSuperAdmin()) {
        $user_type = _SUPERADMIN;
    }
    $user_activity = GetActivityCount($cfg["user"]);
    if ($user_activity == 0) {
        $user_percent = 0;
    } else {
        $user_percent = number_format($user_activity / $total_activity * 100);
    }
    ?>

    <table width="100%" border="0" cellpadding="3" cellspacing="0">
    <tr>

        <!-- left column -->
        <td width="50%" bgcolor="<?php 
    echo $cfg["table_data_bg"];
    ?>
" valign="top">
        <div align="center">
        <table border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td align="right"><?php 
    echo _JOINED;
    ?>
:&nbsp;</td>
            <td><strong><?php 
    echo date(_DATETIMEFORMAT, $time_created);
    ?>
</strong></td>
        </tr>
        <tr>
            <td colspan="2" align="center">&nbsp;</td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _UPLOADPARTICIPATION;
    ?>
:&nbsp;</td>
            <td>
                <table width="200" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td background="themes/<?php 
    echo $cfg["theme"];
    ?>
/images/proglass.gif" width="<?php 
    echo $user_percent * 2;
    ?>
"><img src="images/blank.gif" width="1" height="12" border="0"></td>
                    <td background="themes/<?php 
    echo $cfg["theme"];
    ?>
/images/noglass.gif" width="<?php 
    echo 200 - $user_percent * 2;
    ?>
"><img src="images/blank.gif" width="1" height="12" border="0"></td>
                </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _UPLOADS;
    ?>
:&nbsp;</td>
            <td><strong><?php 
    echo $user_activity;
    ?>
</strong></td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _PERCENTPARTICIPATION;
    ?>
:&nbsp;</td>
            <td><strong><?php 
    echo $user_percent;
    ?>
%</strong></td>
        </tr>
        <tr>
            <td colspan="2" align="center"><div align="center" class="tiny">(<?php 
    echo _PARTICIPATIONSTATEMENT . " " . $cfg['days_to_keep'] . " " . _DAYS;
    ?>
)</div><br></td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _TOTALPAGEVIEWS;
    ?>
:&nbsp;</td>
            <td><strong><?php 
    echo $hits;
    ?>
</strong></td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _USERTYPE;
    ?>
:&nbsp;</td>
            <td><strong><?php 
    echo $user_type;
    ?>
</strong></td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <table>
                    <tr>
                        <td align="center">
                            <BR />[ <a href="?op=showCookies">Cookie Management</a> ]
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        </table>
        </div>
        </td>

        <!-- right column -->
        <td valign="top">
        <div align="center">
        <table cellpadding="5" cellspacing="0" border="0">
        <form name="theForm" action="profile.php?op=updateProfile" method="post" onsubmit="return validateProfile()">
        <tr>
            <td align="right"><?php 
    echo _USER;
    ?>
:</td>
            <td>
            <input readonly="true" type="Text" value="<?php 
    echo $cfg["user"];
    ?>
" size="15">
            </td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _NEWPASSWORD;
    ?>
:</td>
            <td>
            <input name="pass1" type="Password" value="" size="15">
            </td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _CONFIRMPASSWORD;
    ?>
:</td>
            <td>
            <input name="pass2" type="Password" value="" size="15">
            </td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _THEME;
    ?>
:</td>
            <td>
            <select name="theme">
<?php 
    $arThemes = GetThemes();
    for ($inx = 0; $inx < sizeof($arThemes); $inx++) {
        $selected = "";
        if ($cfg["theme"] == $arThemes[$inx]) {
            $selected = "selected";
        }
        echo "<option value=\"" . $arThemes[$inx] . "\" " . $selected . ">" . $arThemes[$inx] . "</option>";
    }
    ?>
            </select>
            </td>
        </tr>
                <tr>
            <td align="right"><?php 
    echo _LANGUAGE;
    ?>
:</td>
            <td>
            <select name="language">
<?php 
    $arLanguage = GetLanguages();
    for ($inx = 0; $inx < sizeof($arLanguage); $inx++) {
        $selected = "";
        if ($cfg["language_file"] == $arLanguage[$inx]) {
            $selected = "selected";
        }
        echo "<option value=\"" . $arLanguage[$inx] . "\" " . $selected . ">" . GetLanguageFromFile($arLanguage[$inx]) . "</option>";
    }
    ?>
            </select>
            </td>
        </tr>
        <tr>
            <td colspan="2">
            <input name="hideOffline" type="Checkbox" value="1" <?php 
    echo $hideChecked;
    ?>
> <?php 
    echo _HIDEOFFLINEUSERS;
    ?>
<br>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="2">
            <input type="Submit" value="<?php 
    echo _UPDATE;
    ?>
">
            </td>
        </tr>
        </form>

        </table>

        </div>
        </td>
    </tr>

    <!-- user-settings -->
    <tr><td colspan="2" align="center" bgcolor="<?php 
    echo $cfg["table_border_dk"];
    ?>
"><strong><?php 
    echo $cfg["user"];
    ?>
's Settings</strong></td></tr>
    <tr><td colspan="2"><br></td></tr>
    <tr><td colspan="2">

    <form name="settingsForm" action="profile.php?op=updateSettingsUser" method="post">
    <table border="0" cellpadding="3" cellspacing="0" width="100%">

        <tr><td colspan="2" align="center" bgcolor="<?php 
    echo $cfg["table_header_bg"];
    ?>
"><strong>Index-Page</strong></td></tr>

        <tr>
            <td align="left" width="350" valign="top"><strong>Select index-page</strong><br>
            Select the index-Page.
            </td>
            <td valign="top">
                <?php 
    printIndexPageSelectForm();
    ?>
            </td>
        </tr>

        <tr>
            <td align="left" width="350" valign="top"><strong>index-page settings</strong><br>
            Select the columns in transfer-list on index-Page.<br>(only for b4rt-index-page)
            </td>
            <td valign="top">
                <?php 
    printIndexPageSettingsForm();
    ?>
            </td>
        </tr>

        <tr>
            <td align="left" width="350" valign="top"><strong>Width</strong><br>
            Specify the width of the index-page. (780):
            </td>
            <td valign="bottom">
                <input name="ui_dim_main_w" type="Text" maxlength="5" value="<?php 
    echo $cfg["ui_dim_main_w"];
    ?>
" size="5">
            </td>
        </tr>
        <tr>
            <td align="left" width="350" valign="top"><strong>Display Links</strong><br>
            Display Links on the index-page. (true):
            </td>
            <td valign="bottom">
                <select name="ui_displaylinks">
                        <option value="1">true</option>
                        <option value="0" <?php 
    if (!$cfg["ui_displaylinks"]) {
        echo "selected";
    }
    ?>
>false</option>
                </select>
            </td>
        </tr>
        <tr>
            <td align="left" width="350" valign="top"><strong>Display Users</strong><br>
            Display Users on the index-page. (true):
            </td>
            <td valign="bottom">
                <select name="ui_displayusers">
                        <option value="1">true</option>
                        <option value="0" <?php 
    if (!$cfg["ui_displayusers"]) {
        echo "selected";
    }
    ?>
>false</option>
                </select>
            </td>
        </tr>
        <tr>
            <td align="left" width="350" valign="top"><strong>Select Drivespace-Bar</strong><br>
            Select Style of Drivespace-Bar on index-Page.
            </td>
            <td valign="top">
                <?php 
    printDrivespacebarSelectForm();
    ?>
            </td>
        </tr>
        <tr>
            <td align="left" width="350" valign="top"><strong>Show Server Stats</strong><br>
            Enable showing the server stats at the bottom:
            </td>
            <td valign="top">
                <select name="index_page_stats">
                        <option value="1">true</option>
                        <option value="0" <?php 
    if (!$cfg["index_page_stats"]) {
        echo "selected";
    }
    ?>
>false</option>
                </select>
            </td>
        </tr>

        <tr>
            <td align="left" width="350" valign="top"><strong>Show Server Load</strong><br>
            Enable showing the average server load over the last 15 minutes:
            </td>
            <td valign="top">
                <select name="show_server_load">
                        <option value="1">true</option>
                        <option value="0" <?php 
    if (!$cfg["show_server_load"]) {
        echo "selected";
    }
    ?>
>false</option>
                </select>
            </td>
        </tr>

        <tr>
            <td align="left" width="350" valign="top"><strong>Show Connections</strong><br>
            Enable showing the Sum of TCP-Connections:
            </td>
            <td valign="top">
                <select name="index_page_connections">
                        <option value="1">true</option>
                        <option value="0" <?php 
    if (!$cfg["index_page_connections"]) {
        echo "selected";
    }
    ?>
>false</option>
                </select>
            </td>
        </tr>

        <tr>
            <td align="left" width="350" valign="top"><strong>Use Refresh</strong><br>
            Use meta-refresh on index-page. (true):
            </td>
            <td valign="bottom">
                <select name="ui_indexrefresh">
                        <option value="1">true</option>
                        <option value="0" <?php 
    if (!$cfg["ui_indexrefresh"]) {
        echo "selected";
    }
    ?>
>false</option>
                </select>
            </td>
        </tr>
        <tr>
            <td align="left" width="350" valign="top"><strong>Page Refresh (in seconds)</strong><br>
            Number of seconds before the torrent list page refreshes:
            </td>
            <td valign="top">
                <input name="page_refresh" type="Text" maxlength="3" value="<?php 
    echo $cfg["page_refresh"];
    ?>
" size="3">
            </td>
        </tr>

        <tr>
            <td align="left" width="350" valign="top"><strong>Select Sort-Order</strong><br>
            Select default Sort-Order of transfers on index-Page.
            </td>
            <td valign="top">
                <?php 
    printSortOrderSettingsForm();
    ?>
            </td>
        </tr>
        <tr>
            <td align="left" width="350" valign="top"><strong>Enable sorttable</strong><br>
            Enable Client-Side sorting of Transfer-Table:
            </td>
            <td valign="top">
                <select name="enable_sorttable">
                        <option value="1">true</option>
                        <option value="0" <?php 
    if (!$cfg["enable_sorttable"]) {
        echo "selected";
    }
    ?>
>false</option>
                </select>
            </td>
        </tr>

        <tr>
           <td align="left" width="350" valign="top"><strong>Enable Good looking statistics</strong><br>
           Enable/Disable "Good looking statistics" :
           </td>
           <td valign="top">
               <select name="enable_goodlookstats">
                       <option value="1">true</option>
                       <option value="0" <?php 
    if (!$cfg["enable_goodlookstats"]) {
        echo "selected";
    }
    ?>
>false</option>
               </select>
           </td>
        </tr>

        <tr>
           <td align="left" width="350" valign="top"><strong>Good looking statistics settings</strong><br>
           Configure Settings of "Good looking statistics" :
           </td>
           <td valign="top">
            <?php 
    printGoodLookingStatsForm();
    ?>
           </td>
        </tr>

        <tr>
           <td align="left" width="350" valign="top"><strong>Enable Big bold drivespace warning</strong><br>
           Enable/Disable "Big bold drivespace warning" :
           </td>
           <td valign="top">
               <select name="enable_bigboldwarning">
                       <option value="1">true</option>
                       <option value="0" <?php 
    if (!$cfg["enable_bigboldwarning"]) {
        echo "selected";
    }
    ?>
>false</option>
               </select>
           </td>
        </tr>

        <tr><td colspan="2" align="center" bgcolor="<?php 
    echo $cfg["table_header_bg"];
    ?>
"><strong>Download-Details</strong></td></tr>
        <tr>
            <td align="left" width="350" valign="top"><strong>Width</strong><br>
            Specify the width of the details-popup. (450):
            </td>
            <td valign="bottom">
                <input name="ui_dim_details_w" type="Text" maxlength="5" value="<?php 
    echo $cfg["ui_dim_details_w"];
    ?>
" size="5">
            </td>
        </tr>
        <tr>
            <td align="left" width="350" valign="top"><strong>Height</strong><br>
            Specify the height of the details-popup. (290):
            </td>
            <td valign="bottom">
                <input name="ui_dim_details_h" type="Text" maxlength="5" value="<?php 
    echo $cfg["ui_dim_details_h"];
    ?>
" size="5">
            </td>
        </tr>

        <tr><td colspan="2" align="center" bgcolor="<?php 
    echo $cfg["table_header_bg"];
    ?>
"><strong>Misc</strong></td></tr>

        <tr>
            <td align="left" width="350" valign="top"><strong>Default Torrent Search Engine</strong><br>
            Select the default search engine for torrent searches:
            </td>
            <td valign="top">
                <?php 
    echo buildSearchEngineDDL($cfg["searchEngine"]);
    ?>
            </td>
        </tr>

        <!-- move hack settings -->
        <?php 
    if ($cfg["enable_move"] != 0) {
        ?>
            <script src="move_extensionSettings.js" type="text/javascript"></script>
    		<tr>
            	<td align="left" width="350" valign="top"><strong>Move Settings</strong><br>
            	<u>Note :</u> You must specify absolute paths here. relative paths are not valid.<br>
            	<u>Note :</u> The created dirs will not be deleted after removing a entry from the List.
            	</td>
        		<td valign="top">
                 <?php 
        printMoveSettingsForm();
        ?>
    		    </td>
    		</tr>
        <?php 
    }
    ?>

        <tr>
            <td align="left" width="350" valign="top"><strong>Display TorrentFlux Link</strong><br>
            Display TorrentFlux Link at bottom of pages. (true):
            </td>
            <td valign="bottom">
                <select name="ui_displayfluxlink">
                        <option value="1">true</option>
                        <option value="0" <?php 
    if (!$cfg["ui_displayfluxlink"]) {
        echo "selected";
    }
    ?>
>false</option>
                </select>
            </td>
        </tr>

        <tr><td colspan="2"><hr noshade></td></tr>
        <tr>
            <td align="center" colspan="2">
                <input type="Submit" value="Update Settings">
            </td>
        </tr>
    </table>
    </form>

    </td></tr>
    <!-- user-settings -->

    </table>

    <script language="JavaScript">
    function validateProfile()
    {
        var msg = ""
        if (theForm.pass1.value != "" || theForm.pass2.value != "")
        {
            if (theForm.pass1.value.length <= 5 || theForm.pass2.value.length <= 5)
            {
                msg = msg + "* <?php 
    echo _PASSWORDLENGTH;
    ?>
\n";
                theForm.pass1.focus();
            }
            if (theForm.pass1.value != theForm.pass2.value)
            {
                msg = msg + "* <?php 
    echo _PASSWORDNOTMATCH;
    ?>
\n";
                theForm.pass1.value = "";
                theForm.pass2.value = "";
                theForm.pass1.focus();
            }
        }

        if (msg != "")
        {
            alert("<?php 
    echo _PLEASECHECKFOLLOWING;
    ?>
:\n\n" + msg);
            return false;
        }
        else
        {
            return true;
        }
    }
    </script>

<?php 
    echo "</td></tr>";
    echo "</table></div><br><br>";
    DisplayFoot();
}
/**
 * setUserState
 */
function setUserState()
{
    global $cfg, $db;
    $user_id = tfb_getRequestVar('user_id');
    $user_state = tfb_getRequestVar('state');
    // check params
    if (!isset($user_id) && isset($user_state)) {
        return false;
    }
    // sanity-check, don't allow setting state of superadmin to 0
    if ($user_state == 0 && IsSuperAdmin($user_id)) {
        AuditAction($cfg["constants"]["error"], "Invalid try to deactivate superadmin account.");
        return false;
    }
    // set new state
    $sql = "SELECT * FROM tf_users WHERE user_id = " . $db->qstr($user_id);
    $rs = $db->Execute($sql);
    if ($db->ErrorNo() != 0) {
        dbError($sql);
    }
    $rec = array('state' => $user_state);
    $sql = $db->GetUpdateSQL($rs, $rec);
    $result = $db->Execute($sql);
    if ($db->ErrorNo() != 0) {
        dbError($sql);
    }
    switch ($user_state) {
        case 0:
            AuditAction($cfg["constants"]["admin"], "User " . $user_id . " deactivated.");
            break;
        case 1:
            AuditAction($cfg["constants"]["admin"], "User " . $user_id . " activated.");
            break;
    }
    return true;
}
Esempio n. 7
0
function showIndex()
{
    global $cfg, $db;
    $hideChecked = "";
    if ($cfg["hide_offline"] == 1) {
        $hideChecked = "checked";
    }
    DisplayHead($cfg["user"] . "'s " . _PROFILE);
    echo "<div align=\"center\">";
    echo "<table border=1 bordercolor=\"" . $cfg["table_admin_border"] . "\" cellpadding=\"2\" cellspacing=\"0\" width=\"760\">";
    echo "<tr><td colspan=6 bgcolor=\"" . $cfg["table_data_bg"] . "\" background=\"themes/" . $cfg["theme"] . "/images/bar.gif\">";
    echo "<img src=\"images/properties.png\" width=18 height=13 border=0>&nbsp;&nbsp;<font class=\"title\">" . $cfg["user"] . "'s " . _PROFILE . "</font>";
    echo "</td></tr><tr><td align=\"center\">";
    $total_activity = GetActivityCount();
    $sql = "SELECT user_id, hits, last_visit, time_created, user_level FROM tf_users WHERE user_id=" . $db->qstr($cfg["user"]);
    list($user_id, $hits, $last_visit, $time_created, $user_level) = $db->GetRow($sql);
    $user_type = _NORMALUSER;
    if (IsAdmin()) {
        $user_type = _ADMINISTRATOR;
    }
    if (IsSuperAdmin()) {
        $user_type = _SUPERADMIN;
    }
    $user_activity = GetActivityCount($cfg["user"]);
    if ($user_activity == 0) {
        $user_percent = 0;
    } else {
        $user_percent = number_format($user_activity / $total_activity * 100);
    }
    ?>

    <table width="100%" border="0" cellpadding="3" cellspacing="0">
    <tr>
        <td width="50%" bgcolor="<?php 
    echo $cfg["table_data_bg"];
    ?>
" valign="top">

        <div align="center">
        <table border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td align="right"><?php 
    echo _JOINED;
    ?>
:&nbsp;</td>
            <td><strong><?php 
    echo date(_DATETIMEFORMAT, $time_created);
    ?>
</strong></td>
        </tr>
        <tr>
            <td colspan="2" align="center">&nbsp;</td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _UPLOADPARTICIPATION;
    ?>
:&nbsp;</td>
            <td>
                <table width="200" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td background="themes/<?php 
    echo $cfg["theme"];
    ?>
/images/proglass.gif" width="<?php 
    echo $user_percent * 2;
    ?>
"><img src="images/blank.gif" width="1" height="12" border="0"></td>
                    <td background="themes/<?php 
    echo $cfg["theme"];
    ?>
/images/noglass.gif" width="<?php 
    echo 200 - $user_percent * 2;
    ?>
"><img src="images/blank.gif" width="1" height="12" border="0"></td>
                </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _UPLOADS;
    ?>
:&nbsp;</td>
            <td><strong><?php 
    echo $user_activity;
    ?>
</strong></td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _PERCENTPARTICIPATION;
    ?>
:&nbsp;</td>
            <td><strong><?php 
    echo $user_percent;
    ?>
%</strong></td>
        </tr>
        <tr>
            <td colspan="2" align="center"><div align="center" class="tiny">(<?php 
    echo _PARTICIPATIONSTATEMENT . " " . $cfg['days_to_keep'] . " " . _DAYS;
    ?>
)</div><br></td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _TOTALPAGEVIEWS;
    ?>
:&nbsp;</td>
            <td><strong><?php 
    echo $hits;
    ?>
</strong></td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _USERTYPE;
    ?>
:&nbsp;</td>
            <td><strong><?php 
    echo $user_type;
    ?>
</strong></td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <table>
                    <tr>
                        <td align="center">
                            <BR />[ <a href="?op=showCookies">Cookie Management</a> ]
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        </table>
        </div>

        </td>
        <td valign="top">
        <div align="center">
        <table cellpadding="5" cellspacing="0" border="0">
        <form name="theForm" action="profile.php?op=updateProfile" method="post" onsubmit="return validateProfile()">
        <tr>
            <td align="right"><?php 
    echo _USER;
    ?>
:</td>
            <td>
            <input readonly="true" type="Text" value="<?php 
    echo $cfg["user"];
    ?>
" size="15">
            </td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _NEWPASSWORD;
    ?>
:</td>
            <td>
            <input name="pass1" type="Password" value="" size="15">
            </td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _CONFIRMPASSWORD;
    ?>
:</td>
            <td>
            <input name="pass2" type="Password" value="" size="15">
            </td>
        </tr>
        <tr>
            <td align="right"><?php 
    echo _THEME;
    ?>
:</td>
            <td>
            <select name="theme">
<?php 
    $arThemes = GetThemes();
    for ($inx = 0; $inx < sizeof($arThemes); $inx++) {
        $selected = "";
        if ($cfg["theme"] == $arThemes[$inx]) {
            $selected = "selected";
        }
        echo "<option value=\"" . $arThemes[$inx] . "\" " . $selected . ">" . $arThemes[$inx] . "</option>";
    }
    ?>
            </select>
            </td>
        </tr>
                <tr>
            <td align="right"><?php 
    echo _LANGUAGE;
    ?>
:</td>
            <td>
            <select name="language">
<?php 
    $arLanguage = GetLanguages();
    for ($inx = 0; $inx < sizeof($arLanguage); $inx++) {
        $selected = "";
        if ($cfg["language_file"] == $arLanguage[$inx]) {
            $selected = "selected";
        }
        echo "<option value=\"" . $arLanguage[$inx] . "\" " . $selected . ">" . GetLanguageFromFile($arLanguage[$inx]) . "</option>";
    }
    ?>
            </select>
            </td>
        </tr>
        <tr>
            <td colspan="2">
            <input name="hideOffline" type="Checkbox" value="1" <?php 
    echo $hideChecked;
    ?>
> <?php 
    echo _HIDEOFFLINEUSERS;
    ?>
<br>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="2">
            <input type="Submit" value="<?php 
    echo _UPDATE;
    ?>
">
            </td>
        </tr>
        </form>
        </table>
        </div>
        </td>
    </tr>
    </table>


    <script language="JavaScript">
    function validateProfile()
    {
        var msg = ""
        if (theForm.pass1.value != "" || theForm.pass2.value != "")
        {
            if (theForm.pass1.value.length <= 5 || theForm.pass2.value.length <= 5)
            {
                msg = msg + "* <?php 
    echo _PASSWORDLENGTH;
    ?>
\n";
                theForm.pass1.focus();
            }
            if (theForm.pass1.value != theForm.pass2.value)
            {
                msg = msg + "* <?php 
    echo _PASSWORDNOTMATCH;
    ?>
\n";
                theForm.pass1.value = "";
                theForm.pass2.value = "";
                theForm.pass1.focus();
            }
        }

        if (msg != "")
        {
            alert("<?php 
    echo _PLEASECHECKFOLLOWING;
    ?>
:\n\n" + msg);
            return false;
        }
        else
        {
            return true;
        }
    }
    </script>

<?php 
    echo "</td></tr>";
    echo "</table></div><br><br>";
    DisplayFoot();
}