當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Users::user_info方法代碼示例

本文整理匯總了PHP中Users::user_info方法的典型用法代碼示例。如果您正苦於以下問題:PHP Users::user_info方法的具體用法?PHP Users::user_info怎麽用?PHP Users::user_info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Users的用法示例。


在下文中一共展示了Users::user_info方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_permissions_for_user

    /**
     * Get a user's permissions.
     *
     * @param $UserID
     * @param array|false $CustomPermissions
     *	Pass in the user's custom permissions if you already have them.
     *	Leave false if you don't have their permissions. The function will fetch them.
     * @return array Mapping of PermissionName=>bool/int
     */
    public static function get_permissions_for_user($UserID, $CustomPermissions = false)
    {
        $UserInfo = Users::user_info($UserID);
        // Fetch custom permissions if they weren't passed in.
        if ($CustomPermissions === false) {
            $QueryID = G::$DB->get_query_id();
            G::$DB->query('
				SELECT CustomPermissions
				FROM users_main
				WHERE ID = ' . (int) $UserID);
            list($CustomPermissions) = G::$DB->next_record(MYSQLI_NUM, false);
            G::$DB->set_query_id($QueryID);
        }
        if (!empty($CustomPermissions) && !is_array($CustomPermissions)) {
            $CustomPermissions = unserialize($CustomPermissions);
        }
        $Permissions = self::get_permissions($UserInfo['PermissionID']);
        // Manage 'special' inherited permissions
        $BonusPerms = array();
        $BonusCollages = 0;
        foreach ($UserInfo['ExtraClasses'] as $PermID => $Value) {
            $ClassPerms = self::get_permissions($PermID);
            $BonusCollages += $ClassPerms['Permissions']['MaxCollages'];
            unset($ClassPerms['Permissions']['MaxCollages']);
            $BonusPerms = array_merge($BonusPerms, $ClassPerms['Permissions']);
        }
        if (empty($CustomPermissions)) {
            $CustomPermissions = array();
        }
        // This is legacy donor cruft
        if ($UserInfo['Donor']) {
            $DonorPerms = self::get_permissions(DONOR);
            unset($DonorPerms['Permissions']['MaxCollages']);
        } else {
            $DonorPerms = array('Permissions' => array());
        }
        $MaxCollages = $Permissions['Permissions']['MaxCollages'] + $BonusCollages;
        if (isset($CustomPermissions['MaxCollages'])) {
            $MaxCollages += $CustomPermissions['MaxCollages'];
            unset($CustomPermissions['MaxCollages']);
        }
        $Permissions['Permissions']['MaxCollages'] = $MaxCollages;
        // Combine the permissions
        return array_merge($Permissions['Permissions'], $BonusPerms, $CustomPermissions, $DonorPerms['Permissions']);
    }
開發者ID:Moscarda,項目名稱:Gazelle,代碼行數:54,代碼來源:permissions.class.php

示例2: json_die

<?php

if (empty($_GET['id']) || !is_number($_GET['id'])) {
    json_die("failure");
}
list($NumComments, $Page, $Thread) = Comments::load('torrents', (int) $_GET['id'], false);
//---------- Begin printing
$JsonComments = array();
foreach ($Thread as $Key => $Post) {
    list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
    list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
    $JsonComments[] = array('postId' => (int) $PostID, 'addedTime' => $AddedTime, 'bbBody' => $Body, 'body' => Text::full_format($Body), 'editedUserId' => (int) $EditedUserID, 'editedTime' => $EditedTime, 'editedUsername' => $EditedUsername, 'userinfo' => array('authorId' => (int) $AuthorID, 'authorName' => $Username, 'artist' => $Artist == 1, 'donor' => $Donor == 1, 'warned' => $Warned != '0000-00-00 00:00:00', 'avatar' => $Avatar, 'enabled' => $Enabled == 2 ? false : true, 'userTitle' => $UserTitle));
}
json_die("success", array('page' => (int) $Page, 'pages' => ceil($NumComments / TORRENT_COMMENTS_PER_PAGE), 'comments' => $JsonComments));
開發者ID:karamanolev,項目名稱:Gazelle,代碼行數:14,代碼來源:tcomments.php

示例3: array

            $Percent = $Votes[$i] / $TotalVotes;
        } else {
            $Ratio = 0;
            $Percent = 0;
        }
        $JsonPollAnswers[] = array('answer' => $Answer, 'ratio' => $Ratio, 'percent' => $Percent);
    }
    if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || $LoggedUser['Class'] < $Forums[$ForumID]['MinClassWrite']) {
        $JsonPoll['voted'] = True;
    } else {
        $JsonPoll['voted'] = False;
    }
    $JsonPoll['answers'] = $JsonPollAnswers;
}
//Sqeeze in stickypost
if ($ThreadInfo['StickyPostID']) {
    if ($ThreadInfo['StickyPostID'] != $Thread[0]['ID']) {
        array_unshift($Thread, $ThreadInfo['StickyPost']);
    }
    if ($ThreadInfo['StickyPostID'] != $Thread[count($Thread) - 1]['ID']) {
        $Thread[] = $ThreadInfo['StickyPost'];
    }
}
$JsonPosts = array();
foreach ($Thread as $Key => $Post) {
    list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime) = array_values($Post);
    list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
    $UserInfo = Users::user_info($EditedUserID);
    $JsonPosts[] = array('postId' => (int) $PostID, 'addedTime' => $AddedTime, 'bbBody' => $Body, 'body' => Text::full_format($Body), 'editedUserId' => (int) $EditedUserID, 'editedTime' => $EditedTime, 'editedUsername' => $UserInfo['Username'], 'author' => array('authorId' => (int) $AuthorID, 'authorName' => $Username, 'paranoia' => $Paranoia, 'artist' => $Artist === '1', 'donor' => $Donor === '1', 'warned' => $Warned !== '0000-00-00 00:00:00', 'avatar' => $Avatar, 'enabled' => $Enabled === '2' ? false : true, 'userTitle' => $UserTitle));
}
print json_encode(array('status' => 'success', 'response' => array('forumId' => (int) $ForumID, 'forumName' => $Forums[$ForumID]['Name'], 'threadId' => (int) $ThreadID, 'threadTitle' => display_str($ThreadInfo['Title']), 'subscribed' => in_array($ThreadID, $UserSubscriptions), 'locked' => $ThreadInfo['IsLocked'] == 1, 'sticky' => $ThreadInfo['IsSticky'] == 1, 'currentPage' => (int) $Page, 'pages' => ceil($ThreadInfo['Posts'] / $PerPage), 'poll' => empty($JsonPoll) ? null : $JsonPoll, 'posts' => $JsonPosts)));
開發者ID:Kufirc,項目名稱:Gazelle,代碼行數:31,代碼來源:thread.php

