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