120 lines
		
	
	
		
			7.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			120 lines
		
	
	
		
			7.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
|     defined('BASEPATH') OR exit('No direct script access allowed');
 | |
| 
 | |
|     use Coduo\PHPHumanizer\DateTimeHumanizer;
 | |
| 
 | |
| ?>
 | |
| <li class="post-item is-reply% my-2" data-uuid="<?= $uuid ?>" data-username="<?= $username ?>">
 | |
|     <div class="comment-well" <?= isset($hideShadows) && $hideShadows ? 'style="box-shadow: none;padding:0"' : '' ?>>
 | |
|         <div class="post-non-content">
 | |
|             <a href="<?= base_url('user/' . $username) ?>" target="_blank">
 | |
|                 <img src="<?= $profile_picture ?>?w=100" class="img-fluid">
 | |
|             </a>
 | |
|         </div>
 | |
|         <div class="content-container">
 | |
|             <div class="content">
 | |
|                 <h3>
 | |
|                     <a href="<?= base_url('user/' . $username) ?>" target="_blank">
 | |
|                         <?= $displayname ?>
 | |
|                     </a>
 | |
|                     <small><?php
 | |
|                             $date_created = strtotime($date);
 | |
|                             echo DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$date_created"), $_SESSION['site_lang']); ?></small>
 | |
|                     <?php if ($reply_to != NULL): ?>
 | |
|                         <small>
 | |
|                             <i class="fa fa-reply"></i>
 | |
|                             <?= lang('post_reply_to') ?>
 | |
|                             <a href="#" onclick="showFullPost('<?= $replyToPost['uuid'] ?>', '<?= $replyToPost['username'] ?>')">@<?= $replyToPost['displayname'] ?></a>
 | |
|                         </small>
 | |
|                     <?php endif; ?>
 | |
|                 </h3>
 | |
|                 <div class="comment">
 | |
|                     <p>
 | |
|                         <?= $this->PostsModel->closeTags($content) ?>
 | |
|                     </p>
 | |
| 
 | |
|                     <?php if (!empty($media)): ?>
 | |
|                         <div class="post-media-list row">
 | |
|                             <?php foreach ($media as $item) {
 | |
|                                 $url = '/f/' . $item['name'];
 | |
|                                 switch ($item['type']) {
 | |
|                                     case 'image':
 | |
|                                         ?>
 | |
|                                         <div class="col">
 | |
|                                             <div class="post-media post-image" data-full-image="<?= $url ?>" style="background-image: url('<?= $url ?>?w=500')"></div>
 | |
|                                         </div>
 | |
|                                         <?php
 | |
|                                         break;
 | |
|                                     case 'video':
 | |
|                                         ?>
 | |
|                                         <div class="col">
 | |
|                                             <div class="video-container">
 | |
|                                                 <video class="video" src="<?= $url ?>" muted></video>
 | |
|                                                 <div class="video-controls">
 | |
|                                                     <button type="button" class="video-control-btn video-toggle-play">
 | |
|                                                         <i class="fa fa-play"></i>
 | |
|                                                     </button>
 | |
|                                                     <div class="video-volume-container">
 | |
|                                                         <button type="button" class="video-control-btn video-mute">
 | |
|                                                             <i class="fa fa-volume-muted"></i>
 | |
|                                                         </button>
 | |
|                                                         <input type="range" class="video-volume" min="0" max="1" step="0.1" value="1">
 | |
|                                                     </div>
 | |
|                                                     <output class="video-time">0:00</output>
 | |
|                                                     <input type="range" class="video-seek-bar" value="0">
 | |
|                                                     <output class="video-length">0:00</output>
 | |
|                                                     <button type="button" class="video-control-btn video-fullscreen">
 | |
|                                                         <i class="fa fa-expand"></i>
 | |
|                                                     </button>
 | |
|                                                 </div>
 | |
|                                             </div>
 | |
|                                         </div>
 | |
|                                         <?php
 | |
|                                         break;
 | |
|                                     case 'audio':
 | |
|                                         break;
 | |
|                                 }
 | |
|                             } ?>
 | |
|                         </div>
 | |
|                     <?php endif; ?>
 | |
|                 </div>
 | |
|                 <?php if (!isset($hideActionBtns) || !$hideActionBtns): ?>
 | |
|                     <div class="action-btns">
 | |
|                         <a href="#" data-uuid="<?= $uuid ?>" class="action-btn reply-button" data-toggle="tooltip" data-placement="top" title="<?= lang('post_reply') ?>">
 | |
|                             <i class="far fa-comment"></i>
 | |
|                             <span><?= $replyCount ?></span>
 | |
|                         </a>
 | |
|                         <a href="#" data-uuid="<?= $uuid ?>" class="action-btn like-button <?= isset($userHasLiked) && $userHasLiked ? 'active' : '' ?>" data-toggle="tooltip" data-placement="top" title="<?= lang('post_like') ?>">
 | |
|                             <i class="<?= isset($userHasLiked) && $userHasLiked ? 'fas' : 'far' ?> fa-heart"></i>
 | |
|                             <span><?= $likeCount ?></span>
 | |
|                         </a>
 | |
|                         <div class="action-btn dropdown">
 | |
|                             <a href="#" class="action-btn more-options-button" id="postMoreOptionsButton<?= $uuid ?>" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
 | |
|                                 <i class="fa fa-ellipsis-h"></i>
 | |
|                             </a>
 | |
| 
 | |
|                             <div class="dropdown-menu" aria-labelledby="postMoreOptionsButton<?= $uuid ?>">
 | |
|                                 <a href="#" onclick="copyToClipboard('<?= base_url('user/' . $username . '/post/' . $uuid) ?>')" class="dropdown-item">
 | |
|                                     <i class="fa fa-copy"></i>
 | |
|                                     <?= lang('post_copy_link') ?>
 | |
|                                 </a>
 | |
|                                 <a href="#" onclick="openPostReportModal('<?= $uuid ?>')" class="dropdown-item">
 | |
|                                     <i class="fa fa-flag"></i>
 | |
|                                     <?= lang('post_report') ?>
 | |
|                                 </a>
 | |
|                                 <?php if (isset($_SESSION['user']) && $_SESSION['user']['username'] == $username): ?>
 | |
|                                     <div class="dropdown-divider"></div>
 | |
|                                     <a href="#" onclick="openDeletePostModal('<?= $uuid ?>')" class="dropdown-item text-danger">
 | |
|                                         <i class="fa fa-trash"></i>
 | |
|                                         <?= lang('post_delete') ?>
 | |
|                                     </a>
 | |
|                                 <?php endif; ?>
 | |
|                             </div>
 | |
|                         </div>
 | |
|                     </div>
 | |
|                 <?php endif; ?>
 | |
|             </div>
 | |
|         </div>
 | |
|     </div>
 | |
| </li>
 |