示例4: render_comment

    /**
     * Render one comment
     * @param int $AuthorID
     * @param int $PostID
     * @param string $Body
     * @param string $AddedTime
     * @param int $EditedUserID
     * @param string $EditedTime
     * @param string $Link The link to the post elsewhere on the site
     * @param string $Header The header used in the post
     * @param bool $Tools Whether or not to show [Edit], [Report] etc.
     * @todo Find a better way to pass the page (artist, collages, requests, torrents) to this function than extracting it from $Link
     */
    function render_comment($AuthorID, $PostID, $Body, $AddedTime, $EditedUserID, $EditedTime, $Link, $Unread = false, $Header = '', $Tools = true)
    {
        $UserInfo = Users::user_info($AuthorID);
        $Header = '<strong>' . Users::format_username($AuthorID, true, true, true, true, false) . '</strong> ' . time_diff($AddedTime) . $Header;
        ?>
		<table class="forum_post box vertical_margin<?php 
        echo (!Users::has_avatars_enabled() ? ' noavatar' : '') . ($Unread ? ' forum_unread' : '');
        ?>
" id="post<?php 
        echo $PostID;
        ?>
">
			<colgroup>
<?php 
        if (Users::has_avatars_enabled()) {
            ?>
				<col class="col_avatar" />
<?php 
        }
        ?>
				<col class="col_post_body" />
			</colgroup>
			<tr class="colhead_dark">
				<td colspan="<?php 
        echo Users::has_avatars_enabled() ? 2 : 1;
        ?>
">
					<div style="float: left;"><a class="post_id" href="<?php 
        echo $Link;
        ?>
">#<?php 
        echo $PostID;
        ?>
</a>
						<?php 
        echo $Header;
        if ($Tools) {
            ?>
						- <a href="#quickpost" onclick="Quote('<?php 
            echo $PostID;
            ?>
','<?php 
            echo $UserInfo['Username'];
            ?>
', true);" class="brackets">Quote</a>
<?php 
            if ($AuthorID == G::$LoggedUser['ID'] || check_perms('site_moderate_forums')) {
                ?>
						- <a href="#post<?php 
                echo $PostID;
                ?>
" onclick="Edit_Form('<?php 
                echo $PostID;
                ?>
','<?php 
                echo $Key;
                ?>
');" class="brackets">Edit</a>
<?php 
            }
            if (check_perms('site_moderate_forums')) {
                ?>
						- <a href="#post<?php 
                echo $PostID;
                ?>
" onclick="Delete('<?php 
                echo $PostID;
                ?>
');" class="brackets">Delete</a>
<?php 
            }
            ?>
					</div>
					<div id="bar<?php 
            echo $PostID;
            ?>
" style="float: right;">
						<a href="reports.php?action=report&amp;type=comment&amp;id=<?php 
            echo $PostID;
            ?>
" class="brackets">Report</a>
<?php 
            if (check_perms('users_warn') && $AuthorID != G::$LoggedUser['ID'] && G::$LoggedUser['Class'] >= $UserInfo['Class']) {
                ?>
						<form class="manage_form hidden" name="user" id="warn<?php 
                echo $PostID;
                ?>
//.........這裏部分代碼省略.........
開發者ID:Kufirc,項目名稱:Gazelle,代碼行數:101,代碼來源:commentsview.class.php

示例5:

<?php 
        }
    }
    ?>
			</div>
			<div id="bar<?php 
    echo $PostID;
    ?>
" style="float: right;">
				<a href="reports.php?action=report&amp;type=post&amp;id=<?php 
    echo $PostID;
    ?>
" class="brackets">Report</a>
<?php 
    if (check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
        $AuthorInfo = Users::user_info($AuthorID);
        if ($LoggedUser['Class'] >= $AuthorInfo['Class']) {
            ?>
				<form class="manage_form hidden" name="user" id="warn<?php 
            echo $PostID;
            ?>
" action="" method="post">
					<input type="hidden" name="action" value="warn" />
					<input type="hidden" name="postid" value="<?php 
            echo $PostID;
            ?>
" />
					<input type="hidden" name="userid" value="<?php 
            echo $AuthorID;
            ?>
" />
開發者ID:mohirt,項目名稱:Gazelle,代碼行數:31,代碼來源:thread.php

示例6: error

        error(403);
    }
} elseif ($ConvID = (int) $_POST['convid']) {
    // Staff (via AJAX), get current assign of conversation
    $DB->query("\n\t\tSELECT Level, AssignedToUser\n\t\tFROM staff_pm_conversations\n\t\tWHERE ID = {$ConvID}");
    list($Level, $AssignedToUser) = $DB->next_record();
    $LevelCap = 1000;
    if ($LoggedUser['EffectiveClass'] >= min($Level, $LevelCap) || $AssignedToUser == $LoggedUser['ID']) {
        // Staff member is allowed to assign conversation, assign
        list($LevelType, $NewLevel) = explode('_', db_string($_POST['assign']));
        if ($LevelType == 'class') {
            // Assign to class
            $DB->query("\n\t\t\t\tUPDATE staff_pm_conversations\n\t\t\t\tSET Status = 'Unanswered',\n\t\t\t\t\tLevel = {$NewLevel},\n\t\t\t\t\tAssignedToUser = NULL\n\t\t\t\tWHERE ID = {$ConvID}");
            $Cache->delete_value("num_staff_pms_{$LoggedUser['ID']}");
        } else {
            $UserInfo = Users::user_info($NewLevel);
            $Level = $Classes[$UserInfo['PermissionID']]['Level'];
            if (!$Level) {
                error('Assign to user not found.');
            }
            // Assign to user
            $DB->query("\n\t\t\t\tUPDATE staff_pm_conversations\n\t\t\t\tSET Status = 'Unanswered',\n\t\t\t\t\tAssignedToUser = {$NewLevel},\n\t\t\t\t\tLevel = {$Level}\n\t\t\t\tWHERE ID = {$ConvID}");
            $Cache->delete_value("num_staff_pms_{$LoggedUser['ID']}");
        }
        echo '1';
    } else {
        // Staff member is not allowed to assign conversation
        echo '-1';
    }
} else {
    // No ID
開發者ID:Atmos01,項目名稱:Gazelle,代碼行數:31,代碼來源:assign.php

示例7: authorize

    authorize();
    $DB->query("\n\t\tDELETE FROM users_sessions\n\t\tWHERE UserID = '{$UserID}'\n\t\t\tAND SessionID != '{$SessionID}'");
    $Cache->delete_value("users_sessions_{$UserID}");
}
if (isset($_POST['session'])) {
    authorize();
    $DB->query("\n\t\tDELETE FROM users_sessions\n\t\tWHERE UserID = '{$UserID}'\n\t\t\tAND SessionID = '" . db_string($_POST['session']) . "'");
    $Cache->delete_value("users_sessions_{$UserID}");
}
$UserSessions = $Cache->get_value('users_sessions_' . $UserID);
if (!is_array($UserSessions)) {
    $DB->query("\n\t\tSELECT\n\t\t\tSessionID,\n\t\t\tBrowser,\n\t\t\tOperatingSystem,\n\t\t\tIP,\n\t\t\tLastUpdate\n\t\tFROM users_sessions\n\t\tWHERE UserID = '{$UserID}'\n\t\tORDER BY LastUpdate DESC");
    $UserSessions = $DB->to_array('SessionID', MYSQLI_ASSOC);
    $Cache->cache_value("users_sessions_{$UserID}", $UserSessions, 0);
}
list($UserID, $Username) = array_values(Users::user_info($UserID));
View::show_header($Username . ' &gt; Sessions');
?>
<div class="thin">
<h2><?php 
echo Users::format_username($UserID, $Username);
?>
 &gt; Sessions</h2>
	<div class="box pad">
		<p>Note: Clearing cookies can result in ghost sessions which are automatically removed after 30 days.</p>
	</div>
	<div class="box pad">
		<table cellpadding="5" cellspacing="1" border="0" class="session_table border" width="100%">
			<tr class="colhead">
				<td class="nobr"><strong>IP address</strong></td>
				<td><strong>Browser</strong></td>
開發者ID:Kufirc,項目名稱:Gazelle,代碼行數:31,代碼來源:sessions.php

示例8: user_dupes_table

function user_dupes_table($UserID)
{
    global $DB, $LoggedUser;
    if (!check_perms('users_mod')) {
        error(403);
    }
    if (!is_number($UserID)) {
        error(403);
    }
    $DB->query("\n\t\tSELECT d.ID, d.Comments, SHA1(d.Comments) AS CommentHash\n\t\tFROM dupe_groups AS d\n\t\t\tJOIN users_dupes AS u ON u.GroupID = d.ID\n\t\tWHERE u.UserID = {$UserID}");
    if (list($GroupID, $Comments, $CommentHash) = $DB->next_record()) {
        $DB->query("\n\t\t\tSELECT m.ID\n\t\t\tFROM users_main AS m\n\t\t\t\tJOIN users_dupes AS d ON m.ID = d.UserID\n\t\t\tWHERE d.GroupID = {$GroupID}\n\t\t\tORDER BY m.ID ASC");
        $DupeCount = $DB->record_count();
        $Dupes = $DB->to_array();
    } else {
        $DupeCount = 0;
        $Dupes = array();
    }
    ?>
		<form class="manage_form" name="user" method="post" id="linkedform" action="">
			<input type="hidden" name="action" value="dupes" />
			<input type="hidden" name="dupeaction" value="update" />
			<input type="hidden" name="userid" value="<?php 
    echo $UserID;
    ?>
" />
			<input type="hidden" id="auth" name="auth" value="<?php 
    echo $LoggedUser['AuthKey'];
    ?>
" />
			<input type="hidden" id="form_comment_hash" name="form_comment_hash" value="<?php 
    echo $CommentHash;
    ?>
" />
			<div class="box box2" id="l_a_box">
				<div class="head">
					Linked Accounts (<?php 
    echo max($DupeCount - 1, 0);
    ?>
) <a href="#" onclick="$('.linkedaccounts').gtoggle(); return false;" class="brackets">View</a>
				</div>
				<table width="100%" class="layout hidden linkedaccounts">
					<?php 
    echo $DupeCount ? "<tr>\n" : '';
    $i = 0;
    foreach ($Dupes as $Dupe) {
        $i++;
        list($DupeID) = $Dupe;
        $DupeInfo = Users::user_info($DupeID);
        ?>
						<td align="left"><?php 
        echo Users::format_username($DupeID, true, true, true, true);
        ?>
							<a href="user.php?action=dupes&amp;dupeaction=remove&amp;auth=<?php 
        echo $LoggedUser['AuthKey'];
        ?>
&amp;userid=<?php 
        echo $UserID;
        ?>
&amp;removeid=<?php 
        echo $DupeID;
        ?>
" onclick="return confirm('Are you sure you wish to remove <?php 
        echo $DupeInfo['Username'];
        ?>
 from this group?');" class="brackets tooltip" title="Remove linked account">X</a>
						</td>
<?php 
        if ($i == 4) {
            $i = 0;
            echo "\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n";
        }
    }
    if ($DupeCount) {
        if ($i !== 0) {
            for ($j = $i; $j < 4; $j++) {
                echo "\t\t\t\t\t\t<td>&nbsp;</td>\n";
            }
        }
        ?>
					</tr>
<?php 
    }
    ?>
					<tr>
						<td colspan="5" align="left" style="border-top: thin solid;"><strong>Comments:</strong></td>
					</tr>
					<tr>
						<td colspan="5" align="left">
							<div id="dupecomments" class="<?php 
    echo $DupeCount ? '' : 'hidden';
    ?>
"><?php 
    echo Text::full_format($Comments);
    ?>
</div>
							<div id="editdupecomments" class="<?php 
    echo $DupeCount ? 'hidden' : '';
    ?>
">
//.........這裏部分代碼省略.........
開發者ID:Kufirc,項目名稱:Gazelle,代碼行數:101,代碼來源:linkedfunctions.php

示例9: array

$ArtistForm = Artists::get_artist($GroupID);
if ($TorrentDetails['CategoryID'] == 0) {
    $CategoryName = "Unknown";
} else {
    $CategoryName = $Categories[$TorrentDetails['CategoryID'] - 1];
}
$JsonMusicInfo = array();
if ($CategoryName == "Music") {
    $JsonMusicInfo = array('composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]), 'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]), 'artists' => $ArtistForm[1] == null ? array() : pullmediainfo($ArtistForm[1]), 'with' => $ArtistForm[2] == null ? array() : pullmediainfo($ArtistForm[2]), 'conductor' => $ArtistForm[5] == null ? array() : pullmediainfo($ArtistForm[5]), 'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]), 'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7]));
} else {
    $JsonMusicInfo = null;
}
$TagList = explode('|', $TorrentDetails['GROUP_CONCAT(DISTINCT tags.Name SEPARATOR \'|\')']);
$JsonTorrentDetails = array('wikiBody' => Text::full_format($TorrentDetails['WikiBody']), 'wikiImage' => $TorrentDetails['WikiImage'], 'id' => (int) $TorrentDetails['ID'], 'name' => $TorrentDetails['Name'], 'year' => (int) $TorrentDetails['Year'], 'recordLabel' => $TorrentDetails['RecordLabel'], 'catalogueNumber' => $TorrentDetails['CatalogueNumber'], 'releaseType' => (int) $TorrentDetails['ReleaseType'], 'categoryId' => (int) $TorrentDetails['CategoryID'], 'categoryName' => $CategoryName, 'time' => $TorrentDetails['Time'], 'vanityHouse' => $TorrentDetails['VanityHouse'] == 1, 'isBookmarked' => Bookmarks::has_bookmarked('torrent', $GroupID), 'musicInfo' => $JsonMusicInfo, 'tags' => $TagList);
$Torrent = $TorrentList[$TorrentID];
$Reports = Torrents::get_reports($TorrentID);
if (count($Reports) > 0) {
    $Torrent['Reported'] = true;
} else {
    $Torrent['Reported'] = false;
}
// Convert file list back to the old format
$FileList = explode("\n", $Torrent['FileList']);
foreach ($FileList as &$File) {
    $File = Torrents::filelist_old_format($File);
}
unset($File);
$FileList = implode('|||', $FileList);
$Userinfo = Users::user_info($Torrent['UserID']);
$JsonTorrentList[] = array('id' => (int) $Torrent['ID'], 'infoHash' => $Torrent['InfoHash'], 'media' => $Torrent['Media'], 'format' => $Torrent['Format'], 'encoding' => $Torrent['Encoding'], 'remastered' => $Torrent['Remastered'] == 1, 'remasterYear' => (int) $Torrent['RemasterYear'], 'remasterTitle' => $Torrent['RemasterTitle'], 'remasterRecordLabel' => $Torrent['RemasterRecordLabel'], 'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'], 'scene' => $Torrent['Scene'] == 1, 'hasLog' => $Torrent['HasLog'] == 1, 'hasCue' => $Torrent['HasCue'] == 1, 'logScore' => (int) $Torrent['LogScore'], 'fileCount' => (int) $Torrent['FileCount'], 'size' => (int) $Torrent['Size'], 'seeders' => (int) $Torrent['Seeders'], 'leechers' => (int) $Torrent['Leechers'], 'snatched' => (int) $Torrent['Snatched'], 'freeTorrent' => $Torrent['FreeTorrent'] == 1, 'reported' => $Torrent['Reported'], 'time' => $Torrent['Time'], 'description' => $Torrent['Description'], 'fileList' => $FileList, 'filePath' => $Torrent['FilePath'], 'userId' => (int) $Torrent['UserID'], 'username' => $Userinfo['Username']);
json_print("success", array('group' => $JsonTorrentDetails, 'torrent' => array_pop($JsonTorrentList)));
開發者ID:Kufirc,項目名稱:Gazelle,代碼行數:31,代碼來源:torrent.php

