diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index 0c0b373..b7d5991 100644 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -288,6 +288,34 @@ class Main { } + // Generate disqus hmac (https://github.com/disqus/DISQUS-API-Recipes/blob/master/sso/php/sso.php) + public static function dsqHmacSha1($data, $key) { + + $blocksize = 64; + + if(strlen($key) > $blocksize) { + + $key = pack('H*', sha1($key)); + + } + + $key = str_pad($key, $blocksize, chr(0x00)); + $ipad = str_repeat(chr(0x36), $blocksize); + $opad = str_repeat(chr(0x5c), $blocksize); + $hmac = pack( + 'H*', sha1( + ($key ^ $opad) . pack( + 'H*', sha1( + ($key ^ $ipad) . $data + ) + ) + ) + ); + + return bin2hex($hmac); + + } + // Loading info pages public static function loadInfoPage($id) { diff --git a/_sakura/sakura.php b/_sakura/sakura.php index a406e84..d5b6175 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -80,7 +80,9 @@ $renderData = [ 'cookiepath' => Configuration::getConfig('cookie_path'), 'minpwdentropy' => Configuration::getConfig('min_entropy'), 'minusernamelength' => Configuration::getConfig('username_min_length'), - 'maxusernamelength' => Configuration::getConfig('username_max_length') + 'maxusernamelength' => Configuration::getConfig('username_max_length'), + 'disqus_shortname' => Configuration::getConfig('disqus_shortname'), + 'disqus_api_key' => Configuration::getConfig('disqus_api_key') ], diff --git a/_sakura/templates/yuuno/main/news.tpl b/_sakura/templates/yuuno/main/news.tpl index 6798ff8..2c39aa1 100644 --- a/_sakura/templates/yuuno/main/news.tpl +++ b/_sakura/templates/yuuno/main/news.tpl @@ -34,18 +34,23 @@