function create_row($array)
{
    global $odd, $settings;
    if (!empty($array['submenu']) && $array['text'] != BOX_HEADING_CONFIGURATION) {
        foreach ($array['submenu'] as $menu_item) {
            create_row($menu_item);
        }
    } else {
        if ($array['security_id'] == '') {
            return;
        }
        // && $item['heading'] <> MENU_HEADING_TOOLS) continue;  // special case for reports listings not in Tools menu
        $checked = array();
        if ($array['show_in_users_settings'] === false) {
            return;
            // skip if menu only item
        } elseif (isset($settings[$array['security_id']])) {
            $checked[0] = false;
            $checked[$settings[$array['security_id']]] = true;
        } elseif ($error) {
            $checked[0] = false;
            $checked[$_POST['sID_' . $array['security_id']]] = true;
        } else {
            $checked[0] = true;
            // default to no access
        }
        echo '<tr valign="top" class="' . ($odd ? 'odd' : 'even') . '">';
        echo '<td>' . $array['text'] . '</td>' . chr(10);
        echo '<td align="center">' . html_radio_field('sID_' . $array['security_id'], '4', $checked[4]) . '</td>' . chr(10);
        echo '<td align="center">' . html_radio_field('sID_' . $array['security_id'], '3', $checked[3]) . '</td>' . chr(10);
        echo '<td align="center">' . html_radio_field('sID_' . $array['security_id'], '2', $checked[2]) . '</td>' . chr(10);
        echo '<td align="center">' . html_radio_field('sID_' . $array['security_id'], '1', $checked[1]) . '</td>' . chr(10);
        echo '<td align="center">' . html_radio_field('sID_' . $array['security_id'], '0', $checked[0]) . '</td></tr>' . chr(10);
        $odd = !$odd;
    }
}
Exemple #2
0
<?php

include_once 'utils.php';
include_once 'feed/json_common.php';
require_once '../vendor/autoload.php';
/*
 * Echo out the data
 */
$obj = get_json_data('facebook');
if (count($obj) <= 0 || !$obj->entries) {
    exit;
}
echo '<table class="table table-striped"><th><h2 class="text-center">LMMS Facebook</h2></th>';
foreach ($obj->entries as $item) {
    create_row('facebook', $item->title, $item->alternate, cleanse_urls($item->content, $item->alternate), $item->author->name, 'http://facebook.com/' . get_json_id('facebook'), $item->published);
}
echo '</table>';
/*
 * Fixes facebook JSON feed nuances such as:
 * 	- Relative linking (i.e. href="/makefreemusic")
 *  - URL redirecting (i.e. ...l.php?u=http://my_real_link)
 *  - Render cross-posted thumbnails (i.e. <a src="https://fbcdn-profile-a.akamaihd.net...>)
 */
