source: extensions/PayPalShoppingCart/admin.php @ 14919

Last change on this file since 14919 was 9239, checked in by Saint-Malo, 13 years ago

Version 1.0.2

File size: 4.3 KB
Line 
1<?php
2/*
3  Plugin Panier PayPal Pour Piwigo
4  Copyright (C) 2011 www.queguineur.fr — Tous droits réservés.
5 
6  Ce programme est un logiciel libre ; vous pouvez le redistribuer ou le
7  modifier suivant les termes de la “GNU General Public License” telle que
8  publiée par la Free Software Foundation : soit la version 3 de cette
9  licence, soit (à votre gré) toute version ultérieure.
10 
11  Ce programme est distribué dans l’espoir qu’il vous sera utile, mais SANS
12  AUCUNE GARANTIE : sans même la garantie implicite de COMMERCIALISABILITÉ
13  ni d’ADÉQUATION À UN OBJECTIF PARTICULIER. Consultez la Licence Générale
14  Publique GNU pour plus de détails.
15 
16  Vous devriez avoir reçu une copie de la Licence Générale Publique GNU avec
17  ce programme ; si ce n’est pas le cas, consultez :
18  <http://www.gnu.org/licenses/>.
19*/
20if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
21global $template;
22include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php');
23load_language('plugin.lang', PPPPP_PATH);
24$my_base_url = get_admin_plugin_menu_link(__FILE__);
25include_once (PPPPP_PATH.'/constants.php');
26
27// onglets
28if (!isset($_GET['tab']))
29    $page['tab'] = 'currency';
30else
31    $page['tab'] = $_GET['tab'];
32
33$tabsheet = new tabsheet();
34$tabsheet->add('currency',
35               l10n('Currency'),
36               $my_base_url.'&amp;tab=currency');
37$tabsheet->add('size',
38               l10n('Size'),
39               $my_base_url.'&amp;tab=size');
40$tabsheet->add('shipping',
41               l10n('Shipping cost'),
42               $my_base_url.'&amp;tab=shipping');                         
43$tabsheet->select($page['tab']);
44$tabsheet->assign();
45
46switch($page['tab']){
47 case 'currency':
48  $array_currency=array(
49  'AUD'=>'Australian Dollar',
50  'BRL'=>'Brazilian Real',
51  'CAD'=>'Canadian Dollar',
52  'CZK'=>'Czech Koruna',
53  'DKK'=>'Danish Krone',
54  'EUR'=>'Euro',
55  'HKD'=>'Hong Kong Dollar',
56  'HUF'=>'Hungarian Forint',
57  'ILS'=>'Israeli New Sheqel',
58  'JPY'=>'Japanese Yen',
59  'MYR'=>'Malaysian Ringgit',
60  'MXN'=>'Mexican Peso',
61  'NOK'=>'Norwegian Krone',
62  'NZD'=>'New Zealand Dollar',
63  'PHP'=>'Philippine Peso',
64  'PLN'=>'Polish Zloty',
65  'GBP'=>'Pound Sterling',
66  'SGD'=>'Singapore Dollar',
67  'SEK'=>'Swedish Krona',
68  'CHF'=>'Swiss Franc',
69  'TWD'=>'Taiwan New Dollar',
70  'THB'=>'Thai Baht',
71  'USD'=>'U.S. Dollar'
72  );
73  if(isset($_POST['currency'])){
74   $currency=$_POST['currency'];
75   $query='UPDATE '.PPPPP_CONFIG_TABLE.' SET value = \''.$currency.'\' WHERE param = \'currency\';';
76   pwg_query($query);
77   $page['infos']=l10n('Data updated');
78   }
79 
80  $query='SELECT value FROM '.PPPPP_CONFIG_TABLE.' WHERE param = \'currency\';';
81  $result = pwg_query($query);
82  $row = mysql_fetch_array($result);
83  $template->assign('ppppp_currency',$row[0]);
84 
85  $template->assign('ppppp_array_currency',$array_currency);
86  break;
87 
88 case 'size':
89  if(isset($_POST['delete'])and is_numeric($_POST['delete'])){
90   $delete_id=$_POST['delete'];
91   $query='DELETE FROM '.PPPPP_SIZE_TABLE.' WHERE id = '.$delete_id.';';
92   pwg_query($query);
93   $page['infos']=l10n('Data deleted');
94   }
95  else if (isset($_POST['size'])and isset($_POST['price'])and is_numeric($_POST['price'])){
96   $size=$_POST['size'];
97   $price=$_POST['price'];
98   $query='INSERT into '.PPPPP_SIZE_TABLE.' (size,price) values (\''.$size.'\',\''.$price.'\');';
99   @$res=pwg_query($query);
100   if($res==1)
101    $page['infos']=l10n('Data appened');
102   else
103    $page['errors']=l10n('Error');
104  }
105  $query='SELECT * FROM '.PPPPP_SIZE_TABLE.';';
106  $result = pwg_query($query);
107  while($row = mysql_fetch_array($result)){
108   $template->append('ppppp_array_size',$row);
109  }
110  break;
111
112 case 'shipping':
113  if(isset($_POST['fixed_shipping'])and is_numeric($_POST['fixed_shipping'])){
114   $fixed_shipping=$_POST['fixed_shipping'];
115   $query='UPDATE '.PPPPP_CONFIG_TABLE.' SET value = \''.$fixed_shipping.'\' WHERE param = \'fixed_shipping\';';
116   pwg_query($query);
117   $page['infos']=l10n('Data updated');
118   }
119  $query='SELECT value FROM '.PPPPP_CONFIG_TABLE.' WHERE param = \'fixed_shipping\';';
120  $result = pwg_query($query);
121  $row = mysql_fetch_array($result);
122  $template->assign('ppppp_fixed_shipping',$row[0]);
123  break;
124 }
125
126$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 
127$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
128?>
Note: See TracBrowser for help on using the repository browser.