[7880] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
| 3 | // | Piwigo - a PHP based picture gallery | |
---|
[8629] | 4 | // | cl_conflit | |
---|
[7880] | 5 | // +-----------------------------------------------------------------------+ |
---|
| 6 | // | Copyright(C) 2010 cljosse | |
---|
| 7 | // +-----------------------------------------------------------------------+ |
---|
| 8 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 9 | // | it under the terms of the GNU General Public License as published by | |
---|
| 10 | // | the Free Software Foundation | |
---|
| 11 | // | | |
---|
| 12 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 13 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 14 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 15 | // | General Public License for more details. | |
---|
| 16 | // | | |
---|
| 17 | // | You should have received a copy of the GNU General Public License | |
---|
| 18 | // | along with this program; if not, write to the Free Software | |
---|
| 19 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 20 | // | USA. | |
---|
| 21 | // +-----------------------------------------------------------------------+ |
---|
| 22 | if (!defined('CONFLIT_PATH')) |
---|
| 23 | define( |
---|
| 24 | 'CONFLIT_PATH', |
---|
| 25 | PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/' |
---|
| 26 | ); |
---|
| 27 | |
---|
| 28 | class conflit_controler { |
---|
| 29 | //============================================================ |
---|
| 30 | /* |
---|
[8629] | 31 | * cl_conflit_script_1 |
---|
[7880] | 32 | */ |
---|
[8629] | 33 | static public function cl_conflit_script_1() |
---|
[7880] | 34 | { |
---|
[8629] | 35 | global $template,$user,$conf,$picture ,$page,$cl_plugin; |
---|
| 36 | if (isset( $page['body_id']) && $page['body_id']=='theAdminPage' ) return ; |
---|
| 37 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
| 38 | if ($ma_page=='thePiwiShackControllerPage') return ; |
---|
[7880] | 39 | $my_path = basename(dirname(__FILE__)).'/' ; |
---|
| 40 | $my_path = dirname(__FILE__).'/'; |
---|
| 41 | $template->set_filenames(array('cl_conflit_init'=>$my_path. "template/conflit.tpl" ) ); |
---|
[8629] | 42 | $DEBUG = isset($conf['cl_debug']) ? $conf['cl_debug'] : "false" ; |
---|
| 43 | $cl_conflit_parametres = cl_conflit_Get_Options() ; |
---|
[7880] | 44 | $theme=$user['theme']; |
---|
[8629] | 45 | $url = get_root_url(); |
---|
[7880] | 46 | $template->assign( |
---|
[7895] | 47 | array( |
---|
[7944] | 48 | 'cl_conflit_parametres' => $cl_conflit_parametres , |
---|
| 49 | 'cl_plugins' => $cl_plugin , |
---|
[7905] | 50 | 'cl_version' => $cl_plugin['version'] , |
---|
[7909] | 51 | 'name' => $cl_plugin['name'] , |
---|
[8629] | 52 | 'MY_ROOT' => $url, |
---|
[7880] | 53 | 'theme' => $theme , |
---|
[8629] | 54 | 'DEBUG' => $DEBUG , |
---|
| 55 | 'CONFLIT_PATH' => CONFLIT_PATH) |
---|
[7880] | 56 | ); |
---|
[8629] | 57 | |
---|
[7880] | 58 | return $template->parse( 'cl_conflit_init', false); |
---|
[8629] | 59 | }// function cl_conflit_script_1 |
---|
[7880] | 60 | //================================================================================= |
---|
| 61 | /* |
---|
[8629] | 62 | * cl_conflit_script_2 |
---|
[7880] | 63 | */ |
---|
| 64 | static public function cl_conflit_script_2() |
---|
| 65 | { |
---|
[7895] | 66 | global $template,$user,$conf,$picture ,$page,$cl_plugin; |
---|
[7880] | 67 | $my_path = dirname(__FILE__).'/'; |
---|
[8629] | 68 | $DEBUG = isset($conf['cl_debug']) ? $conf['cl_debug'] : "false" ; |
---|
| 69 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
| 70 | $theme=$user['theme']; |
---|
| 71 | if ($ma_page=='thePiwiShackControllerPage') return ; |
---|
[7880] | 72 | |
---|
| 73 | $template->assign( |
---|
[7895] | 74 | array( |
---|
[7905] | 75 | 'cl_version' => $cl_plugin['version'] , |
---|
[7909] | 76 | 'name' => $cl_plugin['name'] , |
---|
[8629] | 77 | 'ma_page' => $ma_page, |
---|
[7944] | 78 | |
---|
[7880] | 79 | 'theme' => $theme , |
---|
[8629] | 80 | 'DEBUG' => $DEBUG , |
---|
| 81 | 'CONFLIT_PATH' => CONFLIT_PATH) |
---|
[7880] | 82 | ); |
---|
| 83 | |
---|
[8629] | 84 | $autoscript="<script type='text/javascript'> |
---|
| 85 | /* cl_conflit_script_2 */ |
---|
| 86 | if (typeof (save_framework) == 'function') |
---|
| 87 | save_framework('".$page['body_id']."'); |
---|
| 88 | </script>"; |
---|
| 89 | $template->append('footer_elements',$autoscript); |
---|
| 90 | return ; |
---|
[7905] | 91 | }// function cl_conflit_script_2 |
---|
[7880] | 92 | |
---|
[8629] | 93 | //================================================ |
---|
[7905] | 94 | /* |
---|
[8629] | 95 | * cl_conflit_admin |
---|
[7905] | 96 | */ |
---|
| 97 | static public function cl_conflit_admin($menu) |
---|
| 98 | { |
---|
| 99 | global $lang ; |
---|
| 100 | array_push($menu, array('NAME' => 'cl_conflit', |
---|
| 101 | 'URL' => get_admin_plugin_menu_link(CONFLIT_PATH . 'admin/cl_conflit_admin.php'))); |
---|
| 102 | return $menu; |
---|
| 103 | } //function cl_conflit_admin |
---|
[7880] | 104 | |
---|
| 105 | } // class |
---|
[7905] | 106 | /* |
---|
| 107 | * |
---|
| 108 | */ |
---|
| 109 | function cl_conflit_Get_Options() |
---|
| 110 | { |
---|
| 111 | global $conf,$cl_conflit_parametres; |
---|
| 112 | $cl_conflit_parametres = unserialize($conf['cl_conflit']); |
---|
| 113 | $cl_conflit_parametres = cl_conflit_Set_Options(); |
---|
| 114 | return $cl_conflit_parametres; |
---|
| 115 | } |
---|
| 116 | /* |
---|
| 117 | * |
---|
| 118 | */ |
---|
| 119 | function cl_conflit_Set_Options() |
---|
| 120 | { |
---|
[7880] | 121 | |
---|
[7905] | 122 | global $cl_conflit_parametres; |
---|
| 123 | //============================================================================= |
---|
[8187] | 124 | $cl_conflit_parametres->query =(isset($_POST['query'])) ? $_POST['query'] : ((isset($cl_conflit_parametres->query )) ? $cl_conflit_parametres->query : 'Qt' ) ; |
---|
| 125 | $cl_conflit_parametres->type=(isset($_POST['type']))? $_POST['type']: ((isset($cl_conflit_parametres->type)) ? $cl_conflit_parametres->type: 'Ty') ; |
---|
[7880] | 126 | |
---|
[7905] | 127 | |
---|
[8187] | 128 | return $cl_conflit_parametres; |
---|
[7905] | 129 | } |
---|
| 130 | /* |
---|
| 131 | * |
---|
| 132 | */ |
---|
| 133 | function cl_conflit_sauve_options_inf() |
---|
| 134 | { |
---|
| 135 | global $options,$infos_message,$conf,$cl_conflit_parametres ; |
---|
| 136 | $infos_message .=l10n("cl_conflit_save_config")."<br>"; |
---|
| 137 | $cl_conflit_parametres=cl_conflit_Set_Options(); |
---|
[7880] | 138 | |
---|
[7905] | 139 | if ( isset($cl_conflit_parametres) ) |
---|
| 140 | { |
---|
| 141 | |
---|
| 142 | $query = ' |
---|
| 143 | UPDATE '.CONFIG_TABLE.' |
---|
| 144 | SET value="'.addslashes(serialize($cl_conflit_parametres)).'" |
---|
| 145 | WHERE param = "cl_conflit" |
---|
| 146 | LIMIT 1'; |
---|
| 147 | pwg_query($query); |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | } |
---|
[7880] | 151 | ?> |
---|