Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

some minor bugfixes

  • Loading branch information...
commit a6b72745e1869f5f0ef3b1052e64b79aff9bc99b 1 parent 5b13e11
@janithl authored
View
2  config.php
@@ -25,7 +25,7 @@
$config['dyncache'] = 180;
/* back-end secret key */
-$config['besecret'] = 'backendsecretkeywithunicorns';
+$config['besecret'] = sha1('backendsecretkeywithunicorns');
/* facebook app id and secret key */
$config['fbappid'] = 'id';
View
40 index.php
@@ -59,7 +59,7 @@
header('location: ' . config('basepath'));
}
}
- elseif($path[$i] == 'admin' && $path[$i + 2] === config('besecret')) {
+ elseif($path[$i] == 'admin' && sha1($path[$i + 2]) === config('besecret')) {
if($path[$i + 1] == 'cacheclear' || $path[$i + 1] == 'feedget' ||
$path[$i + 1] == 'calculatespice') {
@@ -212,12 +212,33 @@
ob_end_flush();
}
- elseif($path[$i + 1] == 'search' || $path[$i + 1] == 'tags') {
+ elseif($path[$i + 1] == 'tags' && strlen($path[$i + 2]) > 0) {
+
+ /* Tags */
+
+ $out->title = "Kottu: Posts Tagged Under " . htmlentities($path[$i + 2]);
+ $out->posts = array();
+ $out->numblogs = $k->fetchnumblogs();
+
+ $out->page = isset($path[$i + 3]) && strlen($path[$i + 3]) ?
+ $path[$i + 3] : 0;
+ $out->lang = $path[$i];
+ $out->posts = $k->search('', $out->page, $path[$i], $path[$i + 2]);
+ $out->hotposts = array_slice($k->fetchallposts('all', 'today'), 0, 5);
+ $out->evillage = $k->sidescroller();
+ $out->toplink = "tags/{$path[$i + 2]}/";
+ $out->currentpage = $out->lang . '/' . $out->toplink;
+
+ $out->render('web/head.php');
+ $out->render('web/items.php');
+ $out->render('web/sidebar.php');
+ $out->render('web/tail.php');
+ }
+ elseif($path[$i + 1] == 'search') {
/* Web Search */
- $out->title = ($path[$i + 1] == 'tags') ? "Kottu: Posts Tagged Under "
- . htmlentities($path[$i + 2]) : "Kottu: Search";
+ $out->title = "Kottu: Search";
$out->posts = array();
$out->numblogs = $k->fetchnumblogs();
$out->str = '';
@@ -228,16 +249,7 @@
$out->time = 'off';
$out->page = isset($_GET['page']) ? $_GET['page'] : 0;
- if($path[$i + 1] == 'tags' && strlen($path[$i + 2]) > 0) {
-
- $out->page = isset($path[$i + 3]) && strlen($path[$i + 3]) ?
- $path[$i + 3] : 0;
- $out->lang = $path[$i];
- $out->posts = $k->search('', $out->page, $path[$i], $path[$i + 2]);
- $out->toplink = "tags/{$path[$i + 2]}/";
- $out->currentpage = $out->lang . '/' . $out->toplink;
- }
- else if(isset($_GET['q']) && strlen($_GET['q']) > 0) {
+ if(isset($_GET['q']) && strlen($_GET['q']) > 0) {
$out->posts = $k->search($_GET['q'], $out->page, $path[$i]);
$out->str = urldecode($_GET['q']);
View
6 lib/kottubackend.class.php
@@ -208,9 +208,9 @@ public function calculatespice() {
foreach($poststats as $id => $stats) {
- $twbuzz = unskew($stats[0] / ($this->stats['maxtweets'] + 1));
- $fbbuzz = unskew($stats[1] / ($this->stats['maxfbooks'] + 1));
- $clbuzz = unskew($stats[2] / ($this->stats['totclicks'] + 1));
+ $twbuzz = $this->unskew($stats[0] / ($this->stats['maxtweets'] + 1));
+ $fbbuzz = $this->unskew($stats[1] / ($this->stats['maxfbooks'] + 1));
+ $clbuzz = $this->unskew($stats[2] / ($this->stats['totclicks'] + 1));
/* final spice calculation */
$spice = ($twbuzz * config('twweight')) + ($fbbuzz *
View
14 static/style.css
@@ -380,3 +380,17 @@ article {
color:#FFF;
}
+/* tags */
+
+.tag {
+ line-height: 1.2;
+}
+.tagsize1 {
+ font-size: 120%;
+}
+.tagsize2 {
+ font-size: 140%;
+}
+.tagsize3 {
+ font-size: 160%;
+}
View
2  templates/web/error.php
@@ -46,7 +46,7 @@
The page that you were looking for could not be found. Would you like to search for it instead?<br><br>
- <form role="search" method="get" class="searchform" action="<?php echo config('basepath'); ?>/search/" >
+ <form role="search" method="get" class="searchform" action="<?php echo config('basepath'); ?>/all/search/" >
<input tabindex=1 type="text" class="searchbox" name="q" id="q" />
<input tabindex=2 type="submit" class="searchsubmit" value="Search" />
</form>
View
48 templates/web/items.php
@@ -1,50 +1,4 @@
<div class="content">
- <article class="post">
- <div class="postheader">
- <span class="tag tagsize2">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/tech/'; ?>">tech</a>
- </span>
- <span class="tag tagsize1">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/nature/'; ?>">nature</a>
- </span>
- <span class="tag tagsize2">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/news/'; ?>">news</a>
- </span>
- <span class="tag tagsize1">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/education/'; ?>">education</a>
- </span>
- <span class="tag tagsize1">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/travel/'; ?>">food/travel</a>
- </span>
- <span class="tag tagsize3">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/sports/'; ?>">sports</a>
- </span>
- <span class="tag tagsize3">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/personal/'; ?>">personal</a>
- </span>
- <span class="tag tagsize1">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/poetry/'; ?>">poetry</a>
- </span>
- <span class="tag tagsize2">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/business/'; ?>">business</a>
- </span>
- <span class="tag tagsize1">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/faith/'; ?>">faith</a>
- </span>
- <span class="tag tagsize2">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/entertainment/'; ?>">arts</a>
- </span>
- <span class="tag tagsize3">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/politics/'; ?>">politics</a>
- </span>
- <span class="tag tagsize2">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/photo/'; ?>">photo</a>
- </span>
- <span class="tag tagsize2">
- <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/other/'; ?>">etc</a>
- </span>
- </div>
- </article>
<?php if($this->title == "Kottu: Search"): ?>
<article class="post">
@@ -80,7 +34,7 @@
</article>
<?php endif; ?>
-<?php if($this->time != 'off'): ?>
+<?php if($this->time == 'today' || $this->time == 'week' || $this->time == 'month'): ?>
<article class="post">
<div class="timemenu">
<ul>
View
49 templates/web/sidebar.php
@@ -6,6 +6,53 @@
<input tabindex=2 type="submit" class="searchsubmit" value="Search" />
</form>
</div>
+
+ <div class="widgetheader">Tags</div>
+ <div class="widgetcont">
+ <span class="tag tagsize2">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/tech/'; ?>">tech</a>
+ </span>
+ <span class="tag tagsize1">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/nature/'; ?>">nature</a>
+ </span>
+ <span class="tag tagsize2">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/news/'; ?>">news</a>
+ </span>
+ <span class="tag tagsize1">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/education/'; ?>">education</a>
+ </span>
+ <span class="tag tagsize1">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/travel/'; ?>">food/travel</a>
+ </span>
+ <span class="tag tagsize3">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/sports/'; ?>">sports</a>
+ </span>
+ <span class="tag tagsize3">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/personal/'; ?>">personal</a>
+ </span>
+ <span class="tag tagsize1">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/poetry/'; ?>">poetry</a>
+ </span>
+ <span class="tag tagsize2">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/business/'; ?>">business</a>
+ </span>
+ <span class="tag tagsize1">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/faith/'; ?>">faith</a>
+ </span>
+ <span class="tag tagsize2">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/entertainment/'; ?>">arts</a>
+ </span>
+ <span class="tag tagsize3">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/politics/'; ?>">politics</a>
+ </span>
+ <span class="tag tagsize2">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/photo/'; ?>">photo</a>
+ </span>
+ <span class="tag tagsize2">
+ <a href="<?php echo config('basepath'), '/', $this->lang, '/tags/other/'; ?>">etc</a>
+ </span>
+ </div>
+
<div class="widgetheader">Hot Posts</div>
<div class="widgetcont">
<ul>
@@ -18,12 +65,14 @@
</ul>
<div class="hotlink"><a href="<?php echo config('basepath') . '/' . $this->lang . '/today/';?>">read more →</a></div>
</div>
+
<div class="widgetheader">Sri Lanka on Flickr</div>
<div class="widgetcont">
<script type="text/javascript"
src="http://www.flickr.com/badge_code_v2.gne?count=5&display=latest&size=m&layout=x&source=all_tag&tag=lanka%2C+srilanka"></script>
<div class="clear"></div>
</div>
+
<div class="widgetheader">Encourage Them!</div>
<div class="widgetcont" id="encourage">
<p>These are young bloggers from eVillages throughout the country. Please
Please sign in to comment.
Something went wrong with that request. Please try again.