1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based picture gallery | |
---|
4 | // | cl_conflit | |
---|
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 | if (!defined('CONFLIT_PATH_ABS')) |
---|
28 | define( |
---|
29 | 'CONFLIT_PATH_ABS',dirname(__FILE__).'/'); |
---|
30 | class conflit_controler { |
---|
31 | //============================================================ |
---|
32 | /* |
---|
33 | * cl_conflit_script_1 |
---|
34 | */ |
---|
35 | static public function cl_conflit_script_1() |
---|
36 | { |
---|
37 | global $template,$user,$conf,$picture ,$page,$cl_plugin; |
---|
38 | if (isset( $page['body_id']) && $page['body_id']=='theAdminPage' ) return ; |
---|
39 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
40 | if ($ma_page=='thePiwiShackControllerPage') return ; |
---|
41 | $my_path = basename(dirname(__FILE__)).'/' ; |
---|
42 | $my_path = dirname(__FILE__).'/'; |
---|
43 | $template->set_filenames(array('cl_conflit_init'=>$my_path. "template/conflit.tpl" ) ); |
---|
44 | $DEBUG = isset($conf['cl_debug']) ? $conf['cl_debug'] : "false" ; |
---|
45 | $cl_conflit_parametres = cl_conflit_Get_Options() ; |
---|
46 | $theme=$user['theme']; |
---|
47 | $url = get_root_url(); |
---|
48 | |
---|
49 | $template->assign( |
---|
50 | array( |
---|
51 | 'cl_conflit_parametres' => $cl_conflit_parametres , |
---|
52 | 'cl_plugins' => $cl_plugin , |
---|
53 | 'cl_version' => $cl_plugin['version'] , |
---|
54 | 'name' => $cl_plugin['name'] , |
---|
55 | 'MY_ROOT' => $url, |
---|
56 | 'theme' => $theme , |
---|
57 | 'DEBUG' => $DEBUG , |
---|
58 | 'CONFLIT_PATH' => CONFLIT_PATH, |
---|
59 | 'CONFLIT_PATH_ABS' => CONFLIT_PATH_ABS |
---|
60 | ) ); |
---|
61 | |
---|
62 | return $template->parse( 'cl_conflit_init', false); |
---|
63 | }// function cl_conflit_script_1 |
---|
64 | //================================================================================= |
---|
65 | /* |
---|
66 | * cl_conflit_script_2 |
---|
67 | */ |
---|
68 | static public function cl_conflit_script_2() |
---|
69 | { |
---|
70 | global $template,$user,$conf,$picture ,$page,$cl_plugin; |
---|
71 | $my_path = dirname(__FILE__).'/'; |
---|
72 | $DEBUG = isset($conf['cl_debug']) ? $conf['cl_debug'] : "false" ; |
---|
73 | $ma_page=isset($page['body_id'])?$page['body_id']:"" ; |
---|
74 | $theme=$user['theme']; |
---|
75 | if ($ma_page=='thePiwiShackControllerPage') return ; |
---|
76 | |
---|
77 | $template->assign( |
---|
78 | array( |
---|
79 | 'cl_version' => $cl_plugin['version'] , |
---|
80 | 'name' => $cl_plugin['name'] , |
---|
81 | 'ma_page' => $ma_page, |
---|
82 | |
---|
83 | 'theme' => $theme , |
---|
84 | 'DEBUG' => $DEBUG , |
---|
85 | 'CONFLIT_PATH' => CONFLIT_PATH, |
---|
86 | 'CONFLIT_PATH_ABS' => CONFLIT_PATH_ABS |
---|
87 | ) |
---|
88 | ); |
---|
89 | |
---|
90 | $autoscript="<script type='text/javascript'> |
---|
91 | /* cl_conflit_script_2 */ |
---|
92 | if (typeof (save_framework) == 'function') |
---|
93 | save_framework('".$page['body_id']."'); |
---|
94 | </script>"; |
---|
95 | $template->append('footer_elements',$autoscript); |
---|
96 | return ; |
---|
97 | }// function cl_conflit_script_2 |
---|
98 | |
---|
99 | //================================================ |
---|
100 | /* |
---|
101 | * cl_conflit_admin |
---|
102 | */ |
---|
103 | static public function cl_conflit_admin($menu) |
---|
104 | { |
---|
105 | global $lang ; |
---|
106 | array_push($menu, array('NAME' => 'cl_conflit', |
---|
107 | 'URL' => get_admin_plugin_menu_link(CONFLIT_PATH . 'admin/cl_conflit_admin.php'))); |
---|
108 | return $menu; |
---|
109 | } //function cl_conflit_admin |
---|
110 | |
---|
111 | } // class |
---|
112 | /* |
---|
113 | * |
---|
114 | */ |
---|
115 | function cl_conflit_Get_Options() |
---|
116 | { |
---|
117 | global $conf,$cl_conflit_parametres; |
---|
118 | $cl_conflit_parametres = unserialize($conf['cl_conflit']); |
---|
119 | $cl_conflit_parametres = cl_conflit_Set_Options(); |
---|
120 | return $cl_conflit_parametres; |
---|
121 | } |
---|
122 | /* |
---|
123 | * |
---|
124 | */ |
---|
125 | function cl_conflit_Set_Options() |
---|
126 | { |
---|
127 | |
---|
128 | global $cl_conflit_parametres; |
---|
129 | //============================================================================= |
---|
130 | $cl_conflit_parametres->query =(isset($_POST['query'])) ? $_POST['query'] : ((isset($cl_conflit_parametres->query )) ? $cl_conflit_parametres->query : 'Qt' ) ; |
---|
131 | $cl_conflit_parametres->type=(isset($_POST['type']))? $_POST['type']: ((isset($cl_conflit_parametres->type)) ? $cl_conflit_parametres->type: 'Ty') ; |
---|
132 | |
---|
133 | |
---|
134 | return $cl_conflit_parametres; |
---|
135 | } |
---|
136 | /* |
---|
137 | * |
---|
138 | */ |
---|
139 | function cl_conflit_sauve_options_inf() |
---|
140 | { |
---|
141 | global $options,$infos_message,$conf,$cl_conflit_parametres ; |
---|
142 | $infos_message .=l10n("cl_conflit_save_config")."<br>"; |
---|
143 | $cl_conflit_parametres=cl_conflit_Set_Options(); |
---|
144 | |
---|
145 | if ( isset($cl_conflit_parametres) ) |
---|
146 | { |
---|
147 | |
---|
148 | $query = ' |
---|
149 | UPDATE '.CONFIG_TABLE.' |
---|
150 | SET value="'.addslashes(serialize($cl_conflit_parametres)).'" |
---|
151 | WHERE param = "cl_conflit" |
---|
152 | LIMIT 1'; |
---|
153 | pwg_query($query); |
---|
154 | } |
---|
155 | |
---|
156 | } |
---|
157 | ?> |
---|