Merge fix for PR 33 #37

Merged
akinwale merged 8 commits from tx-claim-link into master 2018-10-19 13:54:54 +02:00
Showing only changes of commit 0d1bd292fe - Show all commits

View file

@ -40,13 +40,10 @@
$a = ['purple', 'orange', 'blue', 'teal', 'green', 'yellow']; $a = ['purple', 'orange', 'blue', 'teal', 'green', 'yellow'];
$autoThumbText = ''; $autoThumbText = '';
$link = $claim->Name;
$rawLink = $claim->Name; $rawLink = $claim->Name;
if (isset($claim->Publisher->Name)) { if (isset($claim->Publisher->Name)) {
$link = urlencode($claim->Publisher->Name) . '/' . $link;
$rawLink = $claim->Publisher->Name . '/' . $rawLink; $rawLink = $claim->Publisher->Name . '/' . $rawLink;
} }
$link = 'lbry://' . $link;
$rawLink = 'lbry://' . $rawLink; $rawLink = 'lbry://' . $rawLink;
if ($claim->ClaimType == 1) { $autoThumbText = strtoupper(substr($claim->Name, 1, min( strlen($claim->Name), 10 ))); } else { if ($claim->ClaimType == 1) { $autoThumbText = strtoupper(substr($claim->Name, 1, min( strlen($claim->Name), 10 ))); } else {
$str = str_replace(' ', '', (strlen(trim($claim->Title)) > 0) ? $claim->Title : $claim->Name); $str = str_replace(' ', '', (strlen(trim($claim->Title)) > 0) ? $claim->Title : $claim->Name);
@ -81,7 +78,7 @@ if (strlen(trim($desc)) == 0) {
<div class="claim-info"> <div class="claim-info">
<div data-autothumb="<?php echo $autoThumbText ?>" class="thumbnail <?php echo $a[mt_rand(0, count($a) - 1)] ?>"> <div data-autothumb="<?php echo $autoThumbText ?>" class="thumbnail <?php echo $a[mt_rand(0, count($a) - 1)] ?>">
<?php if (!$claim->IsNSFW && strlen(trim($claim->ThumbnailUrl)) > 0): ?> <?php if (!$claim->IsNSFW && strlen(trim($claim->ThumbnailUrl)) > 0): ?>
<img src="<?php echo $claim->ThumbnailUrl ?>" alt="" /> <img src="<?php echo htmlspecialchars($claim->ThumbnailUrl) ?>" alt="" />
<?php else: ?> <?php else: ?>
<div class="autothumb"><?php echo $autoThumbText ?></div> <div class="autothumb"><?php echo $autoThumbText ?></div>
<?php endif; ?> <?php endif; ?>
@ -144,7 +141,7 @@ if (strlen(trim($desc)) == 0) {
<div class="value half-width"><?php echo strlen(trim($claim->Language)) > 0 ? ($claim->Language == 'en' ? 'English' : '') : '<em>Unspecified</em>' ?></div> <div class="value half-width"><?php echo strlen(trim($claim->Language)) > 0 ? ($claim->Language == 'en' ? 'English' : '') : '<em>Unspecified</em>' ?></div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<a href="<?php echo $link ?>" class="open-lbry-link">Open in LBRY</a> <a href="<?php echo $rawLink ?>" class="open-lbry-link">Open in LBRY</a>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
@ -165,13 +162,10 @@ if (strlen(trim($desc)) == 0) {
} }
$autoThumbText = ''; $autoThumbText = '';
$link = $claim->Name;
$rawLink = $claim->Name; $rawLink = $claim->Name;
if (isset($claim->Publisher->Name)) { if (isset($claim->Publisher->Name)) {
$link = urlencode($claim->Publisher->Name) . '/' . $link;
$rawLink = $claim->Publisher->Name . '/' . $rawLink; $rawLink = $claim->Publisher->Name . '/' . $rawLink;
} }
$link = 'lbry://' . $link;
$rawLink = 'lbry://' . $rawLink; $rawLink = 'lbry://' . $rawLink;
$cost = ''; $cost = '';
if (isset($claim->Price) && $claim->Price > 0) { if (isset($claim->Price) && $claim->Price > 0) {
@ -216,7 +210,7 @@ if (strlen(trim($desc)) == 0) {
<div data-autothumb="<?php echo $autoThumbText ?>" class="thumbnail <?php echo $a[mt_rand(0, count($a) - 1)] ?>"> <div data-autothumb="<?php echo $autoThumbText ?>" class="thumbnail <?php echo $a[mt_rand(0, count($a) - 1)] ?>">
<?php if (!$claim->IsNSFW && strlen(trim($claim->ThumbnailUrl)) > 0): ?> <?php if (!$claim->IsNSFW && strlen(trim($claim->ThumbnailUrl)) > 0): ?>
<img src="<?php echo $claim->ThumbnailUrl ?>" alt="" /> <img src="<?php echo htmlspecialchars($claim->ThumbnailUrl) ?>" alt="" />
<?php else: ?> <?php else: ?>
<div class="autothumb"><?php echo $autoThumbText ?></div> <div class="autothumb"><?php echo $autoThumbText ?></div>
<?php endif; ?> <?php endif; ?>
@ -224,7 +218,7 @@ if (strlen(trim($desc)) == 0) {
<div class="metadata"> <div class="metadata">
<div class="title" title="<?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '') ?>"><?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '<em>No Title</em>') ?></div> <div class="title" title="<?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '') ?>"><?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '<em>No Title</em>') ?></div>
<div class="link" title="<?php echo $rawLink ?>"><a href="<?php echo $link ?>" rel="nofollow"><?php echo $rawLink ?></a></div> <div class="link" title="<?php echo $rawLink ?>"><a href="<?php echo $rawLink ?>" rel="nofollow"><?php echo $rawLink ?></a></div>
<div class="desc"><?php echo strlen(trim($claim->Description)) > 0 ? $claim->Description : '<em>No description available</em>' ?></div> <div class="desc"><?php echo strlen(trim($claim->Description)) > 0 ? $claim->Description : '<em>No description available</em>' ?></div>
@ -291,13 +285,10 @@ if (strlen(trim($desc)) == 0) {
$row++; $row++;
} }
$autoThumbText = ''; $autoThumbText = '';
$link = $claim->Name;
$rawLink = $claim->Name; $rawLink = $claim->Name;
if (isset($claim->Publisher->Name)) { if (isset($claim->Publisher->Name)) {
$link = urlencode($claim->Publisher->Name) . '/' . $link;
$rawLink = $claim->Publisher->Name . '/' . $rawLink; $rawLink = $claim->Publisher->Name . '/' . $rawLink;
} }
$link = 'lbry://' . $link;
$rawLink = 'lbry://' . $rawLink; $rawLink = 'lbry://' . $rawLink;
$cost = ''; $cost = '';
if (isset($claim->Price) && $claim->Price > 0) { if (isset($claim->Price) && $claim->Price > 0) {
@ -342,7 +333,7 @@ if (strlen(trim($desc)) == 0) {
<div data-autothumb="<?php echo $autoThumbText ?>" class="thumbnail <?php echo $a[mt_rand(0, count($a) - 1)] ?>"> <div data-autothumb="<?php echo $autoThumbText ?>" class="thumbnail <?php echo $a[mt_rand(0, count($a) - 1)] ?>">
<?php if (!$claim->IsNSFW && strlen(trim($claim->ThumbnailUrl)) > 0): ?> <?php if (!$claim->IsNSFW && strlen(trim($claim->ThumbnailUrl)) > 0): ?>
<img src="<?php echo $claim->ThumbnailUrl ?>" alt="" /> <img src="<?php echo htmlspecialchars($claim->ThumbnailUrl) ?>" alt="" />
<?php else: ?> <?php else: ?>
<div class="autothumb"><?php echo $autoThumbText ?></div> <div class="autothumb"><?php echo $autoThumbText ?></div>
<?php endif; ?> <?php endif; ?>
@ -350,7 +341,7 @@ if (strlen(trim($desc)) == 0) {
<div class="metadata"> <div class="metadata">
<div class="title" title="<?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '') ?>"><?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '<em>No Title</em>') ?></div> <div class="title" title="<?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '') ?>"><?php echo $claim->ClaimType == 1 ? $claim->Name : ((strlen(trim($claim->Title)) > 0) ? $claim->Title : '<em>No Title</em>') ?></div>
<div class="link" title="<?php echo $rawLink ?>"><a href="<?php echo $link ?>" rel="nofollow"><?php echo $rawLink ?></a></div> <div class="link" title="<?php echo $rawLink ?>"><a href="<?php echo $rawLink ?>" rel="nofollow"><?php echo $rawLink ?></a></div>
<div class="desc"><?php echo strlen(trim($claim->Description)) > 0 ? $claim->Description : '<em>No description available</em>' ?></div> <div class="desc"><?php echo strlen(trim($claim->Description)) > 0 ? $claim->Description : '<em>No description available</em>' ?></div>