示例10: array

$JsonCategory = array();
$JsonForums = array();
foreach ($Forums as $Forum) {
    list($ForumID, $CategoryID, $ForumName, $ForumDescription, $MinRead, $MinWrite, $MinCreate, $NumTopics, $NumPosts, $LastPostID, $LastAuthorID, $LastTopicID, $LastTime, $SpecificRules, $LastTopic, $Locked, $Sticky) = array_values($Forum);
    if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead > $LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== false)) {
        continue;
    }
    $ForumDescription = display_str($ForumDescription);
    if ($CategoryID != $LastCategoryID) {
        if (!empty($JsonForums) && !empty($JsonCategory)) {
            $JsonCategory['forums'] = $JsonForums;
            $JsonCategories[] = $JsonCategory;
        }
        $LastCategoryID = $CategoryID;
        $JsonCategory = array('categoryID' => (int) $CategoryID, 'categoryName' => $ForumCats[$CategoryID]);
        $JsonForums = array();
    }
    if ((!$Locked || $Sticky) && $LastPostID != 0 && ((empty($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastPostID) && strtotime($LastTime) > $LoggedUser['CatchupTime'])) {
        $Read = 'unread';
    } else {
        $Read = 'read';
    }
    $UserInfo = Users::user_info($LastAuthorID);
    $JsonForums[] = array('forumId' => (int) $ForumID, 'forumName' => $ForumName, 'forumDescription' => $ForumDescription, 'numTopics' => (double) $NumTopics, 'numPosts' => (double) $NumPosts, 'lastPostId' => (double) $LastPostID, 'lastAuthorId' => (double) $LastAuthorID, 'lastPostAuthorName' => $UserInfo['Username'], 'lastTopicId' => (double) $LastTopicID, 'lastTime' => $LastTime, 'specificRules' => $SpecificRules, 'lastTopic' => display_str($LastTopic), 'read' => $Read == 1, 'locked' => $Locked == 1, 'sticky' => $Sticky == 1);
}
// ...And an extra one to catch the last category.
if (!empty($JsonForums) && !empty($JsonCategory)) {
    $JsonCategory['forums'] = $JsonForums;
    $JsonCategories[] = $JsonCategory;
}
print json_encode(array('status' => 'success', 'response' => array('categories' => $JsonCategories)));
開發者ID:Kufirc,項目名稱:Gazelle,代碼行數:31,代碼來源:main.php

