Last change
on this file since 9572 was
9572,
checked in by mistic100, 13 years ago
|
[extensions] ContestResults 1.3
- Add error and success messages on admin page
- Add Spain (es_ES) thanks to jpr928
- Contest status is automatic and shows remaining days
- More flexibility for description fields
- Compatibility with Piwigo 2.2.0
|
File size:
966 bytes
|
Line | |
---|
1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | // Racourcis un texte et ajoute une ellipse |
---|
5 | function CR_cut_string($string, $limit) { |
---|
6 | include_once(CR_PATH . 'include/cutstring.class.php'); |
---|
7 | if (strlen(str_replace("\r\n", "\n", strip_tags($string))) > $limit) { |
---|
8 | $output = new HtmlCutString($string, $limit); |
---|
9 | return ($output->cut()).'...'; |
---|
10 | } else { |
---|
11 | return $string; |
---|
12 | } |
---|
13 | } |
---|
14 | |
---|
15 | // Recupère le nom d'un coucours à partir de l'id |
---|
16 | function get_contest_name($id) { |
---|
17 | $contest = pwg_query("SELECT name FROM " . CR_TABLE_1 . " WHERE id = " . $id . ";"); |
---|
18 | if (pwg_db_num_rows($contest)) { |
---|
19 | $contest = pwg_db_fetch_assoc($contest); |
---|
20 | return $contest['name']; |
---|
21 | } else { |
---|
22 | return null; |
---|
23 | } |
---|
24 | } |
---|
25 | |
---|
26 | // Nombre de jours entre deux dates |
---|
27 | function DateDiff($date2, $date1) { |
---|
28 | return ceil((strtotime($date2)-strtotime($date1))/(3600*24)); |
---|
29 | } |
---|
30 | |
---|
31 | // Date passée |
---|
32 | function is_date_passed($date) { |
---|
33 | if (time() > strtotime($date)) { |
---|
34 | return true; |
---|
35 | } else { |
---|
36 | return false; |
---|
37 | } |
---|
38 | } |
---|
39 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.