Ignore:
Timestamp:
Feb 14, 2009, 3:28:21 AM (15 years ago)
Author:
rvelices
Message:

merge 3145-3146 from trunk
Last (I hope) paranoic optims ...

  • move get_uysername and get_groupname from public to admin/functions.inc.php
  • optim in index.php
  • tags.tpl does not need smarty modifier included
  • move func get_comment_post_key from functions_comment to functions (avoid extra inclusion every time on picture page)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/include/functions.inc.php

    r3137 r3147  
    494494  closedir($dir);
    495495  @asort($languages);
    496   @reset($languages);
    497496
    498497  return $languages;
     
    13731372      $source_file = $f;
    13741373      break;
    1375     }
    1376 
    1377     if ($target_charset=='utf-8')
    1378     { // we accept conversion from ISO-8859-1 to UTF-8
    1379       $f = $dir.'.iso-8859-1/'.$filename;
    1380       if (file_exists($f))
    1381       {
    1382         $source_charset = 'iso-8859-1';
    1383         $source_file = $f;
    1384         break;
    1385       }
    13861374    }
    13871375  }
     
    14841472  }
    14851473}
     1474
     1475/**
     1476 * returns a "secret key" that is to be sent back when a user enters a comment
     1477 *
     1478 * @param int image_id
     1479 */
     1480function get_comment_post_key($image_id)
     1481{
     1482  global $conf;
     1483
     1484  $time = time();
     1485
     1486  return sprintf(
     1487    '%s:%s',
     1488    $time,
     1489    hash_hmac(
     1490      'md5',
     1491      $time.':'.$image_id,
     1492      $conf['secret_key']
     1493      )
     1494    );
     1495}
    14861496?>
Note: See TracChangeset for help on using the changeset viewer.