| Server IP : 54.36.91.62 / Your IP : 216.73.217.117 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/administrator/components/com_community/views/photos/ |
Upload File : |
<?php
/**
* @copyright (C) 2013 iJoomla, Inc. - All rights reserved.
* @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html)
* @author iJoomla.com <webmaster@ijoomla.com>
* @url https://www.jomsocial.com/license-agreement
* The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
* More info at https://www.jomsocial.com/license-agreement
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Version;
// Disallow direct access to this file
defined('_JEXEC') or die('Restricted access');
jimport( 'joomla.application.component.view' );
/**
* Configuration view for JomSocial
*/
class CommunityViewPhotos extends HtmlView
{
/**
* The default method that will display the output of this view which is called by
* Joomla
*
* @param string template Template file name
**/
public function display( $tpl = null )
{
// Trigger load default library.
CAssets::getInstance();
$mainframe = Factory::getApplication();
$jinput = $mainframe->input;
$search = $jinput->get('search','','STRING');
// Set the titlebar text
ToolbarHelper::title( Text::_('COM_COMMUNITY_PHOTOS'), 'photos' );
// Add the necessary buttons
ToolBarHelper::trash('delete', Text::_('COM_COMMUNITY_DELETE'));
ToolBarHelper::publishList( 'publish' , Text::_('COM_COMMUNITY_PUBLISH') );
ToolBarHelper::unpublishList( 'unpublish' , Text::_('COM_COMMUNITY_UNPUBLISH') );
$photos = $this->get( 'Photos' );
$pagination = $this->get( 'Pagination' );
foreach($photos as $key=>$val){
$pTable = Table::getInstance('Photo','CTable');
$pTable->load($val->pid);
$groupid = (int) $val->groupid;
$eventid = (int) $val->eventid;
$photos[$key] = $pTable;
$photos[$key]->albumName = $val->name;
$photos[$key]->url = Route::_(Uri::root() . 'index.php?option=com_community&view=photos&task=photo&albumid=' . $val->albumid . '&photoid=' . $pTable->id . ( $groupid ? '&groupid=' . $groupid : '' ). ( $eventid ? '&eventid=' . $eventid : '' ));
}
$this->set( 'photos' , $photos );
$this->set( 'pagination' , $pagination );
$this->set( 'search' , $search );
parent::display( $tpl );
}
public function getPublish( $row , $type , $ajaxTask )
{
$version = new Version();
$currentV = $version->getHelpVersion();
$class = 'jgrid';
$alt = $row->$type ? Text::_('COM_COMMUNITY_PUBLISHED') : Text::_('COM_COMMUNITY_UNPUBLISH');
$state = $row->$type == 1 ? 'publish' : 'unpublish';
$span = '<span class="state '.$state.'"><span class="text">'.$alt.'</span></span></a>';
if($currentV >= '0.30')
{
$class = $row->$type == 1 ? 'disabled jgrid': '';
$span = '<i class="icon-'.$state.'"></i>';
}
if(!isset($row->pid))
{
$row->pid = $row->id;
}
$href = '<a class="'.$class.'" href="javascript:void(0);" onclick="azcommunity.togglePublish(\'' . $ajaxTask . '\',\'' . $row->pid . '\',\'' . $type . '\');">';
$href .= $span;
// Check: ACL
if (!CFactory::getUser()->authorise('community.photoeditstate', 'com_community')) {
return '<i class="icon-'.$state.'"></i>';
}
return $href;
}
public function formatBytes($id)
{
$photo = Table::getInstance('Photo','CTable');
$photo->load($id);
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$precision = 2;
$bytes = max($photo->filesize, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$bytes /= pow(1024, $pow);
//s3 size can only be retrieved from s3, therefore, we can always use the filesize from the table
if($photo->filesize){
return round($bytes, $precision) . ' ' . $units[$pow];
}elseif(is_file(JPATH_ROOT .'/'.$photo->image)){
$size = round(filesize(JPATH_ROOT .'/'.$photo->image)/1048576,2) . ' MB';
} else {
$size = round(filesize(JPATH_ROOT .'/'.$photo->original)/1048576,2) . ' MB';
}
return $size;
}
public function _getStatusHTML()
{
$jinput = Factory::getApplication()->input;
// Check if there are any categories selected
$status = $jinput->getInt( 'status' , 2 );
$select = '<select class="no-margin" name="status" onchange="Joomla.submitform();">';
$statusArray = array(2=>Text::_('COM_COMMUNITY_ALL_STATE'),0=>Text::_('COM_COMMUNITY_UNPUBLISH'),1=>Text::_('COM_COMMUNITY_PUBLISH'));
foreach($statusArray as $key=>$array)
{
$selected = ($status == $key) ? 'selected="true"' : '';
$select .='<option value="'.$key.'"'.$selected.' >'.Text::_($array).'</option>';
}
$select .= '</select>';
return $select;
}
public function getConnectType( $userId )
{
$model = $this->getModel( 'Users' );
$type = $model->getUserConnectType( $userId );
$image = '';
switch( $type )
{
case 'facebook':
$image = '<img src="' . rtrim( Uri::root() , '/' ) . '/administrator/components/com_community/assets/icons/facebook.gif" />';
break;
case 'joomla':
default:
$image = '<img src="' . rtrim( Uri::root() , '/' ) . '/administrator/components/com_community/assets/icons/joomla-icon.png" />';
break;
}
return $image;
}
public function getProfileName($obj)
{
$profileId = $obj->getProfileType();
$profile = Table::getInstance('MultiProfile', 'CTable');
$profile->load($profileId);
return $profile->getName();
}
}