Skip to content

Commit

Permalink
(plugins) fixed gitfeed plugin (add User-Agent header, according to g…
Browse files Browse the repository at this point in the history
…ithub API specs)
  • Loading branch information
silvercircle committed May 8, 2013
1 parent 5af5274 commit cefec4f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
1 change: 0 additions & 1 deletion .idea/inspectionProfiles/NONE.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions Themes/default/css/override_default.css
Expand Up @@ -7,12 +7,12 @@ div.posts_container {
}
div.post_wrapper.std {
background: rgb(238,238,238);
background: -moz-linear-gradient(left, rgba(238,238,238,1) 0%, rgba(245,245,245,1) 210px, rgba(245,245,245,1) 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(238,238,238,1)), color-stop(210px,rgba(245,245,245,1)), color-stop(100%,rgba(245,245,245,1)));
background: -webkit-linear-gradient(left, rgba(238,238,238,1) 0%,rgba(245,245,245,1) 210px,rgba(245,245,245,1) 100%);
background: -o-linear-gradient(left, rgba(238,238,238,1) 0%,rgba(245,245,245,1) 210px,rgba(245,245,245,1) 100%);
background: -ms-linear-gradient(left, rgba(238,238,238,1) 0%,rgba(245,245,245,1) 210px,rgba(245,245,245,1) 100%);
background: linear-gradient(to right, rgba(238,238,238,1) 0%,rgba(245,245,245,1) 210px,rgba(245,245,245,1) 100%);
background: -moz-linear-gradient(left, rgba(231, 231, 231,1) 0%, rgba(245,245,245,1) 210px, rgba(245,245,245,1) 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgb(231, 231, 231)), color-stop(210px,rgba(245,245,245,1)), color-stop(100%,rgba(245,245,245,1)));
background: -webkit-linear-gradient(left, rgba(231, 231, 231,1) 0%,rgba(245,245,245,1) 210px,rgba(245,245,245,1) 100%);
background: -o-linear-gradient(left, rgba(231, 231, 231,1) 0%,rgba(245,245,245,1) 210px,rgba(245,245,245,1) 100%);
background: -ms-linear-gradient(left, rgba(231, 231, 231,1) 0%,rgba(245,245,245,1) 210px,rgba(245,245,245,1) 100%);
background: linear-gradient(to right, rgba(231, 231, 231,1) 0%,rgba(245,245,245,1) 210px,rgba(245,245,245,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#f5f5f5',GradientType=1 );
border:2px solid #ddd;
border-radius: 4px;
Expand All @@ -34,7 +34,7 @@ div.keyinfo.std h5 {
display: inline;
}
div.keyinfo.std {
background:transparent !important;
/*background:transparent !important;*/
height:26px;
padding-left:230px;
}
Expand All @@ -52,7 +52,7 @@ div.post_wrapper.std.alternate {
}
div.post_content.std {
background:#f5f5f5;
border-top: 1px dotted #ccc;
/*border-top: 1px dotted #ccc;*/
}
div.post_wrapper.std.alternate div.post_content.std {
background: rgba(238,244,249,1);
Expand All @@ -79,4 +79,8 @@ div.poster.std h4 a {
a.prefix.req {
background: #70b8e5;
border:1px solid #527fe5;
}

a.recent_commit {
color: red;
}
7 changes: 5 additions & 2 deletions addons/gitfeed/gitfeed_sidebar_top.tpl
Expand Up @@ -6,10 +6,10 @@
{$C.gitfeed_global.message}
</div>
{else}
<ol class="commonlist tinytext">
<ol class="commonlist tinytext" style="padding:0;">
{foreach $C.gitfeed as $commit}
<li>
<a href="{$commit.href}" class="easytip" data-tip="tip_{$commit.sha}">{$commit.message_short}</a>
<a href="{$commit.href}" class="easytip{($commit.recent == true) ? ' recent_commit' : ''}" data-tip="tip_{$commit.sha}">{$commit.message_short}</a>
<span class="floatright">
{$commit.dateline}
</span>
Expand All @@ -20,6 +20,9 @@
</li>
{/foreach}
<li class="righttext">
<div class="righttext">
Red = recent commit (max. 3 days old)
</div>
<a href="{$C.gitfeed_global.see_all.href}">{$C.gitfeed_global.see_all.txt}</a>
</li>
</ol>
Expand Down
8 changes: 6 additions & 2 deletions addons/gitfeed/main.php
Expand Up @@ -13,8 +13,9 @@
*/

// todo: make translatable

// this should always be there
// todo: make configurable (add a admin section where the user can specify his GIT repository)

if (!defined('EOSA'))
die('No access');

Expand Down Expand Up @@ -97,7 +98,9 @@ public static function boardindex()
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_CONNECTTIMEOUT => 2
CURLOPT_CONNECTTIMEOUT => 2,
// github requires a user agent header
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'
));
$json_response = curl_exec($f);
$data = json_decode($json_response, true);
Expand All @@ -112,6 +115,7 @@ public static function boardindex()
'message_short' => shorten_subject($commit['commit']['message'], 60),
'message' => nl2br($commit['commit']['message']), // for the tool tip
'dateline' => timeformat(strtotime($commit['commit']['committer']['date'])),
'recent' => $context['time_now'] - strtotime($commit['commit']['committer']['date']) < 86400 * 3 ? true : false,
'sha' => $commit['sha'],
'href' => self::$my_git_url . 'commit/'. $commit['sha']
);
Expand Down

0 comments on commit cefec4f

Please sign in to comment.