Exemplo n.º 1
0
function renderAddonList(array $addons)
{
    $output = '';
    if (is_array($addons) && count($addons)) {
        $output .= '<ul>';
        foreach ($addons as $addon) {
            $output .= "<li><a href='" . createLinkUrl('addon', $addon->id) . "'>";
            $output .= "<img src='" . getAddonThumbnail($addon->id, 'addonThumbnailSmall') . "' width='60' height='60' alt='{$addon->name}' class='pic alignleft' />";
            $output .= "<b>{$addon->name}</b></a>";
            $output .= "<span class='date'>" . $addon->updated . "</span>";
            $output .= "</li>";
        }
        $output .= '</ul>';
    }
    return $output;
}
Exemplo n.º 2
0
 /**
  * Renders the given addons as thumb list
  * 
  * @param array $addons
  * @param string $uri The URL segment to use for pagination Links
  * @param integer $itemsTotal
  * @param integer $itemsPerPage
  * @return string The rendered list
  */
 protected function renderAddonList(array $addons, $uri, $itemsTotal, $itemsPerPage = 40)
 {
     $output = '';
     if (is_array($addons) && count($addons)) {
         $output .= '<ul id="addonList">';
         foreach ($addons as $addon) {
             $output .= '<li>';
             $output .= '<a href="' . createLinkUrl('addon', $addon->id) . '"><span class="thumbnail"><img src="' . getAddonThumbnail($addon->id, 'addonThumbnail') . '" width="100%" alt="' . $addon->name . '" class="pic" /></span>';
             $output .= '<strong>' . $addon->name . '</strong></a>';
             $output .= '</li>';
         }
         $output .= '</ul>';
         // add pagination
         $output .= renderPagination($uri, $itemsTotal, $itemsPerPage);
     }
     return $output;
 }
