summaryrefslogtreecommitdiffstats
path: root/index.php
blob: a99aef98ed86a7fe14090f32235f85be40c91463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php include("include/header.php"); ?>
<?php include_once("include/autoloader.php"); ?>

<div class="container" role="main">
	<div class="alert alert-success" role="alert">Latest Replicant release: <strong>Replicant 4.2 0004</strong>, supporting up to <strong>12</strong> different devices!</div>
	<div class="row">
		<div class="col-md-8">
			<div class="panel panel-default">
				<div class="panel-heading"><h3 class="panel-title"><span class="glyphicon glyphicon-pencil"></span> <a href="//blog.replicant.us/">Replicant blog</a></h3></div>
				<div class="panel-body">
<?php
$feed = new SimplePie();

$feed->set_feed_url("http://blog.replicant.us/feed/");
$feed->set_cache_location("cache/");

$feed_init = $feed->init();

if ($feed->error() || !$feed_init) {
	print("\t\t\t\t\t<div class=\"alert alert-danger\" role=\"alert\">Loading RSS feed failed</div>\n");
} else {
	$count = 1;

	foreach ($feed->get_items() as $item) {
		print("\t\t\t\t\t<div class=\"page-header\"><h3><a href=\"".$item->get_permalink()."\">".$item->get_title()."</a></h3><small>Posted on <strong>".$item->get_date("j F Y")."</strong> by <strong>".$item->get_author()->get_name()."</strong></small></div>\n");
		print("\t\t\t\t\t<p>".$item->get_description()."</p>\n");

		if ($count++ >= 10)
			break;
	}
}
?>
				</div>
			</div>
		</div>
		<div class="col-md-4">
			<div class="panel panel-default">
				<div class="panel-heading"><span class="glyphicon glyphicon-user"></span> <a href="//redmine.replicant.us/projects/replicant/boards">Replicant forums</a></div>
				<ul class="list-group">
<?php
$feed = new SimplePie();

$feed->set_feed_url("http://redmine.replicant.us/projects/replicant/activity.atom?show_messages=1");
$feed->set_cache_location("cache/");

$feed_init = $feed->init();

if ($feed->error() || !$feed_init) {
	print("\t\t\t\t\t<li class=\"list-group-item list-group-item-danger\">Loading RSS feed failed</li>\n");
} else {
	$count = 1;

	foreach ($feed->get_items() as $item) {
		print("\t\t\t\t\t<li class=\"list-group-item\"><a href=\"".$item->get_permalink()."\">".$item->get_title()."</a><br /><small>Posted on <strong>".$item->get_date("j F Y")."</strong> by <strong>".$item->get_author()->get_name()."</strong></small></li>\n");

		if ($count++ >= 8)
			break;
	}
}
?>
				</ul>
			</div>
		</div>
		<div class="col-md-4">
			<div class="panel panel-default">
				<div class="panel-heading"><span class="glyphicon glyphicon-cog"></span> <a href="https://git.replicant.us/replicant">Replicant git</a></div>
				<ul class="list-group">
<?php
$feed = new SimplePie();

$feed->set_feed_url("https://git.replicant.us/groups/replicant.atom");
$feed->set_cache_location("cache/");

$feed_init = $feed->init();

if ($feed->error() || !$feed_init) {
	print("\t\t\t\t\t<li class=\"list-group-item list-group-item-danger\">Loading RSS feed failed</li>\n");
} else {
	$count = 1;

	foreach ($feed->get_items() as $item) {
		preg_match("/git\.replicant\.us\/replicant\/([^\/]*)\//", $item->get_permalink(), $repo);
		if ($repo == null)
			continue;

		$repo_link = "https://git.replicant.us/replicant/".$repo[1];

		preg_match("/pushed to project branch ([^ ]*) /", $item->get_title(), $branch);
		if ($branch == null)
			continue;

		$commits_contents = preg_grep("/<blockquote><p dir=\"auto\">/", explode("\n", $item->get_content()));
		if ($commits_contents == null)
			continue;

		print("\t\t\t\t\t<li class=\"list-group-item\"><a href=\"".$repo_link."/\">".$repo[1]."</a> (<strong>".$branch[1]."</strong>):<br /><ul>");

		foreach ($commits_contents as $commit_content) {
			preg_match("/<blockquote><p dir=\"auto\">(.*)<\/p>/", $commit_content, $commit);
			if ($commit == null)
				continue;

			print("<li><a href=\"".$item->get_permalink()."\">".$commit[1]."</a></li>");
		}

		print("</ul><small>Pushed on <strong>".$item->get_date("j F Y")."</strong> by <strong>".$item->get_author()->get_name()."</strong></small></li>\n");

		if ($count++ >= 8)
			break;
	}
}
?>
				</ul>
			</div>
		</div>
	</div>
</div>

<?php include("include/footer.php"); ?>