164 lines
6.6 KiB
PHP
164 lines
6.6 KiB
PHP
<?php
|
|
|
|
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
|
|
// Copyright (C) 2005-2013 Solomon Peachy (pizza@shaftnet.org)
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation; either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// This program 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
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program; if not, write to the Free Software
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
include_once "include/config.php";
|
|
include_once "include/common.php";
|
|
include_once "include/contacts.php";
|
|
include_once "include/profile.php";
|
|
include_once "include/site.php";
|
|
include_once "include/orderby.php";
|
|
|
|
$database = site_prolog();
|
|
|
|
$owner_id = pg_escape_string($database, isset($_REQUEST['user']) ? $_REQUEST['user'] : 0);
|
|
|
|
$tmp = FALSE;
|
|
|
|
if ($owner_id) {
|
|
if (is_numeric($owner_id)) {
|
|
$tmp = pg_fetch_row(pg_query($database, "select identifier, type from users where identifier = $owner_id"));
|
|
} else {
|
|
$tmp = pg_fetch_row(pg_query($database, "select identifier, type from users where username='$owner_id'"));
|
|
$owner_id = $tmp[0];
|
|
}
|
|
$owner_type = $tmp[1];
|
|
}
|
|
|
|
$uname = disp_user_string($database, $owner_id, FALSE);
|
|
|
|
$my_folder = ($po_user['id'] == $owner_id);
|
|
|
|
if ($my_folder) {
|
|
$rss = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$site_title : $uname - RSS Folders\" href=\"$site_url/feed.php?type=folder&subtype=user&id=$owner_id\" />\n";
|
|
$rss .= "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$site_title : $uname - RSS Albums\" href=\"$site_url/feed.php?type=album&subtype=user&id=$owner_id\" />\n";
|
|
site_header($strings['users_my_folders'], "", $rss);
|
|
site_navigator(5);
|
|
} else if ($tmp !== FALSE) {
|
|
$rss = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$site_title : $uname - RSS Folders\" href=\"$site_url/feed.php?type=folder&subtype=user&id=$owner_id\" />\n";
|
|
$rss .= "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$site_title : $uname - RSS Albums\" href=\"$site_url/feed.php?type=album&subtype=user&id=$owner_id\" />\n";
|
|
site_header($strings['users_display'], "", $rss);
|
|
site_navigator(1);
|
|
} else {
|
|
site_header($strings['users_select']);
|
|
site_navigator(1);
|
|
}
|
|
|
|
if (($owner_id == 0) || ($owner_type < PO_USER_TYPE_CLIENT)) {
|
|
/* list all users, if no user is specified or the account is disabled */
|
|
|
|
site_navigator_status(disp_user_string($database, $owner_id).
|
|
" : ".$strings['users_select'], "");
|
|
display_users($database, $po_user['id']);
|
|
|
|
if ($po_user['type'] > PO_USER_TYPE_CLIENT) {
|
|
$auth_handle = new $po_auth();
|
|
display_clients($database, $po_user['id'], $auth_handle);
|
|
}
|
|
display_protected_photographers($database, $po_user['id']);
|
|
|
|
} else { /* Legit user that's enabled */
|
|
|
|
/* display users and the administrator */
|
|
$user_name = pg_fetch_row(pg_query($database, "select last_name, first_name from users where users.type >= ".PO_USER_TYPE_CLIENT." and identifier=$owner_id"));
|
|
if ($my_folder) {
|
|
$stats = pg_fetch_row(pg_query($database, "select count_photos_by_user($po_user[id]), count_folders_by_user($po_user[id]) -1, count_albums_by_user($po_user[id]) -1"));
|
|
$left = sprintf($strings['users_you_have_photos'],
|
|
$stats[0],
|
|
$stats[1],
|
|
$stats[2]);
|
|
} else {
|
|
$left = "";
|
|
}
|
|
|
|
site_navigator_status(disp_user_string($database, $owner_id), $left);
|
|
|
|
if (!$my_folder || ($po_user['type'] > PO_USER_TYPE_CLIENT)) {
|
|
display_folders($database, "", $owner_id);
|
|
}
|
|
display_albums($database, "", $owner_id);
|
|
|
|
if ($po_user['type'] >= PO_USER_TYPE_CLIENT) {
|
|
print "<div class=\"actions\">";
|
|
print "<form name=\"photoList\" method=\"post\" action=\"folder.content.php\" accept-charset=\"".$strings['formats_encoding']."\">";
|
|
print "<input type=\"hidden\" name=\"return\" value=\"".generate_link('user', $owner_id)."\"/>";
|
|
print "<input type=\"hidden\" name=\"user\" value=\"$owner_id\"/>";
|
|
print emit_spool_actions($database, $po_user['id']);
|
|
print emit_import_actions($database, $po_user['id']);
|
|
print emit_print_actions($database, $po_user['id']);
|
|
print "</form>";
|
|
print "</div>";
|
|
}
|
|
|
|
if ($my_folder) { /* Looking at my own stuff */
|
|
if ($po_user['type'] > PO_USER_TYPE_CLIENT) {
|
|
$auth_handle = new $po_auth();
|
|
display_clients($database, $po_user['id'], $auth_handle);
|
|
}
|
|
display_protected_photographers($database, $po_user['id']);
|
|
|
|
// site_display_top_photos($database, 'user', $po_user['id'], 20, FALSE);
|
|
site_display_random_photos($database, 'user', $po_user['id'], 10, FALSE);
|
|
} else {
|
|
if ($po_user['id']) {
|
|
$client = pg_fetch_row(pg_query($database, "select identifier from client where users=$po_user[id] and client=$owner_id"));
|
|
if ($client != FALSE) {
|
|
print "<p>$user_name[1] $user_name[0] ".$strings['users_registered_customer'] ."</p>";
|
|
}
|
|
if (($client != 0) || ($po_user['type'] == PO_USER_TYPE_ADMIN)) {
|
|
print emit_contact_info($database, $owner_id);
|
|
}
|
|
|
|
$client2 = pg_fetch_row(pg_query($database, "select identifier from client where client=$po_user[id] and users=$owner_id"));
|
|
if ($client2 != FALSE) {
|
|
print "<table class=\"profile\">";
|
|
print "<tr class=\"folder_top\">\n";
|
|
print emit_td($strings['datebook_event']);
|
|
print "</tr>\n";
|
|
print "<tr><td>";
|
|
print emit_events_for_user($database, $owner_id, $po_user['id']);
|
|
print "</td></tr></table>";
|
|
}
|
|
if ($client2 != 0) {
|
|
print emit_contact_info($database, $owner_id);
|
|
}
|
|
|
|
if ($po_user['type'] != PO_USER_TYPE_ADMIN) {
|
|
$already_client = pg_query($database, "select identifier from client where users=$owner_id and client=$po_user[id] and status!=4");
|
|
if (pg_num_rows($already_client) == 0) {
|
|
print "<p>".$strings['users_register_prompt']." $user_name[1] $user_name[0].</p>";
|
|
|
|
print "<form method=\"post\" action=\"subscription.add.php\" accept-charset=\"".$strings['formats_encoding']."\">";
|
|
print "<input type=\"hidden\" name=\"user\" value=\"$owner_id\"/>\n";
|
|
print "<center>";
|
|
print $thm_elem['button.subscribe'];
|
|
if (($po_user['type'] > PO_USER_TYPE_CLIENT) && !$client) {
|
|
print $thm_elem['button.make_client'];
|
|
}
|
|
print "</center>";
|
|
print "</form>";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
site_footer($database);
|
|
site_epilog($database);
|
|
?>
|