/usr/share/horde/ansel/lib/Block/MyGalleries.php is in php-horde-ansel 3.0.5+debian0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | <?php
/**
* Display summary information on top level galleries.
*
* Copyright 2007-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Michael Rubinsky <mrubinsk@horde.org>
*/
class Ansel_Block_MyGalleries extends Horde_Core_Block
{
/**
*/
public function __construct($app, $params = array())
{
parent::__construct($app, $params);
$this->_name = _("My Galleries");
}
/**
*/
protected function _params()
{
return array(
'limit' => array(
'name' => _("Maximum number of galleries"),
'type' => 'int',
'default' => 0
)
);
}
/**
*/
protected function _title()
{
return Ansel::getUrlFor(
'view',
array(
'groupby' => 'owner',
'owner' => $GLOBALS['registry']->getAuth(),
'view' => 'List'))
->link() . _("My Galleries") . '</a>';
}
/**
*/
protected function _content()
{
$GLOBALS['page_output']->addScriptFile('block.js');
/* Get the top level galleries */
try {
$galleries = $GLOBALS['injector']
->getInstance('Ansel_Storage')
->listGalleries(
array(
'perm' => Horde_Perms::EDIT,
'attributes' => $GLOBALS['registry']->getAuth(),
'all_levels' => false,
'count' => empty($this->_params['limit']) ? 0 : $this->_params['limit'],
'sort_by' => 'last_modified',
'direction' => Ansel::SORT_DESCENDING));
} catch (Ansel_Exception $e) {
return $e->getMessage();
}
$header = array(_("Gallery Name"), _("Last Modified"), _("Photo Count"));
$html = <<<HEADER
<table class="linedRow" cellspacing="0" style="width:100%">
<thead><tr class="item nowrap">
<th class="item leftAlign">$header[0]</th>
<th class="item leftAlign">$header[1]</th>
<th class="item leftAlign">$header[2]</th>
</tr></thead>
<tbody>
HEADER;
foreach ($galleries as $gallery) {
$url = Ansel::getUrlFor(
'view',
array(
'view' => 'Gallery',
'slug' => $gallery->get('slug'),
'gallery' => $gallery->id),
true);
$html .= '<tr><td>'
. $url->link(array('onmouseout' => '$("ansel_preview").hide();$("ansel_preview").update("");',
'onmouseover' => 'Ansel.previewImage(event, ' . $gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')) . ');'))
. htmlspecialchars($gallery->get('name')) . '</a></td><td>'
. strftime($GLOBALS['prefs']->getValue('date_format'), $gallery->get('last_modified'))
. '</td><td>' . (int)$gallery->countImages(true) . '</td></tr>';
}
$html .= '</tbody></table>';
return $html;
}
}
|