|
Revision 3694, 1.3 KB
(checked in by Criss, 4 years ago)
|
|
Add 'Citation' block (thanks to rub, got from 'Fun Citation').
Only available in french language now, but admin can set code for other languages.
|
| Rev | Line | |
|---|
| [3694] | 1 | <?php |
|---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
|---|
| 3 | |
|---|
| 4 | if (!isset($datas)) { |
|---|
| 5 | $default_fr_value = '<script type="text/javascript" '; |
|---|
| 6 | $default_fr_value .= 'src="http://citations.hasarddujour.com/'; |
|---|
| 7 | $default_fr_value .= 'citation-hasard-du-jour.php?random"></script>'; |
|---|
| 8 | $datas = array( |
|---|
| 9 | 'quote_lang' => array( |
|---|
| 10 | "fr_FR" => $default_fr_value |
|---|
| 11 | ), |
|---|
| 12 | ); |
|---|
| 13 | } |
|---|
| 14 | $available_languages = get_languages(); |
|---|
| 15 | // Save configuration |
|---|
| 16 | if (isset($_POST['submit']) and !is_adviser()) { |
|---|
| 17 | $new_data = array(); |
|---|
| 18 | foreach (array_keys($available_languages) as $current_lang) { |
|---|
| 19 | $quote_value_key = 'quote_config_' . $current_lang; |
|---|
| 20 | if ((isset($_POST[$quote_value_key])) and |
|---|
| 21 | ("" != $_POST[$quote_value_key])) { |
|---|
| 22 | $new_data = array_merge( |
|---|
| 23 | $new_data, |
|---|
| 24 | array($current_lang => stripslashes($_POST[$quote_value_key])) |
|---|
| 25 | ); |
|---|
| 26 | } |
|---|
| 27 | } |
|---|
| 28 | $datas = array( |
|---|
| 29 | 'quote_lang' => $new_data |
|---|
| 30 | ); |
|---|
| 31 | } |
|---|
| 32 | global $user; |
|---|
| 33 | $template->assign('MODULE_QUOTE_DATA', $datas['quote_lang']); |
|---|
| 34 | $template->assign('MODULE_QUOTE_LANGUAGES', $available_languages); |
|---|
| 35 | $template->set_filenames(array( |
|---|
| 36 | 'module_options' => dirname(__FILE__) . '/config.tpl') |
|---|
| 37 | ); |
|---|
| 38 | $template->assign_var_from_handle('MODULE_OPTIONS', 'module_options'); |
|---|
| 39 | ?> |
|---|