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