| 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 | global $template,$user,$conf,$picture ,$page,$cl_plugin; |
|---|
| 36 | $my_path = basename(dirname(__FILE__)).'/' ; |
|---|
| 37 | $my_path = dirname(__FILE__).'/'; |
|---|
| 38 | $template->set_filenames(array('cl_conflit_init'=>$my_path. "template/conflit.tpl" ) ); |
|---|
| 39 | $debug = isset($conf['debug']) ? $conf['debug'] : false ; |
|---|
| 40 | $cl_conflit = isset($conf['cl_conflit']) ? $conf['cl_conflit'] : 'true' ; |
|---|
| 41 | $theme=$user['theme']; |
|---|
| 42 | |
|---|
| 43 | $template->assign( |
|---|
| 44 | array( |
|---|
| 45 | 'version' => $cl_plugin['version'] , |
|---|
| 46 | 'name' => $cl_plugin['id'] , |
|---|
| 47 | 'cl_conflit' => $cl_conflit , |
|---|
| 48 | 'theme' => $theme , |
|---|
| 49 | 'DEBUG' => $debug , |
|---|
| 50 | 'CONFLIT_ROOT' => CONFLIT_PATH) |
|---|
| 51 | ); |
|---|
| 52 | |
|---|
| 53 | if( $page['body_id'] == 'theAdminPage' ) return ; |
|---|
| 54 | return $template->parse( 'cl_conflit_init', false); |
|---|
| 55 | }// function cl_autosize_script |
|---|
| 56 | //================================================================================= |
|---|
| 57 | /* |
|---|
| 58 | * |
|---|
| 59 | */ |
|---|
| 60 | static public function cl_conflit_script_2() |
|---|
| 61 | { |
|---|
| 62 | global $template,$user,$conf,$picture ,$page,$cl_plugin; |
|---|
| 63 | |
|---|
| 64 | $my_path = basename(dirname(__FILE__)).'/' ; |
|---|
| 65 | $my_path = dirname(__FILE__).'/'; |
|---|
| 66 | $debug = isset($conf['debug']) ? $conf['debug'] : false ; |
|---|
| 67 | $cl_conflit = isset($conf['cl_conflit']) ? $conf['cl_conflit'] : 'true' ; |
|---|
| 68 | $theme=$user['theme']; |
|---|
| 69 | |
|---|
| 70 | $template->assign( |
|---|
| 71 | array( |
|---|
| 72 | 'version' => $cl_plugin['version'] , |
|---|
| 73 | 'name' => $cl_plugin['id'] , |
|---|
| 74 | 'ma_page' => $page['body_id'], |
|---|
| 75 | 'cl_conflit' => $cl_conflit , |
|---|
| 76 | 'theme' => $theme , |
|---|
| 77 | 'DEBUG' => $debug , |
|---|
| 78 | 'CONFLIT_ROOT' => CONFLIT_PATH) |
|---|
| 79 | ); |
|---|
| 80 | |
|---|
| 81 | $autoscript="<script type='text/javascript'> |
|---|
| 82 | |
|---|
| 83 | if (typeof (save_framework) == 'function') |
|---|
| 84 | save_framework('".$page['body_id']."'); |
|---|
| 85 | </script>"; |
|---|
| 86 | $template->append('footer_elements',$autoscript); |
|---|
| 87 | return ; |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | }// function cl_autosize_script_2 |
|---|
| 91 | |
|---|
| 92 | //================================================================= |
|---|
| 93 | /* |
|---|
| 94 | * |
|---|
| 95 | */ |
|---|
| 96 | static public function cl_conflit_script_3($content) |
|---|
| 97 | { |
|---|
| 98 | global $template,$user,$conf,$picture ,$page,$cl_plugin; |
|---|
| 99 | |
|---|
| 100 | $my_path = basename(dirname(__FILE__)).'/' ; |
|---|
| 101 | $my_path = dirname(__FILE__).'/'; |
|---|
| 102 | $debug = isset($conf['debug']) ? $conf['debug'] : false ; |
|---|
| 103 | $cl_conflit = isset($conf['cl_conflit']) ? $conf['cl_conflit'] : 'true' ; |
|---|
| 104 | $theme=$user['theme']; |
|---|
| 105 | |
|---|
| 106 | $ThePicture = $template->get_template_vars('current'); |
|---|
| 107 | $tpl_name = $user['theme'] ; |
|---|
| 108 | if ( !empty($content) ) { return $content; } |
|---|
| 109 | if ($ThePicture['is_picture'] <> 1 ) { return $content; ; } |
|---|
| 110 | |
|---|
| 111 | $autosizejs = '<script type="text/javascript" charset="utf-8" src="'; |
|---|
| 112 | $autocss = $autosizejs.'themes/default/js/jquery.packed.js"></script>'."\n"; |
|---|
| 113 | $template->append('head_elements',$autocss); |
|---|
| 114 | |
|---|
| 115 | $autocss="<script type='text/javascript'> |
|---|
| 116 | // jQuery('#theImage').css({opacity:'0.0'}); |
|---|
| 117 | </script>"; |
|---|
| 118 | |
|---|
| 119 | $template->append('footer_elements',"\n".$autocss); |
|---|
| 120 | return $content ; |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | }// function cl_autosize_script_3 |
|---|
| 124 | |
|---|
| 125 | |
|---|
| 126 | } // class |
|---|
| 127 | |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | ?> |
|---|