source: extensions/piclens/admin/config.php

Last change on this file was 27570, checked in by plg, 10 years ago

compatibility with Piwigo 2.6

File size: 4.5 KB
Line 
1<?php
2/*
3 * Plugin Name: CoolIris-Piclens
4 * File :  config.php 
5 */
6
7
8if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
9
10global $template, $page;
11 
12$me = get_plugin_data($plugin_id);
13
14$type_list = array(l10n('piclens_label_withoutrecursive'), l10n ('piclens_label_withrecursive') );
15 
16$template->set_filenames( array('plugin_admin_content' => PICLENS_ROOT.'/admin/config.tpl') );
17
18// recuperation des parametres depuis le  fichier de configuration
19if (isset($_POST['restore'])) 
20{ 
21       
22        if (file_exists(PICLENS_CFG_FILE))
23        {
24                // changement du nom du fichier de conf.
25                $me->load_config_file();
26                $me->save_config();
27                array_push($page['infos'], sprintf(l10n('piclens_admin_restoreOK'), PICLENS_CFG_FILE1));
28        }
29        else
30                array_push($page['errors'], sprintf(l10n('piclens_admin_restoreKO'), PICLENS_CFG_FILE1));
31}
32// Sauvegarde des parametres dans le  fichier de configuration (
33if (isset($_POST['savefile'])) 
34{ 
35        if (file_exists(PICLENS_CFG_FILE))
36                array_push($page['infos'], sprintf(l10n('piclens_admin_savefileWN'), PICLENS_CFG_FILE1));
37        // Sauvegarde dans le fichier
38        $me->save_config_file();
39        array_push($page['infos'], sprintf(l10n('piclens_admin_savefileOK'), PICLENS_CFG_FILE1));
40       
41}
42
43if (isset($_POST['submit'])) { 
44  $me->my_config['piclens_active'] = isset($_POST['piclens_active']);
45  $me->my_config['piclens_recursive'] = isset($_POST['piclens_recursive']);
46  $me->my_config['piclens_gallerie_active'] = isset($_POST['piclens_gallerie_active']);
47  $me->my_config['piclens_gallerie_type'] = $_POST['piclens_gallerie_type'];
48  $me->my_config['piclens_lite_active'] = isset($_POST['piclens_lite_active']);
49  $me->my_config['piclens_secureimage'] = isset($_POST['piclens_secureimage']);
50  $me->my_config['piclens_extendeddesc'] = isset($_POST['piclens_extendeddesc']);
51 
52  $me->my_config['piclens_recentpics_active'] = isset($_POST['piclens_recentpics_active']);
53  $me->my_config['piclens_recentcats_active'] = isset($_POST['piclens_recentcats_active']);
54  $me->my_config['piclens_mostvisited_active']  = isset($_POST['piclens_mostvisited_active']);
55  $me->my_config['piclens_bestrated_active'] = isset($_POST['piclens_bestrated_active']);
56  $me->my_config['piclens_favorites_active'] = isset($_POST['piclens_favorites_active']);
57  $me->my_config['piclens_tags_active'] = isset($_POST['piclens_tags_active']);
58
59  $me->my_config['piclens_recursive_mode'] = $_POST['recursive_mode'];
60 
61  $me->save_config();
62  array_push($page['infos'], l10n('piclens_admin_saveOK'));
63       
64}
65
66// Affichage des coix miniature possibles pour la recursivite de l'option 'Activer gallerie'
67$i=1;
68foreach ( $type_list as $order ) //on parcours le tableau
69{
70        $template->append('PlGalleries',array('ID' => $i,'NAME' => $order,'SELECTED' => ($me->my_config['piclens_gallerie_type'] == $i ? 'selected' : '')));
71        $i++;   
72}
73
74$template->assign(array(
75        'PICLENS_ACTIVATED'                     => ($me->my_config['piclens_active'] ? 'checked="checked"' : ''), 
76        'PICLENS_RECURSIVE_ACTIVATED'   => ($me->my_config['piclens_recursive'] ? 'checked="checked"' : '' ),
77        'PICLENS_GALLERIE_ACTIVATED'    => ($me->my_config['piclens_gallerie_active'] ? 'checked="checked"' : '' ),
78        'PICLENS_GALLERIE_TYPE'                 => $me->my_config['piclens_gallerie_type'],
79        'PICLENS_LITE_ACTIVATED'                => ($me->my_config['piclens_lite_active'] ? 'checked="checked"' : '' ),
80        'PICLENS_SECUREIMAGE'                   => get_db_plugins('active','secureImages'),
81        'PICLENS_SECUREIMAGE_ACTIVATED' => ($me->my_config['piclens_secureimage'] ? 'checked="checked"' : '' ),
82        'PICLENS_EXTENDEDDESC'                  => get_db_plugins('active','ExtendedDescription'), 
83        'PICLENS_EXTENDEDDESC_ACTIVATED'=> ($me->my_config['piclens_extendeddesc'] ? 'checked="checked"' : '' ),
84        'PICLENS_RECENTPICS_ACTIVATED'  => ($me->my_config['piclens_recentpics_active'] ? 'checked="checked"' : '' ),
85        'PICLENS_RECENTCATS_ACTIVATED'  => ($me->my_config['piclens_recentcats_active'] ? 'checked="checked"' : '' ),
86        'PICLENS_MOSTVISITED_ACTIVATED' => ($me->my_config['piclens_mostvisited_active'] ? 'checked="checked"' : '' ),
87        'PICLENS_BESTRATED_ACTIVATED'   => ($me->my_config['piclens_bestrated_active'] ? 'checked="checked"' : '' ),
88        'PICLENS_FAVORITES_ACTIVATED'   => ($me->my_config['piclens_favorites_active'] ? 'checked="checked"' : '' ),
89        'PICLENS_TAGS_ACTIVATED'                => ($me->my_config['piclens_tags_active'] ? 'checked="checked"' : '' ),
90        $me->my_config['piclens_recursive_mode'].'_CHECKED' => 'checked="checked"',
91        'ICON_INFO' => PICLENS_ADMIN_PATH . 'info.png',
92        'PICLENS_CFGFILE_PRESENT'               => file_exists(PICLENS_CFG_FILE),
93        ));
94
95 
96$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
97 
98
99?>
Note: See TracBrowser for help on using the repository browser.