2009-09-09 18:50:04 +00:00
|
|
|
<?php defined("SYSPATH") or die("No direct script access.");
|
|
|
|
/**
|
|
|
|
* Gallery - a web based photo album viewer and editor
|
2012-02-27 18:04:35 +00:00
|
|
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
2009-09-09 18:50:04 +00:00
|
|
|
*
|
|
|
|
* 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 2 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 Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
class rwinfo_theme_Core {
|
|
|
|
static function thumb_info($theme, $item) {
|
|
|
|
$results = "";
|
|
|
|
if ($item->view_count) {
|
|
|
|
$results .= "<li>";
|
|
|
|
$results .= t("Views: %view_count", array("view_count" => $item->view_count));
|
|
|
|
$results .= "</li>";
|
|
|
|
}
|
|
|
|
|
2011-01-28 15:53:57 +00:00
|
|
|
// rWatcher Edit: Display Tags on Thumbnails
|
2009-09-09 18:50:04 +00:00
|
|
|
if (module::is_active("tag")) {
|
2009-12-24 09:47:00 +00:00
|
|
|
$tags = ORM::factory("tag")
|
2009-09-09 18:50:04 +00:00
|
|
|
->join("items_tags", "tags.id", "items_tags.tag_id")
|
2009-12-23 05:31:03 +00:00
|
|
|
->where("items_tags.item_id", "=", $item->id)
|
2009-09-09 18:50:04 +00:00
|
|
|
->find_all();
|
2009-12-24 09:47:00 +00:00
|
|
|
if (count($tags) > 0) {
|
2009-09-09 18:50:04 +00:00
|
|
|
$results .= "<li>";
|
|
|
|
$results .= t("Tags:") . " ";
|
2009-12-24 09:47:00 +00:00
|
|
|
$anchors = array();
|
|
|
|
foreach ($tags as $tag) {
|
2010-01-21 01:49:23 +00:00
|
|
|
$anchors[] = "<a href=" . $tag->url() . ">" . html::clean($tag->name) . "</a>";
|
2009-09-09 18:50:04 +00:00
|
|
|
}
|
2009-12-24 09:47:00 +00:00
|
|
|
$results .= join(", ", $anchors) . "</li>";
|
2009-09-09 18:50:04 +00:00
|
|
|
}
|
|
|
|
}
|
2009-10-14 23:28:38 +00:00
|
|
|
// rWatcher End Edit
|
2009-09-09 18:50:04 +00:00
|
|
|
|
2012-06-11 18:05:12 +00:00
|
|
|
|
2009-09-09 18:50:04 +00:00
|
|
|
if ($item->owner) {
|
2012-06-20 18:53:32 +00:00
|
|
|
// rWatcher Edit: Display profile instead of web site, if viewable.
|
|
|
|
$str_owner_url = $item->owner->url;
|
|
|
|
if (rwinfo_theme_Core::_can_view_profile_pages(identity::lookup_user($item->owner->id))) {
|
|
|
|
$str_owner_url = user_profile::url($item->owner->id);
|
|
|
|
}
|
|
|
|
// rWatcher End Edit
|
|
|
|
|
2009-09-09 18:50:04 +00:00
|
|
|
$results .= "<li>";
|
2012-06-11 18:05:12 +00:00
|
|
|
if ($str_owner_url) { //rW Edit str_owner_url
|
2009-10-14 23:28:38 +00:00
|
|
|
$results .= t("By: <a href=\"%owner_url\">%owner_name</a>",
|
|
|
|
array("owner_name" => $item->owner->display_name(),
|
2012-06-11 18:05:12 +00:00
|
|
|
"owner_url" => $str_owner_url)); // rW Edit str_owner_url
|
2009-09-09 18:50:04 +00:00
|
|
|
} else {
|
2009-10-14 23:28:38 +00:00
|
|
|
$results .= t("By: %owner_name", array("owner_name" => $item->owner->display_name()));
|
2009-09-09 18:50:04 +00:00
|
|
|
}
|
|
|
|
$results .= "</li>";
|
|
|
|
}
|
|
|
|
return $results;
|
|
|
|
}
|
2012-06-11 18:05:12 +00:00
|
|
|
|
|
|
|
// This came from modules/gallery/controllers/user_profile.php.
|
2012-06-20 18:46:37 +00:00
|
|
|
static private function _can_view_profile_pages($user) {
|
2012-06-11 18:05:12 +00:00
|
|
|
if (!$user->loaded()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($user->id == identity::active_user()->id) {
|
|
|
|
// You can always view your own profile
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (module::get_var("gallery", "show_user_profiles_to")) {
|
|
|
|
case "admin_users":
|
|
|
|
return identity::active_user()->admin;
|
|
|
|
|
|
|
|
case "registered_users":
|
|
|
|
return !identity::active_user()->guest;
|
|
|
|
|
|
|
|
case "everybody":
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// Fail in private mode on an invalid setting
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2009-09-09 18:50:04 +00:00
|
|
|
}
|