source: extensions/cl_conflit/conflit.inc.php @ 7914

Last change on this file since 7914 was 7914, checked in by cljosse, 13 years ago

[cl_conflit] setup!!

File size: 6.3 KB
Line 
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// +-----------------------------------------------------------------------+
22if (!defined('CONFLIT_PATH')) 
23define(
24  'CONFLIT_PATH',
25   PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'
26);
27
28class conflit_controler {
29//============================================================
30 /*
31  *  cl_conflit_script
32 */
33 static public function cl_conflit_script()
34        {
35           global  $template,$user,$conf,$picture ,$page,$cl_plugin;
36 
37                $my_path =  basename(dirname(__FILE__)).'/' ;
38            $my_path = dirname(__FILE__).'/';
39                $template->set_filenames(array('cl_conflit_init'=>$my_path. "template/conflit.tpl" ) ); 
40                $debug = isset($conf['debug']) ? $conf['debug'] : false ; 
41                $cl_conflit =  isset($conf['cl_conflit']) ? $conf['cl_conflit'] : 'true' ;                     
42                $theme=$user['theme'];
43               
44                $template->assign(
45                                                array( 
46                                                'cl_version' => $cl_plugin['version'] ,
47                                                'name' => $cl_plugin['name'] ,
48                                                'cl_conflit' => $cl_conflit  ,
49                                                'theme' => $theme  ,
50                                                'DEBUG' => $debug   ,
51                                                'CONFLIT_ROOT' => CONFLIT_PATH)
52                                                 );
53
54                if(     $page['body_id'] == 'theAdminPage' ) return ;
55                return $template->parse( 'cl_conflit_init', false);
56        }// function cl_conflit_script
57//=================================================================================
58/*
59 *
60*/
61 static public function cl_conflit_script_2()
62 {
63                global  $template,$user,$conf,$picture ,$page,$cl_plugin;
64         
65                        $my_path =  basename(dirname(__FILE__)).'/' ;
66                        $my_path = dirname(__FILE__).'/';
67                        $debug = isset($conf['debug']) ? $conf['debug'] : false ; 
68                        $cl_conflit =  isset($conf['cl_conflit']) ? $conf['cl_conflit'] : 'true' ;
69                        $theme=$user['theme'];
70
71                        $template->assign(
72                                        array(                                         
73                                            'cl_version' => $cl_plugin['version'] ,
74                                                'name' => $cl_plugin['name'] ,
75                                                'ma_page' =>    $page['body_id'],
76                                                'cl_conflit' => $cl_conflit  ,
77                                                'theme' => $theme  ,
78                                                'DEBUG' => $debug   ,
79                                                'CONFLIT_ROOT' => CONFLIT_PATH)
80                                                );
81                                                 
82                $autoscript="<script type='text/javascript'>
83         
84        if (typeof (save_framework) == 'function')
85        save_framework('".$page['body_id']."');
86</script>";
87                $template->append('footer_elements',$autoscript); 
88                return ;
89
90
91 }// function cl_conflit_script_2
92
93 //=================================================================
94 /*
95 * 
96 */
97 static public function cl_conflit_script_3($content)
98 {
99           global  $template,$user,$conf,$picture ,$page,$cl_plugin;
100           
101                        $my_path =  basename(dirname(__FILE__)).'/' ;
102                        $my_path = dirname(__FILE__).'/';
103                        $debug = isset($conf['debug']) ? $conf['debug'] : false ; 
104                        $cl_conflit =  isset($conf['cl_conflit']) ? $conf['cl_conflit'] : 'true' ;
105                        $theme=$user['theme'];
106
107$ThePicture = $template->get_template_vars('current');
108$tpl_name =   $user['theme'] ;
109if ( !empty($content) )   {  return $content;  }       
110if ($ThePicture['is_picture'] <> 1 )    {  return $content;  ; }       
111
112         $cl_conflitjs = '<script type="text/javascript" charset="utf-8"  src="';
113              $autocss =   $cl_conflitjs.'themes/default/js/jquery.packed.js"></script>'."\n"; 
114                  $template->append('head_elements',$autocss);
115
116                $autocss="<script type='text/javascript'>
117    //   jQuery('#theImage').css({opacity:'0.0'});
118</script>";
119
120                $template->append('footer_elements',"\n".$autocss);
121                return $content ;
122
123
124 }// function cl_conflit_script_3
125        /*
126        *
127        */
128        static public function cl_conflit_admin($menu)
129                {
130                global  $lang ;
131                array_push($menu, array('NAME' => 'cl_conflit',
132                'URL' => get_admin_plugin_menu_link(CONFLIT_PATH . 'admin/cl_conflit_admin.php')));
133                return $menu;
134        } //function cl_conflit_admin
135
136} // class
137        /*
138        *
139        */
140 function cl_conflit_Get_Options()
141  {
142                global $conf,$cl_conflit_parametres; 
143                $cl_conflit_parametres =  unserialize($conf['cl_conflit']);
144                $cl_conflit_parametres =  cl_conflit_Set_Options();
145                return $cl_conflit_parametres;
146  }
147        /*
148        *
149        */
150function cl_conflit_Set_Options()
151  {
152
153  global $cl_conflit_parametres;
154//=============================================================================
155$cl_conflit_parametres->query =(isset($_POST['query'])) ? $_POST['query'] : ((isset($cl_conflit_parametres->query )) ? $cl_conflit_parametres->query : '' ) ;
156$cl_conflit_parametres->type=(isset($_POST['type']))? $_POST['type']: ((isset($cl_conflit_parametres->type)) ? $cl_conflit_parametres->type:  '') ;
157
158 
159return $cl_conflit_parametres;
160}
161        /*
162        *
163        */
164function cl_conflit_sauve_options_inf()
165{
166global $options,$infos_message,$conf,$cl_conflit_parametres  ;
167$infos_message .=l10n("cl_conflit_save_config")."<br>";
168 $cl_conflit_parametres=cl_conflit_Set_Options();
169
170 if ( isset($cl_conflit_parametres) )
171        {
172 
173                $query = '
174                UPDATE '.CONFIG_TABLE.'
175                SET value="'.addslashes(serialize($cl_conflit_parametres)).'"
176                WHERE param = "cl_conflit"
177                LIMIT 1';
178                        pwg_query($query);
179          }
180         
181 }
182
183
184
185
186?>
Note: See TracBrowser for help on using the repository browser.