Exemplo n.º 3
0
require_once 'includes/functions.php';
//  ##############  Finish Includes  ############### //
// ###############  Prepare requested mode ######### //
$orderByProperty = 'created';
$feedTitle = 'Latest XBMC Add-Ons';
if (isset($_GET['mode']) && $_GET['mode'] == 'updated') {
    $orderByProperty = 'updated';
    $feedTitle = 'Recently updated XBMC Add-Ons';
}
// ###############  Setup Queries    ############### //
$queryResult = $db->get_results('SELECT * FROM addon ORDER BY ' . $orderByProperty . ' DESC LIMIT 10');
//  ##############  Finish Queries  ############### //
// Build the Add-Ons list
$itemList = '';
foreach ($queryResult as $addon) {
    $thumbnailExternalUrl = getAddonThumbnail($addon->id, 'addonThumbnail');
    $thumbnailFilePath = str_replace($configuration['cache']['pathRead'], $configuration['cache']['pathWrite'], $thumbnailExternalUrl);
    $thumbnailSize = 0;
    if (file_exists($thumbnailFilePath) && is_file($thumbnailFilePath)) {
        $thumbnailSize = filesize($thumbnailFilePath);
    }
    $itemList .= '		<item>
			<guid>' . $addon->id . '</guid>
			<title>' . htmlspecialchars($addon->name) . '</title>
			<description>' . htmlspecialchars($addon->description) . '</description>
			<date>' . $addon->updated . '</date>
			<link>' . createLinkUrl('addon', $addon->id) . '</link>
			<enclosure url="' . $configuration['baseUrl'] . $thumbnailExternalUrl . '" length="' . $thumbnailSize . '" type="image/png" />
		</item>
';
}
Exemplo n.º 4
0
    public function showAction()
    {
        if (count($this->arguments)) {
            $result = $this->db->get_results('SELECT * FROM addon WHERE id = "' . $this->db->escape($this->arguments[0]) . '" LIMIT 1');
        }
        $output = '';
        if ($result) {
            // prepare variables and rootline
            $addon = current($result);
            $this->pageRenderer->addRootlineItem(array('url' => createLinkUrl('addon', $addon->id), 'name' => 'Details'));
            // prepare authors and create individual links if more are listed by the addon
            $authors = explode(',', $addon->provider_name);
            $authorLinks = array();
            foreach ($authors as $author) {
                if ($author) {
                    $author = cleanupAuthorName($author);
                    $authorLinks[] = '<a href="' . createLinkUrl('author', $author) . '">' . htmlspecialchars($author) . '</a>';
                }
            }
            // create details view
            $output .= '<div id="addonDetail">
				<span class="thumbnail"><img src="' . getAddonThumbnail($addon->id, 'large') . '" alt="' . $addon->name . '" class="pic" /></span>
				<h2>' . htmlspecialchars($addon->name) . '</h2>
				<strong>Author:</strong> ' . implode(', ', $authorLinks);
            // Show the extra details of the Add-on
            $output .= '<br /><strong>Version:</strong> ' . $addon->version;
            $output .= '<br /><strong>Released:</strong> ' . $addon->updated;
            // Show repository details
            $repoConfig = getRepositoryConfiguration($addon->repository_id);
            if ($repoConfig) {
                if (count($this->configuration['repositories']) > 1) {
                    $output .= '<br /><strong>Repository:</strong> ';
                    $output .= $repoConfig['downloadUrl'] ? '<a href="' . $repoConfig['downloadUrl'] . '" rel="nofollow">' . $repoConfig['name'] . '</a>' : $repoConfig['name'];
                }
                if ($repoConfig['statsUrl'] && $addon->downloads > 0) {
                    $output .= '<br /><strong>Downloads:</strong> ' . number_format($addon->downloads);
                }
            }
            // I can't seem to get the following code working. It should list the genres and create links to that each genre.
            /*			$genres = $addon->genres;
            			if ($genres) {
            				$genres = explode(',', $genres );
            				$genreLinks = array();
            				foreach ($genres as $genre) {
            					if ($genre) {
            						$category_args = array();
            						$category_args[] = 'video'; //$addon->content_types;
            						$category_args[] = $genres;
            						$category = getCategoryFromArguments($category_args);						
            						$genreLinks[] = '<a href="' . createLinkUrl('category', $category_args) . '">' . $category['label'] . '</a>';
            					}
            				}
            				$output .= '<br /><strong>Genres:</strong> ' . implode(', ', $genreLinks);
            			}*/
            if ($addon->content_types) {
                $output .= '<br /><strong>Add-on Type:</strong> ' . str_replace('[CR]', '<br />', $addon->content_types);
            }
            if ($addon->genres) {
                $output .= '<br /><strong>Genres:</strong> ' . str_replace('[CR]', '<br />', $addon->genres);
            }
            if ($addon->license) {
                $output .= '<br /><strong>License:</strong> ' . str_replace('[CR]', '<br />', $addon->license);
            }
            if ($addon->platform) {
                $output .= '<br /><strong>Platforms:</strong> ' . str_replace('[CR]', '<br />', $addon->platform);
            }
            /*		if ($addon->xbox_compatible) {
            				$output .= '<br /><h2>XBMC4Xbox COMPATIBLE</h2> ';
            			}*/
            if ($addon->notes) {
                $output .= '<br /><strong>Notes:</strong> ' . str_replace('[CR]', '<br />', $addon->notes);
            }
            if ($addon->OverrideDesc) {
                $output .= '<br /><br /><br /><br /><br /><br /><br /><br /><div class="description"><h2>Description:</h2><h4>' . str_replace('[CR]', '<br />', $addon->mydescription) . '</h4></div>';
            } else {
                $output .= '<br /><br /><br /><br /><br /><br /><br /><br /><div class="description"><h2>Description:</h2><h4>' . str_replace('[CR]', '<br />', $addon->description) . '</h4></div>';
            }
            if ($addon->broken) {
                $output .= renderFlashMessage('This addon is reported as broken!', '<strong>Details:</strong> ' . htmlspecialchars($addon->broken) . '.', 'error');
            }
            if ($addon->my_broken) {
                $output .= renderFlashMessage('This addon is reported as broken!', '<strong>Details:</strong> ' . htmlspecialchars($addon->my_broken) . '.', 'error');
            }
            $output .= '<ul class="addonLinks">';
            $output .= '<br /><h2>Resources:</h2>';
            // Check forum link exists
            $forumLink = $addon->forum ? '<a href="' . $addon->forum . '" target="_blank"><img src="images/forum.png" alt="Forum discussion" /></a>' : '<img src="images/forumbw.png" alt="Forum discussion" />';
            $output .= '<li><strong>Forum Discussion:</strong><br />' . $forumLink . '</li>';
            // Auto Generate Wiki Link
            $output .= '<li><strong>Wiki Docs:</strong><br /><a href="http://wiki.xbmc.org/index.php?title=Add-on:' . $addon->name . '" target="_blank"><img src="images/wiki.png" alt="Wiki page of this addon" /></a></li>';
            // Check sourcecode link exists
            $sourceLink = $addon->source ? '<a href="' . $addon->source . '" target="_blank"><img src="images/code.png" alt="Source code" /></a>' : '<img src="images/codebw.png" alt="Source code" />';
            $output .= "<li><strong>Source Code:</strong><br />" . $sourceLink . '</li>';
            // Check website link exists
            $websiteLink = $addon->website ? '<a href="' . $addon->website . '" target="_blank"><img src="images/website.png" alt="Website" /></a>' : '<img src="images/websitebw.png" alt="Website" />';
            $output .= "<li><strong>Website:</strong><br />" . $websiteLink . '</li>';
            // Show the Download link
            $downloadLink = getAddonDownloadLink($addon);
            if ($downloadLink) {
                $output .= '<li><strong>Direct Download:</strong><br />';
                $output .= '<a href="' . $downloadLink . '" rel="nofollow"><img src="images/download_link.png" alt="Download" /></a></li>';
            }
            // Check if any video links exist
            if ($addon->myvideopreview or $addon->video_preview or $addon->myvideoguide or $addon->video_guide) {
                $output .= '<br /><br /><br /><h2>Video Guides:</h2>';
            }
            // Check video preview link exists
            if ($addon->myvideopreview) {
                $videopreviewLink = '<a href="' . $addon->myvideopreview . '"target="_blank"><img src="images/addons_preview.png" alt="Preview video" /></a>';
                $output .= '<li>' . $videopreviewLink . '</li>';
            } else {
                if ($addon->video_preview) {
                    $videopreviewLink = $addon->video_preview ? '<a href="' . $addon->video_preview . '" target="_blank"><img src="images/addons_preview.png" alt="Preview video" /></a>' : '<img src="images/addons_preview.png" alt="Preview video" />';
                    $output .= '<li>' . $videopreviewLink . '</li>';
                }
            }
            // Check video guide link exists
            if ($addon->myvideoguide) {
                $videoguideLink = '<a href="' . $addon->myvideoguide . '"target="_blank"><img src="images/addons_tutorial.png" alt="Tutorial video" /></a>';
                $output .= '<li>' . $videoguideLink . '</li>';
            } else {
                if ($addon->video_guide) {
                    $videoguideLink = $addon->video_guide ? '<a href="' . $addon->video_guide . '" target="_blank"><img src="images/addons_tutorial.png" alt="Tutorial video" /></a>' : '<img src="images/addons_tutorial.png" alt="Tutorial video" />';
                    $output .= '<li>' . $videoguideLink . '</li>';
                }
            }
            $output .= '</ul></div>';
        } else {
            $this->pageNotFound();
        }
        return $output;
    }
    public function showAction()
    {
        if (count($this->arguments)) {
            $result = $this->db->get_results('SELECT * FROM addon WHERE id = "' . $this->db->escape($this->arguments[0]) . '" LIMIT 1');
        }
        $output = '';
        if ($result) {
            // prepare variables and rootline
            $addon = current($result);
            $this->pageRenderer->addRootlineItem(array('url' => createLinkUrl('addon', $addon->id), 'name' => 'Details'));
            $this->setPageTitle('"' . $addon->name . '" Add-On for Kodi');
            $stats = getAddonStats($addon);
            // prepare authors and create individual links if more are listed by the addon
            $authors = explode(',', $addon->provider_name);
            $authorLinks = array();
            foreach ($authors as $author) {
                if ($author) {
                    $author = cleanupAuthorName($author);
                    $authorLinks[] = '<a href="' . createLinkUrl('author', $author) . '">' . htmlspecialchars($author) . '</a>';
                }
            }
            // create details view
            $output .= '<div id="addonDetail">
				<span class="thumbnail"><img src="' . getAddonThumbnail($addon->id, 'large') . '" alt="' . htmlspecialchars($addon->name) . '" class="pic" /></span>
				<h2>' . htmlspecialchars($addon->name) . '</h2>
				<div id="addonMetaData">
				<strong>Author:</strong> ' . implode(', ', $authorLinks);
            // Show the extra details of the Add-on
            $output .= '<br /><strong>Version:</strong> ' . $addon->version;
            if (is_array($stats) && $stats['Total']) {
                $output .= '<br /><strong>Downloads:</strong> ' . number_format($stats['Total']);
            }
            $output .= '<br /><strong>Released:</strong> ' . $addon->updated;
            // Show repository details
            $repoConfig = getRepositoryConfiguration($addon->repository_id);
            if ($repoConfig) {
                if (count($this->configuration['repositories']) > 1) {
                    $output .= '<br /><strong>Repository:</strong> ';
                    $output .= $repoConfig['downloadUrl'] ? '<a href="' . $repoConfig['downloadUrl'] . '" rel="nofollow">' . htmlspecialchars($repoConfig['name']) . '</a>' : $repoConfig['name'];
                }
            }
            if ($addon->license) {
                $output .= '<br /><strong>License:</strong> ' . str_replace('[CR]', '<br />', $addon->license);
            }
            $output .= '</div>';
            $output .= '<div class="description"><h4>Description:</h4><p>' . str_replace('[CR]', '<br />', $addon->description) . '</p></div>';
            if ($addon->broken) {
                $output .= renderFlashMessage('Warning', 'This addon is currently reported as broken! <br /><strong>Suggestion / Reason:</strong> ' . htmlspecialchars($addon->broken) . '.', 'error');
            }
            $output .= '<ul class="addonLinks">';
            // Check forum link exists
            $forumLink = $addon->forum ? '<a href="' . $addon->forum . '" target="_blank"><img src="images/forum.png" alt="Forum discussion" /></a>' : '<img src="images/forumbw.png" alt="Forum discussion" />';
            $output .= '<li><strong>Forum Discussion:</strong><br />' . $forumLink . '</li>';
            // Auto Generate Wiki Link
            $output .= '<li><strong>Wiki Docs:</strong><br /><a href="http://kodi.wiki/index.php?title=Add-on:' . $addon->name . '" target="_blank"><img src="images/wiki.png" alt="Wiki page of this addon" /></a></li>';
            // Check sourcecode link exists
            $sourceLink = $addon->source ? '<a href="' . $addon->source . '" target="_blank"><img src="images/code.png" alt="Source code" /></a>' : '<img src="images/codebw.png" alt="Source code" />';
            $output .= "<li><strong>Source Code:</strong><br />" . $sourceLink . '</li>';
            // Check website link exists
            $websiteLink = $addon->website ? '<a href="' . $addon->website . '" target="_blank"><img src="images/website.png" alt="Website" /></a>' : '<img src="images/websitebw.png" alt="Website" />';
            $output .= "<li><strong>Website:</strong><br />" . $websiteLink . '</li>';
            // Show the Download link
            $downloadLink = getAddonDownloadLink($addon);
            if ($downloadLink) {
                $output .= '<li><strong>Direct Download:</strong><br />';
                $output .= '<a href="' . $downloadLink . '" rel="nofollow"><img src="images/download_link.png" alt="Download" /></a></li>';
            }
            $output .= '</ul></div>';
        } else {
            $this->pageNotFound();
        }
        return $output;
    }