public function showAction()
 {
     $output = '';
     if (count($this->arguments)) {
         // prepare author name and page breadcrumb
         $author = revertAuthorNameCleanup($this->arguments[0]);
         $cleanAuthor = cleanupAuthorName($author);
         $this->pageRenderer->addRootlineItem(array('url' => createLinkUrl('author', $cleanAuthor), 'name' => $cleanAuthor));
         $output .= '<h2>Browsing</h2><p>By author <strong>' . htmlspecialchars($cleanAuthor) . '</strong></p>';
         $this->setPageTitle('Kodi Add-Ons by ' . htmlspecialchars($cleanAuthor));
         // execute queries
         $limit = 40;
         $offset = max(0, isset($_GET['page']) ? intval($_GET['page']) - 1 : 0) * $limit;
         $addons = $this->db->get_results('SELECT * FROM addon WHERE FIND_IN_SET("' . $this->db->escape($author) . '", provider_name) ' . $this->configuration['addonExcludeClause'] . ' ORDER BY name ASC LIMIT ' . $offset . ', ' . $limit);
         $count = $this->db->get_var('SELECT count(*) FROM addon WHERE FIND_IN_SET("' . $this->db->escape($author) . '", provider_name) ' . $this->configuration['addonExcludeClause']);
         if ($addons && is_array($addons) && count($addons)) {
             $output .= $this->renderAddonList($addons, createLinkUrl('author', $cleanAuthor), $count, $limit);
         } else {
             $this->pageNotFound();
             $output .= renderFlashMessage('No addons found', 'There are currently no addons available in this section');
         }
     } else {
         $this->pageNotFound();
         $this->forward('/');
     }
     return $output;
 }
Пример #2
0
    /**
     * Renders a category list
     * 
     * @param array $categories
     * @return string
     */
    protected function renderCategoryList($categories)
    {
        $items = array();
        foreach ($categories as $categoryName => $categoryData) {
            $attributes = isset($categoryData['rootline']) ? array_keys($categoryData['rootline']) : $categoryName;
            $pathSegment = is_array($attributes) ? implode('/', $attributes) : $attributes;
            $items[] = '<li><a href="' . createLinkUrl('category', $attributes) . '"><span class="thumbnail"><img src="images/categories/' . $pathSegment . '.png" class="pic" alt="' . $categoryData['label'] . '" /></span><strong>' . $categoryData['label'] . '</strong></a></li>';
        }
        return '<ul id="addonCategories">
				' . implode("\n\t\t\t", $items) . '
		</ul>';
    }
Пример #3
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;
}
 public function showAction()
 {
     $arguments = $this->arguments;
     $category = getCategoryFromArguments($arguments);
     $output = '';
     // only continue if we have a valid category
     if ($category) {
         // prepare labels and page rootline
         $categoryLabels = array();
         foreach ($category['rootline'] as $categoryData) {
             $categoryLabels[] = $categoryData['label'];
             $this->pageRenderer->addRootlineItem(array('url' => createLinkUrl('category', array_keys($categoryData['rootline'])), 'name' => $categoryData['label']));
         }
         $output .= '<h2>Browsing</h2><p>Category <strong>' . htmlspecialchars(implode(' / ', $categoryLabels)) . '</strong></p>';
         if (isset($category['pageTitle']) && $category['pageTitle']) {
             $this->setPageTitle($category['pageTitle']);
         }
         // render subcategories if available
         if (isset($category['subCategories'])) {
             $output .= $this->renderCategoryList($category['subCategories']);
             // render category content
         } else {
             $controller = 'AddonController';
             $action = 'list';
             // allow categories to use their own controller and action for rendering
             if (isset($category['controller']) && isset($category['action']) && $category['controller'] && $category['action']) {
                 $controller = $category['controller'];
                 $action = $category['action'];
             }
             require_once 'includes/Controller/' . $controller . '.php';
             $controller = new $controller();
             $controller->setArguments($this->arguments);
             $methodName = $action . 'Action';
             $output .= $controller->{$methodName}($category);
         }
     } else {
         $this->pageNotFound();
         $this->forward('/');
     }
     return $output;
 }
 public function searchAction()
 {
     $output = '';
     if ($_GET['keyword']) {
         // perform search query
         $limit = 40;
         $offset = max(0, isset($_GET['page']) ? intval($_GET['page']) - 1 : 0) * $limit;
         $keyword = $this->db->escape($_GET['keyword']);
         $whereClause = 'id LIKE "' . $keyword . '" OR name LIKE "%' . $keyword . '%" OR description LIKE "%' . $keyword . '" OR provider_name LIKE "%' . $keyword . '%"' . $this->configuration['addonExcludeClause'];
         $addons = $this->db->get_results('SELECT * FROM addon WHERE ' . $whereClause . ' ORDER BY name ASC LIMIT ' . $offset . ', ' . $limit);
         $count = $this->db->get_var('SELECT count(*) FROM addon WHERE ' . $whereClause);
         // render result
         $output .= '<h2>Search</h2><p>Search results for <strong>' . htmlspecialchars($_GET['keyword']) . '</strong></p>';
         if ($addons && is_array($addons) && count($addons)) {
             $output .= $this->renderAddonList($addons, createLinkUrl('search', $_GET['keyword']), $count, $limit);
         } else {
             $output .= renderFlashMessage('No addons found', 'There where no addons found for this keyword.');
         }
     } else {
         $output .= renderFlashMessage('How to search', 'Please enter the keyword you\'re looking for in the search field on the top right corner of the website.', 'info');
     }
     return $output;
 }
Пример #6
0
//  ##############  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>
';
}
shutdown();
// begin output
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>

<rss version="2.0">
	<channel>
		<title><?php 
echo $feedTitle;
?>
Пример #7
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;
    }