function cleanse_urls($str, $article_url)
{
    $html = SimpleHtmlDom\str_get_html($str);
    foreach ($html->find('a') as $element) {
        // Fix cross posts, especially those from LMMSChallenge facebook
        if (!$element->find('img') && is_feed_image($element)) {
            $element->innertext = '<img class="img-thumbnail fb-thumb" src="' . $element->href . '"/>';
            $element->href = $article_url;
Exemple #3
0
<?php

include_once 'feed/json_common.php';
/*
 * Echo out the data
 */
$obj = get_json_data('soundcloud');
if (count($obj) <= 0 || !$obj[0]->user_id) {
    exit;
}
echo '<table class="table table-striped"><th><h2 class="text-center">LMMS SoundCloud</h2></th>';
foreach ($obj as $item) {
    create_row('soundcloud', $item->title, "javascript:embedSound('#div-" . $item->id . "','" . $item->id . "')", trim_feed($item->description, $item->permalink_url), $item->user->username, $item->user->permalink_url, $item->created_at, $item->artwork_url ? $item->artwork_url : $item->user->avatar_url, 'div-' . $item->id);
}
echo '</table>';
Exemple #4
0
include_once '../vendor/kellan/magpierss/rss_fetch.inc';
require_once '../vendor/autoload.php';
if (!defined('MAGPIE_OUTPUT_ENCODING')) {
    define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
}
$rss = fetch_rss(get_protocol() . 'lmms.io/forum/feed.php');
echo '<table class="table table-striped"><th><h2 class="text-center">LMMS Forums</h2></th>';
foreach ($rss->items as $item) {
    // Prepare the html a bit
    $atom = $item['atom_content'];
    $atom = str_replace('<br />', ' ', $atom);
    $atom = str_replace('<hr />', '', $atom);
    $atom = str_replace('\\n', '', $atom);
    $atom = str_replace('<p>Statistics:', '<p class="dummy">', $atom);
    $atom = str_replace('</code>', '</pre>', str_replace('<code>', '<pre>', $atom));
    create_row('forums', $item['title'], $item['id'], cleanse_html($atom, $item['id']));
}
echo '</table>';
/*
 * Cleanses HTML content for better display as a feed on the website
 */
function cleanse_html($atom, $href)
{
    $html = SimpleHtmlDom\str_get_html($atom);
    foreach ($html->find('img') as $element) {
        // Skip smilies
        if (str_contains($element->src, '/smilies/')) {
            continue;
        }
        $class = 'img img-thumbnail forum-thumb';
        $element->outertext = '<a href="' . $href . '"><img class="' . $class . '" src="' . scale_image($element->src, 200) . '"></a>';
Exemple #5
0
<?php

include_once 'feed/json_common.php';
/*
 * Echo out the data
 */
$obj = get_json_data('google', 'activities', '?maxResults=25');
echo '<table class="table table-striped"><th><h2 class="text-center">LMMS Google+</h2></th>';
// Sort on publish date
usort($obj->items, function ($a, $b) {
    return strtotime($a->published) > strtotime($b->published) ? -1 : 1;
});
foreach ($obj as $items) {
    if (!is_array($items) || count($items) < 1) {
        continue;
    }
    $duplicates = array();
    foreach ($items as $item) {
        // Google+ seems to have an abundance of duplicates in their feed (likely historical edits)
        // This is a quick hack to check for duplicates based on title name
        if (array_key_exists($item->title, $duplicates)) {
            continue;
        }
        $duplicates[$item->title] = true;
        create_row('google+', $item->title, $item->url, trim_feed($item->object->content, $item->url), $item->actor->displayName, $item->actor->url, $item->published);
    }
}
echo '</table>';
Exemple #6
0
<?php

include_once 'feed/json_common.php';
/*
 * Maximum number of displayed items
 */
$max = 20;
/*
 * Creates an array of relational JSON objects from cached or online GitHub data
 */
$obj = get_json_data('github', 'issues', '?state=open');
/*
 * Loop through items and echo
 */
$count = 0;
/*
 * Echo our data to the page
 */
echo '<table class="table table-striped"><th><h2 class="text-center">LMMS GitHub</h2></th>';
foreach ($obj as $item) {
    $title = 'GitHub #' . $item->number . ' &bull; ' . $item->title;
    create_row('github', $title, $item->html_url, trim_feed($item->body, $item->html_url), $item->user->login, $item->user->html_url, $item->created_at);
    if ($count++ == $max) {
        break;
    }
}
echo '</table>';
Exemple #7
0
 */
$videos_url = 'https://www.youtube.com/user/LMMSOfficial/videos';
$obj = get_json_data('youtube', 'activities', '&part=snippet&maxResults=25');
echo '<table class="table table-striped"><th><h2 class="text-center">LMMS YouTube</h2></th>';
foreach ($obj as $items) {
    if (!is_array($items) || count($items) < 1) {
        continue;
    }
    $duplicates = array();
    foreach ($items as $item) {
        $item = $item->snippet;
        // YouTube seems to have some duplicates in their feed (likely historical edits)
        // This is a quick hack to check for duplicates based on title name
        if (array_key_exists($item->title, $duplicates)) {
            continue;
        }
        $duplicates[$item->title] = true;
        $id = parse_youtube_id($item->thumbnails->default->url);
        $url = $id ? 'http://www.youtube.com/watch?v=' . $id : '';
        create_row('youtube', $item->title, "javascript:embedVideo('#div-" . $id . "','" . $id . "')", trim_feed($item->description, $url), $item->channelTitle, $videos_url, $item->publishedAt, $item->thumbnails->default->url, 'div-' . $id);
    }
}
echo '</table>';
// The feed doesn't give us a clean URL to the video
// So we parse it from the thumbnail image URL
function parse_youtube_id($thumbnail)
{
    $arr = explode('/', $thumbnail);
    $i = count($arr) - 2;
    return $i > 0 ? $arr[$i] : '';
}
Exemple #8
0
    echo $ToolsHTML;
    ?>
			</table>
		</div>
<?php 
}
// begin Development category
$ToolsHTML = "";
create_row("Clear/view a cache key", "tools.php?action=clear_cache", check_perms("users_mod"));
create_row("PHP processes", "tools.php?action=process_info", check_perms("site_debug"));
create_row("Rerender stylesheet gallery images", "tools.php?action=rerender_gallery", check_perms("site_debug") || check_perms("users_mod"));
create_row("Schedule", "schedule.php?auth={$LoggedUser['AuthKey']}", check_perms("site_debug"));
create_row("Service stats", "tools.php?action=service_stats", check_perms("site_debug"));
create_row("Site options", "tools.php?action=site_options", check_perms('users_mod'));
create_row("Tracker info", "tools.php?action=ocelot_info", check_perms("users_mod"));
create_row("Update GeoIP", "tools.php?action=update_geoip", check_perms("admin_update_geoip"));
if ($ToolsHTML) {
    ?>
		<div class="permission_subcontainer">
			<table class="layout">
				<tr class="colhead"><td>Development</td></tr>
<?php 
    echo $ToolsHTML;
    ?>
			</table>
		</div>
<?php 
}
?>
	<!-- end right column -->
	</div>