示例11: foreach

    $Users = $DB->to_array();
    foreach ($Users as $User) {
        $UserID = $User['uid'];
        $DB->query("\n\t\t\tSELECT UserID\n\t\t\tFROM top_snatchers\n\t\t\tWHERE UserID = '{$UserID}'");
        if ($DB->has_results()) {
            continue;
        }
        $UserInfo = Users::user_info($UserID);
        $Username = $UserInfo['Username'];
        $TimeStamp = $User['tstamp'];
        $Request = "Hi {$Username},\n\nThe user [url=" . site_url() . "user.php?id={$LoggedUser['ID']}]{$LoggedUser['Username']}[/url] has requested a re-seed for the torrent [url=" . site_url() . "torrents.php?id={$GroupID}&torrentid={$TorrentID}]{$Name}[/url], which you snatched on " . date('M d Y', $TimeStamp) . ". The torrent is now un-seeded, and we need your help to resurrect it!\n\nThe exact process for re-seeding a torrent is slightly different for each client, but the concept is the same. The idea is to download the torrent file and open it in your client, and point your client to the location where the data files are, then initiate a hash check.\n\nThanks!";
        Misc::send_pm($UserID, 0, "Re-seed request for torrent {$Name}", $Request);
    }
    $NumUsers = count($Users);
} else {
    $UserInfo = Users::user_info($UploaderID);
    $Username = $UserInfo['Username'];
    $Request = "Hi {$Username},\n\nThe user [url=" . site_url() . "user.php?id={$LoggedUser['ID']}]{$LoggedUser['Username']}[/url] has requested a re-seed for the torrent [url=" . site_url() . "torrents.php?id={$GroupID}&torrentid={$TorrentID}]{$Name}[/url], which you uploaded on " . date('M d Y', strtotime($UploadedTime)) . ". The torrent is now un-seeded, and we need your help to resurrect it!\n\nThe exact process for re-seeding a torrent is slightly different for each client, but the concept is the same. The idea is to download the torrent file and open it in your client, and point your client to the location where the data files are, then initiate a hash check.\n\nThanks!";
    Misc::send_pm($UploaderID, 0, "Re-seed request for torrent {$Name}", $Request);
    $NumUsers = 1;
}
View::show_header();
?>
<div class="thin">
	<div class="header">
		<h2>Successfully sent re-seed request</h2>
	</div>
	<div class="box pad thin">
		<p style="color: black;">Successfully sent re-seed request for torrent <a href="torrents.php?id=<?php 
