Changeset 19464 for extensions/PayPalShoppingCart/main.inc.php
- Timestamp:
- Dec 17, 2012, 3:55:58 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PayPalShoppingCart/main.inc.php
r9876 r19464 2 2 /* 3 3 Plugin Name: PayPal Shopping Cart 4 Version: 1.0.74 Version: auto 5 5 Description: Append PayPal Shopping Cart on Piwigo to sell photos 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=499 … … 56 56 */ 57 57 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 58 59 global $prefixeTable; 60 61 // +-----------------------------------------------------------------------+ 62 // | Define plugin constants | 63 // +-----------------------------------------------------------------------+ 64 65 defined('PPPPP_ID') or define('PPPPP_ID', basename(dirname(__FILE__))); 58 66 define('PPPPP_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); 59 include_once (PPPPP_PATH.'/constants.php'); 67 define('PPPPP_SIZE_TABLE', $prefixeTable.'ppppp_size'); 68 define('PPPPP_CONFIG_TABLE', $prefixeTable.'ppppp_config'); 69 define('PPPPP_VERSION', 'auto'); 70 60 71 61 72 function ppppp_append_form($tpl_source, &$smarty){ … … 112 123 113 124 function ppppp_picture_handler(){ 114 global $template; 125 global $template, $conf, $page; 126 127 if ($conf['PayPalShoppingCart']['apply_to_albums'] == 'list') 128 { 129 if (!isset($page['category'])) 130 { 131 return; 132 } 133 134 $query = ' 135 SELECT 136 paypal_active 137 FROM '.CATEGORIES_TABLE.' 138 WHERE id = '.$page['category']['id'].' 139 ;'; 140 list($paypal_active) = pwg_db_fetch_row(pwg_query($query)); 141 142 if ('false' == $paypal_active) 143 { 144 return; 145 } 146 } 147 115 148 $template->set_prefilter('picture', 'ppppp_append_form'); 116 149 load_language('plugin.lang', PPPPP_PATH); … … 130 163 131 164 $template->assign('ppppp_e_mail',get_webmaster_mail_address()); 132 $template->append('footer_elements',' - PayPal plugin by <a href=http://www.queguineur.fr>queguineur.fr</a>');133 165 } 134 166 … … 169 201 170 202 add_event_handler('get_admin_plugin_menu_links', 'ppppp_admin_menu'); 203 204 add_event_handler('init', 'ppppp_init'); 205 /** 206 * plugin initialization 207 * - check for upgrades 208 * - unserialize configuration 209 * - load language 210 */ 211 function ppppp_init() 212 { 213 global $conf, $pwg_loaded_plugins; 214 215 // apply upgrade if needed 216 if ( 217 PPPPP_VERSION == 'auto' or 218 $pwg_loaded_plugins[PPPPP_ID]['version'] == 'auto' or 219 version_compare($pwg_loaded_plugins[PPPPP_ID]['version'], PPPPP_VERSION, '<') 220 ) 221 { 222 // call install function 223 include_once(PPPPP_PATH.'include/install.inc.php'); 224 ppppp_install(); 225 226 // update plugin version in database 227 if ( $pwg_loaded_plugins[PPPPP_ID]['version'] != 'auto' and PPPPP_VERSION != 'auto' ) 228 { 229 $query = ' 230 UPDATE '. PLUGINS_TABLE .' 231 SET version = "'. PPPPP_VERSION .'" 232 WHERE id = "'. PPPPP_ID .'"'; 233 pwg_query($query); 234 235 $pwg_loaded_plugins[PPPPP_ID]['version'] = PPPPP_VERSION; 236 237 if (defined('IN_ADMIN')) 238 { 239 $_SESSION['page_infos'][] = 'PayPalShoppingCart plugin updated to version '. PPPPP_VERSION; 240 } 241 } 242 } 243 244 // load plugin language file 245 load_language('plugin.lang', PPPPP_PATH); 246 247 // prepare plugin configuration 248 $conf['PayPalShoppingCart'] = unserialize($conf['PayPalShoppingCart']); 249 } 171 250 ?>
Note: See TracChangeset
for help on using the changeset viewer.