Exemplo n.º 1
0
function show_picture_option($profile)
{
    row1(tra("Picture"));
    $warning = "";
    if (profile_screening() && $profile->has_picture) {
        $warning = offensive_profile_warning($profile->verification);
    }
    if ($profile && $profile->has_picture) {
        echo "\n<tr><td colspan=2>\n<table border=0 cellpadding=5\n<tr>\n<td valign=top><a href=\"" . IMAGE_URL . $profile->userid . '.jpg' . "\"><img src=\"" . IMAGE_URL . $profile->userid . '_sm.jpg' . "\"></a>\n</td>\n<td valign=top>" . tra("%1 Your profile picture is shown to the left.", $warning) . "\n<p>" . tra("To replace it, click the \"Browse\" button and select a JPEG or PNG file (%1 or less).", "50KB") . "<br />\n<input name=picture type=file><br>\n<p>" . tra("To remove it from your profile, check this box:") . "\n<input type=checkbox name=delete_pic>\n<p>\n</td></tr>";
        rowify("<br>");
        end_table();
        echo "</td></tr>";
    } else {
        rowify(tra("If you would like include a picture with your profile, click the \"Browse\" button and select a JPEG or PNG file. Please select images of %1 or less.", "50KB") . "\n<p>\n<input name=picture type=file>\n        ");
        rowify("<br>");
    }
}
Exemplo n.º 2
0
function build_picture_pages($width, $height)
{
    // TODO: Add support for a computer image gallery.
    // TODO: Standardize "Last modified" string to a function call (util.inc).
    if (profile_screening()) {
        $query = "SELECT userid FROM profile WHERE has_picture = 1 AND verification=1 order by userid";
    } else {
        $query = "SELECT userid FROM profile WHERE has_picture = 1 order by userid";
    }
    $result = mysql_query($query);
    $numIds = mysql_num_rows($result);
    //echo "Result has $numIds rows.<br>";
    // Build an array of IDs of all users with pictures in their profiles.
    while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
        $userIds[] = $row[0];
    }
    mysql_free_result($result);
    // don't randomize; makes things hard for people who sift profiles
    //
    //	if (count($userIds) > 0) {
    //		// Randomize the ordering of users.
    //		shuffle($userIds);
    //	}
    $numPages = ceil(count($userIds) / ($width * $height));
    // Make sure that a page is generated even when no profiles with pictures
    // exist in order to avoid 404 errors from the profile_menu page.
    if ($numPages == 0) {
        $numPages = 1;
    }
    //echo "Generating $numPages pages.<br>";
    $count = 0;
    for ($page = 1; $page <= $numPages; $page++) {
        $filename = PROFILE_PATH . "user_gallery_" . $page . ".html";
        open_output_buffer();
        page_head("Profile gallery: page {$page} of {$numPages}", null, null, "../");
        echo "Last updated ", pretty_time_str(time()), "\n<p>Browse the user profiles by picture.\r\n\t\t\tOnly user profiles with pictures are listed here.";
        echo "<table class=bordered border=1 cellpadding=5>\n";
        for ($row = 0; $row < $height; $row++) {
            echo "<tr>";
            for ($col = 0; $col < $width; $col++) {
                if ($count < $numIds) {
                    echo "<td class=\"bordered\" align=\"center\">\r\n\t\t\t\t\t\t<a href=\"" . URL_BASE . "view_profile.php?userid=" . $userIds[$count] . "\"><img src=\"" . URL_BASE . IMAGE_URL . $userIds[$count] . "_sm.jpg\"></a>\r\n\t\t\t\t\t</td>";
                    $count++;
                }
            }
            echo "</tr>\n";
            if ($count == $numIds) {
                break;
            }
        }
        echo "</table>\n";
        // Previous and Next links
        write_page_links("user_gallery", $page, $numPages);
        page_tail(false, "../");
        close_output_buffer($filename);
    }
    //echo "<br><br><a href=\""  .PROFILE_PATH . "user_gallery_1.html\">Go to the first generated page.</a>";
}
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/forum.inc";
require_once "../inc/text_transform.inc";
require_once "../inc/profile.inc";
require_once "../inc/util_ops.inc";
require_once "../project/project.inc";
db_init();
function buttons($i)
{
    echo "\n        <input type=\"radio\" name=\"user{$i}\" value=\"0\"> skip <br>\n        <input type=\"radio\" name=\"user{$i}\" value=\"1\" checked=\"checked\"> accept <br>\n        <input type=\"radio\" name=\"user{$i}\" value=\"-1\"> reject\n    ";
}
admin_page_head("screen profiles");
if (function_exists('profile_screen_query')) {
    $query = profile_screen_query();
} else {
    if (profile_screening()) {
        $query = "select * from profile, user where profile.userid=user.id " . " and has_picture>0 " . " and verification=0 " . " limit 20";
    } else {
        $query = "select * from profile, user where profile.userid=user.id " . " and has_picture>0 " . " and verification=0 " . " and uotd_time is null " . " and expavg_credit>1 " . " and (response1 <> '' or response2 <> '') " . " order by recommend desc limit 20";
    }
}
$result = _mysql_query($query);
$n = 0;
echo "<form action=profile_screen_action.php>\n";
start_table();
$found = false;
while ($profile = _mysql_fetch_object($result)) {
    $found = true;
    echo "<tr><td valign=top>";
    buttons($n);
    echo "\n        <br>Name: {$profile->name}\n        <br>recommends: {$profile->recommend}\n        <br>rejects: {$profile->reject}\n        <br>RAC: {$profile->expavg_credit}\n        <br>\n    ";
function build_picture_pages($width, $height)
{
    print_debug_msg("Beginning to build picture pages...");
    // TODO: Add support for a computer image gallery.
    // TODO: Standardize "Last modified" string to a function call (util.inc).
    if (profile_screening()) {
        $profiles = BoincProfile::enum_fields('userid', 'has_picture = 1 AND verification=1', 'order by userid');
    } else {
        $profiles = BoincProfile::enum_fields('userid', 'has_picture = 1', 'order by userid');
    }
    // Build an array of IDs of all users with pictures in their profiles.
    $userIds = array();
    $numIds = 0;
    foreach ($profiles as $profile) {
        $user = BoincUser::lookup_id($profile->userid);
        if (!$user) {
            continue;
        }
        // maybe we should delete the profile if user is non-existent anymore?
        if ($user->name) {
            $userIds[] = $profile->userid;
            $numIds++;
        }
    }
    $msg = "{$numIds} users have profiles AND uploaded a picture";
    if (profile_screening()) {
        $msg .= " AND were screened by the project";
    }
    print_debug_msg($msg);
    // don't randomize; makes things hard for people who sift profiles
    //
    //    if (count($userIds) > 0) {
    //        // Randomize the ordering of users.
    //        shuffle($userIds);
    //    }
    $numPages = ceil(count($userIds) / ($width * $height));
    // Make sure that a page is generated even when no profiles with pictures
    // exist in order to avoid 404 errors from the profile_menu page.
    if ($numPages == 0) {
        $numPages = 1;
    }
    print_debug_msg("Generating {$numPages} pages");
    $count = 0;
    for ($page = 1; $page <= $numPages; $page++) {
        $filename = PROFILE_PATH . "user_gallery_" . $page . ".html";
        open_output_buffer();
        page_head("Profile gallery: page {$page} of {$numPages}", null, null, "../");
        echo "Last updated ", pretty_time_str(time()), "\n<p>Browse the user profiles by picture.\n            Only user profiles with pictures are listed here.";
        echo "<table class=bordered border=1 cellpadding=5>\n";
        for ($row = 0; $row < $height; $row++) {
            echo "<tr>";
            for ($col = 0; $col < $width; $col++) {
                if ($count < $numIds) {
                    echo "<td class=\"bordered\" align=\"center\">\n                        <a href=\"" . URL_BASE . "view_profile.php?userid=" . $userIds[$count] . "\"><img src=\"" . URL_BASE . IMAGE_URL . $userIds[$count] . "_sm.jpg\"></a>\n                    </td>";
                    $count++;
                }
            }
            echo "</tr>\n";
            if ($count == $numIds) {
                break;
            }
        }
        echo "</table>\n";
        // Previous and Next links
        write_page_links("user_gallery", $page, $numPages);
        page_tail(false, "../");
        close_output_buffer($filename);
    }
    print_debug_msg("done building picture pages");
}