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