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; }
<!-- End Tabbed Box Container --> </div> <?php $top5 = $db->get_results("SELECT *, COUNT( provider_name ) AS counttotal FROM addon WHERE 1=1 " . $configuration['addonExcludeClause'] . " GROUP BY provider_name ORDER BY counttotal DESC LIMIT 9"); $counter = 0; $iconMap = array(1 => 'gold.png', 2 => 'silver.png', 3 => 'bronze.png'); if (is_array($top5) && count($top5)) { ?> <!-- Any Widget --> <div class="widget-container"> <h2>Top Developers</h2> <ul> <?php foreach ($top5 as $top5s) { $author = cleanupAuthorName($top5s->provider_name); $counter++; $icon = 'images/' . (isset($iconMap[$counter]) ? $iconMap[$counter] : $counter . '.png'); echo "<li><img src='{$icon}' height='20' width='20' alt='Rank {$counter}' /><a href='" . createLinkUrl('author', $author) . "' title='Show all addons from this author'> " . substr($author, 0, 15) . " ({$top5s->counttotal} uploads)</a></li>"; } ?> </ul> </div> <div class="widget-container"> <h2>Guides</h2> <ul> <?php echo "<li><img src='images/pin.png' height='22' width='22' /><a href='http://wiki.xbmc.org/index.php?title=How_to_install_an_Add-on_from_a_zip_file' > Install an Add-on from a zip file</a></li>"; echo "<li><img src='images/pin.png' height='22' width='22' /><a href='http://wiki.xbmc.org/index.php?title=How_to_install_an_Add-on_using_the_GUI' > Install an Add-on from the GUI</a></li>"; echo "<li><img src='images/pin.png' height='22' width='22' /><a href='http://wiki.xbmc.org/index.php?title=Submitting_Add-ons' > How to submit an Add-on</a></li>";
/** * Renders the addon author ranking * * @return string */ public function getTopDevelopersWidgetMarker() { $top5 = $this->db->get_results("SELECT *, COUNT( provider_name ) AS counttotal FROM addon WHERE 1=1 " . $this->configuration['addonExcludeClause'] . " GROUP BY provider_name ORDER BY counttotal DESC LIMIT 9"); $counter = 0; $iconMap = array(1 => 'gold.png', 2 => 'silver.png', 3 => 'bronze.png'); if (is_array($top5) && count($top5)) { $developers = ''; foreach ($top5 as $top5s) { $author = cleanupAuthorName($top5s->provider_name); $counter++; $icon = 'images/' . (isset($iconMap[$counter]) ? $iconMap[$counter] : $counter . '.png'); $developers .= "<li><img src='{$icon}' height='20' width='20' alt='Rank {$counter}' /><a href='" . createLinkUrl('author', $author) . "' title='Show all addons from this author'> " . substr($author, 0, 15) . " ({$top5s->counttotal} uploads)</a></li>"; } return $this->makeWidget('Top developers', '<ul class="topDevelopers">' . $developers . '</ul>'); } return ''; }
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; }