Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
fix(View): Fix view function redeclare
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhilip committed Mar 17, 2019
1 parent 4413b46 commit 81c8aff
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions apps/views/common/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,33 @@
*
*/

/**
* @param \apps\models\Torrent $torrent
* @return string
*/
function get_torrent_uploader_id(\apps\models\Torrent $torrent)
{
if ($torrent->getUplver() == 'yes' and app()->user->getClass(true) < app()->config->get('authority.see_anonymous_uploader')) {
return 0;
} else {
return $torrent->getOwnerId();
if (!function_exists('get_torrent_uploader_id')) {
/**
* @param \apps\models\Torrent $torrent
* @return string
*/
function get_torrent_uploader_id(\apps\models\Torrent $torrent)
{
if ($torrent->getUplver() == 'yes' and app()->user->getClass(true) < app()->config->get('authority.see_anonymous_uploader')) {
return 0;
} else {
return $torrent->getOwnerId();
}
}
}

/**
* @param \apps\models\Torrent $torrent
* @return string
*/
function get_torrent_uploader(\apps\models\Torrent $torrent)
{
$owner_id = get_torrent_uploader_id($torrent);
if ($owner_id == 0) {
return '<i>Anonymous</i>';
} else {
return "<a class=\"text-default\" href=\"/user/panel?id={$torrent->getOwnerId()}\" data-toggle=\"tooltip\" title=\"User\">{$torrent->getOwner()->getUsername()}</a>";
if (!function_exists('get_torrent_uploader')) {
/**
* @param \apps\models\Torrent $torrent
* @return string
*/
function get_torrent_uploader(\apps\models\Torrent $torrent)
{
$owner_id = get_torrent_uploader_id($torrent);
if ($owner_id == 0) {
return '<i>Anonymous</i>';
} else {
return "<a class=\"text-default\" href=\"/user/panel?id={$torrent->getOwnerId()}\" data-toggle=\"tooltip\" title=\"User\">{$torrent->getOwner()->getUsername()}</a>";
}
}
}

0 comments on commit 81c8aff

Please sign in to comment.