Line | |
---|
1 | <?php |
---|
2 | /* adds info about comments count on main admin page, uses javascript */ |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | global $template; |
---|
6 | |
---|
7 | // comments count |
---|
8 | $query = ' |
---|
9 | SELECT COUNT(*) |
---|
10 | FROM '.COA_TABLE.' |
---|
11 | ;'; |
---|
12 | list($nb_comments) = pwg_db_fetch_row(pwg_query($query)); |
---|
13 | |
---|
14 | $template->assign( |
---|
15 | 'DB_COMMENTS_ALBUMS', |
---|
16 | l10n_dec('%d comment', '%d comments', $nb_comments) |
---|
17 | ); |
---|
18 | |
---|
19 | // unvalidated comments |
---|
20 | $query = ' |
---|
21 | SELECT COUNT(*) |
---|
22 | FROM '.COA_TABLE.' |
---|
23 | WHERE validated=\'false\' |
---|
24 | ;'; |
---|
25 | list($nb_comments) = pwg_db_fetch_row(pwg_query($query)); |
---|
26 | |
---|
27 | if ($nb_comments > 0) |
---|
28 | { |
---|
29 | $template->assign( |
---|
30 | 'unvalidated_albums', |
---|
31 | array( |
---|
32 | 'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments&section=albums', |
---|
33 | 'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments) |
---|
34 | ) |
---|
35 | ); |
---|
36 | } |
---|
37 | |
---|
38 | $template->set_prefilter('intro', 'coa_admin_intro_prefilter'); |
---|
39 | |
---|
40 | function coa_admin_intro_prefilter($content, &$smarty) |
---|
41 | { |
---|
42 | $search = '(<a href="{$unvalidated.URL}">{$unvalidated.INFO}</a>)'; |
---|
43 | |
---|
44 | $replace = $search.' |
---|
45 | {/if} |
---|
46 | [{\'Photos\'|@translate}] |
---|
47 | </li> |
---|
48 | <li> |
---|
49 | {$DB_COMMENTS_ALBUMS} |
---|
50 | {if isset($unvalidated_albums)} |
---|
51 | (<a href="{$unvalidated_albums.URL}">{$unvalidated_albums.INFO}</a>) |
---|
52 | {/if} |
---|
53 | [{\'Albums\'|@translate}] |
---|
54 | {if true}'; |
---|
55 | |
---|
56 | return str_replace($search, $replace, $content); |
---|
57 | } |
---|
58 | |
---|
59 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.