1 | <?php |
---|
2 | //Chech whether we are indeed included by Piwigo. |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | //Load translation files |
---|
6 | load_language('plugin.lang', MEDIA_ICON_PATH); |
---|
7 | |
---|
8 | //Check access and exit when user status is not ok |
---|
9 | check_status(ACCESS_ADMINISTRATOR); |
---|
10 | |
---|
11 | $conf_media_icon = $conf['media_icon']; |
---|
12 | $conf_media_icon_unserialize = unserialize($conf['media_icon']); |
---|
13 | |
---|
14 | //Save config |
---|
15 | if (isset($_POST['submit'])) { |
---|
16 | //New parameters |
---|
17 | $conf_media_icon_unserialize['style'] = $_POST['style']; |
---|
18 | |
---|
19 | //Save |
---|
20 | conf_update_param('media_icon', serialize($conf_media_icon_unserialize)); |
---|
21 | array_push($page['infos'], l10n('Information data registered in database')); |
---|
22 | } |
---|
23 | |
---|
24 | //Parameters of the template |
---|
25 | $template->assign('MEDIA_ICON_STYLE_LOGO_SELECTED', ($conf_media_icon_unserialize['style'] == 'logo') ? 'selected="selected"' : null); |
---|
26 | $template->assign('MEDIA_ICON_STYLE_PHOTO_SELECTED', ($conf_media_icon_unserialize['style'] == 'photo') ? 'selected="selected"' : null); |
---|
27 | $template->assign('MEDIA_ICON_STYLE_FOLDER_SELECTED', ($conf_media_icon_unserialize['style'] == 'folder') ? 'selected="selected"' : null); |
---|
28 | $template->assign('MEDIA_ICON_STYLE_FOLDERCOLOR_SELECTED', ($conf_media_icon_unserialize['style'] == 'foldercolor') ? 'selected="selected"' : null); |
---|
29 | |
---|
30 | //Fetch the template. |
---|
31 | global $template; |
---|
32 | |
---|
33 | //add a stylesheet |
---|
34 | $template->append('head_elements', '<link rel="stylesheet" type="text/css" href="'.MEDIA_ICON_PATH.'template/'.$conf_media_icon_unserialize['style'].'_media_icon.css">'); |
---|
35 | |
---|
36 | //Add our template to the global template |
---|
37 | $template->set_filenames( |
---|
38 | array( |
---|
39 | 'plugin_admin_content' => dirname(__FILE__).'/admin.tpl' |
---|
40 | ) |
---|
41 | ); |
---|
42 | |
---|
43 | //Assign the template contents to ADMIN_CONTENT |
---|
44 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
45 | ?> |
---|