Cleaning some hash functions

pull/525/head
Alexandre Alapetite 10 years ago
parent 5b06f6cd94
commit 3275018238
  1. 4
      app/Models/Feed.php
  2. 6
      lib/lib_rss.php

@ -105,7 +105,7 @@ class FreshRSS_Feed extends Minz_Model {
$file = DATA_PATH . '/favicons/' . $this->hash() . '.txt'; $file = DATA_PATH . '/favicons/' . $this->hash() . '.txt';
if (!file_exists ($file)) { if (!file_exists ($file)) {
$t = $this->website; $t = $this->website;
if (empty($t)) { if ($t == '') {
$t = $this->url; $t = $this->url;
} }
file_put_contents($file, $t); file_put_contents($file, $t);
@ -296,7 +296,7 @@ class FreshRSS_Feed extends Minz_Model {
} }
function lock() { function lock() {
$this->lockPath = TMP_PATH . '/' . md5(Minz_Configuration::salt() . $this->url) . '.freshrss.lock'; $this->lockPath = TMP_PATH . '/' . $this->hash() . '.freshrss.lock';
if (file_exists($this->lockPath) && ((time() - @filemtime($this->lockPath)) > 3600)) { if (file_exists($this->lockPath) && ((time() - @filemtime($this->lockPath)) > 3600)) {
@unlink($this->lockPath); @unlink($this->lockPath);
} }

@ -56,12 +56,6 @@ function checkUrl($url) {
} }
} }
// tiré de Shaarli de Seb Sauvage //Format RFC 4648 base64url
function small_hash ($txt) {
$t = rtrim (base64_encode (hash ('crc32', $txt, true)), '=');
return strtr ($t, '+/', '-_');
}
function formatNumber($n, $precision = 0) { function formatNumber($n, $precision = 0) {
return str_replace(' ', ' ', //Espace insécable //TODO: remplacer par une espace _fine_ insécable return str_replace(' ', ' ', //Espace insécable //TODO: remplacer par une espace _fine_ insécable
number_format($n, $precision, '.', ' ')); //number_format does not seem to be Unicode-compatible number_format($n, $precision, '.', ' ')); //number_format does not seem to be Unicode-compatible

Loading…
Cancel
Save