echo $GroupID;
?>
開發者ID:Kufirc,項目名稱:Gazelle,代碼行數:31,代碼來源:reseed.php

示例12: error

<?php

//TODO: Redo HTML
if (!check_perms('admin_manage_permissions')) {
    error(403);
}
if (!isset($_REQUEST['userid']) || !is_number($_REQUEST['userid'])) {
    error(404);
}
include SERVER_ROOT . "/classes/permissions_form.php";
list($UserID, $Username, $PermissionID) = array_values(Users::user_info($_REQUEST['userid']));
$DB->query("\n\tSELECT CustomPermissions\n\tFROM users_main\n\tWHERE ID = '{$UserID}'");
list($Customs) = $DB->next_record(MYSQLI_NUM, false);
$Defaults = Permissions::get_permissions_for_user($UserID, array());
$Delta = array();
if (isset($_POST['action'])) {
    authorize();
    foreach ($PermissionsArray as $Perm => $Explaination) {
        $Setting = isset($_POST["perm_{$Perm}"]) ? 1 : 0;
        $Default = isset($Defaults[$Perm]) ? 1 : 0;
        if ($Setting != $Default) {
            $Delta[$Perm] = $Setting;
        }
    }
    if (!is_number($_POST['maxcollages']) && !empty($_POST['maxcollages'])) {
        error("Please enter a valid number of extra personal collages");
    }
    $Delta['MaxCollages'] = $_POST['maxcollages'];
    $Cache->begin_transaction("user_info_heavy_{$UserID}");
    $Cache->update_row(false, array('CustomPermissions' => $Delta));
    $Cache->commit_transaction(0);
開發者ID:Kufirc,項目名稱:Gazelle,代碼行數:31,代碼來源:permissions.php

示例13: error

<?php

if (!check_perms('users_mod')) {
    error(403);
}
if (isset($_GET['userid']) && is_number($_GET['userid'])) {
    $UserHeavyInfo = Users::user_heavy_info($_GET['userid']);
    if (isset($UserHeavyInfo['torrent_pass'])) {
        $TorrentPass = $UserHeavyInfo['torrent_pass'];
        $UserPeerStats = Tracker::user_peer_count($TorrentPass);
        $UserInfo = Users::user_info($_GET['userid']);
        $UserLevel = $Classes[$UserInfo['PermissionID']]['Level'];
        if (!check_paranoia('leeching+', $UserInfo['Paranoia'], $UserLevel, $_GET['userid'])) {
            $UserPeerStats[0] = false;
        }
        if (!check_paranoia('seeding+', $UserInfo['Paranoia'], $UserLevel, $_GET['userid'])) {
            $UserPeerStats[1] = false;
        }
    } else {
        $UserPeerStats = false;
    }
} else {
    $MainStats = Tracker::info();
}
View::show_header('Tracker info');
?>
<div class="thin">
	<div class="header">
		<h2>Tracker info</h2>
	</div>
	<div class="linkbox">
開發者ID:Kufirc,項目名稱:Gazelle,代碼行數:31,代碼來源:ocelot_info.php

示例14: foreach

	<table style="table-layout: fixed; width: 100%;">
		<tr class="colhead">
			<td>Username</td>
			<td>Rank</td>
			<td>Hidden</td>
			<td>Last Donated</td>
			<td>Icon Text</td>
			<td>Icon</td>
			<td>Icon Link</td>
			<td>Avatar Text</td>
			<td>Second Avatar</td>
		</tr>
<?php 
$Row = 'b';
foreach ($Users as $User) {
    $UserInfo = Users::user_info($User['UserID']);
    $Username = $UserInfo['Username'];
    ?>
		<tr class="row<?php 
    echo $Row;
    ?>
">
			<td><?php 
    echo Users::format_username($User['UserID'], false, true, true, false, false, true);
    ?>
</td>
			<td><?php 
    echo $User['Rank'];
    ?>
</td>
			<td><?php 
開發者ID:Kufirc,項目名稱:Gazelle,代碼行數:31,代碼來源:donor_rewards.php

示例15: list

     $DB->query("\n\t\t\tSELECT Enabled\n\t\t\tFROM users_main\n\t\t\tWHERE ID = '{$LoggedUser['ID']}'");
     list($Enabled) = $DB->next_record();
     $Cache->cache_value('enabled_' . $LoggedUser['ID'], $Enabled, 0);
 }
 if ($Enabled == 2) {
     logout();
 }
 // Up/Down stats
 $UserStats = $Cache->get_value('user_stats_' . $LoggedUser['ID']);
 if (!is_array($UserStats)) {
     $DB->query("\n\t\t\tSELECT Uploaded AS BytesUploaded, Downloaded AS BytesDownloaded, RequiredRatio\n\t\t\tFROM users_main\n\t\t\tWHERE ID = '{$LoggedUser['ID']}'");
     $UserStats = $DB->next_record(MYSQLI_ASSOC);
     $Cache->cache_value('user_stats_' . $LoggedUser['ID'], $UserStats, 3600);
 }
 // Get info such as username
 $LightInfo = Users::user_info($LoggedUser['ID']);
 $HeavyInfo = Users::user_heavy_info($LoggedUser['ID']);
 // Create LoggedUser array
 $LoggedUser = array_merge($HeavyInfo, $LightInfo, $UserStats);
 $LoggedUser['RSS_Auth'] = md5($LoggedUser['ID'] . RSS_HASH . $LoggedUser['torrent_pass']);
 // $LoggedUser['RatioWatch'] as a bool to disable things for users on Ratio Watch
 $LoggedUser['RatioWatch'] = $LoggedUser['RatioWatchEnds'] != '0000-00-00 00:00:00' && time() < strtotime($LoggedUser['RatioWatchEnds']) && $LoggedUser['BytesDownloaded'] * $LoggedUser['RequiredRatio'] > $LoggedUser['BytesUploaded'];
 // Load in the permissions
 $LoggedUser['Permissions'] = Permissions::get_permissions_for_user($LoggedUser['ID'], $LoggedUser['CustomPermissions']);
 $LoggedUser['Permissions']['MaxCollages'] += Donations::get_personal_collages($LoggedUser['ID']);
 // Change necessary triggers in external components
 $Cache->CanClear = check_perms('admin_clear_cache');
 // Because we <3 our staff
 if (check_perms('site_disable_ip_history')) {
     $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
 }
開發者ID:karamanolev,項目名稱:Gazelle,代碼行數:31,代碼來源:script_start.php


注:本文中的Users::user_info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。