Compare commits
1724 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b58ec6c0e | ||
|
|
a3a06d737b | ||
|
|
1657c1c5b1 | ||
|
|
dfabd7878a | ||
|
|
ca8fbb4d47 | ||
|
|
47b2176b4d | ||
|
|
3d39e32c43 | ||
|
|
04a3aab393 | ||
|
|
6fb9419dbc | ||
|
|
76cb8f5e03 | ||
|
|
367c863e3a | ||
|
|
ffc24ed10b | ||
|
|
c3e7c28220 | ||
|
|
c66db0eef1 | ||
|
|
bc3f7c89a9 | ||
|
|
49b2efe3a5 | ||
|
|
f5aadafc92 | ||
|
|
005913ce3b | ||
|
|
722223c2a4 | ||
|
|
dbe72f8f76 | ||
|
|
d8fcdf19fe | ||
|
|
b7c28b8c48 | ||
|
|
0ebcc6cb67 | ||
|
|
1af8b45b5f | ||
|
|
8356cb82cf | ||
|
|
42e3ab3b90 | ||
|
|
7f14442c89 | ||
|
|
f59ff65357 | ||
|
|
f4ed4ce3ee | ||
|
|
b027122859 | ||
|
|
a69d737ad8 | ||
|
|
3c7d9ba53b | ||
|
|
4eaf942429 | ||
|
|
42134be069 | ||
|
|
66b1f844e4 | ||
|
|
b03a1730f6 | ||
|
|
f1755dc5b2 | ||
|
|
48b82a094f | ||
|
|
acc401e3e8 | ||
|
|
7648f8ece0 | ||
|
|
e5d25eea83 | ||
|
|
ac24d5ddd8 | ||
|
|
0b3c094698 | ||
|
|
00fa12e8f1 | ||
|
|
fb66ab60e3 | ||
|
|
c666cd32ab | ||
|
|
c4732a431a | ||
|
|
f21b8defa1 | ||
|
|
c604df470d | ||
|
|
15298ee65b | ||
|
|
2490a1def3 | ||
|
|
6db9f7dcb0 | ||
|
|
c8faf79c15 | ||
|
|
ddcede4ef5 | ||
|
|
b12517c17c | ||
|
|
b7fecada80 | ||
|
|
fdd72b47fa | ||
|
|
9ebe542fdb | ||
|
|
c32038a6f4 | ||
|
|
d3458a1c26 | ||
|
|
d9b6c6401a | ||
|
|
e66762fc85 | ||
|
|
bcd15e8f6f | ||
|
|
f670f7573f | ||
|
|
5660c09d62 | ||
|
|
45fbdd8635 | ||
|
|
3989b708c8 | ||
|
|
ba7ec2dd9d | ||
|
|
b365c2befa | ||
|
|
d84b5b2749 | ||
|
|
69feff1ee1 | ||
|
|
cc50d29cc3 | ||
|
|
9c01024080 | ||
|
|
e4654570e9 | ||
|
|
38d17b447e | ||
|
|
c13021dad0 | ||
|
|
2d3db2e15d | ||
|
|
4804005df2 | ||
|
|
1207b5bf40 | ||
|
|
7ac2f24ff3 | ||
|
|
74145e0081 | ||
|
|
2d238bbac7 | ||
|
|
5735102138 | ||
|
|
f3e2225957 | ||
|
|
6db622ece6 | ||
|
|
67ba2e5df5 | ||
|
|
3bbbdf8de5 | ||
|
|
5dbd54ff5f | ||
|
|
8370b1cd15 | ||
|
|
1d734487ff | ||
|
|
74fb39ef4b | ||
|
|
cb8cec2551 | ||
|
|
3e39010a9b | ||
|
|
0367e98504 | ||
|
|
f8acb56108 | ||
|
|
8a5493103d | ||
|
|
eb2d92644f | ||
|
|
a6f7bec80f | ||
|
|
e710e73009 | ||
|
|
668f3676eb | ||
|
|
73e4b5fe56 | ||
|
|
391fea452c | ||
|
|
109c38c5e0 | ||
|
|
4c83dce8f4 | ||
|
|
3359ebb347 | ||
|
|
bb7050715b | ||
|
|
bac9674b03 | ||
|
|
dce036f929 | ||
|
|
d764a3c2fe | ||
|
|
a6b66fb288 | ||
|
|
ad6e5b1cb8 | ||
|
|
27e910572c | ||
|
|
0f87f86203 | ||
|
|
7c7eda3167 | ||
|
|
2dbeb55bf1 | ||
|
|
9506172dd4 | ||
|
|
79867d0a75 | ||
|
|
aed1e77b94 | ||
|
|
ddcdcd571d | ||
|
|
130cf8ed11 | ||
|
|
ca68421dae | ||
|
|
3790730861 | ||
|
|
6f6f13a4e0 | ||
|
|
fd06e5c1a1 | ||
|
|
ccaa0542a0 | ||
|
|
faa6dda362 | ||
|
|
06ab93a8f6 | ||
|
|
4261dbc0df | ||
|
|
c45a172559 | ||
|
|
335d5cf93d | ||
|
|
4427b9a377 | ||
|
|
95de65c92f | ||
|
|
772083c15d | ||
|
|
8bec694c94 | ||
|
|
21666cf39d | ||
|
|
63436b787b | ||
|
|
b854caf867 | ||
|
|
2a0dcf9692 | ||
|
|
76f3457e2f | ||
|
|
48a8719d2f | ||
|
|
e718fb9c02 | ||
|
|
a02f6983f0 | ||
|
|
1278a064b6 | ||
|
|
48776271fd | ||
|
|
c827a9af0e | ||
|
|
9aa523fb4d | ||
|
|
9756801649 | ||
|
|
e02cc320ee | ||
|
|
ad9bf8d324 | ||
|
|
13f63f53f7 | ||
|
|
9d6ab8e70b | ||
|
|
ef75f20a63 | ||
|
|
e84dec5c4a | ||
|
|
0242329b30 | ||
|
|
844b0f4055 | ||
|
|
933d1e4d86 | ||
|
|
699ee23d94 | ||
|
|
5f91af9c4e | ||
|
|
5532f12d80 | ||
|
|
4dc0ebb2de | ||
|
|
a848e82ae9 | ||
|
|
cbea65eb66 | ||
|
|
41d593618d | ||
|
|
c5c479dcb7 | ||
|
|
cb92bacb97 | ||
|
|
1934e2ef6a | ||
|
|
3ceff1df09 | ||
|
|
f00820e090 | ||
|
|
6d46e7dced | ||
|
|
3439de9ef9 | ||
|
|
49922799e1 | ||
|
|
40d2a6282b | ||
|
|
62696d85f9 | ||
|
|
4334537fe1 | ||
|
|
1962458d39 | ||
|
|
e69629b214 | ||
|
|
642d9b4648 | ||
|
|
b13b8db639 | ||
|
|
e4361ad56b | ||
|
|
71cbc22bc0 | ||
|
|
c68c8be6e8 | ||
|
|
4b15da6656 | ||
|
|
3fbdda4b45 | ||
|
|
b0366ed9ac | ||
|
|
0d5421a40c | ||
|
|
bbdf6513a8 | ||
|
|
2ee0842282 | ||
|
|
4a5f3dc5c9 | ||
|
|
312d93a601 | ||
|
|
2ad9e4aa20 | ||
|
|
663009b3bb | ||
|
|
da416dea61 | ||
|
|
3f649efee7 | ||
|
|
8c0e148b75 | ||
|
|
99e90d5492 | ||
|
|
7056c69af1 | ||
|
|
abead31e0f | ||
|
|
f632af5e7a | ||
|
|
9fef06a9bb | ||
|
|
e095ebccd3 | ||
|
|
7b394c6cbd | ||
|
|
d0c1167d6c | ||
|
|
f0cf51ab64 | ||
|
|
9159631b27 | ||
|
|
bb524bf7a5 | ||
|
|
b7437fdb3c | ||
|
|
eab460df2d | ||
|
|
e0415ec7e2 | ||
|
|
5b4d337cd6 | ||
|
|
1723512579 | ||
|
|
ed19c60ff8 | ||
|
|
e176ea6dd3 | ||
|
|
7025caef50 | ||
|
|
a4b5aa4251 | ||
|
|
620653ce13 | ||
|
|
ef9d7c62b6 | ||
|
|
c333d84530 | ||
|
|
2ee1dd5813 | ||
|
|
e05452c7c4 | ||
|
|
a9b5f70767 | ||
|
|
de6d9c7bbe | ||
|
|
5dc1c8a71c | ||
|
|
ff30d33e8f | ||
|
|
2a83293a54 | ||
|
|
20b05a63ee | ||
|
|
e902d3e1dd | ||
|
|
2190551536 | ||
|
|
9e74ede928 | ||
|
|
b10fb843b5 | ||
|
|
b45021c243 | ||
|
|
7ec7dd4bbe | ||
|
|
8a82865591 | ||
|
|
7a81fbab9c | ||
|
|
e941c6df4a | ||
|
|
b0247fe0cb | ||
|
|
18c81442d1 | ||
|
|
5c8b5334a8 | ||
|
|
ecb6e763ff | ||
|
|
703e77cae2 | ||
|
|
9a175627e6 | ||
|
|
975bce4de9 | ||
|
|
8a395c2b6e | ||
|
|
b654b56035 | ||
|
|
b0fbfbfd88 | ||
|
|
a27ac5f6ed | ||
|
|
c1e4594a22 | ||
|
|
49a03078ab | ||
|
|
983508dd8b | ||
|
|
d6470b462b | ||
|
|
595c1384f4 | ||
|
|
52d4292f76 | ||
|
|
9b6824a825 | ||
|
|
9d10de0848 | ||
|
|
2537c72189 | ||
|
|
276f493dd7 | ||
|
|
0ce1e22813 | ||
|
|
f09017dc73 | ||
|
|
1cc95bcce1 | ||
|
|
5b908a0844 | ||
|
|
c47131aa9f | ||
|
|
792452c2e0 | ||
|
|
eb5cea2726 | ||
|
|
4abe8efd75 | ||
|
|
c16ca27155 | ||
|
|
a918295ae3 | ||
|
|
c441358b40 | ||
|
|
f00892539c | ||
|
|
3f97d4ab2b | ||
|
|
401722bb0b | ||
|
|
8cb669fb2c | ||
|
|
67f4bf47da | ||
|
|
1d47af51d7 | ||
|
|
8add301ef3 | ||
|
|
4965071c42 | ||
|
|
2406935d7a | ||
|
|
08a389a760 | ||
|
|
9e8d16ad6a | ||
|
|
70c92e1d38 | ||
|
|
3f12f6b83f | ||
|
|
07b109e003 | ||
|
|
53d85ae134 | ||
|
|
d57b3cbcd7 | ||
|
|
8fdcb10f78 | ||
|
|
14cb2b1ef0 | ||
|
|
a98752eb22 | ||
|
|
e4096bf943 | ||
|
|
db15eec68b | ||
|
|
a25cc16f28 | ||
|
|
a318ca610f | ||
|
|
bc160bb762 | ||
|
|
58c35a2152 | ||
|
|
226230f58b | ||
|
|
96b9355d9d | ||
|
|
d6ef55b5ed | ||
|
|
c7310f3899 | ||
|
|
a24764b9b3 | ||
|
|
928e0a5625 | ||
|
|
1bf46b362c | ||
|
|
fd90a0313d | ||
|
|
4cdc2c23db | ||
|
|
716acbaffa | ||
|
|
d723813173 | ||
|
|
ae4a223509 | ||
|
|
eda71ac8fb | ||
|
|
174be2bfce | ||
|
|
d9cb7eb475 | ||
|
|
6ae7ef6cbb | ||
|
|
eae6b9f67b | ||
|
|
107bd4f779 | ||
|
|
e42cb899ef | ||
|
|
5e6ab08a00 | ||
|
|
8a1bd2eb2d | ||
|
|
5d825bbbc1 | ||
|
|
611b4f7bde | ||
|
|
90a53b4cf1 | ||
|
|
df543a4f14 | ||
|
|
dd01f32fad | ||
|
|
40339f1add | ||
|
|
7fc0c2330b | ||
|
|
b8812a4161 | ||
|
|
5ef065bbca | ||
|
|
2eb10a760f | ||
|
|
11f41ed9c2 | ||
|
|
740ac7c843 | ||
|
|
60272fbce4 | ||
|
|
28ac8e58d5 | ||
|
|
e3f0000076 | ||
|
|
1a76c8975f | ||
|
|
e5f3c3ca2a | ||
|
|
ab22eaf449 | ||
|
|
8c99bcf8a4 | ||
|
|
03194ce5c6 | ||
|
|
1ca36181db | ||
|
|
e050010261 | ||
|
|
4621551acf | ||
|
|
9900226eba | ||
|
|
63283c94c2 | ||
|
|
e855e49dfb | ||
|
|
aa7a811258 | ||
|
|
f182a82ee9 | ||
|
|
284c892d4d | ||
|
|
1f1ca31cda | ||
|
|
b6ab71ecc2 | ||
|
|
4be94127c8 | ||
|
|
24a617d922 | ||
|
|
14028f0d36 | ||
|
|
634934e6cf | ||
|
|
5784a4cd46 | ||
|
|
74a00eab8a | ||
|
|
38f3940d18 | ||
|
|
68f2cb80fb | ||
|
|
fe5fe7f3db | ||
|
|
41b256f637 | ||
|
|
d2e80e4fbf | ||
|
|
89be6d647c | ||
|
|
b01e9b1a8a | ||
|
|
6299e72833 | ||
|
|
710605dd2a | ||
|
|
e531c74372 | ||
|
|
bb55277763 | ||
|
|
4cc9dc04bf | ||
|
|
c58d04acc9 | ||
|
|
4e159bf6b6 | ||
|
|
5fe5558dbe | ||
|
|
6507f909b3 | ||
|
|
2844627e14 | ||
|
|
72644e0118 | ||
|
|
41f81bf5ae | ||
|
|
4b858a2bed | ||
|
|
4296afbf39 | ||
|
|
7fea58a6bd | ||
|
|
50edc71603 | ||
|
|
37b868fde9 | ||
|
|
55d910eb08 | ||
|
|
257ff5c380 | ||
|
|
503d819dab | ||
|
|
b407c8f737 | ||
|
|
58fbf5f9e8 | ||
|
|
effd1924f8 | ||
|
|
c229af31c5 | ||
|
|
a48be7ddf3 | ||
|
|
7472b6c466 | ||
|
|
a5ee9ec98c | ||
|
|
916d1fbaef | ||
|
|
0552cfb60a | ||
|
|
8931216544 | ||
|
|
03823bc17d | ||
|
|
adae213cec | ||
|
|
3689276b37 | ||
|
|
ca652516d9 | ||
|
|
13e4f0d9e5 | ||
|
|
b3b48cf3b0 | ||
|
|
2faf5b2f34 | ||
|
|
764ccc45a3 | ||
|
|
6b502937dd | ||
|
|
bc5fb5c6f9 | ||
|
|
b0c20f9693 | ||
|
|
04ee777109 | ||
|
|
ac8177b68c | ||
|
|
b9ee33bdcb | ||
|
|
45a3f8d33a | ||
|
|
c34205e59d | ||
|
|
6f647b1937 | ||
|
|
b5eb325a88 | ||
|
|
8fa67843b1 | ||
|
|
5719c43481 | ||
|
|
35150997c7 | ||
|
|
faef9495ea | ||
|
|
a1fb08f026 | ||
|
|
18e709aec4 | ||
|
|
082d404597 | ||
|
|
726a53c490 | ||
|
|
04e40cbb73 | ||
|
|
554bc0e943 | ||
|
|
44275b0939 | ||
|
|
fdab7ebc70 | ||
|
|
9885ab5324 | ||
|
|
c11c30deca | ||
|
|
f1d63980e1 | ||
|
|
834bf6596d | ||
|
|
371acd1f43 | ||
|
|
5553d55063 | ||
|
|
612e8d7680 | ||
|
|
b78b1a1a4c | ||
|
|
5119bb7355 | ||
|
|
7306517a29 | ||
|
|
f891bb9139 | ||
|
|
1197105373 | ||
|
|
08afdaa444 | ||
|
|
07ced238d1 | ||
|
|
131dc2e4b2 | ||
|
|
c1b8ee96f3 | ||
|
|
afe8a4cc52 | ||
|
|
75cbb3abbb | ||
|
|
950dcf92b7 | ||
|
|
8b46abe6de | ||
|
|
35429b0699 | ||
|
|
b092fa73d3 | ||
|
|
0f728fa1c0 | ||
|
|
ad2f4716ab | ||
|
|
742ef4ac2d | ||
|
|
21826ca6b7 | ||
|
|
d8b7a0fc85 | ||
|
|
69585ed7e6 | ||
|
|
321bca2989 | ||
|
|
ed1a1ab1c6 | ||
|
|
a6f91fcb11 | ||
|
|
82319ab68d | ||
|
|
54cecbe9a1 | ||
|
|
68fc8b4e12 | ||
|
|
27d8e7fa6c | ||
|
|
772d0541cc | ||
|
|
1065c8e54f | ||
|
|
30159bb893 | ||
|
|
3bef0be66c | ||
|
|
9963c84fd9 | ||
|
|
874a67141f | ||
|
|
933fdab33a | ||
|
|
3e268db6f9 | ||
|
|
c1213e34bc | ||
|
|
5058eb2854 | ||
|
|
669aed08c6 | ||
|
|
568327849c | ||
|
|
58a1a5b919 | ||
|
|
4c6e936967 | ||
|
|
9be2c0c705 | ||
|
|
cbdafe100f | ||
|
|
3de647a81f | ||
|
|
5caa9752ba | ||
|
|
48df260f67 | ||
|
|
91e5974c52 | ||
|
|
f864d987fd | ||
|
|
4068f50cd2 | ||
|
|
c92e78ad00 | ||
|
|
72077bb489 | ||
|
|
baba250ba6 | ||
|
|
dc716baa05 | ||
|
|
42bfc372da | ||
|
|
53e0c4fccf | ||
|
|
66fad890fc | ||
|
|
48233bfa43 | ||
|
|
6d45885d63 | ||
|
|
9e7c542d8a | ||
|
|
cff850ed51 | ||
|
|
047efe3e72 | ||
|
|
db61901f68 | ||
|
|
d38bbc2ea5 | ||
|
|
fd4d790a32 | ||
|
|
5016b3ca0d | ||
|
|
14c94558a6 | ||
|
|
6694cf0a20 | ||
|
|
eeefaf3a4f | ||
|
|
5336732032 | ||
|
|
b0d9a04e95 | ||
|
|
f8ba11c870 | ||
|
|
fc8b5cda7c | ||
|
|
c8556afc76 | ||
|
|
ed01281fca | ||
|
|
7f117d226f | ||
|
|
57d6ba89f0 | ||
|
|
1ec33f92e2 | ||
|
|
621dce0532 | ||
|
|
569115728f | ||
|
|
4965c1d908 | ||
|
|
66fa6c64af | ||
|
|
b173b1b737 | ||
|
|
d3cf1d4d3a | ||
|
|
34d2efae1e | ||
|
|
70ccc98eac | ||
|
|
4f0bd1ad42 | ||
|
|
817ed773bb | ||
|
|
17c2ddaa12 | ||
|
|
c8631927f4 | ||
|
|
29fdd527c8 | ||
|
|
81e5f72142 | ||
|
|
ca687d3588 | ||
|
|
8115985070 | ||
|
|
1d67787ca6 | ||
|
|
701a75adde | ||
|
|
6535835ca2 | ||
|
|
88b6219e66 | ||
|
|
ad8f419186 | ||
|
|
9e234492f7 | ||
|
|
fa7c508114 | ||
|
|
be6473f82d | ||
|
|
55166aefa1 | ||
|
|
24df9cbff5 | ||
|
|
ebe628fd75 | ||
|
|
0d58f4fd23 | ||
|
|
57080f48cd | ||
|
|
a3d762e854 | ||
|
|
1a2bb0e8bc | ||
|
|
e77c445911 | ||
|
|
937a4b9a3d | ||
|
|
ce8b796598 | ||
|
|
d0e02651c5 | ||
|
|
015ff89c4b | ||
|
|
eb1ea1a12b | ||
|
|
c44490637f | ||
|
|
94925aa10a | ||
|
|
edb2da2600 | ||
|
|
c62eb897a5 | ||
|
|
b9c0cebc09 | ||
|
|
f0fe2c860a | ||
|
|
ebadf3e961 | ||
|
|
ced2e2f229 | ||
|
|
ef03bc051c | ||
|
|
398823b8ee | ||
|
|
100dc43616 | ||
|
|
601c4ded53 | ||
|
|
e2026d1cc3 | ||
|
|
37a918a0bf | ||
|
|
94974c5f2c | ||
|
|
77a66c64fd | ||
|
|
eb6620fabe | ||
|
|
851763fc2a | ||
|
|
4f2edd0d27 | ||
|
|
698da37899 | ||
|
|
c971c1df66 | ||
|
|
818a2f99ea | ||
|
|
74bb9d88c8 | ||
|
|
c46fd00276 | ||
|
|
483a4b1f95 | ||
|
|
80ed8e6db9 | ||
|
|
f44bdde391 | ||
|
|
56e698165c | ||
|
|
845d741024 | ||
|
|
a1c8dec437 | ||
|
|
3424e6f5ee | ||
|
|
96f0d1e895 | ||
|
|
f9dec971b6 | ||
|
|
64e62fa338 | ||
|
|
04cf1350fc | ||
|
|
7a412e08ef | ||
|
|
e5a66e4f95 | ||
|
|
491f946586 | ||
|
|
e255465416 | ||
|
|
a0e4124e3a | ||
|
|
4d9c71b4a6 | ||
|
|
9c0f70d68b | ||
|
|
31d8d91b1a | ||
|
|
250546f245 | ||
|
|
e00763b927 | ||
|
|
c88bcde30e | ||
|
|
17b7d300b7 | ||
|
|
c60054b040 | ||
|
|
ef00a2400b | ||
|
|
c9f065173b | ||
|
|
8c5d2bfaf8 | ||
|
|
bc16bdf560 | ||
|
|
96868355a6 | ||
|
|
cb4d8eec16 | ||
|
|
fb59853cb1 | ||
|
|
1240604e7d | ||
|
|
92741d95ea | ||
|
|
5b5612d589 | ||
|
|
f537049a56 | ||
|
|
fa4ebdc23c | ||
|
|
5a397515ab | ||
|
|
43c32d61c0 | ||
|
|
7f28e60ed6 | ||
|
|
873b94a743 | ||
|
|
10212011e9 | ||
|
|
fdbf78d786 | ||
|
|
47016ca6e4 | ||
|
|
01bf4d9526 | ||
|
|
ca584c730c | ||
|
|
17b828b671 | ||
|
|
f0b9fed843 | ||
|
|
a93440dfa1 | ||
|
|
a6367738ca | ||
|
|
292c68ed51 | ||
|
|
e3d03f7e7d | ||
|
|
581cdc12e9 | ||
|
|
575939017b | ||
|
|
68694bde19 | ||
|
|
1fbf610497 | ||
|
|
2d64b31bfb | ||
|
|
f657317b39 | ||
|
|
ccca9d75b5 | ||
|
|
7c94f13ef7 | ||
|
|
d5900c22f1 | ||
|
|
fe7dfe0460 | ||
|
|
12aa189913 | ||
|
|
060b680405 | ||
|
|
e7d4ddaec8 | ||
|
|
d638ff4496 | ||
|
|
d1088bde51 | ||
|
|
d2afd68ff2 | ||
|
|
daf0b16a4f | ||
|
|
182cde11b9 | ||
|
|
8116a85ea7 | ||
|
|
677f758c0d | ||
|
|
17a8dbc05b | ||
|
|
71b77471de | ||
|
|
07f267626f | ||
|
|
b8875bb65b | ||
|
|
86e51ee01a | ||
|
|
33ecd84fb1 | ||
|
|
b475167130 | ||
|
|
0ba4fe9c7e | ||
|
|
953cb8b872 | ||
|
|
9413c697d6 | ||
|
|
20b1786c1a | ||
|
|
181e2c68b6 | ||
|
|
48b4d96441 | ||
|
|
93d769f9bc | ||
|
|
5d598c46dc | ||
|
|
ff2b44fc74 | ||
|
|
411f72fba2 | ||
|
|
9e08540e84 | ||
|
|
fe0775f4a8 | ||
|
|
1d4b035272 | ||
|
|
903d9b783a | ||
|
|
c4420cb657 | ||
|
|
ab4795f617 | ||
|
|
cb2307abaf | ||
|
|
486622522c | ||
|
|
1cfd76a66f | ||
|
|
3ffa50d1ac | ||
|
|
10c9a90307 | ||
|
|
290ad585fa | ||
|
|
748ea347a5 | ||
|
|
be4505041f | ||
|
|
e12751102b | ||
|
|
fe2abf8bc0 | ||
|
|
30e338cab2 | ||
|
|
9315894615 | ||
|
|
714757dcac | ||
|
|
a73ff13321 | ||
|
|
c8a0f3b982 | ||
|
|
90f2d6c7c3 | ||
|
|
2ee2272d0e | ||
|
|
401650feaa | ||
|
|
4b3c1bca94 | ||
|
|
5a7fa97b95 | ||
|
|
7d0bba4e03 | ||
|
|
b230e4654d | ||
|
|
4e04df6d98 | ||
|
|
d9f8dfcce8 | ||
|
|
bb01a8debc | ||
|
|
4e0a3102a3 | ||
|
|
0c64e8edeb | ||
|
|
4f71dcf861 | ||
|
|
cff9554dda | ||
|
|
c5dd56aa5f | ||
|
|
9a616a7f3f | ||
|
|
6b32d53742 | ||
|
|
5dfcac4053 | ||
|
|
4f4609e980 | ||
|
|
71ecfb917b | ||
|
|
3e3ff64cc5 | ||
|
|
a296e0192c | ||
|
|
c044aea666 | ||
|
|
9fb10416f4 | ||
|
|
7371c301ae | ||
|
|
6679a7db85 | ||
|
|
beaaef3c0f | ||
|
|
5e6c8f4b2d | ||
|
|
edbac35e4f | ||
|
|
4692f2c744 | ||
|
|
bf444e84e8 | ||
|
|
5f79d9f879 | ||
|
|
d7ac4fb94e | ||
|
|
8d3b768575 | ||
|
|
cc470048d1 | ||
|
|
6eb881bc4c | ||
|
|
103eb9a9c1 | ||
|
|
9c368349f2 | ||
|
|
e36250fbcb | ||
|
|
d97b2f999c | ||
|
|
99981ffb51 | ||
|
|
7a453863f9 | ||
|
|
430d902bfe | ||
|
|
8a67500a4a | ||
|
|
cf384e0af1 | ||
|
|
04e0214776 | ||
|
|
7bfbfe0123 | ||
|
|
66647d13ed | ||
|
|
2343573da9 | ||
|
|
f7445817da | ||
|
|
f61f2f0570 | ||
|
|
7692c1a16f | ||
|
|
b4341af6a2 | ||
|
|
b376fad60d | ||
|
|
3ad47429c9 | ||
|
|
1cebf04794 | ||
|
|
0d65f5b236 | ||
|
|
c59864c663 | ||
|
|
f7d6e0c64e | ||
|
|
e14c09e404 | ||
|
|
000691dc48 | ||
|
|
2804ac0d2a | ||
|
|
4c93b5fea5 | ||
|
|
90853d47e7 | ||
|
|
62465a7920 | ||
|
|
f0fe5c12d7 | ||
|
|
f9c4e50c19 | ||
|
|
eb08f69f7b | ||
|
|
6e237489d9 | ||
|
|
9aea3d826d | ||
|
|
e1e634dd6e | ||
|
|
e5b32b6666 | ||
|
|
4fd262bd68 | ||
|
|
2a74e65fd5 | ||
|
|
e6dfc34e68 | ||
|
|
8f00f0f46f | ||
|
|
42df2fe0f3 | ||
|
|
861a84dbe8 | ||
|
|
dd52ff9253 | ||
|
|
c7a984c927 | ||
|
|
962c48728b | ||
|
|
75cc00c082 | ||
|
|
a9fb7e1eb9 | ||
|
|
d0fd852078 | ||
|
|
5ee2e7a6bb | ||
|
|
3557b042e0 | ||
|
|
314d0713db | ||
|
|
11c86e7e66 | ||
|
|
e19fdabc20 | ||
|
|
d21e3d37ac | ||
|
|
759e67c64a | ||
|
|
ec1437ad8b | ||
|
|
c971fd21cc | ||
|
|
cf176f57a0 | ||
|
|
5d864982f5 | ||
|
|
b0cab274e9 | ||
|
|
b5d6af8aa5 | ||
|
|
fd763af064 | ||
|
|
e856cf4a5d | ||
|
|
03765bac1d | ||
|
|
dbc54e9737 | ||
|
|
9ab291669f | ||
|
|
7445c65796 | ||
|
|
0251c800de | ||
|
|
cdc24e78d3 | ||
|
|
fb601c96f8 | ||
|
|
7e8ba0ffff | ||
|
|
4afc9fbd23 | ||
|
|
e7f323d549 | ||
|
|
7a6364bfa7 | ||
|
|
1122f9a28e | ||
|
|
7793fac72e | ||
|
|
5bccee8478 | ||
|
|
378b1386c3 | ||
|
|
c8fddc68d1 | ||
|
|
72d5173e87 | ||
|
|
3e99186cd6 | ||
|
|
14632c7fbe | ||
|
|
d6502560d0 | ||
|
|
d5a56e3b27 | ||
|
|
db39d6a2d2 | ||
|
|
53bc5ac168 | ||
|
|
82c611f092 | ||
|
|
6ca032c3be | ||
|
|
ceb04e828b | ||
|
|
5097d70dc9 | ||
|
|
a645b126d6 | ||
|
|
454733bcea | ||
|
|
39fcb10404 | ||
|
|
7151022505 | ||
|
|
feee8cb438 | ||
|
|
fa27a22612 | ||
|
|
626a0e67b8 | ||
|
|
9f60944c60 | ||
|
|
f5c09af54e | ||
|
|
9081507794 | ||
|
|
a498289551 | ||
|
|
9494881976 | ||
|
|
61319af5be | ||
|
|
2bc17241ca | ||
|
|
ba09ad8613 | ||
|
|
ec4b71b2b7 | ||
|
|
acdb240de4 | ||
|
|
59ebf2b7d0 | ||
|
|
661cf626ea | ||
|
|
eb60442a04 | ||
|
|
9564bf4ef8 | ||
|
|
ed36aa6971 | ||
|
|
c9490973b5 | ||
|
|
365915cb0e | ||
|
|
2ee064cd1c | ||
|
|
9aa1f705f1 | ||
|
|
f0029f6465 | ||
|
|
5d12e7f2ec | ||
|
|
02330a5d06 | ||
|
|
2f9ecca752 | ||
|
|
1e315d7d5a | ||
|
|
710329a8a6 | ||
|
|
927c437679 | ||
|
|
2c918da8e9 | ||
|
|
78dee05c5a | ||
|
|
1e9e80b266 | ||
|
|
0598f561b7 | ||
|
|
d1719fc0e2 | ||
|
|
a61afc42d8 | ||
|
|
2b9b96482a | ||
|
|
6971844278 | ||
|
|
0c224ad29d | ||
|
|
8b8bb3db00 | ||
|
|
c1df197a5a | ||
|
|
65c4c0c134 | ||
|
|
d9e3d1a339 | ||
|
|
dd8965c1a3 | ||
|
|
bcb0f0fbf0 | ||
|
|
fcf0a4c5cf | ||
|
|
71dcca6695 | ||
|
|
e39c4c2304 | ||
|
|
7ff90aec1c | ||
|
|
286535500b | ||
|
|
61898e2ac1 | ||
|
|
b2cab5d3f4 | ||
|
|
2d5635187e | ||
|
|
9d1650ca0a | ||
|
|
693e7c05bf | ||
|
|
78ddaa120c | ||
|
|
06564db555 | ||
|
|
6a6fe4bb5f | ||
|
|
7cbd4c20f2 | ||
|
|
aae41922b5 | ||
|
|
1777dee8e9 | ||
|
|
eb2e1826e5 | ||
|
|
cef6e4f65a | ||
|
|
3f15c80a82 | ||
|
|
5ce693bd87 | ||
|
|
32344a5c3f | ||
|
|
ba6de70fc5 | ||
|
|
41a4ccbc4c | ||
|
|
eb9654e1ea | ||
|
|
2a22c9a502 | ||
|
|
b22fe70288 | ||
|
|
c98eefef0d | ||
|
|
dd9257d008 | ||
|
|
74788d0959 | ||
|
|
5f4ee34f0f | ||
|
|
8b4f3d0cf6 | ||
|
|
2f9e2b313f | ||
|
|
af9dc8707a | ||
|
|
5af9dce752 | ||
|
|
3f2a2c99c6 | ||
|
|
433a771bfe | ||
|
|
6303b68d51 | ||
|
|
4c2e1ca2c8 | ||
|
|
c43af9ca20 | ||
|
|
2d1a1a473c | ||
|
|
382f4678bf | ||
|
|
af8cac9d64 | ||
|
|
bfd36393b7 | ||
|
|
5fc60a0864 | ||
|
|
d8509b2829 | ||
|
|
be31f53773 | ||
|
|
de59e7b432 | ||
|
|
ab1594fb7e | ||
|
|
8aa35a9196 | ||
|
|
65de510dfa | ||
|
|
42564ca3d0 | ||
|
|
43958d54e7 | ||
|
|
c044f5796b | ||
|
|
d2e9af38eb | ||
|
|
c65af0c1f3 | ||
|
|
886fcda18e | ||
|
|
243387c4e0 | ||
|
|
38ac02496c | ||
|
|
8ad7b9a283 | ||
|
|
6517b06539 | ||
|
|
730e5e4d96 | ||
|
|
463d94914d | ||
|
|
27c9dbe7b4 | ||
|
|
7b2c4b0f06 | ||
|
|
9f92e7941c | ||
|
|
dafba9ea02 | ||
|
|
54e25793fd | ||
|
|
6e2827418f | ||
|
|
39f37e465f | ||
|
|
3638cdc3c9 | ||
|
|
30835cb4c8 | ||
|
|
e5ae345855 | ||
|
|
8c5430133d | ||
|
|
1aaa5b1e02 | ||
|
|
f895c0c65b | ||
|
|
96844f2d92 | ||
|
|
651e2d72b9 | ||
|
|
a5486b7875 | ||
|
|
63599c09dc | ||
|
|
055c381d60 | ||
|
|
ea69499aed | ||
|
|
23a24b58e2 | ||
|
|
643346b806 | ||
|
|
bf309b0d51 | ||
|
|
2e34e7cadd | ||
|
|
232c21bd0a | ||
|
|
154c7a9ed9 | ||
|
|
336fb68ef4 | ||
|
|
a7bc16dadd | ||
|
|
c9c781771a | ||
|
|
6c9158a305 | ||
|
|
5ef98d7b47 | ||
|
|
d588a80b4a | ||
|
|
e1c52879af | ||
|
|
cbe497ef8c | ||
|
|
60cea8ce9f | ||
|
|
92565efe43 | ||
|
|
5bd7821915 | ||
|
|
d4dfab892f | ||
|
|
c6375f3877 | ||
|
|
50cb82f508 | ||
|
|
de6dc071fb | ||
|
|
da97c9237c | ||
|
|
6235389101 | ||
|
|
b58fb34c97 | ||
|
|
45645f1f50 | ||
|
|
cb175ba261 | ||
|
|
2ea57df6cb | ||
|
|
9fbe849930 | ||
|
|
3863401d0b | ||
|
|
ef6805a8a1 | ||
|
|
f1c26377a5 | ||
|
|
bc565999d1 | ||
|
|
e16af90d6a | ||
|
|
ae43d7f86b | ||
|
|
cf8cb50631 | ||
|
|
205e54c31c | ||
|
|
c4391df038 | ||
|
|
cc24b5abc0 | ||
|
|
da6641ca10 | ||
|
|
7d7d3bfdd4 | ||
|
|
90a56ae920 | ||
|
|
552e264c95 | ||
|
|
9984312409 | ||
|
|
74151b61b2 | ||
|
|
2e67942ba5 | ||
|
|
740419c6ed | ||
|
|
502369ee4f | ||
|
|
278dc40a5e | ||
|
|
039271f118 | ||
|
|
2d0bd337b5 | ||
|
|
543c42430c | ||
|
|
e0d943f822 | ||
|
|
e372544485 | ||
|
|
aa11f38d17 | ||
|
|
af92291a9e | ||
|
|
798de9aaea | ||
|
|
17aa43a4e5 | ||
|
|
53f19438d3 | ||
|
|
5ae93179f2 | ||
|
|
6073e159f0 | ||
|
|
0075d6f1ea | ||
|
|
8cc0c3e7a8 | ||
|
|
4a662a90da | ||
|
|
e0448016af | ||
|
|
81aae0acf3 | ||
|
|
c4e28b117d | ||
|
|
d946197b9f | ||
|
|
20595431fd | ||
|
|
d376d80d0b | ||
|
|
3bf92f6fa2 | ||
|
|
98bf6af495 | ||
|
|
3a53b68896 | ||
|
|
c4abd685d3 | ||
|
|
8e659eb701 | ||
|
|
af1db0fc07 | ||
|
|
fa7ac9460d | ||
|
|
b9692f7515 | ||
|
|
867c38f43b | ||
|
|
c8ac4f4163 | ||
|
|
f78b83d6c2 | ||
|
|
5494ed1a3a | ||
|
|
7db309c819 | ||
|
|
76227dfe9a | ||
|
|
bfd80a8cb9 | ||
|
|
8ca63c6823 | ||
|
|
859bef9394 | ||
|
|
2acce20048 | ||
|
|
c340b46f7d | ||
|
|
329a0966ca | ||
|
|
14bf4ba719 | ||
|
|
de69396a04 | ||
|
|
3a6f44828e | ||
|
|
9353d5a8bc | ||
|
|
ca010e3a20 | ||
|
|
48d8dc379f | ||
|
|
4d91a31031 | ||
|
|
4d93b9a5fe | ||
|
|
81a2788184 | ||
|
|
0bac60447e | ||
|
|
01bb408766 | ||
|
|
e62a73aa6d | ||
|
|
d510153022 | ||
|
|
2ff2e87033 | ||
|
|
2a1de3f012 | ||
|
|
f3a8adaefb | ||
|
|
a8a11c0ece | ||
|
|
5fe22693dd | ||
|
|
fa5b99b53b | ||
|
|
c955e5a0a3 | ||
|
|
bf0c68ca5e | ||
|
|
fc0af2739c | ||
|
|
ce914bd435 | ||
|
|
31815febc5 | ||
|
|
3fdb9d9eec | ||
|
|
f8ddc8fcfc | ||
|
|
2c0f3a453f | ||
|
|
2a0305f31e | ||
|
|
577221ff08 | ||
|
|
251dd966b7 | ||
|
|
9658d81762 | ||
|
|
791dd3e6a6 | ||
|
|
493dc1d811 | ||
|
|
f01b058f09 | ||
|
|
5fc2d5fe34 | ||
|
|
220a1406d3 | ||
|
|
19a86d0a8f | ||
|
|
8cb02307e5 | ||
|
|
9d2b379b88 | ||
|
|
c781f25760 | ||
|
|
7f13440775 | ||
|
|
fca4a10c0f | ||
|
|
2900595bc0 | ||
|
|
fb5c6d48f2 | ||
|
|
de7107b58c | ||
|
|
9236b287b1 | ||
|
|
581e212a66 | ||
|
|
64dca3508e | ||
|
|
02026b1c8c | ||
|
|
70c6d95950 | ||
|
|
6749d55e54 | ||
|
|
0e494ed7db | ||
|
|
bf609d8374 | ||
|
|
92b032e8dd | ||
|
|
14542fea44 | ||
|
|
38a23cf978 | ||
|
|
539b92b651 | ||
|
|
3c12ce1943 | ||
|
|
8e25db88cf | ||
|
|
5e4eece1de | ||
|
|
27fc74ffa5 | ||
|
|
1cdc37f80d | ||
|
|
bd1657dc01 | ||
|
|
e7fa851a7c | ||
|
|
2f20dea507 | ||
|
|
4134ed3f5d | ||
|
|
40d0463987 | ||
|
|
7a75fe3c57 | ||
|
|
4d7bf6f76a | ||
|
|
ef8f39babe | ||
|
|
f9bcf3f84f | ||
|
|
646eda2e4e | ||
|
|
e228825648 | ||
|
|
3d0e96b313 | ||
|
|
6c7d1a5ee7 | ||
|
|
05de006711 | ||
|
|
6cb41061cf | ||
|
|
bac1d615cb | ||
|
|
da0ae2d9cb | ||
|
|
6f9f82a2e5 | ||
|
|
5e8cd2a3f2 | ||
|
|
097846fe14 | ||
|
|
fda5b287c9 | ||
|
|
f407514c7e | ||
|
|
9d063a0a67 | ||
|
|
23c5f297ce | ||
|
|
5423757ab8 | ||
|
|
b4d436ca21 | ||
|
|
51de6be6cc | ||
|
|
66db4c486d | ||
|
|
4b8ae2693c | ||
|
|
fce8c6a4e0 | ||
|
|
9eda5d4cdc | ||
|
|
3dc3144727 | ||
|
|
fc8a13192c | ||
|
|
a1f4c147b9 | ||
|
|
3133e7ab27 | ||
|
|
0e33114d4d | ||
|
|
a39871ee84 | ||
|
|
2ea5c7d0ba | ||
|
|
06713441d5 | ||
|
|
053af8843f | ||
|
|
13607b185b | ||
|
|
018cd09251 | ||
|
|
899c461853 | ||
|
|
1c6dae34d1 | ||
|
|
22d2088e69 | ||
|
|
99593ce1b5 | ||
|
|
2a764cfd14 | ||
|
|
e80543448a | ||
|
|
9391324c8d | ||
|
|
7dba311ab1 | ||
|
|
b3e47d5274 | ||
|
|
1bb02e3abf | ||
|
|
65e3e5b8de | ||
|
|
ab53862f87 | ||
|
|
4c720551a8 | ||
|
|
c1594d0a66 | ||
|
|
35280d155d | ||
|
|
2da2b5c374 | ||
|
|
a499af94bb | ||
|
|
e1d3f25007 | ||
|
|
9b4f965033 | ||
|
|
d2a0cf76ee | ||
|
|
61d80451da | ||
|
|
723efe49f6 | ||
|
|
e12b202e85 | ||
|
|
3e37164520 | ||
|
|
ae5fc92bf7 | ||
|
|
79115b2572 | ||
|
|
ad7cef7424 | ||
|
|
fffe36a72b | ||
|
|
2adb0ed5b7 | ||
|
|
e3f67a1d82 | ||
|
|
af180672b1 | ||
|
|
ae7f8eeada | ||
|
|
1193a572c1 | ||
|
|
0874edc9c3 | ||
|
|
3842184c8a | ||
|
|
ef17d0b7da | ||
|
|
f1e265fad4 | ||
|
|
09338a79bf | ||
|
|
07ff8bba2a | ||
|
|
9ca40220be | ||
|
|
8fcc94e777 | ||
|
|
9af35db5ce | ||
|
|
c1d5575723 | ||
|
|
2a8a547fe3 | ||
|
|
3b827893b1 | ||
|
|
2068aaaf2a | ||
|
|
72672c7a8f | ||
|
|
2fbc132933 | ||
|
|
1c206de2ba | ||
|
|
3e1c4e426f | ||
|
|
9e5832fb33 | ||
|
|
7770d914a0 | ||
|
|
3620f0837f | ||
|
|
4b56fa5c68 | ||
|
|
a2483c8114 | ||
|
|
97a30b4aab | ||
|
|
aab66997da | ||
|
|
ddc6b504c8 | ||
|
|
aa5684360d | ||
|
|
3e9e437ac1 | ||
|
|
1e13bf599b | ||
|
|
e90bd74e36 | ||
|
|
227e13680b | ||
|
|
923eb2cd21 | ||
|
|
093c743141 | ||
|
|
8b59a8dd04 | ||
|
|
940d412a0c | ||
|
|
df9948c445 | ||
|
|
e8ff5b025f | ||
|
|
117583a0d0 | ||
|
|
355bad0fba | ||
|
|
a73ef6232a | ||
|
|
317346ce46 | ||
|
|
af54cbaf32 | ||
|
|
76fedb28db | ||
|
|
38bfdcd843 | ||
|
|
b5a03180f5 | ||
|
|
8554df3197 | ||
|
|
b1e011cabd | ||
|
|
41138b45c0 | ||
|
|
42c5603cc3 | ||
|
|
5292c8547b | ||
|
|
645c251c8a | ||
|
|
98b04bb67b | ||
|
|
073c5f16f2 | ||
|
|
38a5ed6c79 | ||
|
|
a40968d40e | ||
|
|
642db2b948 | ||
|
|
f9c565699b | ||
|
|
590fbe0ef0 | ||
|
|
50bdd80431 | ||
|
|
e689f575dd | ||
|
|
5f02dc0d0e | ||
|
|
6a96dd1371 | ||
|
|
94e015fb29 | ||
|
|
bf3736c820 | ||
|
|
36088f9e6c | ||
|
|
2b96479279 | ||
|
|
f30c29afa4 | ||
|
|
be8d2136be | ||
|
|
ccd0383e88 | ||
|
|
c26b75987e | ||
|
|
e620a3d350 | ||
|
|
164006e767 | ||
|
|
d943eb7b2b | ||
|
|
5a5bc410bf | ||
|
|
65fbf9138c | ||
|
|
02d6a07110 | ||
|
|
74aa0b573c | ||
|
|
df7416a453 | ||
|
|
82410874d3 | ||
|
|
7281de8839 | ||
|
|
089a31f32c | ||
|
|
966250e202 | ||
|
|
7dcd300c7d | ||
|
|
202b54326f | ||
|
|
96ed001ff3 | ||
|
|
0db92ddae5 | ||
|
|
c682a16028 | ||
|
|
c304a2c620 | ||
|
|
c97115fd98 | ||
|
|
58d205edc5 | ||
|
|
877074f659 | ||
|
|
2b3e74baaa | ||
|
|
af89f873d0 | ||
|
|
8a4c8e1d04 | ||
|
|
a1a1c8340e | ||
|
|
474ef2b3d0 | ||
|
|
a1854047e9 | ||
|
|
8a4660a378 | ||
|
|
3d36012cb9 | ||
|
|
3192ddb27d | ||
|
|
86f18ce106 | ||
|
|
2045401f9e | ||
|
|
810f17c38e | ||
|
|
1b6d0d1be3 | ||
|
|
05fde82c53 | ||
|
|
d277791787 | ||
|
|
41c4897976 | ||
|
|
4c255554fe | ||
|
|
98b1103e2e | ||
|
|
6a1ea62d13 | ||
|
|
fc88323443 | ||
|
|
80e750c4c9 | ||
|
|
7c32b171cd | ||
|
|
b280534764 | ||
|
|
e1b0cf4ea0 | ||
|
|
a0dc3f8923 | ||
|
|
7a217595cd | ||
|
|
916cee53e5 | ||
|
|
2171c5598c | ||
|
|
2957b3dbb1 | ||
|
|
7b1344becf | ||
|
|
f7c7b6350f | ||
|
|
eca7864dc4 | ||
|
|
2309720a0b | ||
|
|
da24f70c91 | ||
|
|
52b96fb902 | ||
|
|
45eb3a52ad | ||
|
|
255160292a | ||
|
|
ddc82146fc | ||
|
|
7d2e172321 | ||
|
|
12942dd4a8 | ||
|
|
6a39d24f05 | ||
|
|
e98c1cdf5c | ||
|
|
4d34ca86b7 | ||
|
|
60c004493e | ||
|
|
30e94d126c | ||
|
|
ff51f77bba | ||
|
|
a139df824f | ||
|
|
2107dd5d5d | ||
|
|
78f6a4e20a | ||
|
|
cfca41b012 | ||
|
|
95fc50f0fb | ||
|
|
83fc0977c9 | ||
|
|
4f5b1dd933 | ||
|
|
01d99a4d58 | ||
|
|
e85dcad20b | ||
|
|
450c8bf81f | ||
|
|
af81bc3e23 | ||
|
|
4e717fe190 | ||
|
|
33179c218b | ||
|
|
b00ad8249d | ||
|
|
926063e08f | ||
|
|
1437dec72f | ||
|
|
7c85e104de | ||
|
|
4181a8ea5b | ||
|
|
14a3e123db | ||
|
|
118338a5ea | ||
|
|
a127911a7f | ||
|
|
a3fb583b98 | ||
|
|
df5e702f5c | ||
|
|
a7b62a9520 | ||
|
|
d8b6693264 | ||
|
|
34c4d39649 | ||
|
|
1c01c20149 | ||
|
|
4f2a090e24 | ||
|
|
69db63f26c | ||
|
|
2dbea99b61 | ||
|
|
b24d2fa274 | ||
|
|
56294efe91 | ||
|
|
f0dde5e983 | ||
|
|
f8989018a7 | ||
|
|
b432c3fd35 | ||
|
|
1d6a3e90c8 | ||
|
|
14f55eccb7 | ||
|
|
fc6530d1f5 | ||
|
|
bbb13f5568 | ||
|
|
46ba33ef92 | ||
|
|
8b6ec916e0 | ||
|
|
5bc5979e2d | ||
|
|
56c570e4b8 | ||
|
|
fd45c7bb4d | ||
|
|
d0102a81b7 | ||
|
|
526a94a0e6 | ||
|
|
22707acfae | ||
|
|
1947e320c9 | ||
|
|
1b836a3920 | ||
|
|
734a615464 | ||
|
|
a3881668f0 | ||
|
|
9641b3c55b | ||
|
|
27ef804c10 | ||
|
|
7eef9391af | ||
|
|
95233f9df5 | ||
|
|
92cc465a3c | ||
|
|
b45dd02452 | ||
|
|
b9e7daf0b7 | ||
|
|
6bc3640449 | ||
|
|
a568d2c669 | ||
|
|
738590890e | ||
|
|
58c8c71018 | ||
|
|
c3cc90a191 | ||
|
|
7c45913536 | ||
|
|
a07a7f93cc | ||
|
|
6904b58a3e | ||
|
|
155586da90 | ||
|
|
031c450293 | ||
|
|
d8f69d3cc2 | ||
|
|
a88c90fbe1 | ||
|
|
40e0f3dca5 | ||
|
|
067342db32 | ||
|
|
d2cb63d1e3 | ||
|
|
42d996ec94 | ||
|
|
e5e12bdf90 | ||
|
|
52da3c8bb8 | ||
|
|
abbcb7892d | ||
|
|
e055c62066 | ||
|
|
781d92ccd4 | ||
|
|
394549b805 | ||
|
|
1977f1d851 | ||
|
|
8d9309ba23 | ||
|
|
34c9336b37 | ||
|
|
70a130854c | ||
|
|
224b55c3c2 | ||
|
|
8c049f8afd | ||
|
|
1db441bc42 | ||
|
|
28c187186f | ||
|
|
605204e8f1 | ||
|
|
7476f5e534 | ||
|
|
6700cc023e | ||
|
|
23e00a95f8 | ||
|
|
03eaee9bf4 | ||
|
|
62a578b314 | ||
|
|
9f7a0e4e82 | ||
|
|
fdd0aa2aa0 | ||
|
|
01eb0bedc3 | ||
|
|
b3d60e169b | ||
|
|
e5703a3d69 | ||
|
|
8bcea2496e | ||
|
|
a835a4aa8c | ||
|
|
453edf991d | ||
|
|
b7cc6cb72d | ||
|
|
79d16b8d9a | ||
|
|
59b55487be | ||
|
|
facb2318e5 | ||
|
|
578d6de4b9 | ||
|
|
87df41c9d6 | ||
|
|
aa05a52c9b | ||
|
|
d74bcee308 | ||
|
|
0c49b5b416 | ||
|
|
feabf30c20 | ||
|
|
e4a09c5222 | ||
|
|
4e85800d20 | ||
|
|
cccdd42735 | ||
|
|
fa63f24cd3 | ||
|
|
5cae5358fa | ||
|
|
fc7612f010 | ||
|
|
97aa51eb20 | ||
|
|
36ffc04d26 | ||
|
|
bf480eb45e | ||
|
|
0c2521c568 | ||
|
|
8c23f118f1 | ||
|
|
74f7dda09e | ||
|
|
7564ceb76a | ||
|
|
aba41c1078 | ||
|
|
602bfdfdec | ||
|
|
da410fa260 | ||
|
|
4f3f180fdd | ||
|
|
3df03aa2bb | ||
|
|
b50c7e4334 | ||
|
|
3c6a0944fa | ||
|
|
712a8cd21d | ||
|
|
467313e111 | ||
|
|
9fbc821f61 | ||
|
|
4bacf38897 | ||
|
|
c9de718503 | ||
|
|
7869976b39 | ||
|
|
90724761b0 | ||
|
|
a318f6e081 | ||
|
|
480678b81a | ||
|
|
625920282a | ||
|
|
80d8b0a1a9 | ||
|
|
fbfe491903 | ||
|
|
a3245e4093 | ||
|
|
77a4815ef0 | ||
|
|
0f64fbb542 | ||
|
|
a25f1341ea | ||
|
|
a886313c61 | ||
|
|
9ccb38c2af | ||
|
|
875358dd31 | ||
|
|
eacdc8d624 | ||
|
|
24e213cda8 | ||
|
|
5aab81dc66 | ||
|
|
7ef8474e4c | ||
|
|
5a41f08c70 | ||
|
|
18c930c28e | ||
|
|
79346ead0d | ||
|
|
174947be5b | ||
|
|
0c7d567451 | ||
|
|
39f2f53db2 | ||
|
|
76f895c4d5 | ||
|
|
e7b5cd5b95 | ||
|
|
79fd72e461 | ||
|
|
371f9a5397 | ||
|
|
9032e37b38 | ||
|
|
1e55c19726 | ||
|
|
3842a2f473 | ||
|
|
3eff951265 | ||
|
|
adb185cdf9 | ||
|
|
7d4520b573 | ||
|
|
78fee5c3a3 | ||
|
|
c2258ae8e9 | ||
|
|
d27c0b3b7d | ||
|
|
347c584ae9 | ||
|
|
9aab069851 | ||
|
|
25ac858966 | ||
|
|
5195452a3f | ||
|
|
44976ee2eb | ||
|
|
7dec5e6793 | ||
|
|
f0b901ca90 | ||
|
|
6c92e8ee82 | ||
|
|
ef9bc292b8 | ||
|
|
a041afeb57 | ||
|
|
9a975849ee | ||
|
|
b66043f886 | ||
|
|
9d42140fa9 | ||
|
|
e347e11872 | ||
|
|
7d5f1ae314 | ||
|
|
814a847878 | ||
|
|
6ccb93e606 | ||
|
|
4817e97cd8 | ||
|
|
375e0a4f6d | ||
|
|
76f7326832 | ||
|
|
9a169ae91f | ||
|
|
cb5fc11308 | ||
|
|
af96604d69 | ||
|
|
5dcc1a65bf | ||
|
|
1134ed9a02 | ||
|
|
3f57d1f64a | ||
|
|
6616d46842 | ||
|
|
f59d648bda | ||
|
|
835093d7e0 | ||
|
|
fa6152abc7 | ||
|
|
5521ce88c2 | ||
|
|
e0ea67b2d5 | ||
|
|
53467eb7d3 | ||
|
|
16516953fb | ||
|
|
d33325c23f | ||
|
|
9271f5bebc | ||
|
|
c61be32591 | ||
|
|
64b6633fdd | ||
|
|
68c7be42c2 | ||
|
|
2c60ea0863 | ||
|
|
4c421016ed | ||
|
|
f530ade4f6 | ||
|
|
39a13dff73 | ||
|
|
631c3d7fbc | ||
|
|
b12bf222a9 | ||
|
|
89fcb38dc7 | ||
|
|
829ad87f8a | ||
|
|
0c68e37e40 | ||
|
|
acee5463dd | ||
|
|
c2922f16e3 | ||
|
|
2d228a4fb8 | ||
|
|
2a1e42606b | ||
|
|
c0bd68221a | ||
|
|
0ac3122871 | ||
|
|
7e1ac5572e | ||
|
|
6d414e45c5 | ||
|
|
b2ff23ecac | ||
|
|
22d23f8324 | ||
|
|
d7eaa5f5a4 | ||
|
|
a4f6bde797 | ||
|
|
99c89469fb | ||
|
|
93b9a835d4 | ||
|
|
60e357bd4b | ||
|
|
4e0b3ed2f7 | ||
|
|
ae6350fabf | ||
|
|
138e98f6e2 | ||
|
|
fd645ddb80 | ||
|
|
382584ad35 | ||
|
|
31e78477ef | ||
|
|
7cadad5d3e | ||
|
|
c7d4290206 | ||
|
|
13849fc2c8 | ||
|
|
a1843c1900 | ||
|
|
14a8c84bdd | ||
|
|
f371f3e3bc | ||
|
|
b558f33ae8 | ||
|
|
d9a7af17cc | ||
|
|
5638172b38 | ||
|
|
0aada6cc1e | ||
|
|
89bc665d48 | ||
|
|
acfa8d8600 | ||
|
|
39d005f222 | ||
|
|
51f2bf2617 | ||
|
|
549d5be0c7 | ||
|
|
7481712923 | ||
|
|
cb3d802346 | ||
|
|
b8706ddd8a | ||
|
|
751ae5d740 | ||
|
|
2b05b5308c | ||
|
|
e86d668a49 | ||
|
|
28025e0ff6 | ||
|
|
f6162845ab | ||
|
|
8e64aa20e9 | ||
|
|
a1303a0cb0 | ||
|
|
f0be4af34e | ||
|
|
21ca4d15d7 | ||
|
|
bbb8acc0de | ||
|
|
9e0333a664 | ||
|
|
f06172fc2e | ||
|
|
7a01e42704 | ||
|
|
0eb73c212a | ||
|
|
4079e1c159 | ||
|
|
0e4b7fbd72 | ||
|
|
1dc910a60c | ||
|
|
49468717c2 | ||
|
|
5ef6b3b0d6 | ||
|
|
3ab2ba9a75 | ||
|
|
3c9fdb4e2c | ||
|
|
03596be790 | ||
|
|
a9b94cee4b | ||
|
|
e9acb86ac5 | ||
|
|
52d1d13891 | ||
|
|
d1d4d57eca | ||
|
|
a01a13274a | ||
|
|
f62cdb1963 | ||
|
|
9cf09cbc7c | ||
|
|
e093ecd554 | ||
|
|
eec48ed7b5 | ||
|
|
09977516c2 | ||
|
|
7c67fd84c2 | ||
|
|
183e1289c4 | ||
|
|
aad6d1b6f3 | ||
|
|
4de7854629 | ||
|
|
eb2c483f2f | ||
|
|
7411db9a69 | ||
|
|
f4a3e88283 | ||
|
|
3957de6087 | ||
|
|
d36b369b45 | ||
|
|
671162a5f5 | ||
|
|
d61637c5e5 | ||
|
|
5f778cb23a | ||
|
|
e22bc403e6 | ||
|
|
decbcc7246 | ||
|
|
f48b1ffc45 | ||
|
|
6e46649631 | ||
|
|
8d1435dfd0 | ||
|
|
269121a9c4 | ||
|
|
bdc18d1d39 | ||
|
|
a86e95fc5a | ||
|
|
47a4f7f31e | ||
|
|
58769824ce | ||
|
|
f0ee603966 | ||
|
|
f48792054a | ||
|
|
8508481d36 | ||
|
|
8b6a67327e | ||
|
|
953c9e0262 | ||
|
|
5155b92591 | ||
|
|
653ef8d115 | ||
|
|
89cc9649cf | ||
|
|
0811404de8 | ||
|
|
4d2740eb35 | ||
|
|
13da28a2a8 | ||
|
|
01868b944c | ||
|
|
03ffa388af | ||
|
|
239f92eaf1 | ||
|
|
e4825ac555 | ||
|
|
bd9366daf5 | ||
|
|
9066b7e8c4 | ||
|
|
3e090ce36d | ||
|
|
b1ea0538a3 | ||
|
|
06cc9cff99 | ||
|
|
f2b5ee338b | ||
|
|
6f08bcb12e | ||
|
|
3e298ba94f | ||
|
|
fa42cc38ae | ||
|
|
093df64e9f | ||
|
|
e2b883f617 | ||
|
|
6fc10e23f8 | ||
|
|
26efd329a3 | ||
|
|
921fbcd564 | ||
|
|
ffeb22bfb9 | ||
|
|
c945049ef1 | ||
|
|
ab5fc723b4 | ||
|
|
6eebc96bd0 | ||
|
|
287a5f42dc | ||
|
|
a2b32fb056 | ||
|
|
b3b7dd32bf | ||
|
|
5d090a25b3 | ||
|
|
35748d1b8f | ||
|
|
d80c7b5ba8 | ||
|
|
72de3384a7 | ||
|
|
d3b2ff2664 | ||
|
|
a1a32714ab | ||
|
|
31ed17058c | ||
|
|
939d2a0cf5 | ||
|
|
ad3e1f1804 | ||
|
|
d822f2a373 | ||
|
|
e990ded287 | ||
|
|
6a99789015 | ||
|
|
77603244c0 | ||
|
|
8bfd44085d | ||
|
|
a875fecb20 | ||
|
|
df255f66c1 | ||
|
|
be4811aa6e | ||
|
|
e159c925d8 | ||
|
|
4ade3a0ea0 | ||
|
|
86fd2a4648 | ||
|
|
3557765c59 | ||
|
|
85fb88a2a4 | ||
|
|
8ef7835cd6 | ||
|
|
ad270d5ea8 | ||
|
|
ad27647a98 | ||
|
|
dd5109b3f5 | ||
|
|
c9ad75fe11 | ||
|
|
d05d16d399 | ||
|
|
51b4c8591d | ||
|
|
fddc7a6a75 | ||
|
|
4f76b91de5 | ||
|
|
771e36aecb | ||
|
|
0fbd146713 | ||
|
|
9e349dd274 | ||
|
|
4caa9d2775 | ||
|
|
6814ae87c6 | ||
|
|
e08b70a242 | ||
|
|
90efde2a00 | ||
|
|
10e68bda6b | ||
|
|
1a462e0a85 | ||
|
|
e72ae93557 | ||
|
|
e62be3d793 | ||
|
|
9619b93c73 | ||
|
|
462c362191 | ||
|
|
ff2df3e3b3 | ||
|
|
884e95f307 | ||
|
|
811018f78c | ||
|
|
d1510f6f36 | ||
|
|
e921117581 | ||
|
|
42da42f827 | ||
|
|
4ae81d8acd | ||
|
|
3baf0f02a5 | ||
|
|
5a1d73862a | ||
|
|
e91c92ce98 | ||
|
|
fce17efbb8 | ||
|
|
fa2fc8b69d | ||
|
|
35e5efb530 | ||
|
|
89213e18e5 | ||
|
|
8a0a62ae03 | ||
|
|
2c493137c3 | ||
|
|
0452f08f64 | ||
|
|
7b8f139103 | ||
|
|
0dbcebf01e | ||
|
|
311e8ab964 | ||
|
|
20276404a8 | ||
|
|
3a922aabfe | ||
|
|
e5c68ba9ae | ||
|
|
39e2b09219 | ||
|
|
82754451ad | ||
|
|
67c80b2b42 | ||
|
|
c5cc771f16 | ||
|
|
a6c08c7340 | ||
|
|
10dd3db8d4 | ||
|
|
9f7c369d53 | ||
|
|
50f9794383 | ||
|
|
25b1bceffd | ||
|
|
39d0acc30b | ||
|
|
143022e488 | ||
|
|
2ee764963b | ||
|
|
4f3aad65e3 | ||
|
|
8bf1b23239 | ||
|
|
f085f81d23 | ||
|
|
c0d49e1455 | ||
|
|
3c50152c94 | ||
|
|
c0e8f46e8e |
4
404.php
4
404.php
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -39,4 +39,4 @@ elseif (in_array(substr($_SERVER['REQUEST_URI'], -3), array('.js', 'css')))
|
||||
die('');
|
||||
|
||||
require_once(dirname(__FILE__).'/config/config.inc.php');
|
||||
ControllerFactory::getController('PageNotFoundController')->run();
|
||||
Controller::getController('PageNotFoundController')->run();
|
||||
|
||||
43
admin-dev/ajax-tab.php
Executable file
43
admin-dev/ajax-tab.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require(dirname(__FILE__).'/../config/config.inc.php');
|
||||
require(dirname(__FILE__).'/functions.php');
|
||||
|
||||
// For retrocompatibility with "tab" parameter
|
||||
if (!isset($_GET['controller']) && isset($_GET['tab']))
|
||||
$_GET['controller'] = strtolower($_GET['tab']);
|
||||
if (!isset($_POST['controller']) && isset($_POST['tab']))
|
||||
$_POST['controller'] = strtolower($_POST['tab']);
|
||||
if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
|
||||
$_REQUEST['controller'] = strtolower($_REQUEST['tab']);
|
||||
// Retrocompatibility with 1.4
|
||||
$_REQUEST['ajaxMode'] = $_POST['ajaxMode'] = $_GET['ajaxMode'] = $_REQUEST['ajax'] = $_POST['ajax'] = $_GET['ajax'] = 1;
|
||||
|
||||
Dispatcher::getInstance()->setControllerDirectories(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_));
|
||||
Dispatcher::getInstance()->dispatch();
|
||||
@@ -25,16 +25,16 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('PS_ADMIN_DIR', getcwd());
|
||||
include(PS_ADMIN_DIR.'/../config/config.inc.php');
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
/* Getting cookie or logout */
|
||||
require_once(dirname(__FILE__).'/init.php');
|
||||
|
||||
require_once(PS_ADMIN_DIR.'/tabs/AdminCounty.php');
|
||||
$context = Context::getContext();
|
||||
|
||||
if (isset($_GET['changeParentUrl']))
|
||||
if (Tools::isSubmit('changeParentUrl'))
|
||||
echo '<script type="text/javascript">parent.parent.document.location.href = "'.addslashes(urldecode(Tools::getValue('changeParentUrl'))).'";</script>';
|
||||
if (isset($_GET['installBoughtModule']))
|
||||
if (Tools::isSubmit('installBoughtModule'))
|
||||
{
|
||||
$file = false;
|
||||
while ($file === false OR file_exists(_PS_MODULE_DIR_.$file))
|
||||
@@ -66,48 +66,54 @@ if (isset($_GET['installBoughtModule']))
|
||||
die(displayJavascriptAlert('Module copied to disk'));
|
||||
}
|
||||
|
||||
function displayJavascriptAlert($s){echo '<script type="text/javascript">alert(\''.addslashes($s).'\');</script>';}
|
||||
|
||||
if (isset($_GET['ajaxProductManufacturers']))
|
||||
function displayJavascriptAlert($s)
|
||||
{
|
||||
$currentIndex = 'index.php?tab=AdminCatalog';
|
||||
echo '<script type="text/javascript">alert(\''.addslashes($s).'\');</script>';
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('ajaxProductManufacturers'))
|
||||
{
|
||||
AdminTab::$currentIndex = 'index.php?tab=AdminCatalog';
|
||||
$manufacturers = Manufacturer::getManufacturers();
|
||||
if ($manufacturers)
|
||||
{
|
||||
$jsonArray = array();
|
||||
foreach ($manufacturers AS $manufacturer)
|
||||
$jsonArray[] = '{"optionValue": "'.$manufacturer['id_manufacturer'].'", "optionDisplay": "'.htmlspecialchars($manufacturer['name']).'"}';
|
||||
$jsonArray[] = '{"optionValue": "'.$manufacturer['id_manufacturer'].'", "optionDisplay": "'.htmlspecialchars(trim($manufacturer['name'])).'"}';
|
||||
die('['.implode(',', $jsonArray).']');
|
||||
}
|
||||
}
|
||||
if (isset($_GET['ajaxReferrers']))
|
||||
|
||||
|
||||
if (Tools::isSubmit('ajaxReferrers'))
|
||||
{
|
||||
require('tabs/AdminReferrers.php');
|
||||
require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php');
|
||||
}
|
||||
|
||||
if (isset($_GET['ajaxProductSuppliers']))
|
||||
if (Tools::isSubmit('ajaxProductSuppliers'))
|
||||
{
|
||||
$currentIndex = 'index.php?tab=AdminCatalog';
|
||||
AdminTab::$currentIndex = 'index.php?tab=AdminCatalog';
|
||||
$suppliers = Supplier::getSuppliers();
|
||||
if ($suppliers)
|
||||
{
|
||||
$jsonArray = array();
|
||||
foreach ($suppliers AS $supplier)
|
||||
$jsonArray[] = '{"optionValue": "'.$supplier['id_supplier'].'", "optionDisplay": "'.htmlspecialchars($supplier['name']).'"}';
|
||||
$jsonArray[] = '{"optionValue": "'.$supplier['id_supplier'].'", "optionDisplay": "'.htmlspecialchars(trim($supplier['name'])).'"}';
|
||||
die('['.implode(',', $jsonArray).']');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['ajaxProductAccessories']))
|
||||
if (Tools::isSubmit('ajaxProductAccessories'))
|
||||
{
|
||||
$currentIndex = 'index.php?tab=AdminCatalog';
|
||||
AdminTab::$currentIndex = 'index.php?tab=AdminCatalog';
|
||||
$jsonArray = array();
|
||||
|
||||
$products = Db::getInstance()->ExecuteS('
|
||||
$products = Db::getInstance()->executeS('
|
||||
SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
|
||||
'.Context::getContext()->shop->addSqlRestrictionOnLang('pl').'
|
||||
AND p.`id_product` != '.(int)(Tools::getValue('id_product')).'
|
||||
AND p.`id_product` NOT IN (
|
||||
SELECT a.`id_product_2`
|
||||
@@ -120,18 +126,16 @@ if (isset($_GET['ajaxProductAccessories']))
|
||||
die('['.implode(',', $jsonArray).']');
|
||||
}
|
||||
|
||||
if (isset($_GET['ajaxDiscountCustomers']))
|
||||
if (Tools::isSubmit('ajaxDiscountCustomers'))
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$currentIndex = 'index.php?tab=AdminDiscounts';
|
||||
AdminTab::$currentIndex = 'index.php?tab=AdminDiscounts';
|
||||
$jsonArray = array();
|
||||
$filter = Tools::getValue('filter');
|
||||
|
||||
if (Validate::isBool_Id($filter))
|
||||
$filterArray = explode('_', $filter);
|
||||
|
||||
$customers = Db::getInstance()->ExecuteS('
|
||||
$customers = Db::getInstance()->executeS('
|
||||
SELECT `id_customer`, `email`, CONCAT(`lastname`, \' \', `firstname`) as name
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `deleted` = 0 AND is_guest = 0
|
||||
@@ -143,10 +147,10 @@ if (isset($_GET['ajaxDiscountCustomers']))
|
||||
ORDER BY CONCAT(`lastname`, \' \', `firstname`) ASC
|
||||
LIMIT 50');
|
||||
|
||||
$groups = Db::getInstance()->ExecuteS('
|
||||
$groups = Db::getInstance()->executeS('
|
||||
SELECT g.`id_group`, gl.`name`
|
||||
FROM `'._DB_PREFIX_.'group` g
|
||||
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)($cookie->id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)($context->language->id).')
|
||||
WHERE '.(Validate::isUnsignedInt($filter) ? 'g.`id_group` = '.(int)($filter) : 'gl.`name` LIKE "%'.pSQL($filter).'%"
|
||||
'.((Validate::isBool_Id($filter) AND $filterArray[0] == 1) ? 'OR g.`id_group` = '.(int)($filterArray[1]) : '')).'
|
||||
ORDER BY gl.`name` ASC
|
||||
@@ -165,9 +169,7 @@ if (isset($_GET['ajaxDiscountCustomers']))
|
||||
}
|
||||
|
||||
if (Tools::getValue('page') == 'prestastore' AND @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3))
|
||||
readfile('http://addons.prestashop.com/adminmodules.php?lang='.Language::getIsoById($cookie->id_lang));
|
||||
if (Tools::getValue('page') == 'themes' AND @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3))
|
||||
readfile('http://addons.prestashop.com/adminthemes.php?lang='.Language::getIsoById($cookie->id_lang));
|
||||
readfile('http://addons.prestashop.com/adminmodules.php?lang='.$context->language->iso_code);
|
||||
|
||||
if ($step = (int)(Tools::getValue('ajaxProductTab')))
|
||||
{
|
||||
@@ -182,17 +184,15 @@ if ($step = (int)(Tools::getValue('ajaxProductTab')))
|
||||
die (Tools::displayError('Product cannot be loaded'));
|
||||
|
||||
$switchArray = array(3 => 'displayFormPrices', 4 => 'displayFormAttributes', 5 => 'displayFormFeatures', 6 => 'displayFormCustomization', 7 => 'displayFormAttachments');
|
||||
$currentIndex = 'index.php?tab=AdminCatalog';
|
||||
AdminTab::$currentIndex = 'index.php?tab=AdminCatalog';
|
||||
if (key_exists($step, $switchArray))
|
||||
$admin->{$switchArray[$step]}($product, $languages, $defaultLanguage);
|
||||
}
|
||||
|
||||
if (isset($_GET['getAvailableFields']) and isset($_GET['entity']))
|
||||
if (Tools::isSubmit('getAvailableFields') AND Tools::isSubmit('entity'))
|
||||
{
|
||||
$currentIndex = 'index.php?tab=AdminImport';
|
||||
$jsonArray = array();
|
||||
require_once(dirname(__FILE__).'/tabs/AdminImport.php');
|
||||
$import = new AdminImport();
|
||||
$import = new AdminImportController();
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
@@ -202,7 +202,7 @@ if (isset($_GET['getAvailableFields']) and isset($_GET['entity']))
|
||||
die('['.implode(',', $jsonArray).']');
|
||||
}
|
||||
|
||||
if (array_key_exists('ajaxModulesPositions', $_POST))
|
||||
if (Tools::isSubmit('ajaxModulesPositions'))
|
||||
{
|
||||
$id_module = (int)(Tools::getValue('id_module'));
|
||||
$id_hook = (int)(Tools::getValue('id_hook'));
|
||||
@@ -219,7 +219,7 @@ if (array_key_exists('ajaxModulesPositions', $_POST))
|
||||
die('{"hasError" : true, "errors" : "This module can not be loaded"}');
|
||||
}
|
||||
|
||||
if (array_key_exists('ajaxCategoriesPositions', $_POST))
|
||||
if (Tools::isSubmit('ajaxCategoriesPositions'))
|
||||
{
|
||||
$id_category_to_move = (int)(Tools::getValue('id_category_to_move'));
|
||||
$id_category_parent = (int)(Tools::getValue('id_category_parent'));
|
||||
@@ -240,7 +240,7 @@ if (array_key_exists('ajaxCategoriesPositions', $_POST))
|
||||
{
|
||||
if (isset($position) && $category->updatePosition($way, $position))
|
||||
{
|
||||
Module::hookExec('categoryUpdate');
|
||||
Hook::exec('categoryUpdate');
|
||||
die(true);
|
||||
}
|
||||
else
|
||||
@@ -251,7 +251,7 @@ if (array_key_exists('ajaxCategoriesPositions', $_POST))
|
||||
|
||||
}
|
||||
|
||||
if (array_key_exists('ajaxCMSCategoriesPositions', $_POST))
|
||||
if (Tools::isSubmit('ajaxCMSCategoriesPositions'))
|
||||
{
|
||||
$id_cms_category_to_move = (int)(Tools::getValue('id_cms_category_to_move'));
|
||||
$id_cms_category_parent = (int)(Tools::getValue('id_cms_category_parent'));
|
||||
@@ -279,7 +279,7 @@ if (array_key_exists('ajaxCMSCategoriesPositions', $_POST))
|
||||
die('{"hasError" : true, "errors" : "This cms category can not be loaded"}');
|
||||
}
|
||||
|
||||
if (array_key_exists('ajaxCMSPositions', $_POST))
|
||||
if (Tools::isSubmit('ajaxCMSPositions'))
|
||||
{
|
||||
$id_cms = (int)(Tools::getValue('id_cms'));
|
||||
$id_category = (int)(Tools::getValue('id_cms_category'));
|
||||
@@ -308,7 +308,7 @@ if (array_key_exists('ajaxCMSPositions', $_POST))
|
||||
}
|
||||
|
||||
/* Modify product position in catalog */
|
||||
if (array_key_exists('ajaxProductsPositions', $_POST))
|
||||
if (Tools::isSubmit('ajaxProductsPositions'))
|
||||
{
|
||||
$way = (int)(Tools::getValue('way'));
|
||||
$id_product = (int)(Tools::getValue('id_product'));
|
||||
@@ -336,14 +336,45 @@ if (array_key_exists('ajaxProductsPositions', $_POST))
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['ajaxProductPackItems']))
|
||||
if (Tools::isSubmit('ajaxProductImagesPositions'))
|
||||
{
|
||||
$id_image = (int)(Tools::getValue('id_image'));
|
||||
$way = (int)(Tools::getValue('way'));
|
||||
$positions = Tools::getValue('imageTable');
|
||||
|
||||
if (is_array($positions))
|
||||
foreach ($positions AS $key => $value)
|
||||
{
|
||||
$pos = explode('_', $value);
|
||||
if ((isset($pos[1])) AND ($pos[1] == $id_image))
|
||||
{
|
||||
// +1 is added because images position range starts from 1 instead of 0 for other objects (products, categories...)
|
||||
$position = ($key + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$image = new Image($id_image);
|
||||
if (Validate::isLoadedObject($image))
|
||||
{
|
||||
if (isset($position) && $image->updatePosition($way, $position))
|
||||
die(true);
|
||||
else
|
||||
die('{"hasError" : true, "errors" : "Cannot update image position"}');
|
||||
}
|
||||
else
|
||||
die('{"hasError" : true, "errors" : "This image cannot be loaded"}');
|
||||
}
|
||||
|
||||
|
||||
if (Tools::isSubmit('ajaxProductPackItems'))
|
||||
{
|
||||
$jsonArray = array();
|
||||
$products = Db::getInstance()->ExecuteS('
|
||||
$products = Db::getInstance()->executeS('
|
||||
SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
|
||||
'.Context::getContext()->shop->addSqlRestrictionOnLang('pl').'
|
||||
AND p.`id_product` NOT IN (SELECT DISTINCT id_product_pack FROM `'._DB_PREFIX_.'pack`)
|
||||
AND p.`id_product` != '.(int)(Tools::getValue('id_product')));
|
||||
|
||||
@@ -352,20 +383,23 @@ if (isset($_GET['ajaxProductPackItems']))
|
||||
die('['.implode(',', $jsonArray).']');
|
||||
}
|
||||
|
||||
if (isset($_GET['ajaxStates']) AND isset($_GET['id_country']))
|
||||
if (Tools::isSubmit('ajaxStates') AND Tools::isSubmit('id_country'))
|
||||
{
|
||||
$states = Db::getInstance()->ExecuteS('
|
||||
$states = Db::getInstance()->executeS('
|
||||
SELECT s.id_state, s.name
|
||||
FROM '._DB_PREFIX_.'state s
|
||||
LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`)
|
||||
WHERE s.id_country = '.(int)(Tools::getValue('id_country')).' AND s.active = 1 AND c.`contains_states` = 1
|
||||
ORDER BY s.`name` ASC');
|
||||
|
||||
|
||||
if (is_array($states) AND !empty($states))
|
||||
{
|
||||
$list = '';
|
||||
if (Tools::getValue('no_empty') != true)
|
||||
$list = '<option value="0">-----------</option>'."\n";
|
||||
{
|
||||
$empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------';
|
||||
$list = '<option value="0">'.Tools::htmlentitiesUTF8($empty_value).'</option>'."\n";
|
||||
}
|
||||
|
||||
foreach ($states AS $state)
|
||||
$list .= '<option value="'.(int)($state['id_state']).'"'.((isset($_GET['id_state']) AND $_GET['id_state'] == $state['id_state']) ? ' selected="selected"' : '').'>'.$state['name'].'</option>'."\n";
|
||||
@@ -381,33 +415,31 @@ if (Tools::isSubmit('submitCustomerNote') AND $id_customer = (int)Tools::getValu
|
||||
$note = html_entity_decode(Tools::getValue('note'));
|
||||
if (!empty($note) AND !Validate::isCleanHtml($note))
|
||||
die ('error:validation');
|
||||
if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer SET `note` = "'.pSQL($note, true).'" WHERE id_customer = '.(int)$id_customer.' LIMIT 1'))
|
||||
if (!Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'customer SET `note` = "'.pSQL($note, true).'" WHERE id_customer = '.(int)$id_customer.' LIMIT 1'))
|
||||
die ('error:update');
|
||||
die('ok');
|
||||
}
|
||||
|
||||
if (Tools::getValue('form_language_id'))
|
||||
{
|
||||
if (!($cookie->employee_form_lang = (int)(Tools::getValue('form_language_id'))))
|
||||
if (!($context->cookie->employee_form_lang = (int)(Tools::getValue('form_language_id'))))
|
||||
die ('Error while updating cookie.');
|
||||
die ('Form language updated.');
|
||||
}
|
||||
|
||||
if (Tools::getValue('submitPublishProduct'))
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (Tools::getIsset('id_product'))
|
||||
{
|
||||
$id_product = (int)(Tools::getValue('id_product'));
|
||||
$id_tab_catalog = (int)(Tab::getIdFromClassName('AdminCatalog'));
|
||||
$token = Tools::getAdminToken('AdminCatalog'.(int)($id_tab_catalog).(int)($cookie->id_employee));
|
||||
$bo_product_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.$token;
|
||||
$id_tab_catalog = (int)(Tab::getIdFromClassName('AdminProducts'));
|
||||
$token = Tools::getAdminToken('AdminProducts'.(int)($id_tab_catalog).(int)$context->employee->id);
|
||||
$bo_product_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminProducts&id_product='.$id_product.'&updateproduct&token='.$token;
|
||||
|
||||
if (Tools::getValue('redirect'))
|
||||
die($bo_product_url);
|
||||
|
||||
$profileAccess = Profile::getProfileAccess((int)$cookie->profile, $id_tab_catalog);
|
||||
$profileAccess = Profile::getProfileAccess($context->employee->id_profile, $id_tab_catalog);
|
||||
if($profileAccess['edit'])
|
||||
{
|
||||
$product = new Product((int)(Tools::getValue('id_product')));
|
||||
@@ -431,19 +463,17 @@ if (Tools::getValue('submitPublishProduct'))
|
||||
|
||||
if (Tools::getValue('submitPublishCMS'))
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (Tools::getIsset('id_cms'))
|
||||
{
|
||||
$id_cms = (int)(Tools::getValue('id_cms'));
|
||||
$id_tab_cms = (int)(Tab::getIdFromClassName('AdminCMSContent'));
|
||||
$token = Tools::getAdminToken('AdminCMSContent'.(int)($id_tab_cms).(int)($cookie->id_employee));
|
||||
$bo_cms_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminCMSContent&id_cms='.(int)$id_cms.'&updatecms&token='.$token;
|
||||
$id_tab_cms = (int)(Tab::getIdFromClassName('AdminCmsContent'));
|
||||
$token = Tools::getAdminToken('AdminCmsContent'.(int)($id_tab_cms).(int)$context->employee->id);
|
||||
$bo_cms_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminCmsContent&id_cms='.(int)$id_cms.'&updatecms&token='.$token;
|
||||
|
||||
if (Tools::getValue('redirect'))
|
||||
die($bo_cms_url);
|
||||
|
||||
$profileAccess = Profile::getProfileAccess((int)$cookie->profile, $id_tab_cms);
|
||||
$profileAccess = Profile::getProfileAccess($context->employee->id_profile, $id_tab_cms);
|
||||
if($profileAccess['edit'])
|
||||
{
|
||||
$cms = new CMS((int)(Tools::getValue('id_cms')));
|
||||
@@ -477,7 +507,7 @@ if (Tools::isSubmit('submitTrackClickOnHelp'))
|
||||
if (Tools::isSubmit('saveImportMatchs'))
|
||||
{
|
||||
$match = implode('|', Tools::getValue('type_value'));
|
||||
Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'import_match` (
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'import_match` (
|
||||
`id_import_match` ,
|
||||
`name` ,
|
||||
`match`,
|
||||
@@ -495,41 +525,22 @@ if (Tools::isSubmit('saveImportMatchs'))
|
||||
|
||||
if (Tools::isSubmit('deleteImportMatchs'))
|
||||
{
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'import_match` WHERE id_import_match = '.pSQL(Tools::getValue('idImportMatchs')));
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'import_match` WHERE `id_import_match` = '.(int)Tools::getValue('idImportMatchs'));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('loadImportMatchs'))
|
||||
{
|
||||
$return = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'import_match` WHERE id_import_match = '.pSQL(Tools::getValue('idImportMatchs')));
|
||||
$return = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'import_match` WHERE `id_import_match` = '.(int)Tools::getValue('idImportMatchs'));
|
||||
die('{"id" : "'.$return[0]['id_import_match'].'", "matchs" : "'.$return[0]['match'].'", "skip" : "'.$return[0]['skip'].'"}');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('toggleScreencast'))
|
||||
{
|
||||
global $cookie;
|
||||
$cookie->show_screencast = (int)(!(bool)$cookie->show_screencast);
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('ajaxAddZipCode') OR Tools::isSubmit('ajaxRemoveZipCode'))
|
||||
{
|
||||
$zipcodes = Tools::getValue('zipcodes');
|
||||
$id_county = (int)Tools::getValue('id_county');
|
||||
|
||||
$county = new County($id_county);
|
||||
if (!Validate::isLoadedObject($county))
|
||||
die('error');
|
||||
|
||||
if (Tools::isSubmit('ajaxAddZipCode'))
|
||||
if (Validate::isLoadedObject($context->employee))
|
||||
{
|
||||
if ($county->isZipCodeRangePresent($zipcodes))
|
||||
die('error:'.Tools::displayError('This Zip Code is already in use.'));
|
||||
if ($county->addZipCodes($zipcodes))
|
||||
die(AdminCounty::renderZipCodeList($county->getZipCodes()));
|
||||
$context->employee->bo_show_screencast = !$context->employee->bo_show_screencast;
|
||||
$context->employee->update();
|
||||
}
|
||||
else if (Tools::isSubmit('ajaxRemoveZipCode') AND $county->removeZipCodes($zipcodes))
|
||||
die(AdminCounty::renderZipCodeList($county->getZipCodes()));
|
||||
|
||||
die('error');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('helpAccess'))
|
||||
@@ -541,14 +552,23 @@ if (Tools::isSubmit('helpAccess'))
|
||||
|
||||
if (isset($item) AND isset($isoUser) AND isset($country))
|
||||
die(HelpAccess::displayHelp($item, $isoUser, $country, $version));
|
||||
die();
|
||||
die('{nohelp}');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getHookableList'))
|
||||
{
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}');
|
||||
/* PrestaShop demo mode*/
|
||||
|
||||
if (!strlen(Tools::getValue('hooks_list')))
|
||||
die('{"hasError" : true, "errors" : ["Live Edit : no module on this page"]}');
|
||||
|
||||
$modules_list = explode(',', Tools::getValue('modules_list'));
|
||||
$hooks_list = explode(',', Tools::getValue('hooks_list'));
|
||||
$hookableList = array();
|
||||
|
||||
foreach ($modules_list as $module)
|
||||
{
|
||||
$module = trim($module);
|
||||
@@ -566,18 +586,23 @@ if (Tools::isSubmit('getHookableList'))
|
||||
if ($moduleInstance->isHookableOn($hook_name))
|
||||
array_push($hookableList[$hook_name], $module);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$hookableList['hasError'] = false;
|
||||
die(Tools::jsonEncode($hookableList));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getHookableModuleList'))
|
||||
{
|
||||
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}');
|
||||
/* PrestaShop demo mode*/
|
||||
|
||||
include('../init.php');
|
||||
$hook_name = Tools::getValue('hook');
|
||||
$hookableModulesList = array();
|
||||
$modules = Db::getInstance()->ExecuteS('SELECT id_module, name FROM `'._DB_PREFIX_.'module` ');
|
||||
$modules = Db::getInstance()->executeS('SELECT id_module, name FROM `'._DB_PREFIX_.'module` ');
|
||||
foreach ($modules as $module)
|
||||
{
|
||||
if (file_exists(_PS_MODULE_DIR_.$module['name'].'/'.$module['name'].'.php'))
|
||||
@@ -585,14 +610,19 @@ if (Tools::isSubmit('getHookableModuleList'))
|
||||
include_once(_PS_MODULE_DIR_.$module['name'].'/'.$module['name'].'.php');
|
||||
$mod = new $module['name']();
|
||||
if ($mod->isHookableOn($hook_name))
|
||||
$hookableModulesList[] = array('id' => (int)$mod->id, 'name' => $mod->displayName, 'display' => Module::hookExec($hook_name, array(), (int)$mod->id));
|
||||
}
|
||||
$hookableModulesList[] = array('id' => (int)$mod->id, 'name' => $mod->displayName, 'display' => Hook::exec($hook_name, array(), (int)$mod->id));
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($hookableModulesList));
|
||||
die(Tools::jsonEncode($hookableModulesList));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('saveHook'))
|
||||
{
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}');
|
||||
/* PrestaShop demo mode*/
|
||||
|
||||
$hooks_list = explode(',', Tools::getValue('hooks_list'));
|
||||
$id_shop = (int)Tools::getValue('id_shop');
|
||||
if ($id_shop)
|
||||
@@ -603,23 +633,28 @@ if (Tools::isSubmit('saveHook'))
|
||||
$hook = trim($hook);
|
||||
if (!$hook)
|
||||
continue;
|
||||
|
||||
|
||||
$sql = 'DELETE FROM '._DB_PREFIX_.'hook_module
|
||||
WHERE id_hook = (SELECT id_hook FROM '._DB_PREFIX_.'hook WHERE `name` = \''.pSQL($hook).'\' LIMIT 1)
|
||||
AND id_shop = '.$id_shop;
|
||||
Db::getInstance()->Execute($sql);
|
||||
Db::getInstance()->execute($sql);
|
||||
$hookedModules = explode(',', Tools::getValue($hook));
|
||||
$i = 1;
|
||||
$value = '';
|
||||
$ids = array();
|
||||
foreach ($hookedModules as $module)
|
||||
{
|
||||
$ids = explode('_', $module);
|
||||
$value .= '('.$ids[1].', '.$id_shop.', (SELECT id_hook FROM '._DB_PREFIX_.'hook WHERE `name` = \''.pSQL($hook).'\' LIMIT 1), '.$i.'),';
|
||||
$id = explode('_', $module);
|
||||
if (!in_array($id[1], $ids))
|
||||
{
|
||||
$ids[] = $id[1];
|
||||
$value .= '('.(int)$id[1].', (SELECT id_hook FROM `'._DB_PREFIX_.'hook` WHERE `name` = \''.pSQL($hook).'\' LIMIT 0, 1), '.(int)$i.'),';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$value = rtrim($value, ',');
|
||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'hook_module (id_module, id_shop, id_hook, position) VALUES '.$value);
|
||||
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'hook_module (id_module, id_shop, id_hook, position) VALUES '.$value);
|
||||
|
||||
}
|
||||
}
|
||||
die('{"hasError" : false, "errors" : ""}');
|
||||
@@ -628,26 +663,26 @@ if (Tools::isSubmit('saveHook'))
|
||||
if (Tools::isSubmit('getAdminHomeElement'))
|
||||
{
|
||||
$result = array();
|
||||
|
||||
$protocol = (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http';
|
||||
$isoUser = Language::getIsoById(intval($cookie->id_lang));
|
||||
$isoCountry = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
$context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5)));
|
||||
|
||||
|
||||
$protocol = Tools::usingSecureMode() ? 'https' : 'http';
|
||||
$isoUser = Context::getContext()->language->iso_code;
|
||||
$isoCountry = Context::getContext()->country->iso_code;
|
||||
$stream_context = @stream_context_create(array('http' => array('method'=> 'GET', 'timeout' => 5)));
|
||||
|
||||
// SCREENCAST
|
||||
if (@fsockopen('www.prestashop.com', 80, $errno, $errst, 3))
|
||||
$result['screencast'] = 'OK';
|
||||
else
|
||||
$result['screencast'] = 'NOK';
|
||||
|
||||
|
||||
// PREACTIVATION
|
||||
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/preactivation/preactivation-block.php?version=1.0&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&protocol='.$protocol.'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&date_creation='._PS_CREATION_DATE_.'&v='._PS_VERSION_.'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context);
|
||||
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/preactivation/preactivation-block.php?version=1.0&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&protocol='.$protocol.'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&date_creation='._PS_CREATION_DATE_.'&v='._PS_VERSION_.'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
|
||||
if (!$content)
|
||||
$result['partner_preactivation'] = 'NOK';
|
||||
else
|
||||
{
|
||||
$content = explode('|', $content);
|
||||
if ($content[0] == 'OK')
|
||||
if ($content[0] == 'OK' && Validate::isCleanHtml($content[2]) && Validate::isCleanHtml($content[1]))
|
||||
{
|
||||
$result['partner_preactivation'] = $content[2];
|
||||
$content[1] = explode('#%#', $content[1]);
|
||||
@@ -665,44 +700,299 @@ if (Tools::isSubmit('getAdminHomeElement'))
|
||||
else
|
||||
$result['partner_preactivation'] = 'NOK';
|
||||
}
|
||||
|
||||
|
||||
// PREACTIVATION PAYPAL WARNING
|
||||
$content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Context::getContext()->country->iso_code).'&iso_lang='.Tools::strtolower(Context::getContext()->language->iso_code).'&id_lang='.(int)Context::getContext()->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
|
||||
$content = explode('|', $content);
|
||||
if ($content[0] == 'OK' && Validate::isCleanHtml($content[1]))
|
||||
Configuration::updateValue('PS_PREACTIVATION_PAYPAL_WARNING', $content[1]);
|
||||
else
|
||||
Configuration::updateValue('PS_PREACTIVATION_PAYPAL_WARNING', '');
|
||||
|
||||
// DISCOVER PRESTASHOP
|
||||
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $context);
|
||||
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id, false, $stream_context);
|
||||
if (!$content)
|
||||
$result['discover_prestashop'] = 'NOK';
|
||||
else
|
||||
{
|
||||
$content = explode('|', $content);
|
||||
if ($content[0] == 'OK')
|
||||
if ($content[0] == 'OK' && Validate::isCleanHtml($content[1]))
|
||||
$result['discover_prestashop'] = $content[1];
|
||||
else
|
||||
$result['discover_prestashop'] = 'NOK';
|
||||
|
||||
|
||||
if (@fsockopen('www.prestashop.com', 80, $errno, $errst, 3))
|
||||
$result['discover_prestashop'] .= '<iframe frameborder="no" style="margin: 0px; padding: 0px; width: 315px; height: 290px;" src="'.$protocol.'://www.prestashop.com/rss/news2.php?v='._PS_VERSION_.'&lang='.$isoUser.'"></iframe>';
|
||||
|
||||
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/paypal/paypal-tips.php?protocol='.$protocol.'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $context);
|
||||
|
||||
$content = @file_get_contents($protocol.'://www.prestashop.com/partner/paypal/paypal-tips.php?protocol='.$protocol.'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)Context::getContext()->language->id, false, $stream_context);
|
||||
$content = explode('|', $content);
|
||||
if ($content[0] == 'OK')
|
||||
if ($content[0] == 'OK' && Validate::isCleanHtml($content[1]))
|
||||
$result['discover_prestashop'] .= $content[1];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($result));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getChildrenCategories') && Tools::getValue('id_category_parent'))
|
||||
if (Tools::isSubmit('getChildrenCategories') && Tools::getValue('id_category_parent'))
|
||||
{
|
||||
$children_categories = Category::getChildrenWithNbSelectedSubCatForProduct(Tools::getValue('id_category_parent'), Tools::getValue('id_product', 0), Tools::getValue('post_selected_cat', null), $cookie->id_lang);
|
||||
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id);
|
||||
die(Tools::jsonEncode($children_categories));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('updateProductImageShopAsso'))
|
||||
if (Tools::isSubmit('getNotifications'))
|
||||
{
|
||||
if ($id_image = (int)Tools::getValue('id_image') AND $id_shop = (int)Tools::getValue('id_shop'))
|
||||
$notification = new Notification;
|
||||
die(Tools::jsonEncode($notification->getLastElements()));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('updateElementEmployee') && Tools::getValue('updateElementEmployeeType'))
|
||||
{
|
||||
$notification = new Notification;
|
||||
die($notification->updateEmployeeLastElement(Tools::getValue('updateElementEmployeeType')));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('syncImapMail'))
|
||||
{
|
||||
if (!$url = Configuration::get('PS_SAV_IMAP_URL')
|
||||
|| !$port = Configuration::get('PS_SAV_IMAP_PORT')
|
||||
|| !$user = Configuration::get('PS_SAV_IMAP_USER')
|
||||
|| !$password = Configuration::get('PS_SAV_IMAP_PWD'))
|
||||
die('{"hasError" : true, "errors" : ["Configuration is not correct"]}');
|
||||
|
||||
if (!function_exists('imap_open'))
|
||||
die('{"hasError" : true, "errors" : ["imap is not installed on this server"]}');
|
||||
|
||||
$mbox = @imap_open('{'.$url.':'.$port.(Configuration::get('PS_SAV_IMAP_SSL') ? '/ssl' : '').'}', $user, $password);
|
||||
|
||||
//checks if there is no error when connecting imap server
|
||||
$errors = imap_errors();
|
||||
$str_errors = '';
|
||||
$str_error_delete = '';
|
||||
if (sizeof($errors))
|
||||
{
|
||||
if ((int)Tools::getValue('active'))
|
||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'image_shop (`id_image`, `id_shop`) VALUES('.(int)$id_image.', '.(int)$id_shop.')');
|
||||
else
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'image_shop WHERE `id_image`='.(int)$id_image.' AND `id_shop`='.(int)$id_shop);
|
||||
$str_errors = '["';
|
||||
foreach($errors as $error)
|
||||
$str_errors .= '"'.$error.'",';
|
||||
$str_errors = rtrim($str_errors, ',').'';
|
||||
}
|
||||
|
||||
//checks if imap connexion is active
|
||||
if (!$mbox)
|
||||
die('{"hasError" : true, "errors" : ["Cannot connect to the mailbox"]}');
|
||||
|
||||
//Returns information about the current mailbox. Returns FALSE on failure.
|
||||
$check = imap_check($mbox);
|
||||
if ($check)
|
||||
die('{"hasError" : true, "errors" : ["Fail to get information about the current mailbox"]}');
|
||||
|
||||
if ($check->Nmsgs == 0)
|
||||
die('{"hasError" : true, "errors" : ["NO message to sync"]}');
|
||||
|
||||
$result = imap_fetch_overview($mbox,"1:{$check->Nmsgs}",0);
|
||||
foreach ($result as $overview)
|
||||
{
|
||||
//check if message exist in database
|
||||
if (isset($overview->subject))
|
||||
$subject = $overview->subject;
|
||||
else
|
||||
$subject = '';
|
||||
|
||||
//Creating an md5 to check if message has been allready processed
|
||||
$md5 = md5($overview->date.$overview->from.$subject.$overview->msgno);
|
||||
$exist = Db::getInstance()->getValue(
|
||||
'SELECT `md5_header`
|
||||
FROM `'._DB_PREFIX_.'customer_message_sync_imap`
|
||||
WHERE `md5_header` = \''.pSQL($md5).'\'');
|
||||
if ($exist)
|
||||
{
|
||||
if (Configuration::get('PS_SAV_IMAP_DELETE_MSG'))
|
||||
if (!imap_delete($mbox, $overview->msgno))
|
||||
$str_error_delete = ', "Fail to delete message"';
|
||||
}
|
||||
else
|
||||
{
|
||||
//check if subject has id_order
|
||||
preg_match('/\#ct([0-9]*)/', $subject, $matches1);
|
||||
preg_match('/\#tc([0-9-a-z-A-Z]*)/', $subject, $matches2);
|
||||
|
||||
if (isset($matches1[1]) && isset($matches2[1]))
|
||||
{
|
||||
//check if order exist in database
|
||||
$ct = new CustomerThread((int)$matches1[1]);
|
||||
|
||||
if (Validate::isLoadedObject($ct) && $ct->token == $matches2[1])
|
||||
{
|
||||
$cm = new CustomerMessage();
|
||||
$cm->id_customer_thread = $ct->id;
|
||||
$cm->message = imap_fetchbody($mbox, $overview->msgno, 1);
|
||||
$cm->add();
|
||||
}
|
||||
}
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'customer_message_sync_imap` (`md5_header`) VALUES (\''.pSQL($md5).'\')');
|
||||
}
|
||||
}
|
||||
imap_expunge($mbox);
|
||||
imap_close($mbox);
|
||||
die('{"hasError" : false, "errors" : '.$str_errors.$str_errors_delete.'"]}');
|
||||
}
|
||||
|
||||
/* Modify attribute position */
|
||||
if (Tools::isSubmit('ajaxAttributesPositions'))
|
||||
{
|
||||
$way = (int)Tools::getValue('way');
|
||||
$id_attribute = (int)Tools::getValue('id_attribute');
|
||||
$id_attribute_group = (int)Tools::getValue('id_attribute_group');
|
||||
$positions = Tools::getValue('attribute');
|
||||
|
||||
if (is_array($positions))
|
||||
foreach ($positions as $position => $value)
|
||||
{
|
||||
// pos[1] = id_attribute_group, pos[2] = id_attribute, pos[3]=old position
|
||||
$pos = explode('_', $value);
|
||||
|
||||
if ((isset($pos[1]) && isset($pos[2])) && ($pos[1] == $id_attribute_group && (int)$pos[2] === $id_attribute))
|
||||
{
|
||||
if ($attribute = new Attribute((int)$pos[2]))
|
||||
if (isset($position) && $attribute->updatePosition($way, $position))
|
||||
echo "ok position $position for attribute $pos[2]\r\n";
|
||||
else
|
||||
echo '{"hasError" : true, "errors" : "Can not update attribute '. $id_attribute . ' to position '.$position.' "}';
|
||||
else
|
||||
echo '{"hasError" : true, "errors" : "This attribute ('.$id_attribute.') can t be loaded"}';
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Modify group attribute position */
|
||||
if (Tools::isSubmit('ajaxGroupsAttributesPositions'))
|
||||
{
|
||||
$way = (int)Tools::getValue('way');
|
||||
$id_attribute_group = (int)Tools::getValue('id_attribute_group');
|
||||
$positions = Tools::getValue('attribute_group');
|
||||
|
||||
$new_positions = array();
|
||||
foreach($positions as $k => $v)
|
||||
if (count(explode('_', $v)) == 3)
|
||||
$new_positions[] = $v;
|
||||
|
||||
foreach ($new_positions as $position => $value)
|
||||
{
|
||||
// pos[1] = id_attribute_group, pos[2] = old position
|
||||
$pos = explode('_', $value);
|
||||
|
||||
if (isset($pos[1]) && (int)$pos[1] === $id_attribute_group)
|
||||
{
|
||||
if ($group_attribute = new AttributeGroup((int)$pos[1]))
|
||||
if (isset($position) && $group_attribute->updatePosition($way, $position))
|
||||
echo "ok position $position for group attribute $pos[1]\r\n";
|
||||
else
|
||||
echo '{"hasError" : true, "errors" : "Can not update group attribute '. $id_attribute_group . ' to position '.$position.' "}';
|
||||
else
|
||||
echo '{"hasError" : true, "errors" : "This group attribute ('.$id_attribute_group.') can t be loaded"}';
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Modify feature position */
|
||||
if (Tools::isSubmit('ajaxFeaturesPositions'))
|
||||
{
|
||||
$way = (int)Tools::getValue('way');
|
||||
$id_feature = (int)Tools::getValue('id_feature');
|
||||
$positions = Tools::getValue('feature');
|
||||
|
||||
$new_positions = array();
|
||||
foreach($positions as $k => $v)
|
||||
if (!empty($v))
|
||||
$new_positions[] = $v;
|
||||
|
||||
foreach ($new_positions as $position => $value)
|
||||
{
|
||||
// pos[2] = id_feature, pos[3] = old position
|
||||
$pos = explode('_', $value);
|
||||
|
||||
if (isset($pos[2]) && (int)$pos[2] === $id_feature)
|
||||
{
|
||||
if ($feature = new Feature((int)$pos[2]))
|
||||
if (isset($position) && $feature->updatePosition($way, $position))
|
||||
echo "ok position $position for feature $pos[1]\r\n";
|
||||
else
|
||||
echo '{"hasError" : true, "errors" : "Can not update feature '. $id_feature . ' to position '.$position.' "}';
|
||||
else
|
||||
echo '{"hasError" : true, "errors" : "This feature ('.$id_feature.') can t be loaded"}';
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Modify carrier position */
|
||||
if (Tools::isSubmit('ajaxCarriersPositions'))
|
||||
{
|
||||
$way = (int)(Tools::getValue('way'));
|
||||
$id_carrier = (int)(Tools::getValue('id_carrier'));
|
||||
$positions = Tools::getValue('carrier');
|
||||
|
||||
|
||||
foreach ($positions as $position => $value)
|
||||
{
|
||||
$pos = explode('_', $value);
|
||||
|
||||
if (isset($pos[2]) && (int)$pos[2] === $id_carrier)
|
||||
{
|
||||
if ($carrier = new Carrier((int)$pos[2]))
|
||||
if (isset($position) && $carrier->updatePosition($way, $position))
|
||||
echo "ok position $position for carrier $pos[1]\r\n";
|
||||
else
|
||||
echo '{"hasError" : true, "errors" : "Can not update carrier '. $id_carrier . ' to position '.$position.' "}';
|
||||
else
|
||||
echo '{"hasError" : true, "errors" : "This carrier ('.$id_carrier.') can t be loaded"}';
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('searchCategory'))
|
||||
{
|
||||
$q = Tools::getValue('q');
|
||||
$limit = Tools::getValue('limit');
|
||||
$results = Db::getInstance()->executeS(
|
||||
'SELECT c.`id_category`, cl.`name`
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.$context->shop->addSqlRestrictionOnLang('cl').')
|
||||
WHERE cl.`id_lang` = '.(int)$context->language->id.' AND c.`level_depth` <> 0
|
||||
AND cl.`name` LIKE \'%'.pSQL($q).'%\'
|
||||
GROUP BY c.id_category
|
||||
ORDER BY c.`position`
|
||||
LIMIT '.(int)$limit);
|
||||
if ($results)
|
||||
foreach ($results as $result)
|
||||
echo trim($result['name']).'|'.(int)$result['id_category']."\n";
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getParentCategoriesId') && $id_category = Tools::getValue('id_category'))
|
||||
{
|
||||
$category = new Category((int)$id_category);
|
||||
$results = Db::getInstance()->executeS('SELECT `id_category` FROM `'._DB_PREFIX_.'category` c WHERE c.`nleft` < '.(int)$category->nleft.' AND c.`nright` > '.(int)$category->nright.'');
|
||||
$output = array();
|
||||
foreach ($results as $result)
|
||||
$output[] = $result;
|
||||
|
||||
die(Tools::jsonEncode($output));
|
||||
}
|
||||
|
||||
/* Update attribute */
|
||||
if (Tools::isSubmit('ajaxUpdateTaxRule'))
|
||||
{
|
||||
$id_tax_rule = Tools::getValue('id_tax_rule');
|
||||
$tax_rules = new TaxRule((int)$id_tax_rule);
|
||||
$output = array();
|
||||
foreach ($tax_rules as $key => $result)
|
||||
$output[$key] = $result;
|
||||
die(Tools::jsonEncode($output));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -25,61 +25,59 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('PS_ADMIN_DIR', getcwd());
|
||||
include_once('../config/config.inc.php');
|
||||
include_once('tabs/AdminCatalog.php');
|
||||
include_once('tabs/AdminProducts.php');
|
||||
include_once('init.php');
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
include_once('../config/config.inc.php');
|
||||
include_once('tabs/AdminCatalog.php');
|
||||
include_once('tabs/AdminProducts.php');
|
||||
include_once('init.php');
|
||||
|
||||
if (Tools::getValue('token') != Tools::getAdminTokenLite('AdminCatalog'))
|
||||
die(1);
|
||||
if (Tools::getValue('token') != Tools::getAdminTokenLite('AdminCatalog'))
|
||||
die(1);
|
||||
|
||||
$catalog = new AdminCatalog();
|
||||
$adminProducts = new AdminProducts();
|
||||
$catalog = new AdminCatalog();
|
||||
$adminProducts = new AdminProducts();
|
||||
|
||||
global $cookie;
|
||||
|
||||
echo ' <tr>
|
||||
<td class="col-left"><label for="id_category_default" class="t">'.$adminProducts->getL('Default category:').'</label></td>
|
||||
<td>
|
||||
<select id="id_category_default" name="id_category_default" onchange="checkDefaultCategory(this.value);">';
|
||||
$categories = Category::getCategories((int)($cookie->id_lang), false);
|
||||
Category::recurseCategory($categories, $categories[0][1], 1, (int)(Tools::getValue('id_category_default')));
|
||||
echo ' </select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left">'.$adminProducts->getL('Catalog:').'</td>
|
||||
<td>
|
||||
<div style="overflow: auto; min-height: 300px; padding-top: 0.6em;" id="categoryList">
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(\'div#categoryList input.categoryBox\').click(function (){
|
||||
if ($(this).is(\':not(:checked)\') && $(\'div#categoryList input.id_category_default\').val() == $(this).val())
|
||||
alert(\''.utf8_encode(html_entity_decode($adminProducts->getL('Consider changing the default category.'))).'\');
|
||||
});
|
||||
echo ' <tr>
|
||||
<td class="col-left"><label for="id_category_default" class="t">'.$adminProducts->getL('Default category:').'</label></td>
|
||||
<td>
|
||||
<select id="id_category_default" name="id_category_default" onchange="checkDefaultCategory(this.value);">';
|
||||
$categories = Category::getCategories(Context::getContext()->language->id, false);
|
||||
Category::recurseCategory($categories, $categories[0][1], 1, (int)(Tools::getValue('id_category_default')));
|
||||
echo ' </select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-left">'.$adminProducts->getL('Catalog:').'</td>
|
||||
<td>
|
||||
<div style="overflow: auto; min-height: 300px; padding-top: 0.6em;" id="categoryList">
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(\'div#categoryList input.categoryBox\').click(function (){
|
||||
if ($(this).is(\':not(:checked)\') && $(\'div#categoryList input.id_category_default\').val() == $(this).val())
|
||||
alert(\''.utf8_encode(html_entity_decode($adminProducts->getL('Consider changing the default category.'))).'\');
|
||||
});
|
||||
</script>
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
<tr>
|
||||
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'categoryBox[]\', this.checked)" /></th>
|
||||
<th>'.$adminProducts->getL('ID').'</th>
|
||||
<th style="width: 600px">'.$adminProducts->getL('Name').'</th>
|
||||
</tr>';
|
||||
$done = array();
|
||||
$index = array();
|
||||
|
||||
$categoryBox = Tools::getValue('categoryBox');
|
||||
if ($categoryBox != '')
|
||||
{
|
||||
$categoryBox = @unserialize($categoryBox);
|
||||
foreach ($categoryBox AS $k => $row)
|
||||
$index[] = $row;
|
||||
}
|
||||
elseif ((int)Tools::getValue('id_product'))
|
||||
$index = Product::getProductCategories((int)Tools::getValue('id_product'));
|
||||
$adminProducts->recurseCategoryForInclude((int)(Tools::getValue('id_product')), $index, $categories, $categories[0][1], 1, (int)(Tools::getValue('id_category_default')));
|
||||
echo ' </table>
|
||||
<p style="padding:0px; margin:0px 0px 10px 0px;">'.$adminProducts->getL('Mark all checkbox(es) of categories in which product is to appear').'<sup> *</sup></p>
|
||||
</div>
|
||||
</tr>';
|
||||
});
|
||||
</script>
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
<tr>
|
||||
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'categoryBox[]\', this.checked)" /></th>
|
||||
<th>'.$adminProducts->getL('ID').'</th>
|
||||
<th style="width: 600px">'.$adminProducts->getL('Name').'</th>
|
||||
</tr>';
|
||||
$done = array();
|
||||
$index = array();
|
||||
|
||||
$categoryBox = Tools::getValue('categoryBox');
|
||||
if ($categoryBox != '')
|
||||
{
|
||||
$categoryBox = @unserialize($categoryBox);
|
||||
foreach ($categoryBox AS $k => $row)
|
||||
$index[] = $row;
|
||||
}
|
||||
elseif ((int)Tools::getValue('id_product'))
|
||||
$index = Product::getProductCategories((int)Tools::getValue('id_product'));
|
||||
$adminProducts->recurseCategoryForInclude((int)(Tools::getValue('id_product')), $index, $categories, $categories[0][1], 1, (int)(Tools::getValue('id_category_default')));
|
||||
echo ' </table>
|
||||
<p style="padding:0px; margin:0px 0px 10px 0px;">'.$adminProducts->getL('Mark all checkbox(es) of categories in which product is to appear').'<sup> *</sup></p>
|
||||
</div>
|
||||
</tr>';
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('PS_ADMIN_DIR', getcwd());
|
||||
include(PS_ADMIN_DIR.'/../config/config.inc.php');
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
/* Getting cookie or logout */
|
||||
require_once(dirname(__FILE__).'/init.php');
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('PS_ADMIN_DIR', getcwd());
|
||||
include(PS_ADMIN_DIR.'/../config/config.inc.php');
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
/* Getting cookie or logout */
|
||||
require_once(dirname(__FILE__).'/init.php');
|
||||
|
||||
@@ -53,13 +53,13 @@ else
|
||||
// Excluding downloadable products from packs because download from pack is not supported
|
||||
$excludeVirtuals = (bool)Tools::getValue('excludeVirtuals', false);
|
||||
|
||||
$items = Db::getInstance()->ExecuteS('
|
||||
SELECT p.`id_product`, `reference`, pl.name
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product)
|
||||
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\') AND pl.id_lang = '.(int)($cookie->id_lang).
|
||||
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
||||
($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : ''));
|
||||
$sql = 'SELECT p.`id_product`, `reference`, pl.name
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)Context::getContext()->language->id.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
|
||||
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
||||
($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '');
|
||||
$items = Db::getInstance()->executeS($sql);
|
||||
|
||||
if ($items)
|
||||
foreach ($items AS $item)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
include_once(dirname(__FILE__).'/../config/config.inc.php');
|
||||
|
||||
/* Getting cookie or logout */
|
||||
@@ -43,5 +43,5 @@ $smtpPort = $_GET['smtpPort'];
|
||||
$smtpEncryption = $_GET['smtpEnc'];
|
||||
|
||||
$result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), Tools::htmlentitiesUTF8($smtpPassword), Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption));
|
||||
die($result ? 'ok' : 'fail');
|
||||
die($result === true ? 'ok' : $result);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
?>
|
||||
|
||||
@@ -8,13 +8,16 @@
|
||||
*/
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
@ob_start();
|
||||
displayArray($_POST);
|
||||
writeInfo(@ob_get_clean());
|
||||
$safe_post = array();
|
||||
foreach ($_POST AS $key => $value)
|
||||
$safe_post[Tools::safeOutput($key)] = Tools::safeOutput($value);
|
||||
displayArray($safe_post);
|
||||
writeInfo(@ob_get_clean());
|
||||
echo "{";
|
||||
$error = "";
|
||||
$info = "";
|
||||
$info = "";
|
||||
/* $_POST['new_folder'] = substr(md5(time()), 1, 5);
|
||||
$_POST['currentFolderPath'] = "../../uploaded/";*/
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_NEWFOLDER)
|
||||
@@ -44,12 +47,12 @@
|
||||
$manager = new manager(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], false);
|
||||
$pathInfo = $manager->getFolderInfo(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder']);
|
||||
foreach($pathInfo as $k=>$v)
|
||||
{
|
||||
{
|
||||
switch ($k)
|
||||
{
|
||||
|
||||
|
||||
case "ctime";
|
||||
case "ctime";
|
||||
case "mtime":
|
||||
case "atime":
|
||||
$v = date(DATE_TIME_FORMAT, $v);
|
||||
@@ -60,10 +63,10 @@
|
||||
case 'cssClass':
|
||||
$v = 'folderEmpty';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$info .= sprintf(", %s:'%s'", $k, $v);
|
||||
}
|
||||
}else
|
||||
}else
|
||||
{
|
||||
$error = ERR_FOLDER_CREATION_FAILED;
|
||||
}
|
||||
@@ -72,4 +75,4 @@
|
||||
echo "error:'" . $error . "'";
|
||||
echo $info;
|
||||
echo "}";
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?
|
||||
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
$error = '';
|
||||
$fileMoved = array();
|
||||
$unmovedDocDueToSamePath = array();
|
||||
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
$error = '';
|
||||
$fileMoved = array();
|
||||
$unmovedDocDueToSamePath = array();
|
||||
if(CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY))
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
@@ -104,7 +105,7 @@
|
||||
<fieldset id="modes">
|
||||
<legend>Modes</legend>
|
||||
<form name="formAction" id="formAction" method="post" action="<?php echo appendQueryString(CONFIG_URL_IMAGE_UNDO, makeQueryString(array('path'))); ?>">
|
||||
<input type="hidden" name="file_path" id="file_path" value="<?php echo $_GET['path']; ?>" />
|
||||
<input type="hidden" name="file_path" id="file_path" value="<?php echo Tools::safeOutput($_GET['path']); ?>" />
|
||||
|
||||
<p><label><?php echo IMG_MODE_RESIZE; ?></label> <input type="radio" name="mode" value="resize" class="input" checked="checked" onclick="return changeMode();"/>
|
||||
<label><?php echo IMG_MODE_CROP; ?></label> <input type="radio" name="mode" value="crop" class="input" onclick="return changeMode();" />
|
||||
@@ -130,7 +131,7 @@
|
||||
<p><input type="hidden" name="mode" id="image_mode" value="" />
|
||||
<input type="hidden" name="new_name" id="hidden_new_name" value="" />
|
||||
<input type="hidden" name="save_to" id="hidden_save_to" value="" />
|
||||
<input type="hidden" name="path" id="path" value="<?php echo $_GET['path']; ?>" />
|
||||
<input type="hidden" name="path" id="path" value="<?php echo Tools::safeOutput($_GET['path']); ?>" />
|
||||
<input type="hidden" name="flip_angle" id="flip_angle" value="" />
|
||||
<label><?php echo IMG_LBL_WIDTH; ?></label> <input type="text" name="width" id="width" value="" class="input imageInput" />
|
||||
<label><?php echo IMG_LBL_HEIGHT; ?></label> <input type="text" name="height" id="height" value="" class="input imageInput" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
@@ -83,8 +84,8 @@
|
||||
$error = TXT_UNKNOWN_REQUEST;
|
||||
}
|
||||
echo "{";
|
||||
echo "error:'" . $error . "',\n";
|
||||
echo "path:'" . $path . "'";
|
||||
echo "error:'" . Tools::safeOutput($error) . "',\n";
|
||||
echo "path:'" . Tools::safeOutput($path) . "'";
|
||||
echo "}";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
@@ -73,7 +74,7 @@
|
||||
<script type="text/javascript" src="jscripts/ajaxfilemanager.js"></script>-->
|
||||
<script type="text/javascript">
|
||||
var globalSettings = {'upload_init':false};
|
||||
var queryString = '<?php echo makeQueryString(array('path')); ?>';
|
||||
var queryString = '<?php echo Tools::safeOutput(makeQueryString(array('path'))); ?>';
|
||||
var paths = {'root':'<?php echo addTrailingSlash(backslashToSlash(CONFIG_SYS_ROOT_PATH)); ?>', 'root_title':'<?php echo LBL_FOLDER_ROOT; ?>'};
|
||||
var parentFolder = {};
|
||||
var urls = {
|
||||
@@ -89,7 +90,7 @@
|
||||
'text_editor':'<?php echo CONFIG_URL_TEXT_EDITOR; ?>',
|
||||
'image_editor':'<?php echo CONFIG_URL_IMAGE_EDITOR; ?>',
|
||||
'download':'<?php echo CONFIG_URL_DOWNLOAD; ?>',
|
||||
'present':'<?php echo getCurrentUrl(); ?>',
|
||||
'present':'<?php echo Tools::safeOutput(getCurrentUrl()); ?>',
|
||||
'home':'<?php echo CONFIG_URL_HOME; ?>',
|
||||
'view':'<?php echo CONFIG_URL_LIST_LISTING; ?>'
|
||||
};
|
||||
@@ -130,7 +131,7 @@
|
||||
var searchRequired = false;
|
||||
var supporedPreviewExts = '<?php echo CONFIG_VIEWABLE_VALID_EXTS; ?>';
|
||||
var supportedUploadExts = '<?php echo CONFIG_UPLOAD_VALID_EXTS; ?>'
|
||||
var elementId = <?php echo (!empty($_GET['elementId'])?"'" . $_GET['elementId'] . "'":'null'); ?>;
|
||||
var elementId = <?php echo (!empty($_GET['elementId'])?"'" . Tools::safeOutput($_GET['elementId']) . "'":'null'); ?>;
|
||||
var files = {};
|
||||
$(document).ready(
|
||||
function()
|
||||
@@ -463,9 +464,9 @@ $(document).ready(
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo LBL_SEARCH_MTIME; ?></b><br />
|
||||
<input type="text" class="input inputMtime" name="search_mtime_from" id="search_mtime_from" value="<?php echo (!empty($_GET['search_mtime_from'])?$_GET['search_mtime_from']:''); ?>" />
|
||||
<input type="text" class="input inputMtime" name="search_mtime_from" id="search_mtime_from" value="<?php echo (!empty($_GET['search_mtime_from'])?Tools::safeOutput($_GET['search_mtime_from']):''); ?>" />
|
||||
<span class="leftToRightArrow"> </span>
|
||||
<input type="text" class="input inputMtime" name="search_mtime_to" id="search_mtime_to" value="<?php echo (!empty($_GET['search_mtime_to'])?$_GET['search_mtime_to']:''); ?>" />
|
||||
<input type="text" class="input inputMtime" name="search_mtime_to" id="search_mtime_to" value="<?php echo (!empty($_GET['search_mtime_to'])?Tools::safeOutput($_GET['search_mtime_to']):''); ?>" />
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
|
||||
36
admin-dev/ajaxfilemanager/inc/index.php
Normal file
36
admin-dev/ajaxfilemanager/inc/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
admin-dev/ajaxfilemanager/index.php
Normal file
36
admin-dev/ajaxfilemanager/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -31,7 +31,11 @@ eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^
|
||||
//media.js end
|
||||
//ajaxfileupload start
|
||||
jQuery.extend({ createUploadIframe: function(id, uri)
|
||||
{ var frameId = 'jUploadFrame' + id; if(window.ActiveXObject) { var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />'); if(typeof uri== 'boolean'){ io.src = 'javascript:false';}
|
||||
{ var frameId = 'jUploadFrame' + id; if(window.ActiveXObject) {
|
||||
var io = document.createElement('iframe');
|
||||
io.setAttribute('id', frameId);
|
||||
io.setAttribute('name', frameId);
|
||||
if(typeof uri== 'boolean'){ io.src = 'javascript:false';}
|
||||
else if(typeof uri== 'string'){ io.src = uri;}
|
||||
}
|
||||
else { var io = document.createElement('iframe'); io.id = frameId; io.name = frameId;}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
admin-dev/ajaxfilemanager/jscripts/edit_area/index.php
Normal file
36
admin-dev/ajaxfilemanager/jscripts/edit_area/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
admin-dev/ajaxfilemanager/jscripts/edit_area/langs/index.php
Normal file
36
admin-dev/ajaxfilemanager/jscripts/edit_area/langs/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
admin-dev/ajaxfilemanager/jscripts/index.php
Normal file
36
admin-dev/ajaxfilemanager/jscripts/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
admin-dev/ajaxfilemanager/langs/index.php
Normal file
36
admin-dev/ajaxfilemanager/langs/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
admin-dev/ajaxfilemanager/session/index.php
Normal file
36
admin-dev/ajaxfilemanager/session/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
admin-dev/ajaxfilemanager/theme/default/css/index.php
Normal file
36
admin-dev/ajaxfilemanager/theme/default/css/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
admin-dev/ajaxfilemanager/theme/default/images/index.php
Normal file
36
admin-dev/ajaxfilemanager/theme/default/images/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
admin-dev/ajaxfilemanager/theme/default/index.php
Normal file
36
admin-dev/ajaxfilemanager/theme/default/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
admin-dev/ajaxfilemanager/theme/index.php
Normal file
36
admin-dev/ajaxfilemanager/theme/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -25,21 +25,19 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('PS_ADMIN_DIR', getcwd());
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
|
||||
include(PS_ADMIN_DIR.'/../config/config.inc.php');
|
||||
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
|
||||
/* Header can't be included, so cookie must be created here */
|
||||
$cookie = new Cookie('psAdmin');
|
||||
if (!$cookie->id_employee)
|
||||
Tools::redirectAdmin('login.php');
|
||||
if (!Context::getContext()->employee->isLoggedBack())
|
||||
Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminLogin'));
|
||||
|
||||
$tabAccess = Profile::getProfileAccess($cookie->profile, Tab::getIdFromClassName('AdminBackup'));
|
||||
$tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminBackup'));
|
||||
|
||||
if ($tabAccess['view'] !== '1')
|
||||
die (Tools::displayError('You do not have permission to view here'));
|
||||
|
||||
$backupdir = realpath( PS_ADMIN_DIR . '/backups/');
|
||||
$backupdir = realpath(_PS_ADMIN_DIR_ . '/backups/');
|
||||
|
||||
if ($backupdir === false)
|
||||
die (Tools::displayError('Backups directory does not exist.'));
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('PS_ADMIN_DIR', getcwd());
|
||||
|
||||
include(PS_ADMIN_DIR.'/../config/config.inc.php');
|
||||
$cookie = new Cookie('psAdmin');
|
||||
Tools::setCookieLanguage();
|
||||
|
||||
$translations = array(
|
||||
'FR' => array(
|
||||
'Referer is missing' => 'Vous devez indiquer un "referer"',
|
||||
'Confirmation' => 'Confirmation',
|
||||
'Yes' => 'Oui',
|
||||
'No' => 'Non',
|
||||
'close' => 'fermer')
|
||||
);
|
||||
|
||||
if (!Tools::getValue('referer')):
|
||||
echo '<p>'.Tools::historyc_l('Referer is missing', $translations).'</p>';
|
||||
echo '<p><a href="#" onclick="tb_remove()">'.Tools::historyc_l('close', $translations).'</a></p>';
|
||||
else:
|
||||
$referer = Tools::htmlentitiesUTF8(rawurldecode(Tools::getValue('referer')));?>
|
||||
|
||||
|
||||
|
||||
<h2><?php echo Tools::historyc_l('Confirmation', $translations) ?></h2>
|
||||
<p>
|
||||
<a href="#" class="thickbox confirm_yes" title="" onclick="tb_remove(); window.open('<?php echo $referer ?>', '_self')">
|
||||
<?php echo Tools::historyc_l('Yes', $translations) ?>
|
||||
</a>
|
||||
<a href="#" class="confirm_no" onclick="tb_remove()"><?php echo Tools::historyc_l('No', $translations) ?></a>
|
||||
</p>
|
||||
|
||||
<?php endif; //check if referer exists
|
||||
35
admin-dev/cron_currency_rates.php
Normal file
35
admin-dev/cron_currency_rates.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include(dirname(__FILE__).'/../config/config.inc.php');
|
||||
|
||||
if (isset($_GET['secure_key']))
|
||||
{
|
||||
$secureKey = md5(_COOKIE_KEY_.Configuration::get('PS_SHOP_NAME'));
|
||||
if (!empty($secureKey) AND $secureKey === $_GET['secure_key'])
|
||||
Currency::refreshCurrencies();
|
||||
}
|
||||
@@ -25,8 +25,8 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
include_once(dirname(__FILE__).'/../config/config.inc.php');
|
||||
$cookie = new Cookie('psAdmin');
|
||||
|
||||
$module = Tools::getValue('module');
|
||||
$render = Tools::getValue('render');
|
||||
@@ -38,7 +38,7 @@ $height = Tools::getValue('height');
|
||||
$id_employee = Tools::getValue('id_employee');
|
||||
$id_lang = Tools::getValue('id_lang');
|
||||
|
||||
if ($cookie->id_employee != $id_employee)
|
||||
if (Context::getContext()->employee->id != $id_employee)
|
||||
die;
|
||||
|
||||
if (!Tools::file_exists_cache($module_path = dirname(__FILE__).'/../modules/'.$module.'/'.$module.'.php'))
|
||||
|
||||
2
admin-dev/export/.htaccess
Normal file
2
admin-dev/export/.htaccess
Normal file
@@ -0,0 +1,2 @@
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
36
admin-dev/export/index.php
Normal file
36
admin-dev/export/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -27,14 +27,14 @@
|
||||
|
||||
echo ' </div>
|
||||
</div>
|
||||
'.Module::hookExec('backOfficeFooter').'
|
||||
'.Hook::exec('backOfficeFooter').'
|
||||
<div id="footer">
|
||||
<div style="float:left;margin-left:10px;padding-top:6px">
|
||||
<a href="http://www.prestashop.com/" target="_blank" style="font-weight:700;color:#666666">PrestaShop™ '._PS_VERSION_.'</a><br />
|
||||
<span style="font-size:10px">'.translate('Load time:').' '.number_format(microtime(true) - $timerStart, 3, '.', '').'s</span>
|
||||
</div>
|
||||
<div style="float:right;height:40px;margin-right:10px;line-height:38px;vertical-align:middle">';
|
||||
if (strtoupper(Language::getIsoById($cookie->id_lang)) == 'FR') echo '<span style="color: #812143; font-weight: bold;">Questions / Renseignements / Formations :</span> <strong>+33 (0)1.40.18.30.04</strong> de 09h à 18h ';
|
||||
if (strtoupper(Context::getContext()->language->iso_code) == 'FR') echo '<span style="color: #812143; font-weight: bold;">Questions / Renseignements / Formations :</span> <strong>+33 (0)1.40.18.30.04</strong> de 09h à 18h ';
|
||||
|
||||
echo ' | <a href="http://www.prestashop.com/en/contact_us/" target="_blank" class="footer_link">'.translate('Contact').'</a>
|
||||
| <a href="http://forge.prestashop.com" target="_blank" class="footer_link">'.translate('Bug Tracker').'</a>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -25,7 +25,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/../images.inc.php');
|
||||
require_once(dirname(__FILE__).'/../images.inc.php');
|
||||
|
||||
function bindDatepicker($id, $time)
|
||||
{
|
||||
@@ -49,14 +49,20 @@ function bindDatepicker($id, $time)
|
||||
});';
|
||||
}
|
||||
|
||||
// id can be a identifier or an array of identifiers
|
||||
/**
|
||||
* Deprecated since 1.5
|
||||
* Use Controller::addJqueryUi('ui.datepicker') instead
|
||||
*
|
||||
* @param int|array $id id can be a identifier or an array of identifiers
|
||||
* @param unknown_type $time
|
||||
*/
|
||||
function includeDatepicker($id, $time = false)
|
||||
{
|
||||
global $cookie;
|
||||
Tools::displayAsDeprecated();
|
||||
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/jquery-ui-1.8.10.custom.min.js"></script>';
|
||||
$iso = Db::getInstance()->getValue('SELECT iso_code FROM '._DB_PREFIX_.'lang WHERE `id_lang` = '.(int)($cookie->id_lang));
|
||||
$iso = Db::getInstance()->getValue('SELECT iso_code FROM '._DB_PREFIX_.'lang WHERE `id_lang` = '.(int)Context::getContext()->language->id);
|
||||
if ($iso != 'en')
|
||||
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/datepicker/ui/i18n/ui.datepicker-'.$iso.'.js"></script>';
|
||||
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/ui/i18n/jquery.ui.datepicker-'.$iso.'.js"></script>';
|
||||
echo '<script type="text/javascript">';
|
||||
if (is_array($id))
|
||||
foreach ($id as $id2)
|
||||
@@ -76,14 +82,13 @@ function includeDatepicker($id, $time = false)
|
||||
function rewriteSettingsFile($baseUrls = NULL, $theme = NULL, $arrayDB = NULL)
|
||||
{
|
||||
$defines = array();
|
||||
$defines['_PS_DIRECTORY_'] = ($baseUrls AND $baseUrls['_PS_DIRECTORY_']) ? $baseUrls['_PS_DIRECTORY_'] : _PS_DIRECTORY_;
|
||||
$defines['_MEDIA_SERVER_1_'] = ($baseUrls AND isset($baseUrls['_MEDIA_SERVER_1_'])) ? $baseUrls['_MEDIA_SERVER_1_'] : _MEDIA_SERVER_1_;
|
||||
$defines['_MEDIA_SERVER_2_'] = ($baseUrls AND isset($baseUrls['_MEDIA_SERVER_2_'])) ? $baseUrls['_MEDIA_SERVER_2_'] : _MEDIA_SERVER_2_;
|
||||
$defines['_MEDIA_SERVER_3_'] = ($baseUrls AND isset($baseUrls['_MEDIA_SERVER_3_'])) ? $baseUrls['_MEDIA_SERVER_3_'] : _MEDIA_SERVER_3_;
|
||||
$defines['_PS_CACHING_SYSTEM_'] = _PS_CACHING_SYSTEM_;
|
||||
$defines['_PS_CACHE_ENABLED_'] = _PS_CACHE_ENABLED_;
|
||||
$defines['_DB_NAME_'] = (($arrayDB AND isset($arrayDB['_DB_NAME_'])) ? $arrayDB['_DB_NAME_'] : _DB_NAME_);
|
||||
$defines['_MYSQL_ENGINE_'] = _MYSQL_ENGINE_;
|
||||
$defines['_MYSQL_ENGINE_'] = (($arrayDB AND isset($arrayDB['_MYSQL_ENGINE_'])) ? $arrayDB['_MYSQL_ENGINE_'] : _MYSQL_ENGINE_);
|
||||
$defines['_DB_SERVER_'] = (($arrayDB AND isset($arrayDB['_DB_SERVER_'])) ? $arrayDB['_DB_SERVER_'] : _DB_SERVER_);
|
||||
$defines['_DB_USER_'] = (($arrayDB AND isset($arrayDB['_DB_USER_'])) ? $arrayDB['_DB_USER_'] : _DB_USER_);
|
||||
$defines['_DB_PREFIX_'] = (($arrayDB AND isset($arrayDB['_DB_PREFIX_'])) ? $arrayDB['_DB_PREFIX_'] : _DB_PREFIX_);
|
||||
@@ -100,7 +105,7 @@ function rewriteSettingsFile($baseUrls = NULL, $theme = NULL, $arrayDB = NULL)
|
||||
foreach ($defines as $k => $value)
|
||||
$content .= 'define(\''.$k.'\', \''.addslashes($value).'\');'."\n";
|
||||
$content .= "\n?>";
|
||||
if ($fd = @fopen(PS_ADMIN_DIR.'/../config/settings.inc.php', 'w'))
|
||||
if ($fd = @fopen(_PS_ADMIN_DIR_.'/../config/settings.inc.php', 'w'))
|
||||
{
|
||||
fwrite($fd, $content);
|
||||
fclose($fd);
|
||||
@@ -132,53 +137,55 @@ function displayDate($sqlDate, $withTime = false)
|
||||
*/
|
||||
function getPath($urlBase, $id_category, $path = '', $highlight = '', $categoryType = 'catalog', $home = false)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
if ($categoryType == 'catalog')
|
||||
{
|
||||
{
|
||||
$category = Db::getInstance()->getRow('
|
||||
SELECT id_category, level_depth, nleft, nright
|
||||
FROM '._DB_PREFIX_.'category
|
||||
WHERE id_category = '.(int)$id_category);
|
||||
if (isset($category['id_category']))
|
||||
{
|
||||
$categories = Db::getInstance()->ExecuteS('
|
||||
SELECT c.id_category, cl.name, cl.link_rewrite
|
||||
FROM '._DB_PREFIX_.'category c
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category)
|
||||
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)$cookie->id_lang.($home ? ' AND c.id_category='.$id_category : '').'
|
||||
GROUP BY c.id_category
|
||||
ORDER BY c.level_depth ASC
|
||||
LIMIT '.(!$home ? (int)($category['level_depth'] + 1) : 1));
|
||||
$sql = 'SELECT c.id_category, cl.name, cl.link_rewrite
|
||||
FROM '._DB_PREFIX_.'category c
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$context->shop->addSqlRestrictionOnLang('cl').')
|
||||
WHERE c.nleft <= '.(int)$category['nleft'].'
|
||||
AND c.nright >= '.(int)$category['nright'].'
|
||||
AND cl.id_lang = '.(int)$context->language->id.
|
||||
($home ? ' AND c.id_category='.$id_category : '').'
|
||||
GROUP BY c.id_category
|
||||
ORDER BY c.level_depth ASC
|
||||
LIMIT '.(!$home ? (int)($category['level_depth'] + 1) : 1);
|
||||
$categories = Db::getInstance()->executeS($sql);
|
||||
$fullPath = '';
|
||||
$n = 1;
|
||||
$nCategories = (int)sizeof($categories);
|
||||
foreach ($categories AS $category)
|
||||
{
|
||||
$edit = '<a href="'.$urlBase.'&id_category='.(int)$category['id_category'].'&'.(($category['id_category'] == 1 || $home) ? 'viewcategory' : 'addcategory').'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" title="'.($category['id_category'] == 1 ? 'Home' : 'Modify').'"><img src="../img/admin/'.(($category['id_category'] == 1 || $home) ? 'home' : 'edit').'.gif" alt="" /></a> ';
|
||||
$edit = '<a href="'.$urlBase.'&id_category='.(int)$category['id_category'].'&'.(($category['id_category'] == 1 || $home) ? 'viewcategory' : 'addcategory').'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" title="'.($category['id_category'] == 1 ? 'Home' : 'Modify').'"><img src="../img/admin/'.(($category['id_category'] == 1 || $home) ? 'home' : 'edit').'.gif" alt="" /></a> ';
|
||||
$fullPath .= $edit.
|
||||
($n < $nCategories ? '<a href="'.$urlBase.'&id_category='.(int)$category['id_category'].'&viewcategory&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" title="'.htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8').'">' : '').
|
||||
($n < $nCategories ? '<a href="'.$urlBase.'&id_category='.(int)$category['id_category'].'&viewcategory&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" title="'.htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8').'">' : '').
|
||||
(!empty($highlight) ? str_ireplace($highlight, '<span class="highlight">'.htmlentities($highlight, ENT_NOQUOTES, 'UTF-8').'</span>', $category['name']) : $category['name']).
|
||||
($n < $nCategories ? '</a>' : '').
|
||||
(($n++ != $nCategories OR !empty($path)) ? ' > ' : '');
|
||||
}
|
||||
|
||||
|
||||
return $fullPath.$path;
|
||||
}
|
||||
}
|
||||
elseif ($categoryType == 'cms')
|
||||
{
|
||||
$category = new CMSCategory($id_category, (int)($cookie->id_lang));
|
||||
$category = new CMSCategory($id_category, $context->language->id);
|
||||
if (!$category->id)
|
||||
return $path;
|
||||
|
||||
$name = ($highlight != NULL) ? str_ireplace($highlight, '<span class="highlight">'.$highlight.'</span>', CMSCategory::hideCMSCategoryPosition($category->name)) : CMSCategory::hideCMSCategoryPosition($category->name);
|
||||
$edit = '<a href="'.$urlBase.'&id_cms_category='.$category->id.'&addcategory&token=' . Tools::getAdminToken('AdminCMSContent'.(int)(Tab::getIdFromClassName('AdminCMSContent')).(int)($cookie->id_employee)).'">
|
||||
$edit = '<a href="'.$urlBase.'&id_cms_category='.$category->id.'&addcategory&token=' . Tools::getAdminToken('AdminCmsContent'.(int)(Tab::getIdFromClassName('AdminCmsContent')).(int)$context->employee->id).'">
|
||||
<img src="../img/admin/edit.gif" alt="Modify" /></a> ';
|
||||
if ($category->id == 1)
|
||||
$edit = '<a href="'.$urlBase.'&id_cms_category='.$category->id.'&viewcategory&token=' . Tools::getAdminToken('AdminCMSContent'.(int)(Tab::getIdFromClassName('AdminCMSContent')).(int)($cookie->id_employee)).'">
|
||||
$edit = '<a href="'.$urlBase.'&id_cms_category='.$category->id.'&viewcategory&token=' . Tools::getAdminToken('AdminCmsContent'.(int)(Tab::getIdFromClassName('AdminCmsContent')).(int)$context->employee->id).'">
|
||||
<img src="../img/admin/home.gif" alt="Home" /></a> ';
|
||||
$path = $edit.'<a href="'.$urlBase.'&id_cms_category='.$category->id.'&viewcategory&token=' . Tools::getAdminToken('AdminCMSContent'.(int)(Tab::getIdFromClassName('AdminCMSContent')).(int)($cookie->id_employee)).'">
|
||||
$path = $edit.'<a href="'.$urlBase.'&id_cms_category='.$category->id.'&viewcategory&token=' . Tools::getAdminToken('AdminCmsContent'.(int)(Tab::getIdFromClassName('AdminCmsContent')).(int)$context->employee->id).'">
|
||||
'.$name.'</a> > '.$path;
|
||||
if ($category->id == 1)
|
||||
return substr($path, 0, strlen($path) - 3);
|
||||
@@ -209,10 +216,9 @@ function createDir($path, $rights)
|
||||
|
||||
function checkPSVersion()
|
||||
{
|
||||
libxml_set_streams_context(stream_context_create(array('http' => array('timeout' => 3))));
|
||||
if ($feed = @simplexml_load_file('http://www.prestashop.com/xml/version.xml') AND _PS_VERSION_ < $feed->version->num)
|
||||
return array('name' => $feed->version->name, 'link' => $feed->download->link);
|
||||
return false;
|
||||
$upgrader = new Upgrader();
|
||||
|
||||
return $upgrader->checkPSVersion();
|
||||
}
|
||||
|
||||
function translate($string)
|
||||
@@ -225,59 +231,54 @@ function translate($string)
|
||||
return str_replace('"', '"', stripslashes($str));
|
||||
}
|
||||
|
||||
function recursiveTab($id_tab)
|
||||
{
|
||||
global $cookie, $tabs;
|
||||
|
||||
$adminTab = Tab::getTab((int)$cookie->id_lang, $id_tab);
|
||||
$tabs[]= $adminTab;
|
||||
if ($adminTab['id_parent'] > 0)
|
||||
recursiveTab($adminTab['id_parent']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new Tab object
|
||||
*
|
||||
* @param string $tab class name
|
||||
* @return mixed(AdminTab, bool) tab object or false if failed
|
||||
*/
|
||||
function checkingTab($tab)
|
||||
{
|
||||
global $adminObj, $cookie;
|
||||
|
||||
$tab = trim($tab);
|
||||
|
||||
$tab_lowercase = strtolower($tab);
|
||||
if (!Validate::isTabName($tab))
|
||||
return false;
|
||||
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT id_tab, module FROM `'._DB_PREFIX_.'tab` WHERE class_name = \''.pSQL($tab).'\'');
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT id_tab, module, class_name FROM `'._DB_PREFIX_.'tab` WHERE class_name = \''.pSQL($tab).'\'');
|
||||
if (!$row['id_tab'])
|
||||
{
|
||||
if (isset(AdminTab::$tabParenting[$tab]))
|
||||
Tools::redirectAdmin('?tab='.AdminTab::$tabParenting[$tab].'&token='.Tools::getAdminTokenLite(AdminTab::$tabParenting[$tab]));
|
||||
echo Tools::displayError('Tab cannot be found.');
|
||||
echo sprintf(Tools::displayError('Tab %s cannot be found.'),$tab);
|
||||
return false;
|
||||
}
|
||||
if ($row['module'] AND file_exists(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php'))
|
||||
include_once(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php');
|
||||
elseif (file_exists(PS_ADMIN_DIR.'/tabs/'.$tab.'.php'))
|
||||
include_once(PS_ADMIN_DIR.'/tabs/'.$tab.'.php');
|
||||
|
||||
// Class file is included in Dispatcher::dispatch() function
|
||||
if (!class_exists($tab, false) OR !$row['id_tab'])
|
||||
{
|
||||
echo Tools::displayError('Tab file cannot be found.');
|
||||
echo sprintf(Tools::displayError('Tab file %s cannot be found.'),$tab);
|
||||
return false;
|
||||
}
|
||||
$adminObj = new $tab;
|
||||
if (!$adminObj->viewAccess() AND ($adminObj->table != 'employee' OR $cookie->id_employee != Tools::getValue('id_employee') OR !Tools::isSubmit('updateemployee')))
|
||||
if (!$adminObj->viewAccess() AND ($adminObj->table != 'employee' OR Context::getContext()->employee->id != Tools::getValue('id_employee') OR !Tools::isSubmit('updateemployee')))
|
||||
{
|
||||
$adminObj->_errors = array(Tools::displayError('Access denied'));
|
||||
echo $adminObj->displayErrors();
|
||||
return false;
|
||||
}
|
||||
return $row['id_tab'];
|
||||
return $adminObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @TODO deprecate for Tab::checkTabRights()
|
||||
*/
|
||||
function checkTabRights($id_tab)
|
||||
{
|
||||
global $cookie;
|
||||
static $tabAccesses = NULL;
|
||||
|
||||
|
||||
if ($tabAccesses === NULL)
|
||||
$tabAccesses = Profile::getProfileAccesses($cookie->profile);
|
||||
$tabAccesses = Profile::getProfileAccesses(Context::getContext()->employee->id_profile);
|
||||
|
||||
if (isset($tabAccesses[(int)($id_tab)]['view']))
|
||||
return ($tabAccesses[(int)($id_tab)]['view'] === '1');
|
||||
@@ -387,3 +388,230 @@ function simpleXMLToArray ($xml, $flattenValues = true, $flattenAttributes = tru
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a sweet HTML list for shop selection
|
||||
*
|
||||
* @todo move in adminTab
|
||||
* @return string
|
||||
*/
|
||||
function generateShopList()
|
||||
{
|
||||
$tree = Shop::getTree();
|
||||
$context = Context::getContext();
|
||||
|
||||
// Get default value
|
||||
list($shopID, $shopGroupID) = Shop::getContext();
|
||||
if ($shopID)
|
||||
$value = 's-'.$shopID;
|
||||
else if ($shopGroupID)
|
||||
$value = 'g-'.$shopGroupID;
|
||||
else
|
||||
$value = '';
|
||||
|
||||
// Generate HTML
|
||||
$url = $_SERVER['REQUEST_URI'].(($_SERVER['QUERY_STRING']) ? '&' : '?').'setShopContext=';
|
||||
$html = '<select class="shopList" onchange="location.href = \''.$url.'\'+$(this).val();">';
|
||||
|
||||
if ($context->employee->id_profile == _PS_ADMIN_PROFILE_ ||
|
||||
$context->shop->getTotalShopsWhoExists() == Employee::getTotalEmployeeShopById($context->employee->id))
|
||||
$html .= '<option value="" class="first">'.translate('All shops').'</option>';
|
||||
/*$html .= (Context::getContext()->employee->id_profile == _PS_ADMIN_PROFILE_) ? '<option value="" class="first">'.translate('All shops').'</option>' : '';*/
|
||||
foreach ($tree as $gID => $group_data)
|
||||
{
|
||||
$disabled = ($group_data['totalShops'] != count($group_data['shops'])) ? 'disabled="disabled"' : '';
|
||||
$html .= '<option class="group" value="g-'.$gID.'" '.(($value == 'g-'.$gID) ? 'selected="selected"' : '').' '.$disabled.'>'.htmlspecialchars($group_data['name']).'</option>';
|
||||
foreach ($group_data['shops'] as $sID => $shopData)
|
||||
if ($shopData['active'])
|
||||
$html .= '<option value="s-'.$sID.'" class="shop" '.(($value == 's-'.$sID || $context->shop->id == $sID) ? 'selected="selected"' : '').'>» '.$shopData['name'].'</option>';
|
||||
}
|
||||
$html .= '</select>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* for retrocompatibility with old AdminTab, old index.php
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function runAdminTab($tab, $ajaxMode = false)
|
||||
{
|
||||
$ajaxMode = (bool)$ajaxMode;
|
||||
|
||||
require_once(_PS_ADMIN_DIR_.'/init.php');
|
||||
$cookie = Context::getContext()->cookie;
|
||||
if (empty($tab) and !sizeof($_POST))
|
||||
{
|
||||
$tab = 'AdminHome';
|
||||
$_POST['tab'] = 'AdminHome';
|
||||
$_POST['token'] = Tools::getAdminTokenLite($tab);
|
||||
}
|
||||
// $tab = $_REQUEST['tab'];
|
||||
if ($adminObj = checkingTab($tab))
|
||||
{
|
||||
$noTabLink = $adminObj->noTabLink;
|
||||
// init is different for new tabs (AdminController) and old tabs (AdminTab)
|
||||
if ($adminObj instanceof AdminController)
|
||||
{
|
||||
if($ajaxMode)
|
||||
$adminObj->ajax = true;
|
||||
$adminObj->path = dirname($_SERVER["PHP_SELF"]);
|
||||
$adminObj->run();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$ajaxMode)
|
||||
require_once(_PS_ADMIN_DIR_.'/header.inc.php');
|
||||
$isoUser = Context::getContext()->language->id;
|
||||
$tabs = array();
|
||||
$tabs = Tab::recursiveTab($adminObj->id, $tabs);
|
||||
$tabs = array_reverse($tabs);
|
||||
$bread = '';
|
||||
foreach ($tabs AS $key => $item)
|
||||
{
|
||||
$bread .= ' <img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" alt=">" />';
|
||||
if (count($tabs) - 1 > $key)
|
||||
$bread .= '<a href="?tab='.$item['class_name'].'&token='.Tools::getAdminToken($item['class_name'].intval($item['id_tab']).(int)Context::getContext()->employee->id).'">';
|
||||
|
||||
$bread .= $item['name'];
|
||||
if (count($tabs) - 1 > $key)
|
||||
$bread .= '</a>';
|
||||
}
|
||||
|
||||
// @TODO : a way to desactivate this feature
|
||||
if (!$ajaxMode)
|
||||
echo'<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
$.ajax({
|
||||
type: \'POST\',
|
||||
url: \'ajax.php\',
|
||||
data: \'helpAccess=1&item='.$item['class_name'].'&isoUser='.$isoUser.'&country='.Context::getContext()->country->iso_code.'&version='._PS_VERSION_.'\',
|
||||
async : true,
|
||||
success: function(msg) {
|
||||
$("#help-button").html(msg);
|
||||
$("#help-button").fadeIn("slow");
|
||||
}
|
||||
});
|
||||
});</script>';
|
||||
|
||||
if (!$ajaxMode)
|
||||
echo '<div class="path_bar">
|
||||
<div id="help-button" class="floatr" style="display: none; font-family: Verdana; font-size: 10px; margin-right: 4px; margin-top: 4px;">
|
||||
</div>
|
||||
<a href="?token='.Tools::getAdminToken($tab.intval(Tab::getIdFromClassName($tab)).(int)Context::getContext()->employee->id).'">'.translate('Back Office').'</a>
|
||||
'.$bread.'</div>';
|
||||
|
||||
if (!$ajaxMode && Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL)
|
||||
{
|
||||
echo '<div class="multishop_info">';
|
||||
if (Context::shop() == Shop::CONTEXT_GROUP)
|
||||
printf(translate('You are configuring your store for group shop %s'), '<b>'.Context::getContext()->shop->getGroup()->name.'</b>');
|
||||
elseif (Context::shop() == Shop::CONTEXT_SHOP)
|
||||
printf(translate('You are configuring your store for shop %s'), '<b>'.Context::getContext()->shop->name.'</b>');
|
||||
echo '</div>';
|
||||
}
|
||||
if (Validate::isLoadedObject($adminObj))
|
||||
{
|
||||
if ($adminObj->checkToken())
|
||||
{
|
||||
if($ajaxMode)
|
||||
{
|
||||
// the differences with index.php is here
|
||||
$adminObj->ajaxPreProcess();
|
||||
$action = Tools::getValue('action');
|
||||
// no need to use displayConf() here
|
||||
|
||||
if (!empty($action) AND method_exists($adminObj, 'ajaxProcess'.Tools::toCamelCase($action)) )
|
||||
$adminObj->{'ajaxProcess'.Tools::toCamelCase($action)}();
|
||||
else
|
||||
$adminObj->ajaxProcess();
|
||||
|
||||
// @TODO We should use a displayAjaxError
|
||||
$adminObj->displayErrors();
|
||||
if (!empty($action) AND method_exists($adminObj, 'displayAjax'.Tools::toCamelCase($action)) )
|
||||
$adminObj->{'displayAjax'.$action}();
|
||||
else
|
||||
$adminObj->displayAjax();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Filter memorization */
|
||||
if (isset($_POST) AND !empty($_POST) AND isset($adminObj->table))
|
||||
foreach ($_POST AS $key => $value)
|
||||
if (is_array($adminObj->table))
|
||||
{
|
||||
foreach ($adminObj->table AS $table)
|
||||
if (strncmp($key, $table.'Filter_', 7) === 0 OR strncmp($key, 'submitFilter', 12) === 0)
|
||||
$cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
}
|
||||
elseif (strncmp($key, $adminObj->table.'Filter_', 7) === 0 OR strncmp($key, 'submitFilter', 12) === 0)
|
||||
$cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
|
||||
if (isset($_GET) AND !empty($_GET) AND isset($adminObj->table))
|
||||
foreach ($_GET AS $key => $value)
|
||||
if (is_array($adminObj->table))
|
||||
{
|
||||
foreach ($adminObj->table AS $table)
|
||||
if (strncmp($key, $table.'OrderBy', 7) === 0 OR strncmp($key, $table.'Orderway', 8) === 0)
|
||||
$cookie->$key = $value;
|
||||
}
|
||||
elseif (strncmp($key, $adminObj->table.'OrderBy', 7) === 0 OR strncmp($key, $adminObj->table.'Orderway', 12) === 0)
|
||||
$cookie->$key = $value;
|
||||
$adminObj->displayConf();
|
||||
$adminObj->postProcess();
|
||||
$adminObj->displayErrors();
|
||||
$adminObj->display();
|
||||
include(_PS_ADMIN_DIR_.'/footer.inc.php');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($ajaxMode)
|
||||
{
|
||||
// If this is an XSS attempt, then we should only display a simple, secure page
|
||||
ob_clean();
|
||||
|
||||
// ${1} in the replacement string of the regexp is required, because the token may begin with a number and mix up with it (e.g. $17)
|
||||
$url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}'.$adminObj->token.'$2', $_SERVER['REQUEST_URI']);
|
||||
if (false === strpos($url, '?token=') AND false === strpos($url, '&token='))
|
||||
$url .= '&token='.$adminObj->token;
|
||||
|
||||
|
||||
// we can display the correct url
|
||||
// die(Tools::jsonEncode(array(translate('Invalid security token'),$url)));
|
||||
die(Tools::jsonEncode(translate('Invalid security token')));
|
||||
}
|
||||
else
|
||||
{
|
||||
// If this is an XSS attempt, then we should only display a simple, secure page
|
||||
ob_clean();
|
||||
|
||||
// ${1} in the replacement string of the regexp is required, because the token may begin with a number and mix up with it (e.g. $17)
|
||||
$url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}'.$adminObj->token.'$2', $_SERVER['REQUEST_URI']);
|
||||
if (false === strpos($url, '?token=') AND false === strpos($url, '&token='))
|
||||
$url .= '&token='.$adminObj->token;
|
||||
|
||||
$message = translate('Invalid security token');
|
||||
echo '<html><head><title>'.$message.'</title></head><body style="font-family:Arial,Verdana,Helvetica,sans-serif;background-color:#EC8686">
|
||||
<div style="background-color:#FAE2E3;border:1px solid #000000;color:#383838;font-weight:700;line-height:20px;margin:0 0 10px;padding:10px 15px;width:500px">
|
||||
<img src="../img/admin/error2.png" style="margin:-4px 5px 0 0;vertical-align:middle">
|
||||
'.$message.'
|
||||
</div>';
|
||||
echo '<a href="'.htmlentities($url).'" method="get" style="float:left;margin:10px">
|
||||
<input type="button" value="'.Tools::htmlentitiesUTF8(translate('I understand the risks and I really want to display this page')).'" style="height:30px;margin-top:5px" />
|
||||
</a>
|
||||
<a href="index.php" method="get" style="float:left;margin:10px">
|
||||
<input type="button" value="'.Tools::htmlentitiesUTF8(translate('Take me out of here!')).'" style="height:40px" />
|
||||
</a>
|
||||
</body></html>';
|
||||
die;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -25,7 +25,6 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('PS_ADMIN_DIR', getcwd());
|
||||
|
||||
include(PS_ADMIN_DIR.'/../get-file.php');
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require(dirname(dirname(__FILE__)).'/config/config.inc.php');
|
||||
Controller::getController('GetFileController')->run();
|
||||
@@ -25,8 +25,8 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
include_once(dirname(__FILE__).'/../config/config.inc.php');
|
||||
$cookie = new Cookie('psAdmin');
|
||||
|
||||
$module = Tools::getValue('module');
|
||||
$render = Tools::getValue('render');
|
||||
@@ -41,7 +41,7 @@ $dir = Tools::getValue('dir', 0); // Should be a String : Either ASC or DESC
|
||||
$id_employee = (int)(Tools::getValue('id_employee'));
|
||||
$id_lang = (int)(Tools::getValue('id_lang'));
|
||||
|
||||
if ($cookie->id_employee != $id_employee)
|
||||
if (Context::getContext()->employee->id != $id_employee)
|
||||
die;
|
||||
|
||||
if (!Validate::isModuleName($module))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -31,52 +31,205 @@ header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-ch
|
||||
header('Pragma: no-cache');
|
||||
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
|
||||
|
||||
require_once(dirname(__FILE__).'/init.php');
|
||||
|
||||
echo '
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$iso.'" lang="'.$iso.'">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="robots" content="NOFOLLOW, NOINDEX" />
|
||||
<link type="text/css" rel="stylesheet" href="'._PS_JS_DIR_.'jquery/datepicker/datepicker.css" />
|
||||
<link type="text/css" rel="stylesheet" href="'._PS_CSS_DIR_.'admin.css" />
|
||||
<link type="text/css" rel="stylesheet" href="'._PS_CSS_DIR_.'jquery.cluetip.css" />
|
||||
<link type="text/css" rel="stylesheet" href="themes/'.$employee->bo_theme.'/admin.css" />
|
||||
<link type="text/css" rel="stylesheet" href="themes/'.Context::getContext()->employee->bo_theme.'/admin.css" />
|
||||
<title>PrestaShop™ - '.translate('Administration panel').'</title>
|
||||
<script type="text/javascript">
|
||||
var helpboxes = '.Configuration::get('PS_HELPBOX').';
|
||||
var roundMode = '.Configuration::get('PS_PRICE_ROUND_MODE').';
|
||||
</script>
|
||||
<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/jquery-1.4.4.min.js"></script>
|
||||
<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/jquery.hoverIntent.minified.js"></script>
|
||||
<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/jquery.cluetip.js"></script>
|
||||
<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/plugins/jquery.hoverIntent.js"></script>
|
||||
<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/plugins/cluetip/jquery.cluetip.js"></script>
|
||||
<script type="text/javascript" src="'._PS_JS_DIR_.'admin.js"></script>
|
||||
<script type="text/javascript" src="'._PS_JS_DIR_.'toggle.js"></script>
|
||||
<script type="text/javascript" src="'._PS_JS_DIR_.'tools.js"></script>
|
||||
<script type="text/javascript" src="'._PS_JS_DIR_.'ajax.js"></script>
|
||||
<link rel="shortcut icon" href="'._PS_IMG_.'favicon.ico" />
|
||||
'.Module::hookExec('backOfficeHeader').'
|
||||
'.Hook::exec('backOfficeHeader').'
|
||||
<!--[if IE]>
|
||||
<link type="text/css" rel="stylesheet" href="'._PS_CSS_DIR_.'admin-ie.css" />
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
div#header_infos, div#header_infos a#header_shopname, div#header_infos a#header_logout, div#header_infos a#header_foaccess {
|
||||
color:'.(Tools::getBrightness(empty($employee->bo_color) ? '#FFFFFF' : $employee->bo_color) < 128 ? 'white' : '#383838').'
|
||||
color:'.(Tools::getBrightness(empty(Context::getContext()->employee->bo_color) ? '#FFFFFF' : Context::getContext()->employee->bo_color) < 128 ? 'white' : '#383838').'
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function getPush()
|
||||
{
|
||||
$.post("ajax.php",{"getNotifications" : "1"}, function(data) {
|
||||
if (data)
|
||||
{
|
||||
json = jQuery.parseJSON(data);
|
||||
|
||||
// Add orders notifications to the list
|
||||
html = "";
|
||||
nb_notifs = 0;
|
||||
$.each(json.order, function(property, value) {
|
||||
html += "<li>'.translate('A new order has been made on your shop.').'<br />'.translate('Order number : ').'<strong>#" + parseInt(value.id_order) + "</strong><br />'.translate('Total : ').'<strong>" + value.total_paid_real + "</strong><br />'.translate('From : ').'<strong>" + value.customer_name + "</strong><br /><a href=\"index.php?controller=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'&vieworder&id_order=" + parseInt(value.id_order) + "\">'.translate('Click here to see that order').'</a></li>";
|
||||
});
|
||||
if (html != "")
|
||||
{
|
||||
$("#list_orders_notif").prev("p").hide();
|
||||
$("#list_orders_notif").empty().append(html);
|
||||
nb_notifs = $("#list_orders_notif li").length;
|
||||
$("#orders_notif_value").text(nb_notifs);
|
||||
$("#orders_notif_number_wrapper").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#orders_notif_number_wrapper").hide();
|
||||
}
|
||||
|
||||
// Add customers notifications to the list
|
||||
html = "";
|
||||
nb_notifs = 0;
|
||||
$.each(json.customer, function(property, value) {
|
||||
html += "<li>'.translate('A new customer registered on your shop.').'<br />'.translate('Customer name : ').'<strong>" + value.customer_name + "</strong><br /><a href=\"index.php?controller=AdminCustomers&token='.Tools::getAdminTokenLite('AdminCustomers').'&viewcustomer&id_customer=" + parseInt(value.id_customer) + "\">'.translate('Click here to see that customer').'</a></li>";
|
||||
});
|
||||
if (html != "")
|
||||
{
|
||||
$("#list_customers_notif").prev("p").hide();
|
||||
$("#list_customers_notif").empty().append(html);
|
||||
nb_notifs = $("#list_customers_notif li").length;
|
||||
$("#customers_notif_value").text(nb_notifs);
|
||||
$("#customers_notif_number_wrapper").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#customers_notif_number_wrapper").hide();
|
||||
}
|
||||
|
||||
// Add messages notifications to the list
|
||||
html = "";
|
||||
nb_notifs = 0;
|
||||
$.each(json.message, function(property, value) {
|
||||
html += "<li>'.translate('A new message posted on your shop.').'<br />'.translate('From : ').'<strong>" + value.customer_name + "</strong><br />'.translate('Excerpt : ').'<strong>" + value.message_customer + "</strong><br /><a href=\"index.php?controller=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'&vieworder&id_order=" + parseInt(value.id_order) + "\">'.translate('Click here to see that message').'</a></li>";
|
||||
});
|
||||
if (html != "")
|
||||
{
|
||||
$("#list_messages_notif").prev("p").hide();
|
||||
$("#list_messages_notif").empty().append(html);
|
||||
nb_notifs = $("#list_messages_notif li").length;
|
||||
$("#messages_notif_value").text(nb_notifs);
|
||||
$("#messages_notif_number_wrapper").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#messages_notif_number_wrapper").hide();
|
||||
}
|
||||
|
||||
}
|
||||
setTimeout("getPush()",60000);
|
||||
});
|
||||
}
|
||||
|
||||
$().ready(function()
|
||||
{
|
||||
var hints = $(\'.translatable span.hint\');
|
||||
';
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
if (Context::shop() == Shop::CONTEXT_ALL)
|
||||
$youEditFieldFor = translate('A modification of this field will be applied for all shops');
|
||||
else if (Context::shop() == Shop::CONTEXT_GROUP)
|
||||
$youEditFieldFor = sprintf(translate('A modification of this field will be applied for all shops of group %s'), '<b>'.Context::getContext()->shop->getGroup()->name.'</b>');
|
||||
else
|
||||
$youEditFieldFor = sprintf(translate('A modification of this field will be applied for the shop %s'), '<b>'.Context::getContext()->shop->name.'</b>');
|
||||
echo 'hints.html(hints.html()+\'<br /><span class="red">'.addslashes($youEditFieldFor).'</span>\');';
|
||||
}
|
||||
|
||||
echo ' var html = "";
|
||||
var nb_notifs = 0;
|
||||
var wrapper_id = "";
|
||||
var type = new Array();
|
||||
|
||||
$(".notifs").live("click", function(){
|
||||
wrapper_id = $(this).attr("id");
|
||||
type = wrapper_id.split("s_notif")
|
||||
$.post("ajax.php",{"updateElementEmployee" : "1", "updateElementEmployeeType" : type[0]}, function(data) {
|
||||
if(data)
|
||||
{
|
||||
if(!$("#" + wrapper_id + "_wrapper").is(":visible"))
|
||||
{
|
||||
$(".notifs_wrapper").hide();
|
||||
$("#" + wrapper_id + "_number_wrapper").hide();
|
||||
$("#" + wrapper_id + "_wrapper").show();
|
||||
}else
|
||||
{
|
||||
$("#" + wrapper_id + "_wrapper").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#main").click(function(){
|
||||
$(".notifs_wrapper").hide();
|
||||
});
|
||||
|
||||
getPush();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body '.((!empty($employee->bo_color)) ? 'style="background:'.Tools::htmlentitiesUTF8($employee->bo_color).'"' : '').'>
|
||||
<body '.((!empty(Context::getContext()->employee->bo_color)) ? 'style="background:'.Tools::htmlentitiesUTF8(Context::getContext()->employee->bo_color).'"' : '').'>
|
||||
<div id="top_container">
|
||||
<div id="container">
|
||||
<div id="header_infos"><span>
|
||||
<a id="header_shopname" href="index.php"><span>'.Configuration::get('PS_SHOP_NAME').'</span></a><br />
|
||||
'.Tools::substr($employee->firstname, 0, 1).'. '.htmlentities($employee->lastname, ENT_COMPAT, 'UTF-8').'
|
||||
[ <a href="index.php?logout" id="header_logout"><span>'.translate('logout').'</span></a> ]
|
||||
- <a href="'.__PS_BASE_URI__.'" id="header_foaccess" target="_blank" title="'.translate('View my shop').'"><span>'.translate('View my shop').'</span></a>
|
||||
- <a href="index.php?tab=AdminEmployees&id_employee='.(int)$cookie->id_employee.'&updateemployee&token='.Tools::getAdminTokenLite('AdminEmployees').'" style="font-size: 10px;"><img src="../img/admin/employee.gif" alt="" /> '.translate('My preferences').'</a>
|
||||
</span></div>
|
||||
<div id="header">
|
||||
<div id="header_infos">
|
||||
<a id="header_shopname" href="index.php"><span>'.Configuration::get('PS_SHOP_NAME').'</span></a><div id="notifs_icon_wrapper">';
|
||||
if (Configuration::get('PS_SHOW_NEW_ORDERS') == 1)
|
||||
{
|
||||
echo '<div id="orders_notif" class="notifs"><span id="orders_notif_number_wrapper" class="number_wrapper"><span id="orders_notif_value">0</span></span>
|
||||
<div id="orders_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>'.translate('Last orders').'</h3>
|
||||
<p class="no_notifs">'.translate('No new orders has been made on your shop').'</p>
|
||||
<ul id="list_orders_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'">'.translate('Show all orders').'</a></p>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
if (Configuration::get('PS_SHOW_NEW_CUSTOMERS') == 1)
|
||||
{
|
||||
echo '<div id="customers_notif" class="notifs notifs_alternate"><span id="customers_notif_number_wrapper" class="number_wrapper"><span id="customers_notif_value">0</span></span>
|
||||
<div id="customers_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>'.translate('Last customers').'</h3>
|
||||
<p class="no_notifs">'.translate('No new customers registered on your shop').'</p>
|
||||
<ul id="list_customers_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminCustomers&token='.Tools::getAdminTokenLite('AdminCustomers').'">'.translate('Show all customers').'</a></p>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
if (Configuration::get('PS_SHOW_NEW_MESSAGES') == 1)
|
||||
{
|
||||
echo '<div id="messages_notif" class="notifs"><span id="messages_notif_number_wrapper" class="number_wrapper"><span id="messages_notif_value">0</span></span>
|
||||
<div id="messages_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>'.translate('Last messages').'</h3>
|
||||
<p class="no_notifs">'.translate('No new messages posted on your shop').'</p>
|
||||
<ul id="list_messages_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminMessages&token='.Tools::getAdminTokenLite('AdminMessages').'">'.translate('Show all messages').'</a></p>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
echo '</div><span id="employee_links">
|
||||
<a href="index.php?controller=AdminEmployees&id_employee='.(int)Context::getContext()->employee->id.'&updateemployee&token='.Tools::getAdminTokenLite('AdminEmployees').'" class="employee" alt="">'.translate('My preferences').'</a>
|
||||
<span class="separator"></span>
|
||||
<span class="employee_name">
|
||||
'.Tools::substr(Context::getContext()->employee->firstname, 0, 1).'. '.htmlentities(Context::getContext()->employee->lastname, ENT_COMPAT, 'UTF-8').'
|
||||
</span><span class="separator"></span><a href="index.php?logout" id="header_logout"><span>'.translate('logout').'</span></a><span class="separator"></span>';
|
||||
if (Context::getContext()->shop->getBaseURL())
|
||||
echo '<a href="'.Context::getContext()->shop->getBaseURL().'" id="header_foaccess" target="_blank" title="'.translate('View my shop').'"><span>'.translate('View my shop').'</span></a>';
|
||||
echo '</span>
|
||||
<div id="header_search">
|
||||
<form method="post" action="index.php?tab=AdminSearch&token='.Tools::getAdminTokenLite('AdminSearch').'">
|
||||
<form method="post" action="index.php?controller=AdminSearch&token='.Tools::getAdminTokenLite('AdminSearch').'">
|
||||
<input type="text" name="bo_query" id="bo_query"
|
||||
value="'.Tools::safeOutput(Tools::stripslashes(Tools::getValue('bo_query'))).'"
|
||||
/>
|
||||
@@ -84,6 +237,7 @@ echo '
|
||||
<option value="0">'.translate('everywhere').'</option>
|
||||
<option value="1" '.(Tools::getValue('bo_search_type') == 1 ? 'selected="selected"' : '').'>'.translate('catalog').'</option>
|
||||
<option value="2" '.(Tools::getValue('bo_search_type') == 2 ? 'selected="selected"' : '').'>'.translate('customers').'</option>
|
||||
<option value="6" '.(Tools::getValue('bo_search_type') == 6 ? 'selected="selected"' : '').'>'.translate('ip address').'</option>
|
||||
<option value="3" '.(Tools::getValue('bo_search_type') == 3 ? 'selected="selected"' : '').'>'.translate('orders').'</option>
|
||||
<option value="4" '.(Tools::getValue('bo_search_type') == 4 ? 'selected="selected"' : '').'>'.translate('invoices').'</option>
|
||||
<option value="5" '.(Tools::getValue('bo_search_type') == 5 ? 'selected="selected"' : '').'>'.translate('carts').'</option>
|
||||
@@ -103,75 +257,80 @@ echo '
|
||||
</script>
|
||||
<select onchange="quickSelect(this);" id="quick_select">
|
||||
<option value="0">'.translate('Quick Access').'</option>';
|
||||
foreach (QuickAccess::getQuickAccesses((int)($cookie->id_lang)) AS $quick)
|
||||
foreach (QuickAccess::getQuickAccesses(Context::getContext()->language->id) AS $quick)
|
||||
{
|
||||
preg_match('/tab=(.+)(&.+)?$/', $quick['link'], $adminTab);
|
||||
preg_match('/controller=(.+)(&.+)?$/', $quick['link'], $adminTab);
|
||||
if (isset($adminTab[1]))
|
||||
{
|
||||
if (strpos($adminTab[1], '&'))
|
||||
$adminTab[1] = substr($adminTab[1], 0, strpos($adminTab[1], '&'));
|
||||
$quick['link'] .= '&token='.Tools::getAdminToken($adminTab[1].(int)(Tab::getIdFromClassName($adminTab[1])).(int)($cookie->id_employee));
|
||||
$quick['link'] .= '&token='.Tools::getAdminToken($adminTab[1].(int)(Tab::getIdFromClassName($adminTab[1])).(int)(Context::getContext()->employee->id));
|
||||
}
|
||||
echo '<option value="'.$quick['link'].($quick['new_window'] ? '_blank' : '').'">> '.$quick['name'].'</option>';
|
||||
}
|
||||
echo ' </select>
|
||||
</div>';
|
||||
|
||||
if (Tools::isMultiShopActivated())
|
||||
echo '<div id="header_shoplist">'.Shop::generateHtmlList().'</div>';
|
||||
if (Shop::isFeatureActive())
|
||||
echo '<div id="header_shoplist">'.translate('Select your shop:').' '.generateShopList().'</div>';
|
||||
|
||||
echo '</div>';
|
||||
echo Hook::exec('backOfficeTop');
|
||||
echo '<ul id="menu">';
|
||||
|
||||
echo ' <div class="flatclear"> </div>
|
||||
'.Module::hookExec('backOfficeTop').'
|
||||
<ul id="menu">';
|
||||
if (empty($tab))
|
||||
echo '<div class="mainsubtablist" style="display:none"></div>';
|
||||
// This is made to display the subtab list
|
||||
$id_current_tab = (int)Tab::getIdFromClassName($tab);
|
||||
|
||||
$id_parent_tab_current = (int)(Tab::getCurrentParentId());
|
||||
$tabs = Tab::getTabs((int)$cookie->id_lang, 0);
|
||||
$myCurrentTab = new Tab($id_current_tab);
|
||||
$tabs = Tab::getTabs(Context::getContext()->language->id, 0);
|
||||
$echoLis = '';
|
||||
$mainsubtablist = '';
|
||||
|
||||
foreach ($tabs AS $t)
|
||||
if (checkTabRights($t['id_tab']) === true)
|
||||
{
|
||||
$img = (Tools::file_exists_cache(_PS_ADMIN_DIR_.'/themes/'.$employee->bo_theme.'/img/t/'.$t['class_name'].'.gif') ? 'themes/'.$employee->bo_theme.'/img/' : _PS_IMG_).'t/'.$t['class_name'].'.gif';
|
||||
$img = (Tools::file_exists_cache(_PS_ADMIN_DIR_.'/themes/'.Context::getContext()->employee->bo_theme.'/img/t/'.$t['class_name'].'.gif') ? 'themes/'.Context::getContext()->employee->bo_theme.'/img/' : _PS_IMG_).'t/'.$t['class_name'].'.gif';
|
||||
if (trim($t['module']) != '')
|
||||
$img = _MODULE_DIR_.$t['module'].'/'.$t['class_name'].'.gif';
|
||||
$current = (($t['class_name'] == $tab) OR ($id_parent_tab_current == $t['id_tab']));
|
||||
echo '<li class="submenu_size '.($current ? 'active' : '').'" id="maintab'.$t['id_tab'].'">
|
||||
<a href="index.php?tab='.$t['class_name'].'&token='.Tools::getAdminToken($t['class_name'].(int)($t['id_tab']).(int)($cookie->id_employee)).'">
|
||||
$current = ((strtolower($t['class_name']) == $tab) OR ($myCurrentTab->id_parent == $t['id_tab']));
|
||||
|
||||
echo '<li class="submenu_size '.($current ? 'active' : '').' maintab" id="maintab'.$t['id_tab'].'">
|
||||
<span class="title">
|
||||
<img src="'.$img.'" alt="" /> '.$t['name'].'
|
||||
</a>
|
||||
</li>';
|
||||
$echoLi = '';
|
||||
$subTabs = Tab::getTabs((int)$cookie->id_lang, (int)$t['id_tab']);
|
||||
</span>
|
||||
<ul class="submenu">';
|
||||
$subTabs = Tab::getTabs(Context::getContext()->language->id, (int)$t['id_tab']);
|
||||
|
||||
// @todo need a better way than using noTabLink property, keeping the fact to avoid db modification
|
||||
if (!in_array($t['class_name'], $noTabLink))
|
||||
array_unshift($subTabs, $t);
|
||||
|
||||
foreach ($subTabs AS $t2)
|
||||
if (checkTabRights($t2['id_tab']) === true)
|
||||
$echoLi .= '<li><a href="index.php?tab='.$t2['class_name'].'&token='.Tools::getAdminTokenLite($t2['class_name']).'">'.$t2['name'].'</a></li>';
|
||||
echo '<li><a href="index.php?controller='.$t2['class_name'].'&token='.Tools::getAdminTokenLite($t2['class_name']).'">'.$t2['name'].'</a></li>';
|
||||
|
||||
echo '</ul></li>';
|
||||
$echoLi = '';
|
||||
foreach ($subTabs AS $t2)
|
||||
if (checkTabRights($t2['id_tab']) === true)
|
||||
$echoLi .= '<li class="subitem"><a href="index.php?controller='.$t2['class_name'].'&token='.Tools::getAdminTokenLite($t2['class_name']).'">'.$t2['name'].'</a></li>';
|
||||
|
||||
if ($current)
|
||||
$mainsubtablist = $echoLi;
|
||||
$echoLis .= '<div id="tab'.(int)($t['id_tab']).'_subtabs" style="display:none">'.$echoLi.'</div>';
|
||||
}
|
||||
echo ' </ul>'.$echoLis;
|
||||
if ($employee->bo_uimode == 'hover')
|
||||
echo ' <script type="text/javascript">
|
||||
$("#menu li").hoverIntent({over:hoverTabs,timeout:100,out:outTabs});
|
||||
function outTabs(){}
|
||||
function hoverTabs() {
|
||||
var content = $("#tab"+parseInt(this.id.substr(7, 3))+"_subtabs").html();
|
||||
$("#submenu").html(content);
|
||||
if (content.length == 0)
|
||||
$("#submenu").removeClass("withLeftBorder");
|
||||
else
|
||||
$("#submenu").addClass("withLeftBorder");
|
||||
$("#menu li").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
}
|
||||
</script>';
|
||||
echo ' <ul id="submenu" '.(strlen($mainsubtablist) ? 'class="withLeftBorder"' : '').'>'.$mainsubtablist.'</ul>
|
||||
<div id="main">
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<div id="main">
|
||||
<div id="content">'
|
||||
.(file_exists(PS_ADMIN_DIR.'/../install') ? '<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">'
|
||||
.(file_exists(_PS_ADMIN_DIR_.'/../install') ? '<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">'
|
||||
.translate('For security reasons, you must also:').' '.
|
||||
translate('deleted the /install folder').
|
||||
translate('delete the /install folder').
|
||||
'</div>' : '').'
|
||||
';
|
||||
if(defined('_PS_MODE_DEV_') && _PS_MODE_DEV_)
|
||||
echo '<div class="warn">This tab is an AdminTab</div>';
|
||||
|
||||
@@ -26,135 +26,19 @@
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility
|
||||
require(dirname(__FILE__).'/../config/config.inc.php');
|
||||
require(dirname(__FILE__).'/functions.php');
|
||||
|
||||
include(PS_ADMIN_DIR.'/../config/config.inc.php');
|
||||
include(PS_ADMIN_DIR.'/functions.php');
|
||||
include(PS_ADMIN_DIR.'/header.inc.php');
|
||||
if (empty($tab) and !sizeof($_POST))
|
||||
{
|
||||
$tab = 'AdminHome';
|
||||
$_POST['tab'] = 'AdminHome';
|
||||
$_POST['token'] = Tools::getAdminTokenLite($tab);
|
||||
}
|
||||
|
||||
if ($id_tab = checkingTab($tab))
|
||||
{
|
||||
$isoUser = Language::getIsoById(intval($cookie->id_lang));
|
||||
$tabs = array();
|
||||
recursiveTab($id_tab);
|
||||
$tabs = array_reverse($tabs);
|
||||
$bread = '';
|
||||
|
||||
foreach ($tabs AS $key => $item)
|
||||
$bread .= ' <img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" />
|
||||
'.((sizeof($tabs) - 1 > $key)
|
||||
? '<a href="?tab='.$item['class_name'].'&token='.Tools::getAdminToken($item['class_name'].intval($item['id_tab']).intval($cookie->id_employee)).'">'
|
||||
: '').'
|
||||
'.$item['name'].((sizeof($tabs) - 1 > $key) ? '</a>' : '');
|
||||
|
||||
echo'<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
$.ajax({
|
||||
type: \'POST\',
|
||||
url: \'ajax.php\',
|
||||
data: \'helpAccess=1&item='.$item['class_name'].'&isoUser='.$isoUser.'&country='.Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')).'&version='._PS_VERSION_.'\',
|
||||
async : true,
|
||||
success: function(msg) {
|
||||
$("#help-button").html(msg);
|
||||
$("#help-button").fadeIn("slow");
|
||||
}
|
||||
});
|
||||
});</script>';
|
||||
|
||||
|
||||
echo '<div class="path_bar">
|
||||
<div id="help-button" class="floatr" style="display: none; font-family: Verdana; font-size: 10px; margin-right: 4px; margin-top: 4px;">
|
||||
</div>
|
||||
<a href="?token='.Tools::getAdminToken($tab.intval(Tab::getIdFromClassName($tab)).intval($cookie->id_employee)).'">'.translate('Back Office').'</a>
|
||||
'.$bread;
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
echo '
|
||||
<span style="float:right">'.translate('You are currently view/configure your store for').' <b>';
|
||||
if (Shop::getContextType() == Shop::CONTEXT_ALL)
|
||||
echo 'all shops';
|
||||
elseif (Shop::getContextType() == Shop::CONTEXT_GROUP)
|
||||
{
|
||||
$group_shop = new GroupShop((int)Shop::getCurrentGroupShop());
|
||||
echo 'all shops of group shop <b>'.$group_shop->name.'</b>';
|
||||
}
|
||||
elseif (Shop::getContextType() == Shop::CONTEXT_SHOP)
|
||||
{
|
||||
$shop = new Shop((int)Shop::getCurrentShop());
|
||||
echo 'shop <b>'.$shop->name.'</b>';
|
||||
}
|
||||
echo '</b>
|
||||
</span> ';
|
||||
}
|
||||
echo '
|
||||
</div>';
|
||||
|
||||
if (Validate::isLoadedObject($adminObj))
|
||||
{
|
||||
if ($adminObj->checkToken())
|
||||
{
|
||||
/* Filter memorization */
|
||||
if (isset($_POST) AND !empty($_POST) AND isset($adminObj->table))
|
||||
foreach ($_POST AS $key => $value)
|
||||
if (is_array($adminObj->table))
|
||||
{
|
||||
foreach ($adminObj->table AS $table)
|
||||
if (strncmp($key, $table.'Filter_', 7) === 0 OR strncmp($key, 'submitFilter', 12) === 0)
|
||||
$cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
}
|
||||
elseif (strncmp($key, $adminObj->table.'Filter_', 7) === 0 OR strncmp($key, 'submitFilter', 12) === 0)
|
||||
$cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
|
||||
if (isset($_GET) AND !empty($_GET) AND isset($adminObj->table))
|
||||
foreach ($_GET AS $key => $value)
|
||||
if (is_array($adminObj->table))
|
||||
{
|
||||
foreach ($adminObj->table AS $table)
|
||||
if (strncmp($key, $table.'OrderBy', 7) === 0 OR strncmp($key, $table.'Orderway', 8) === 0)
|
||||
$cookie->$key = $value;
|
||||
}
|
||||
elseif (strncmp($key, $adminObj->table.'OrderBy', 7) === 0 OR strncmp($key, $adminObj->table.'Orderway', 12) === 0)
|
||||
$cookie->$key = $value;
|
||||
|
||||
$adminObj->displayConf();
|
||||
$adminObj->postProcess();
|
||||
$adminObj->displayErrors();
|
||||
$adminObj->display();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If this is an XSS attempt, then we should only display a simple, secure page
|
||||
ob_clean();
|
||||
|
||||
// ${1} in the replacement string of the regexp is required, because the token may begin with a number and mix up with it (e.g. $17)
|
||||
$url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}'.$adminObj->token.'$2', $_SERVER['REQUEST_URI']);
|
||||
if (false === strpos($url, '?token=') AND false === strpos($url, '&token='))
|
||||
$url .= '&token='.$adminObj->token;
|
||||
|
||||
$message = translate('Invalid security token');
|
||||
echo '<html><head><title>'.$message.'</title></head><body style="font-family:Arial,Verdana,Helvetica,sans-serif;background-color:#EC8686">
|
||||
<div style="background-color:#FAE2E3;border:1px solid #000000;color:#383838;font-weight:700;line-height:20px;margin:0 0 10px;padding:10px 15px;width:500px">
|
||||
<img src="../img/admin/error2.png" style="margin:-4px 5px 0 0;vertical-align:middle">
|
||||
'.$message.'
|
||||
</div>';
|
||||
echo '<a href="'.htmlentities($url).'" method="get" style="float:left;margin:10px">
|
||||
<input type="button" value="'.Tools::htmlentitiesUTF8(translate('I understand the risks and I really want to display this page')).'" style="height:30px;margin-top:5px" />
|
||||
</a>
|
||||
<a href="index.php" method="get" style="float:left;margin:10px">
|
||||
<input type="button" value="'.Tools::htmlentitiesUTF8(translate('Take me out of here!')).'" style="height:40px" />
|
||||
</a>
|
||||
</body></html>';
|
||||
die;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include(PS_ADMIN_DIR.'/footer.inc.php');
|
||||
// For retrocompatibility with "tab" parameter
|
||||
if (!isset($_GET['controller']) && isset($_GET['tab']))
|
||||
$_GET['controller'] = strtolower($_GET['tab']);
|
||||
if (!isset($_POST['controller']) && isset($_POST['tab']))
|
||||
$_POST['controller'] = strtolower($_POST['tab']);
|
||||
if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
|
||||
$_REQUEST['controller'] = strtolower($_REQUEST['tab']);
|
||||
|
||||
// Prepare and trigger admin dispatcher
|
||||
Dispatcher::getInstance()->setDefaultController('AdminHome');
|
||||
Dispatcher::getInstance()->setControllerNotFound('AdminNotFound');
|
||||
Dispatcher::getInstance()->setControllerDirectories(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_));
|
||||
Dispatcher::getInstance()->dispatch();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -28,66 +28,72 @@
|
||||
ob_start();
|
||||
$timerStart = microtime(true);
|
||||
|
||||
$currentFileName = array_reverse(explode("/", $_SERVER['SCRIPT_NAME']));
|
||||
$cookie = new Cookie('psAdmin', substr($_SERVER['SCRIPT_NAME'], strlen(__PS_BASE_URI__), -strlen($currentFileName['0'])));
|
||||
// $_GET['tab'] = $_GET['controller'];
|
||||
// $_POST['tab'] = $_POST['controller'];
|
||||
// $_REQUEST['tab'] = $_REQUEST['controller'];
|
||||
|
||||
$context = Context::getContext();
|
||||
if (isset($_GET['logout']))
|
||||
$cookie->logout();
|
||||
$context->employee->logout();
|
||||
|
||||
if (!$cookie->isLoggedBack())
|
||||
if (!isset($context->employee) || !$context->employee->isLoggedBack())
|
||||
Tools::redirectAdmin('index.php?controller=AdminLogin&redirect='.$_SERVER['REQUEST_URI']);
|
||||
|
||||
// Set current index
|
||||
$currentIndex = $_SERVER['SCRIPT_NAME'].(($controller = Tools::getValue('controller')) ? '?controller='.$controller: '');
|
||||
|
||||
if ($back = Tools::getValue('back'))
|
||||
$currentIndex .= '&back='.urlencode($back);
|
||||
AdminTab::$currentIndex = $currentIndex;
|
||||
|
||||
$iso = $context->language->iso_code;
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
|
||||
|
||||
/* Server Params */
|
||||
$protocol_link = (Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
|
||||
$protocol_content = (isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
|
||||
$link = new Link($protocol_link, $protocol_content);
|
||||
$context->link = $link;
|
||||
define('_PS_BASE_URL_', Tools::getShopDomain(true));
|
||||
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
|
||||
|
||||
$path = dirname(__FILE__).'/themes/';
|
||||
if (empty($context->employee->bo_theme) OR !file_exists($path.$context->employee->bo_theme.'/admin.css'))
|
||||
{
|
||||
|
||||
$destination = substr($_SERVER['REQUEST_URI'], strlen(dirname($_SERVER['SCRIPT_NAME'])) + 1);
|
||||
Tools::redirectAdmin('login.php'.(empty($destination) || ($destination == 'index.php?logout') ? '' : '?redirect='.$destination));
|
||||
if (file_exists($path.'oldschool/admin.css'))
|
||||
$context->employee->bo_theme = 'oldschool';
|
||||
elseif (file_exists($path.'origins/admin.css'))
|
||||
$context->employee->bo_theme = 'origins';
|
||||
else
|
||||
foreach (scandir($path) as $theme)
|
||||
if ($theme[0] != '.' AND file_exists($path.$theme.'/admin.css'))
|
||||
{
|
||||
$employee->bo_theme = $theme;
|
||||
break;
|
||||
}
|
||||
$context->employee->update();
|
||||
}
|
||||
else
|
||||
|
||||
// Change shop context ?
|
||||
if (Shop::isFeatureActive() && Tools::getValue('setShopContext') !== false)
|
||||
{
|
||||
$link = new Link();
|
||||
|
||||
$currentIndex = $_SERVER['SCRIPT_NAME'].(($tab = Tools::getValue('tab')) ? '?tab='.$tab : '');
|
||||
if ($back = Tools::getValue('back'))
|
||||
$currentIndex .= '&back='.urlencode($back);
|
||||
|
||||
/* Server Params */
|
||||
$protocol_link = (Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
|
||||
$protocol_content = (isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
|
||||
define('_PS_BASE_URL_', Tools::getShopDomain(true));
|
||||
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
|
||||
|
||||
$employee = new Employee((int)$cookie->id_employee);
|
||||
$cookie->id_lang = (int)$employee->id_lang;
|
||||
$iso = strtolower(Language::getIsoById($cookie->id_lang ? $cookie->id_lang : Configuration::get('PS_LANG_DEFAULT')));
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
|
||||
|
||||
/* attribute id_lang is often needed, so we create a constant for performance reasons */
|
||||
define('_USER_ID_LANG_', (int)$cookie->id_lang);
|
||||
|
||||
$path = dirname(__FILE__).'/themes/';
|
||||
if (empty($employee->bo_theme) OR !file_exists($path.$employee->bo_theme.'/admin.css'))
|
||||
{
|
||||
if (file_exists($path.'oldschool/admin.css'))
|
||||
$employee->bo_theme = 'oldschool';
|
||||
elseif (file_exists($path.'origins/admin.css'))
|
||||
$employee->bo_theme = 'origins';
|
||||
else
|
||||
foreach (scandir($path) as $theme)
|
||||
if ($theme[0] != '.' AND file_exists($path.$theme.'/admin.css'))
|
||||
{
|
||||
$employee->bo_theme = $theme;
|
||||
break;
|
||||
}
|
||||
$employee->update();
|
||||
}
|
||||
|
||||
// Change shop context ?
|
||||
if (Tools::isMultiShopActivated() && Tools::getValue('setShopContext') !== false)
|
||||
{
|
||||
$cookie->shopContext = Tools::getValue('setShopContext');
|
||||
$url = parse_url($_SERVER['REQUEST_URI']);
|
||||
$query = (isset($url['query'])) ? $url['query'] : '';
|
||||
parse_str($query, $parseQuery);
|
||||
unset($parseQuery['setShopContext']);
|
||||
Tools::redirectAdmin($url['path'] . '?' . http_build_query($parseQuery));
|
||||
}
|
||||
$context->cookie->shopContext = Tools::getValue('setShopContext');
|
||||
$url = parse_url($_SERVER['REQUEST_URI']);
|
||||
$query = (isset($url['query'])) ? $url['query'] : '';
|
||||
parse_str($query, $parseQuery);
|
||||
unset($parseQuery['setShopContext']);
|
||||
Tools::redirectAdmin($url['path'] . '?' . http_build_query($parseQuery));
|
||||
}
|
||||
|
||||
$context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
|
||||
$shopID = '';
|
||||
if ($context->cookie->shopContext)
|
||||
{
|
||||
$split = explode('-', $context->cookie->shopContext);
|
||||
if (count($split) == 2 && $split[0] == 's')
|
||||
$shopID = (int)$split[1];
|
||||
}
|
||||
$context->shop = new Shop($shopID);
|
||||
@@ -24,164 +24,5 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
ob_start();
|
||||
define('PS_ADMIN_DIR', getcwd());
|
||||
|
||||
include(PS_ADMIN_DIR.'/../config/config.inc.php');
|
||||
include(PS_ADMIN_DIR.'/functions.php');
|
||||
|
||||
$clientIsMaintenanceOrLocal = in_array(Tools::getRemoteAddr(), array_merge(array('127.0.0.1'),explode(',', Configuration::get('PS_MAINTENANCE_IP'))));
|
||||
|
||||
$errors = array();
|
||||
|
||||
if ((empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off')
|
||||
AND Configuration::get('PS_SSL_ENABLED'))
|
||||
{
|
||||
// You can uncomment theses lines if you want to force https even from localhost and automatically redirect
|
||||
// header('HTTP/1.1 301 Moved Permanently');
|
||||
// header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
|
||||
// exit();
|
||||
|
||||
// If ssl is enabled, https protocol is required. Exception for maintenance and local (127.0.0.1) IP
|
||||
if ($clientIsMaintenanceOrLocal)
|
||||
$errors[] = translate('SSL is activated. However, your IP is allowed to use unsecure mode (Maintenance or local IP).').'<br/>';
|
||||
else
|
||||
$warningSslMessage = translate('SSL is activated. Please connect using the following url to log in in secure mode (https).')
|
||||
.'<br/><br/><a href="https://'.Tools::getServerName().$_SERVER['REQUEST_URI'].'">https://'.Tools::getServerName().$_SERVER['REQUEST_URI'].'</a>';
|
||||
}
|
||||
|
||||
$cookie = new Cookie('psAdmin', substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__), -10));
|
||||
if (!isset($cookie->id_lang))
|
||||
$cookie->id_lang = Configuration::get('PS_LANG_DEFAULT');
|
||||
$iso = strtolower(Language::getIsoById((int)($cookie->id_lang)));
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
|
||||
|
||||
/* Cookie creation and redirection */
|
||||
if (Tools::isSubmit('Submit'))
|
||||
{
|
||||
/* Check fields validity */
|
||||
$passwd = trim(Tools::getValue('passwd'));
|
||||
$email = trim(Tools::getValue('email'));
|
||||
if (empty($email))
|
||||
$errors[] = Tools::displayError('E-mail is empty');
|
||||
elseif (!Validate::isEmail($email))
|
||||
$errors[] = Tools::displayError('Invalid e-mail address');
|
||||
elseif (empty($passwd))
|
||||
$errors[] = Tools::displayError('Password is blank');
|
||||
elseif (!Validate::isPasswd($passwd))
|
||||
$errors[] = Tools::displayError('Invalid password');
|
||||
else
|
||||
{
|
||||
/* Seeking for employee */
|
||||
$employee = new Employee();
|
||||
$employee = $employee->getByemail($email, $passwd);
|
||||
if (!$employee)
|
||||
{
|
||||
$errors[] = Tools::displayError('Employee does not exist or password is incorrect.');
|
||||
$cookie->logout();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Creating cookie */
|
||||
$cookie->id_employee = $employee->id;
|
||||
$cookie->email = $employee->email;
|
||||
$cookie->profile = $employee->id_profile;
|
||||
$cookie->passwd = $employee->passwd;
|
||||
$cookie->remote_addr = ip2long(Tools::getRemoteAddr());
|
||||
$cookie->write();
|
||||
/* Redirect to admin panel */
|
||||
if (isset($_GET['redirect']))
|
||||
$url = strval($_GET['redirect'].(isset($_GET['token']) ? ('&token='.$_GET['token']) : ''));
|
||||
else
|
||||
$url = 'index.php';
|
||||
if (!Validate::isCleanHtml($url))
|
||||
die(Tools::displayError());
|
||||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$iso.'" lang="'.$iso.'">
|
||||
<meta http-equiv="Refresh" content="0;URL='.Tools::safeOutput($url, true).'">
|
||||
<head>
|
||||
<script language="javascript" type="text/javascript">
|
||||
window.location.replace("'.Tools::safeOutput($url, true).'");
|
||||
</script>
|
||||
<div style="text-align:center; margin-top:250px;"><a href="'.Tools::safeOutput($url, true).'">'.translate('Click here to launch Administration panel').'</a></div>
|
||||
</head>
|
||||
</html>';
|
||||
exit ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$iso.'" lang="'.$iso.'">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link type="text/css" rel="stylesheet" href="../css/login.css" />
|
||||
<title>PrestaShop™ - '.translate('Administration panel').'</title>';
|
||||
echo '
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">';
|
||||
|
||||
if ($nbErrors = sizeof($errors))
|
||||
{
|
||||
echo '
|
||||
<div id="error">
|
||||
<h3>'.($nbErrors > 1 ? translate('There are') : translate('There is')).' '.$nbErrors.' '.($nbErrors > 1 ? translate('errors') : translate('error')).'</h3>
|
||||
<ol style="margin: 0 0 0 20px;">';
|
||||
foreach ($errors AS $error)
|
||||
echo '<li>'.$error.'</li>';
|
||||
echo '
|
||||
</ol>
|
||||
</div>
|
||||
<br />';
|
||||
}
|
||||
|
||||
echo '
|
||||
<div id="login">
|
||||
<h1>'.Tools::htmlentitiesUTF8(Configuration::get('PS_SHOP_NAME')).'</h1>
|
||||
<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post">';
|
||||
|
||||
$randomNb = rand(100, 999);
|
||||
if(file_exists(PS_ADMIN_DIR.'/../install') OR file_exists(PS_ADMIN_DIR.'/../admin'))
|
||||
{
|
||||
echo ' <span>'.translate('For security reasons, you cannot connect to the Back Office until after you have:').'<br /><br />
|
||||
- '.translate('deleted the /install folder').'<br />
|
||||
- '.translate('renamed the /admin folder (eg. ').'/admin'.$randomNb.')<br />
|
||||
<br />'.translate('Please then access this page by the new url (eg. http://www.domain.tld/admin').$randomNb.')</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// If https enabled, we force it except if you try to log in from maintenance or local ip
|
||||
if ( (empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off')
|
||||
AND ( Configuration::get('PS_SSL_ENABLED') AND !$clientIsMaintenanceOrLocal)
|
||||
)
|
||||
echo '<div class="error">'.$warningSslMessage.'</div>';
|
||||
else
|
||||
echo '<label for="email">'.translate('E-mail address:').'</label><br />
|
||||
<input type="text" id="email" name="email" value="'.Tools::safeOutput(Tools::getValue('email')).'" class="input"/>
|
||||
<div style="margin: 1.8em 0 0 0;">
|
||||
<label for="passwd">'.translate('Password:').'</label><br />
|
||||
<input id="passwd" type="password" name="passwd" class="input" value=""/>
|
||||
</div>
|
||||
<div>
|
||||
<div id="submit"><input type="submit" name="Submit" value="'.translate('Log in').'" class="button" /></div>
|
||||
<div id="lost"><a href="password.php">'.translate('Lost password?').'</a></div>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
if (document.getElementById('email')) document.getElementById('email').focus();
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
echo '
|
||||
</form>
|
||||
</div>
|
||||
<h2><a href="http://www.prestashop.com">© Copyright by PrestaShop. all rights reserved.</a></h2>
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
header('Location: index.php?controller=AdminLogin');
|
||||
@@ -24,93 +24,4 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('PS_ADMIN_DIR', getcwd());
|
||||
|
||||
include(PS_ADMIN_DIR.'/../config/config.inc.php');
|
||||
include(PS_ADMIN_DIR.'/functions.php');
|
||||
|
||||
$cookie = new Cookie('psAdmin', substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__), -10));
|
||||
|
||||
$errors = array();
|
||||
|
||||
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
$iso = strtolower(Language::getIsoById((int)$id_lang));
|
||||
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
|
||||
|
||||
if (isset($_POST['Submit']))
|
||||
{
|
||||
$errors = array();
|
||||
if (empty($_POST['email']))
|
||||
$errors[] = Tools::displayError('E-mail is empty');
|
||||
elseif (!Validate::isEmail($_POST['email']))
|
||||
$errors[] = Tools::displayError('Invalid e-mail address');
|
||||
else
|
||||
{
|
||||
$employee = new Employee();
|
||||
if (!$employee->getByemail($_POST['email']) OR !$employee)
|
||||
$errors[] = Tools::displayError('This account does not exist');
|
||||
else
|
||||
{
|
||||
if ((strtotime($employee->last_passwd_gen.'+'.Configuration::get('PS_PASSWD_TIME_BACK').' minutes') - time()) > 0 )
|
||||
$errors[] = Tools::displayError('You can regenerate your password only every').' '.Configuration::get('PS_PASSWD_TIME_BACK').' '.Tools::displayError('minute(s)');
|
||||
else
|
||||
{
|
||||
$pwd = Tools::passwdGen();
|
||||
$employee->passwd = md5(pSQL(_COOKIE_KEY_.$pwd));
|
||||
$employee->last_passwd_gen = date('Y-m-d H:i:s', time());
|
||||
$result = $employee->update();
|
||||
if (!$result)
|
||||
$errors[] = Tools::displayError('An error occurred during your password change.');
|
||||
else
|
||||
{
|
||||
Mail::Send((int)$id_lang, 'password', Mail::l('Your new admin password'), array('{email}' => $employee->email, '{lastname}' => $employee->lastname, '{firstname}' => $employee->firstname, '{passwd}' => $pwd), $employee->email, $employee->firstname.' '.$employee->lastname);
|
||||
$confirmation = 'ok';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$iso.'" lang="'.$iso.'">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link type="text/css" rel="stylesheet" href="../css/login.css" />
|
||||
<title>PrestaShop™ - '.translate('Administration panel').'</title>
|
||||
</head>
|
||||
<body><div id="container">';
|
||||
|
||||
if (sizeof($errors))
|
||||
{
|
||||
echo '<div id="error">
|
||||
<h3>'.translate('There is 1 error').'</h3>
|
||||
<ol>';
|
||||
foreach ($errors AS $error)
|
||||
echo '<li>'.$error.'</li>';
|
||||
echo '</ol>
|
||||
</div>';
|
||||
}
|
||||
|
||||
echo '
|
||||
<div id="login">
|
||||
<h1>'.Configuration::get('PS_SHOP_NAME').'</h1>
|
||||
<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post">
|
||||
<div class="page-title center">'.translate('Forgot your password?').'</div><br />';
|
||||
if (isset($confirmation))
|
||||
echo ' <br />
|
||||
<div style="font-weight: bold;">'.translate('Your password has been e-mailed to you').'.</div>
|
||||
<div style="margin: 2em 0 0 0; text-align: right;"><a href="login.php?email='.Tools::safeOutput(Tools::getValue('email')).'">> '.translate('back to login home').'</a></div>';
|
||||
else
|
||||
echo ' <span style="font-weight: bold;">'.translate('Please, enter your e-mail address').' </span>
|
||||
'.translate('(the one you wrote during your registration) in order to receive your access codes by e-mail').'.<br />
|
||||
<input type="text" name="email" class="input" />
|
||||
<div>
|
||||
<div id="submit"><input type="submit" name="Submit" value="'.translate('Send').'" class="button" /></div>
|
||||
<div id="lost"> </div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<h2><a href="http://www.prestashop.com">© Copyright by PrestaShop. all rights reserved.</a></h2>
|
||||
</div></body></html>';
|
||||
header('Location: index.php?controller=AdminLogin');
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -25,15 +25,13 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('PS_ADMIN_DIR', getcwd());
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
|
||||
include(PS_ADMIN_DIR.'/../config/config.inc.php');
|
||||
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
|
||||
if (!Context::getContext()->employee->id)
|
||||
Tools::redirectAdmin('index.php?controller=AdminLogin');
|
||||
|
||||
/* Header can't be included, so cookie must be created here */
|
||||
$cookie = new Cookie('psAdmin');
|
||||
if (!$cookie->id_employee)
|
||||
Tools::redirectAdmin('login.php');
|
||||
|
||||
$functionArray = array(
|
||||
'pdf' => 'generateInvoicePDF',
|
||||
'id_order_slip' => 'generateOrderSlipPDF',
|
||||
@@ -41,7 +39,8 @@ $functionArray = array(
|
||||
'invoices' => 'generateInvoicesPDF',
|
||||
'invoices2' => 'generateInvoicesPDF2',
|
||||
'slips' => 'generateOrderSlipsPDF',
|
||||
'deliveryslips' => 'generateDeliverySlipsPDF'
|
||||
'deliveryslips' => 'generateDeliverySlipsPDF',
|
||||
'id_supply_order' => 'generateSupplyOrderFormPDF'
|
||||
);
|
||||
|
||||
foreach ($functionArray as $var => $function)
|
||||
@@ -51,14 +50,47 @@ foreach ($functionArray as $var => $function)
|
||||
die;
|
||||
}
|
||||
|
||||
function generateSupplyOrderFormPDF()
|
||||
{
|
||||
if (!isset($_GET['id_supply_order']))
|
||||
die (Tools::displayError('Missing supply order ID'));
|
||||
|
||||
$id_supply_order = (int)$_GET['id_supply_order'];
|
||||
$supply_order = new SupplyOrder($id_supply_order);
|
||||
|
||||
if (!Validate::isLoadedObject($supply_order))
|
||||
die(Tools::displayError('Cannot find this supply order in the database'));
|
||||
|
||||
generatePDF($supply_order, PDF::TEMPLATE_SUPPLY_ORDER_FORM);
|
||||
}
|
||||
|
||||
function generateInvoicePDF()
|
||||
{
|
||||
if (!isset($_GET['id_order']))
|
||||
die (Tools::displayError('Missing order ID'));
|
||||
$order = new Order((int)($_GET['id_order']));
|
||||
if (Tools::isSubmit('id_order'))
|
||||
generateInvoicePDFByIdOrder(Tools::getValue('id_order'));
|
||||
elseif (Tools::isSubmit('id_order_invoice'))
|
||||
generateInvoicePDFByIdOrderInvoice(Tools::getValue('id_order_invoice'));
|
||||
else
|
||||
die (Tools::displayError('Missing order ID or invoice order ID'));
|
||||
exit;
|
||||
}
|
||||
|
||||
function generateInvoicePDFByIdOrder($id_order)
|
||||
{
|
||||
$order = new Order($id_order);
|
||||
if (!Validate::isLoadedObject($order))
|
||||
die(Tools::displayError('Cannot find order in database'));
|
||||
PDF::invoice($order);
|
||||
|
||||
generatePDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
function generateInvoicePDFByIdOrderInvoice($id_order_invoice)
|
||||
{
|
||||
$order_invoice = new OrderInvoice($id_order_invoice);
|
||||
if (!Validate::isLoadedObject($order_invoice))
|
||||
die(Tools::displayError('Cannot find order invoice in database'));
|
||||
|
||||
generatePDF($order_invoice, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
function generateOrderSlipPDF()
|
||||
@@ -69,7 +101,8 @@ function generateOrderSlipPDF()
|
||||
die(Tools::displayError('Cannot find order in database'));
|
||||
$order->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $order);
|
||||
$tmp = NULL;
|
||||
PDF::invoice($order, 'D', false, $tmp, $orderSlip);
|
||||
|
||||
generatePDF($orderSlip, PDF::TEMPLATE_ORDER_SLIP);
|
||||
}
|
||||
|
||||
function generateDeliverySlipPDF()
|
||||
@@ -77,38 +110,62 @@ function generateDeliverySlipPDF()
|
||||
$order = Order::getByDelivery((int)($_GET['id_delivery']));
|
||||
if (!Validate::isLoadedObject($order))
|
||||
die(Tools::displayError('Cannot find order in database'));
|
||||
$tmp = NULL;
|
||||
PDF::invoice($order, 'D', false, $tmp, false, $order->delivery_number);
|
||||
|
||||
generatePDF($order, PDF::TEMPLATE_DELIVERY_SLIP);
|
||||
}
|
||||
|
||||
function generateInvoicesPDF()
|
||||
{
|
||||
$orders = Order::getOrdersIdInvoiceByDate($_GET['date_from'], $_GET['date_to'], NULL, 'invoice');
|
||||
if (!is_array($orders))
|
||||
$id_orders_list = Order::getOrdersIdInvoiceByDate($_GET['date_from'], $_GET['date_to'], NULL, 'invoice');
|
||||
if (!is_array($id_orders_list))
|
||||
die (Tools::displayError('No invoices found'));
|
||||
PDF::multipleInvoices($orders);
|
||||
|
||||
$orders = array();
|
||||
foreach ($id_orders_list as $id_order)
|
||||
$orders[] = new Order((int)$id_order);
|
||||
|
||||
generatePDF($orders, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
function generateInvoicesPDF2()
|
||||
{
|
||||
$allOrders = array();
|
||||
$id_orders_list = array();
|
||||
foreach (explode('-', Tools::getValue('id_order_state')) as $id_order_state)
|
||||
if (is_array($orders = Order::getOrderIdsByStatus((int)$id_order_state)))
|
||||
$allOrders = array_merge($allOrders, $orders);
|
||||
PDF::multipleInvoices($allOrders);
|
||||
if (is_array($id_orders = Order::getOrderIdsByStatus((int)$id_order_state)))
|
||||
$id_orders_list = array_merge($id_orders_list, $id_orders);
|
||||
|
||||
$orders = array();
|
||||
foreach ($id_orders_list as $id_order)
|
||||
$orders[] = new Order((int)$id_order);
|
||||
|
||||
generatePDF($orders, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
function generateOrderSlipsPDF()
|
||||
{
|
||||
$orderSlips = OrderSlip::getSlipsIdByDate($_GET['date_from'], $_GET['date_to']);
|
||||
if (!count($orderSlips))
|
||||
$id_order_slips_list = OrderSlip::getSlipsIdByDate($_GET['date_from'], $_GET['date_to']);
|
||||
if (!count($id_order_slips_list))
|
||||
die (Tools::displayError('No order slips found'));
|
||||
PDF::multipleOrderSlips($orderSlips);
|
||||
|
||||
$order_slips = array();
|
||||
foreach ($id_order_slips_list as $id_order_slips)
|
||||
$order_slips[] = new OrderSlip((int)$id_order_slips);
|
||||
|
||||
generatePDF($order_slips, PDF::TEMPLATE_ORDER_SLIP);
|
||||
}
|
||||
|
||||
function generateDeliverySlipsPDF()
|
||||
{
|
||||
$slips = unserialize(urldecode($_GET['deliveryslips']));
|
||||
if (is_array($slips))
|
||||
PDF::multipleDelivery($slips);
|
||||
generatePDF($slips, PDF::TEMPLATE_DELIVERY_SLIP);
|
||||
}
|
||||
|
||||
|
||||
function generatePDF($object, $template)
|
||||
{
|
||||
global $smarty;
|
||||
$pdf = new PDF($object, $template, $smarty);
|
||||
$pdf->render();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,5 +32,6 @@ if (substr(_COOKIE_KEY_, 34, 8) != Tools::getValue('token'))
|
||||
|
||||
ini_set('max_execution_time', 7200);
|
||||
Search::indexation(Tools::getValue('full'));
|
||||
if (Tools::getValue('redirect'))
|
||||
Tools::redirectAdmin($_SERVER['HTTP_REFERER'].'&conf=4');
|
||||
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminAccess extends AdminTab
|
||||
{
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitAddaccess') AND $action = Tools::getValue('action') AND $id_tab = (int)(Tools::getValue('id_tab')) AND $id_profile = (int)(Tools::getValue('id_profile')) AND $this->tabAccess['edit'] == 1)
|
||||
{
|
||||
if ($id_tab == -1 AND $action == 'all' AND (int)(Tools::getValue('perm')) == 0)
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'access` SET `view` = '.(int)(Tools::getValue('perm')).', `add` = '.(int)(Tools::getValue('perm')).', `edit` = '.(int)(Tools::getValue('perm')).', `delete` = '.(int)(Tools::getValue('perm')).' WHERE `id_profile` = '.(int)($id_profile).' AND `id_tab` != 31');
|
||||
elseif ($id_tab == -1 AND $action == 'all')
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'access` SET `view` = '.(int)(Tools::getValue('perm')).', `add` = '.(int)(Tools::getValue('perm')).', `edit` = '.(int)(Tools::getValue('perm')).', `delete` = '.(int)(Tools::getValue('perm')).' WHERE `id_profile` = '.(int)($id_profile));
|
||||
elseif ($id_tab == -1)
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'access` SET `'.pSQL($action).'` = '.(int)(Tools::getValue('perm')).' WHERE `id_profile` = '.(int)($id_profile));
|
||||
elseif ($action == 'all')
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'access` SET `view` = '.(int)(Tools::getValue('perm')).', `add` = '.(int)(Tools::getValue('perm')).', `edit` = '.(int)(Tools::getValue('perm')).', `delete` = '.(int)(Tools::getValue('perm')).' WHERE `id_tab` = '.(int)($id_tab).' AND `id_profile` = '.(int)($id_profile));
|
||||
else
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'access` SET `'.pSQL($action).'` = '.(int)(Tools::getValue('perm')).' WHERE `id_tab` = '.(int)($id_tab).' AND `id_profile` = '.(int)($id_profile));
|
||||
}
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
$this->displayForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current profile id
|
||||
*
|
||||
* @return the $_GET['profile'] if valid, else 1 (the first profile id)
|
||||
*/
|
||||
function getCurrentProfileId()
|
||||
{
|
||||
return (isset($_GET['profile']) AND !empty($_GET['profile']) AND is_numeric($_GET['profile'])) ? (int)($_GET['profile']) : 1;
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
$currentProfile = (int)($this->getCurrentProfileId());
|
||||
$tabs = Tab::getTabs($cookie->id_lang);
|
||||
$profiles = Profile::getProfiles((int)($cookie->id_lang));
|
||||
$accesses = Profile::getProfileAccesses((int)($currentProfile));
|
||||
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
setLang(Array(\''.$this->l('Profile updated').'\', \''.$this->l('Request failed!').'\', \''.$this->l('Update in progress. Please wait.').'\', \''.$this->l('Server connection failed!').'\'));
|
||||
</script>
|
||||
<div id="ajax_confirmation"></div>
|
||||
<table class="table" cellspacing="0">
|
||||
<tr>
|
||||
<th '.($currentProfile == (int)_PS_ADMIN_PROFILE_ ? 'colspan="6"' : '').'>
|
||||
<select name="profile" onchange="redirect(\''.Tools::getHttpHost(true, true).$currentIndex.'&token='.$this->token.'&profile=\'+this.options[this.selectedIndex].value)">';
|
||||
if ($profiles)
|
||||
foreach ($profiles AS $profile)
|
||||
echo '<option value="'.(int)$profile['id_profile'].'" '.((int)$profile['id_profile'] == $currentProfile ? 'selected="selected"' : '').'>'.$profile['name'].'</option>';
|
||||
|
||||
$tabsize = sizeof($tabs);
|
||||
foreach ($tabs AS $tab)
|
||||
if ($tab['id_tab'] > $tabsize)
|
||||
$tabsize = $tab['id_tab'];
|
||||
echo '
|
||||
</select>
|
||||
</th>';
|
||||
|
||||
if ($currentProfile != (int)(_PS_ADMIN_PROFILE_))
|
||||
echo '
|
||||
<th class="center">'.$this->l('View').'<br /><input type="checkbox" name="1" id="viewall" onclick="ajax_power(this, \'view\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')" /></th>
|
||||
<th class="center">'.$this->l('Add').'<br /><input type="checkbox" name="1" id="addall" onclick="ajax_power(this, \'add\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')" /></th>
|
||||
<th class="center">'.$this->l('Edit').'<br /><input type="checkbox" name="1" id="editall" onclick="ajax_power(this, \'edit\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')" /></th>
|
||||
<th class="center">'.$this->l('Delete').'<br /><input type="checkbox" name="1" id="deleteall" onclick="ajax_power(this, \'delete\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')" /></th>
|
||||
<th class="center">'.$this->l('All').'<br /><input type="checkbox" name="1" id="allall" onclick="ajax_power(this, \'all\', -1, '.$currentProfile.', \''.$this->token.'\', \''.$tabsize.'\', \''.sizeof($tabs).'\')" /></th>
|
||||
</tr>';
|
||||
|
||||
if (!sizeof($tabs))
|
||||
echo '<tr><td colspan="5">'.$this->l('No tab').'</td></tr>';
|
||||
elseif ($currentProfile == (int)(_PS_ADMIN_PROFILE_))
|
||||
echo '<tr><td colspan="5">'.$this->l('Administrator permissions can\'t be modified.').'</td></tr>';
|
||||
else
|
||||
foreach ($tabs AS $tab)
|
||||
if (!$tab['id_parent'] OR (int)($tab['id_parent']) == -1)
|
||||
{
|
||||
$this->printTabAccess((int)($currentProfile), $tab, $accesses[$tab['id_tab']], false, $tabsize, sizeof($tabs));
|
||||
foreach ($tabs AS $child)
|
||||
if ($child['id_parent'] === $tab['id_tab'])
|
||||
$this->printTabAccess($currentProfile, $child, $accesses[$child['id_tab']], true, $tabsize, sizeof($tabs));
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
private function printTabAccess($currentProfile, $tab, $access, $is_child, $tabsize, $tabnumber)
|
||||
{
|
||||
$result_accesses = 0;
|
||||
$perms = array('view', 'add', 'edit', 'delete');
|
||||
echo '<tr><td'.($is_child ? '' : ' class="bold"').'>'.($is_child ? ' » ' : '').$tab['name'].'</td>';
|
||||
foreach ($perms as $perm)
|
||||
{
|
||||
if($this->tabAccess['edit'] == 1)
|
||||
echo '<td class="center"><input type="checkbox" name="1" id=\''.$perm.(int)($access['id_tab']).'\' class=\''.$perm.' '.(int)($access['id_tab']).'\' onclick="ajax_power(this, \''.$perm.'\', '.(int)($access['id_tab']).', '.(int)($access['id_profile']).', \''.$this->token.'\', \''.$tabsize.'\', \''.$tabnumber.'\')" '.((int)($access[$perm]) == 1 ? 'checked="checked"' : '').'/></td>';
|
||||
else
|
||||
echo '<td class="center"><input type="checkbox" name="1" disabled="disabled" '.((int)($access[$perm]) == 1 ? 'checked="checked"' : '').' /></td>';
|
||||
$result_accesses += $access[$perm];
|
||||
}
|
||||
echo '<td class="center"><input type="checkbox" name="1" id=\'all'.(int)($access['id_tab']).'\' class=\'all '.(int)($access['id_tab']).'\' onclick="ajax_power(this, \'all\', '.(int)($access['id_tab']).', '.(int)($access['id_profile']).', \''.$this->token.'\', \''.$tabsize.'\', \''.$tabnumber.'\')" '.($result_accesses == 4 ? 'checked="checked"' : '').'/></td></tr>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminAddonsCatalog extends AdminTab
|
||||
{
|
||||
public function display()
|
||||
{
|
||||
$parentDomain = Tools::getHttpHost(true).substr($_SERVER['REQUEST_URI'], 0, -1 * strlen(basename($_SERVER['REQUEST_URI'])));
|
||||
echo '<iframe frameborder="no" style="margin:0px;padding:0px;width:100%;height:920px" src="http://addons.prestashop.com/iframe/search.php?parentUrl='.$parentDomain.'"></iframe>
|
||||
<div class="clear"> </div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminAddonsMyAccount extends AdminTab
|
||||
{
|
||||
public function display()
|
||||
{
|
||||
$parentDomain = Tools::getHttpHost(true).substr($_SERVER['REQUEST_URI'], 0, -1 * strlen(basename($_SERVER['REQUEST_URI'])));
|
||||
echo '<iframe frameborder="no" style="margin:0px;padding:0px;width:100%;height:920px" src="http://addons.prestashop.com/iframe/myaccount.php?parentUrl='.$parentDomain.'"></iframe>
|
||||
<div class="clear"> </div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,510 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7320 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
if(Configuration::get('VATNUMBER_MANAGEMENT') AND file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php'))
|
||||
include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
|
||||
|
||||
class AdminAddresses extends AdminTab
|
||||
{
|
||||
/** @var array countries list */
|
||||
private $countriesArray = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'address';
|
||||
$this->className = 'Address';
|
||||
$this->lang = false;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->requiredDatabase = true;
|
||||
$this->addressType = 'customer';
|
||||
|
||||
if (!Tools::getValue('realedit'))
|
||||
$this->deleted = true;
|
||||
$this->_select = 'cl.`name` as country';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON
|
||||
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)($cookie->id_lang).')';
|
||||
|
||||
$countries = Country::getCountries((int)($cookie->id_lang));
|
||||
foreach ($countries AS $country)
|
||||
$this->countriesArray[$country['id_country']] = $country['name'];
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'firstname' => array('title' => $this->l('First name'), 'width' => 80, 'filter_key' => 'a!firstname'),
|
||||
'lastname' => array('title' => $this->l('Last name'), 'width' => 100, 'filter_key' => 'a!lastname'),
|
||||
'address1' => array('title' => $this->l('Address'), 'width' => 200),
|
||||
'postcode' => array('title' => $this->l('Postcode/ Zip Code'), 'align' => 'right', 'width' => 50),
|
||||
'city' => array('title' => $this->l('City'), 'width' => 150),
|
||||
'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'select' => $this->countriesArray, 'filter_key' => 'cl!id_country'));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (isset($_POST['submitAdd'.$this->table]))
|
||||
{
|
||||
// Transform e-mail in id_customer for parent processing
|
||||
if ($this->addressType == 'customer')
|
||||
{
|
||||
if (Validate::isEmail(Tools::getValue('email')))
|
||||
{
|
||||
$customer = new Customer;
|
||||
$customer = $customer->getByemail(Tools::getValue('email'));
|
||||
if (Validate::isLoadedObject($customer))
|
||||
$_POST['id_customer'] = $customer->id;
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('This e-mail address is not registered.');
|
||||
}
|
||||
elseif ($id_customer = Tools::getValue('id_customer'))
|
||||
{
|
||||
$customer = new Customer((int)($id_customer));
|
||||
if (Validate::isLoadedObject($customer))
|
||||
$_POST['id_customer'] = $customer->id;
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Unknown customer');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Unknown customer');
|
||||
if (Country::isNeedDniByCountryId(Tools::getValue('id_country')) AND !Tools::getValue('dni'))
|
||||
$this->_errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
|
||||
}
|
||||
|
||||
// Check manufacturer selected
|
||||
if ($this->addressType == 'manufacturer')
|
||||
{
|
||||
$manufacturer = new Manufacturer((int)(Tools::getValue('id_manufacturer')));
|
||||
if (!Validate::isLoadedObject($manufacturer))
|
||||
$this->_errors[] = Tools::displayError('Manufacturer selected is not valid.');
|
||||
}
|
||||
|
||||
/* If the selected country does not contain states */
|
||||
$id_state = (int)(Tools::getValue('id_state'));
|
||||
if ($id_country = Tools::getValue('id_country') AND $country = new Country((int)($id_country)) AND !(int)($country->contains_states) AND $id_state)
|
||||
$this->_errors[] = Tools::displayError('You have selected a state for a country that does not contain states.');
|
||||
|
||||
/* If the selected country contains states, then a state have to be selected */
|
||||
if ((int)($country->contains_states) AND !$id_state)
|
||||
$this->_errors[] = Tools::displayError('An address located in a country containing states must have a state selected.');
|
||||
|
||||
/* Check zip code */
|
||||
if ($country->need_zip_code)
|
||||
{
|
||||
$zip_code_format = $country->zip_code_format;
|
||||
if (($postcode = Tools::getValue('postcode')) AND $zip_code_format)
|
||||
{
|
||||
$zip_regexp = '/^'.$zip_code_format.'$/ui';
|
||||
$zip_regexp = str_replace(' ', '( |)', $zip_regexp);
|
||||
$zip_regexp = str_replace('-', '(-|)', $zip_regexp);
|
||||
$zip_regexp = str_replace('N', '[0-9]', $zip_regexp);
|
||||
$zip_regexp = str_replace('L', '[a-zA-Z]', $zip_regexp);
|
||||
$zip_regexp = str_replace('C', $country->iso_code, $zip_regexp);
|
||||
if (!preg_match($zip_regexp, $postcode))
|
||||
$this->_errors[] = Tools::displayError('Your zip/postal code is incorrect.').'<br />'.Tools::displayError('Must be typed as follows:').' '.str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $zip_code_format)));
|
||||
}
|
||||
elseif ($zip_code_format)
|
||||
$this->_errors[] = Tools::displayError('Postcode required.');
|
||||
elseif ($postcode AND !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
|
||||
$this->_errors[] = Tools::displayError('Your zip/postal code is incorrect.');
|
||||
}
|
||||
|
||||
|
||||
/* If this address come from order's edition and is the same as the other one (invoice or delivery one)
|
||||
** we delete its id_address to force the creation of a new one */
|
||||
if ((int)(Tools::getValue('id_order')))
|
||||
{
|
||||
$this->_redirect = false;
|
||||
if (isset($_POST['address_type']))
|
||||
$_POST['id_address'] = '';
|
||||
}
|
||||
}
|
||||
if (!sizeof($this->_errors))
|
||||
parent::postProcess();
|
||||
|
||||
/* Reassignation of the order's new (invoice or delivery) address */
|
||||
$address_type = ((int)(Tools::getValue('address_type')) == 2 ? 'invoice' : ((int)(Tools::getValue('address_type')) == 1 ? 'delivery' : ''));
|
||||
if (isset($_POST['submitAdd'.$this->table]) AND ($id_order = (int)(Tools::getValue('id_order'))) AND !sizeof($this->_errors) AND !empty($address_type))
|
||||
{
|
||||
if(!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'orders SET `id_address_'.$address_type.'` = '.Db::getInstance()->Insert_ID().' WHERE `id_order` = '.$id_order))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while linking this address to its order.');
|
||||
else
|
||||
Tools::redirectAdmin(Tools::getValue('back').'&conf=4');
|
||||
}
|
||||
}
|
||||
|
||||
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
|
||||
{
|
||||
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit);
|
||||
|
||||
global $cookie;
|
||||
|
||||
/* Manage default params values */
|
||||
if (empty($limit))
|
||||
$limit = ((!isset($cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $cookie->{$this->table.'_pagination'});
|
||||
|
||||
if (!Validate::isTableOrIdentifier($this->table))
|
||||
die('filter is corrupted');
|
||||
if (empty($orderBy))
|
||||
$orderBy = Tools::getValue($this->table.'Orderby', 'id_'.$this->table);
|
||||
if (empty($orderWay))
|
||||
$orderWay = Tools::getValue($this->table.'Orderway', 'ASC');
|
||||
$limit = (int)(Tools::getValue('pagination', $limit));
|
||||
$cookie->{$this->table.'_pagination'} = $limit;
|
||||
|
||||
/* Check params validity */
|
||||
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay)
|
||||
OR !is_numeric($start) OR !is_numeric($limit)
|
||||
OR !Validate::isUnsignedId($id_lang))
|
||||
die(Tools::displayError('get list params is not valid'));
|
||||
|
||||
/* Determine offset from current page */
|
||||
if ((isset($_POST['submitFilter'.$this->table]) OR
|
||||
isset($_POST['submitFilter'.$this->table.'_x']) OR
|
||||
isset($_POST['submitFilter'.$this->table.'_y'])) AND
|
||||
!empty($_POST['submitFilter'.$this->table]) AND
|
||||
is_numeric($_POST['submitFilter'.$this->table]))
|
||||
$start = (int)($_POST['submitFilter'.$this->table] - 1) * $limit;
|
||||
|
||||
/* Cache */
|
||||
$this->_lang = (int)($id_lang);
|
||||
$this->_orderBy = $orderBy;
|
||||
$this->_orderWay = Tools::strtoupper($orderWay);
|
||||
|
||||
/* SQL table : orders, but class name is Order */
|
||||
$sqlTable = $this->table == 'order' ? 'orders' : $this->table;
|
||||
|
||||
/* Query in order to get results number */
|
||||
$queryTotal = Db::getInstance()->getRow('
|
||||
SELECT COUNT(a.`id_'.$this->table.'`) AS total
|
||||
FROM `'._DB_PREFIX_.$sqlTable.'` a
|
||||
'.($this->lang ? 'LEFT JOIN `'._DB_PREFIX_.$this->table.'_lang` b ON (b.`id_'.$this->table.'` = a.`id_'.$this->table.'` AND b.`id_lang` = '.(int)($id_lang).')' : '').'
|
||||
'.(isset($this->_join) ? $this->_join.' ' : '').'
|
||||
WHERE 1 '.(isset($this->_where) ? $this->_where.' ' : '').(($this->deleted OR $this->table == 'currency') ? 'AND a.`deleted` = 0 ' : '').$this->_filter.'
|
||||
'.(isset($this->_group) ? $this->_group.' ' : '').'
|
||||
'.(isset($this->addressType) ? 'AND a.id_'.strval($this->addressType).' != 0' : ''));
|
||||
$this->_listTotal = (int)($queryTotal['total']);
|
||||
|
||||
/* Query in order to get results with all fields */
|
||||
$this->_list = Db::getInstance()->ExecuteS('
|
||||
SELECT a.*'.($this->lang ? ', b.*' : '').(isset($this->_select) ? ', '.$this->_select.' ' : '').'
|
||||
FROM `'._DB_PREFIX_.$sqlTable.'` a
|
||||
'.($this->lang ? 'LEFT JOIN `'._DB_PREFIX_.$this->table.'_lang` b ON (b.`id_'.$this->table.'` = a.`id_'.$this->table.'` AND b.`id_lang` = '.(int)($id_lang).')' : '').'
|
||||
'.(isset($this->_join) ? $this->_join.' ' : '').'
|
||||
WHERE 1 '.(isset($this->_where) ? $this->_where.' ' : '').(($this->deleted OR $this->table == 'currency') ? 'AND a.`deleted` = 0 ' : '').$this->_filter.'
|
||||
'.(isset($this->_group) ? $this->_group.' ' : '').'
|
||||
'.(isset($this->addressType) ? 'AND a.id_'.strval($this->addressType).' != 0' : '').'
|
||||
ORDER BY '.(($orderBy == 'id_'.$this->table) ? 'a.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||
LIMIT '.(int)($start).','.(int)($limit));
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
'.((int)($obj->id) ? '<input type="hidden" name="id_'.$this->table.'" value="'.(int)($obj->id).'" />' : '').'
|
||||
'.(($id_order = (int)(Tools::getValue('id_order'))) ? '<input type="hidden" name="id_order" value="'.(int)($id_order).'" />' : '').'
|
||||
'.(($address_type = (int)(Tools::getValue('address_type'))) ? '<input type="hidden" name="address_type" value="'.(int)($address_type).'" />' : '').'
|
||||
'.(Tools::getValue('realedit') ? '<input type="hidden" name="realedit" value="1" />' : '').'
|
||||
<fieldset>
|
||||
<legend><img src="../img/admin/contact.gif" alt="" />'.$this->l('Addresses').'</legend>';
|
||||
switch ($this->addressType)
|
||||
{
|
||||
case 'manufacturer':
|
||||
echo '<label>'.$this->l('Choose manufacturer').'</label>
|
||||
<div class="margin-form">';
|
||||
$manufacturers = Manufacturer::getManufacturers();
|
||||
echo '<select name="id_manufacturer">';
|
||||
if (!sizeof($manufacturers))
|
||||
echo '<option value="0">'.$this->l('No manufacturer available').' </option>';
|
||||
foreach ($manufacturers as $manufacturer)
|
||||
echo '<option value="'.(int)($manufacturer['id_manufacturer']).'"'.($this->getFieldValue($obj, 'id_manufacturer') == $manufacturer['id_manufacturer'] ? ' selected="selected"' : '').'>'.$manufacturer['name'].' </option>';
|
||||
echo '</select>';
|
||||
echo '</div>';
|
||||
echo '<input type="hidden" name="alias" value="manufacturer">';
|
||||
break;
|
||||
case 'customer':
|
||||
default:
|
||||
if ($obj->id)
|
||||
{
|
||||
$customer = new Customer($obj->id_customer);
|
||||
$tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee));
|
||||
echo '
|
||||
<label>'.$this->l('Customer').'</label>
|
||||
<div class="margin-form"><a style="display: block; padding-top: 4px;" href="?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.$tokenCustomer.'">'.$customer->lastname.' '.$customer->firstname.' ('.$customer->email.')</a></div>
|
||||
<input type="hidden" name="id_customer" value="'.$customer->id.'" />
|
||||
<input type="hidden" name="email" value="'.$customer->email.'" />';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo
|
||||
'<label>'.$this->l('Customer e-mail').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="email" value="'.htmlentities(Tools::getValue('email'), ENT_COMPAT, 'UTF-8').'" style="text-transform: lowercase;" /> <sup>*</sup>
|
||||
</div>';
|
||||
}
|
||||
echo '
|
||||
<label for="dni">'.$this->l('Identification Number').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="dni" id="dni" value="'.htmlentities($this->getFieldValue($obj, 'dni'), ENT_COMPAT, 'UTF-8').'" />
|
||||
<p>'.$this->l('DNI / NIF / NIE').'</p>
|
||||
</div>';
|
||||
|
||||
echo '<label>'.$this->l('Alias').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="alias" value="'.htmlentities($this->getFieldValue($obj, 'alias'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
break;
|
||||
}
|
||||
|
||||
$addresses_fields = $this->processAddressFormat();
|
||||
$addresses_fields = $addresses_fields["dlv_all_fields"]; // we use delivery address
|
||||
|
||||
|
||||
|
||||
foreach($addresses_fields as $addr_field_item)
|
||||
{
|
||||
if ($addr_field_item == 'company')
|
||||
{
|
||||
if ($this->addressType != 'manufacturer')
|
||||
{
|
||||
echo '<label>'.$this->l('Company').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="company" value="'.htmlentities($this->getFieldValue($obj, 'company'), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
|
||||
if ((Configuration::get('VATNUMBER_MANAGEMENT') AND file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php')) && VatNumber::isApplicable(Configuration::get('PS_COUNTRY_DEFAULT')))
|
||||
echo '<div id="vat_area" style="display: visible">';
|
||||
else if(Configuration::get('VATNUMBER_MANAGEMENT'))
|
||||
echo '<div id="vat_area" style="display: hidden">';
|
||||
else
|
||||
echo'<div style="display: none;">';
|
||||
|
||||
echo '<label>'.$this->l('VAT number').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="vat_number" value="'.htmlentities($this->getFieldValue($obj, 'vat_number'), ENT_COMPAT, 'UTF-8').'" />
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
elseif ($addr_field_item == 'lastname')
|
||||
{
|
||||
echo '
|
||||
<label>'.$this->l('Last name').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="lastname" value="'.htmlentities($this->getFieldValue($obj, 'lastname'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
}
|
||||
elseif ($addr_field_item == 'firstname')
|
||||
{
|
||||
|
||||
echo '
|
||||
<label>'.$this->l('First name').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="firstname" value="'.htmlentities($this->getFieldValue($obj, 'firstname'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
}
|
||||
elseif ($addr_field_item == 'address1')
|
||||
{
|
||||
|
||||
echo '
|
||||
<label>'.$this->l('Address').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="address1" value="'.htmlentities($this->getFieldValue($obj, 'address1'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
</div>';
|
||||
}
|
||||
elseif ($addr_field_item == 'address2')
|
||||
{
|
||||
|
||||
echo '
|
||||
<label>'.$this->l('Address').' (2):</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="address2" value="'.htmlentities($this->getFieldValue($obj, 'address2'), ENT_COMPAT, 'UTF-8').'" />
|
||||
</div>';
|
||||
}
|
||||
elseif ($addr_field_item == 'postcode')
|
||||
{
|
||||
|
||||
echo '
|
||||
<label>'.$this->l('Postcode/ Zip Code').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="postcode" value="'.htmlentities($this->getFieldValue($obj, 'postcode'), ENT_COMPAT, 'UTF-8').'" />
|
||||
</div>';
|
||||
}
|
||||
elseif ($addr_field_item == 'city')
|
||||
{
|
||||
|
||||
echo '
|
||||
<label>'.$this->l('City').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="city" value="'.htmlentities($this->getFieldValue($obj, 'city'), ENT_COMPAT, 'UTF-8').'" style="text-transform: uppercase;" /> <sup>*</sup>
|
||||
</div>';
|
||||
}
|
||||
elseif ($addr_field_item == 'country' || $addr_field_item == 'Country:name')
|
||||
{
|
||||
|
||||
echo '
|
||||
<label>'.$this->l('Country').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="id_country" id="id_country" />';
|
||||
$selectedCountry = $this->getFieldValue($obj, 'id_country');
|
||||
foreach ($this->countriesArray AS $id_country => $name)
|
||||
echo ' <option value="'.$id_country.'"'.((!$selectedCountry AND Configuration::get('PS_COUNTRY_DEFAULT') == $id_country) ? ' selected="selected"' : ($selectedCountry == $id_country ? ' selected="selected"' : '')).'>'.$name.'</option>';
|
||||
echo ' </select> <sup>*</sup>
|
||||
</div>';
|
||||
|
||||
|
||||
echo '
|
||||
<div id="contains_states" '.(!Country::containsStates((int)$selectedCountry) ? 'style="display:none;"' : '').'>
|
||||
<label>'.$this->l('State').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="id_state" id="id_state">
|
||||
</select>
|
||||
<sup>*</sup>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
||||
$id_country_ajax = (int)$this->getFieldValue($obj, 'id_country');
|
||||
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
ajaxStates ();
|
||||
$(\'#id_country\').change(function() {
|
||||
ajaxStates ();
|
||||
});
|
||||
function ajaxStates ()
|
||||
{
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
cache: false,
|
||||
data: "ajaxStates=1&id_country="+$(\'#id_country\').val()+"&id_state="+$(\'#id_state\').val(),
|
||||
success: function(html)
|
||||
{
|
||||
if (html == \'false\')
|
||||
{
|
||||
$("#contains_states").fadeOut();
|
||||
$(\'#id_state option[value=0]\').attr("selected", "selected");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#id_state").html(html);
|
||||
$("#contains_states").fadeIn();
|
||||
$(\'#id_state option[value='.(int)$obj->id_state.']\').attr("selected", "selected");
|
||||
}
|
||||
}
|
||||
}); ';
|
||||
if (file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php'))
|
||||
echo ' $.ajax({
|
||||
type: "GET",
|
||||
url: "'._MODULE_DIR_.'vatnumber/ajax.php?id_country="+$(\'#id_country\').val(),
|
||||
success: function(isApplicable)
|
||||
{
|
||||
if(isApplicable == 1)
|
||||
$(\'#vat_area\').show();
|
||||
else
|
||||
$(\'#vat_area\').hide();
|
||||
}
|
||||
});';
|
||||
echo ' }; }); </script>';
|
||||
}
|
||||
|
||||
} // End foreach
|
||||
echo '
|
||||
<label>'.$this->l('Home phone').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="phone" value="'.htmlentities($this->getFieldValue($obj, 'phone'), ENT_COMPAT, 'UTF-8').'" />
|
||||
</div>';
|
||||
|
||||
echo '
|
||||
<label>'.$this->l('Mobile phone').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="phone_mobile" value="'.htmlentities($this->getFieldValue($obj, 'phone_mobile'), ENT_COMPAT, 'UTF-8').'" />
|
||||
</div>';
|
||||
|
||||
|
||||
echo '
|
||||
<label>'.$this->l('Other').'</label>
|
||||
<div class="margin-form">
|
||||
<textarea name="other" cols="36" rows="4">'.htmlentities($this->getFieldValue($obj, 'other'), ENT_COMPAT, 'UTF-8').'</textarea>
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>';
|
||||
echo '
|
||||
</form>';
|
||||
}
|
||||
|
||||
protected function processAddressFormat()
|
||||
{
|
||||
$tmp_addr = new Address((int)Tools::getValue("id_address"));
|
||||
|
||||
$selectedCountry = ($tmp_addr && $tmp_addr->id_country) ? $tmp_addr->id_country :
|
||||
(int)(Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
|
||||
$inv_adr_fields = AddressFormat::getOrderedAddressFields($selectedCountry);
|
||||
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($selectedCountry);
|
||||
|
||||
$inv_all_fields = array();
|
||||
$dlv_all_fields = array();
|
||||
|
||||
$out = array();
|
||||
|
||||
foreach (array('inv','dlv') as $adr_type)
|
||||
{
|
||||
foreach (${$adr_type.'_adr_fields'} as $fields_line)
|
||||
foreach(explode(' ',$fields_line) as $field_item)
|
||||
${$adr_type.'_all_fields'}[] = trim($field_item);
|
||||
|
||||
|
||||
$out[$adr_type.'_adr_fields'] = ${$adr_type.'_adr_fields'};
|
||||
$out[$adr_type.'_all_fields'] = ${$adr_type.'_all_fields'};
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminAliases extends AdminTab
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
$this->table = 'alias';
|
||||
$this->className = 'Alias';
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'alias' => array('title' => $this->l('Aliases'), 'width' => 160),
|
||||
'search' => array('title' => $this->l('Search'), 'width' => 40),
|
||||
'active' => array('title' => $this->l('Status'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
|
||||
);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (isset($_POST['submitAdd'.$this->table]))
|
||||
{
|
||||
$search = strval(Tools::getValue('search'));
|
||||
$string = strval(Tools::getValue('alias'));
|
||||
$aliases = explode(',', $string);
|
||||
if (empty($search) OR empty($string))
|
||||
$this->_errors[] = $this->l('aliases and result are both required');
|
||||
if (!Validate::isValidSearch($search))
|
||||
$this->_errors[] = $search.' '.$this->l('is not a valid result');
|
||||
foreach ($aliases AS $alias)
|
||||
if (!Validate::isValidSearch($alias))
|
||||
$this->_errors[] = $alias.' '.$this->l('is not a valid alias');
|
||||
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
Alias::deleteAliases($search);
|
||||
foreach ($aliases AS $alias)
|
||||
{
|
||||
$obj = new Alias(NULL, trim($alias), trim($search));
|
||||
$obj->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/search.gif" />'.$this->l('Aliases').'</legend>
|
||||
<label>'.$this->l('Alias:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="40" name="alias" value="'.Tools::getValue('alias', htmlentities($obj->getAliases(), ENT_COMPAT, 'UTF-8')).'" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Enter each alias separated by a comma (\',\')').' '.$this->l('(e.g., \'prestshop,preztashop,prestasohp\')').'<br />
|
||||
'.$this->l('Forbidden characters:').' <>;=#{}</p>
|
||||
</div>
|
||||
<label>'.$this->l('Result:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="15" name="search" value="'.htmlentities($this->getFieldValue($obj, 'search'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Search this word instead.').'</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(dirname(__FILE__).'/AdminThemes.php');
|
||||
|
||||
class AdminAppearance extends AdminThemes // extends AdminThemes only for retro-compatibility
|
||||
{
|
||||
public function display()
|
||||
{
|
||||
Tools::redirectAdmin('index.php?tab=AdminThemes&token='.Tools::getAdminTokenLite('AdminThemes'));
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminAttachments extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'attachment';
|
||||
$this->className = 'Attachment';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_attachment' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Name')),
|
||||
'file' => array('title' => $this->l('File')));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
if ($id = (int)(Tools::getValue('id_attachment')) AND $a = new Attachment($id))
|
||||
{
|
||||
$_POST['file'] = $a->file;
|
||||
$_POST['mime'] = $a->mime;
|
||||
}
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
if (isset($_FILES['file']) AND is_uploaded_file($_FILES['file']['tmp_name']))
|
||||
{
|
||||
if ($_FILES['file']['size'] > (Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024 * 1024))
|
||||
$this->_errors[] = $this->l('File too large, maximum size allowed:').' '.(Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024).' '.$this->l('kb').'. '.$this->l('File size you\'re trying to upload is:').number_format(($_FILES['file']['size']/1024), 2, '.', '').$this->l('kb');
|
||||
else
|
||||
{
|
||||
do $uniqid = sha1(microtime()); while (file_exists(_PS_DOWNLOAD_DIR_.$uniqid));
|
||||
if (!copy($_FILES['file']['tmp_name'], _PS_DOWNLOAD_DIR_.$uniqid))
|
||||
$this->_errors[] = $this->l('File copy failed');
|
||||
$_POST['file_name'] = $_FILES['file']['name'];
|
||||
@unlink($_FILES['file']['tmp_name']);
|
||||
$_POST['file'] = $uniqid;
|
||||
$_POST['mime'] = $_FILES['file']['type'];
|
||||
}
|
||||
}
|
||||
else if (array_key_exists('file', $_FILES) && (int)$_FILES['file']['error'] === 1)
|
||||
{
|
||||
$max_upload = (int)(ini_get('upload_max_filesize'));
|
||||
$max_post = (int)(ini_get('post_max_size'));
|
||||
$upload_mb = min($max_upload, $max_post);
|
||||
$this->_errors[] = $this->l('the File').' <b>'.$_FILES['file']['name'].'</b> '.$this->l('exceeds the size allowed by the server. This limit is set to').' <b>'.$upload_mb.$this->l('Mb').'</b>';
|
||||
}
|
||||
else if (!empty($_FILES['file']['tmp_name']))
|
||||
$this->_errors[] = $this->l('No file or your file isn\'t uploadable, check your server configuration about the upload maximum size.');
|
||||
}
|
||||
$this->validateRules();
|
||||
}
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post" enctype="multipart/form-data">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/t/AdminAttachments.gif" />'.$this->l('Attachment').'</legend>
|
||||
<label>'.$this->l('Filename:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="cname_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'cname¤cdescription', 'cname');
|
||||
echo ' </div>
|
||||
<div class="clear"> </div>
|
||||
<label>'.$this->l('Description:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="cdescription_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<textarea name="description_'.$language['id_lang'].'">'.htmlentities($this->getFieldValue($obj, 'description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'</textarea>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'cname¤cdescription', 'cdescription');
|
||||
echo ' </div>
|
||||
<div class="clear"> </div>
|
||||
<label>'.$this->l('File').'</label>
|
||||
<div class="margin-form">
|
||||
<p><input type="file" name="file" /></p>
|
||||
<p>'.$this->l('Upload file from your computer').'</p>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
@ini_set('max_execution_time', 3600);
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminAttributeGenerator extends AdminTab
|
||||
{
|
||||
private $combinations = array();
|
||||
private $product;
|
||||
|
||||
private function addAttribute($arr, $price = 0, $weight = 0)
|
||||
{
|
||||
foreach ($arr AS $attr)
|
||||
{
|
||||
$price += (float)($_POST['price_impact_'.(int)($attr)]);
|
||||
$weight += (float)($_POST['weight_impact'][(int)($attr)]);
|
||||
}
|
||||
if ($this->product->id)
|
||||
{
|
||||
return (array(
|
||||
'id_product' => (int)($this->product->id),
|
||||
'price' => (float)($price),
|
||||
'weight' => (float)($weight),
|
||||
'ecotax' => 0,
|
||||
'quantity' => (int)($_POST['quantity']),
|
||||
'reference' => pSQL($_POST['reference']),
|
||||
'default_on' => 0));
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
static private function createCombinations($list)
|
||||
{
|
||||
if (sizeof($list) <= 1)
|
||||
return sizeof($list) ? array_map(create_function('$v', 'return (array($v));'), $list[0]) : $list;
|
||||
$res = array();
|
||||
$first = array_pop($list);
|
||||
foreach ($first AS $attribute)
|
||||
{
|
||||
$tab = self::createCombinations($list);
|
||||
foreach ($tab AS $toAdd)
|
||||
$res[] = is_array($toAdd) ? array_merge($toAdd, array($attribute)) : array($toAdd, $attribute);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$this->product = new Product((int)(Tools::getValue('id_product')));
|
||||
|
||||
if (isset($_POST['generate']))
|
||||
{
|
||||
if (!is_array(Tools::getValue('options')))
|
||||
$this->_errors[] = Tools::displayError('Please choose at least 1 attribute.');
|
||||
else
|
||||
{
|
||||
$tab = array_values($_POST['options']);
|
||||
if (sizeof($tab) AND Validate::isLoadedObject($this->product))
|
||||
{
|
||||
self::setAttributesImpacts($this->product->id, $tab);
|
||||
$this->combinations = array_values(self::createCombinations($tab));
|
||||
$values = array_values(array_map(array($this, 'addAttribute'), $this->combinations));
|
||||
$this->product->deleteProductAttributes();
|
||||
$res = $this->product->addProductAttributeMultiple($values);
|
||||
$this->product->addAttributeCombinationMultiple($res, $this->combinations);
|
||||
$this->product->updateQuantityProductWithAttributeQuantity();
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Unable to initialize parameters, combination is missing or object cannot be loaded.');
|
||||
}
|
||||
}
|
||||
elseif (isset($_POST['back']))
|
||||
Tools::redirectAdmin($currentIndex.'&id_product='.(int)(Tools::getValue('id_product')).'&id_category='.(int)(Tools::getValue('id_category')).'&addproduct'.'&tabs=3&token='.Tools::getValue('token'));
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
static private function displayAndReturnAttributeJs()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$attributes = Attribute::getAttributes((int)($cookie->id_lang), true);
|
||||
$attributeJs = array();
|
||||
foreach ($attributes AS $k => $attribute)
|
||||
$attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
var attrs = new Array();
|
||||
attrs[0] = new Array(0, \'---\');';
|
||||
foreach ($attributeJs AS $idgrp => $group)
|
||||
{
|
||||
echo '
|
||||
attrs['.$idgrp.'] = new Array(0, \'---\' ';
|
||||
foreach ($group AS $idattr => $attrname)
|
||||
echo ', '.$idattr.', \''.addslashes(($attrname)).'\'';
|
||||
echo ');';
|
||||
}
|
||||
echo '
|
||||
</script>';
|
||||
return $attributeJs;
|
||||
}
|
||||
|
||||
private function displayGroupSelect($attributeJs, $attributesGroups)
|
||||
{
|
||||
echo ' <div>
|
||||
<select multiple name="attributes[]" id="attribute_group" style="width: 200px; height: 350px; margin-bottom: 10px;">';
|
||||
|
||||
foreach ($attributesGroups AS $k => $attributeGroup)
|
||||
{
|
||||
$idGroup = (int)$attributeGroup['id_attribute_group'];
|
||||
if (isset($attributeJs[$idGroup]))
|
||||
{
|
||||
echo ' <optgroup name="'.$idGroup.'" id="'.$idGroup.'" label="'.htmlspecialchars(stripslashes($attributeGroup['name'])).'">';
|
||||
foreach ($attributeJs[$idGroup] AS $k => $v)
|
||||
echo ' <option name="'.$k.'" id="attr_'.$k.'" value="'.htmlspecialchars($v, ENT_QUOTES).'" title="'.htmlspecialchars($v, ENT_QUOTES).'"">'.$v.'</option>';
|
||||
echo ' </optgroup>';
|
||||
}
|
||||
}
|
||||
echo ' </select>
|
||||
</div>';
|
||||
}
|
||||
|
||||
static private function setAttributesImpacts($id_product, $tab)
|
||||
{
|
||||
$attributes = array();
|
||||
foreach ($tab AS $group)
|
||||
foreach ($group AS $attribute)
|
||||
$attributes[] = '('.(int)($id_product).', '.(int)($attribute).', '.(float)($_POST['price_impact_'.(int)($attribute)]).', '.(float)($_POST['weight_impact'][(int)($attribute)]).')';
|
||||
return Db::getInstance()->Execute(
|
||||
'INSERT INTO `'._DB_PREFIX_.'attribute_impact` (`id_product`, `id_attribute`, `price`, `weight`)
|
||||
VALUES '.implode(',', $attributes).'
|
||||
ON DUPLICATE KEY UPDATE `price`=VALUES(price), `weight`=VALUES(weight)'
|
||||
);
|
||||
}
|
||||
|
||||
static private function getAttributesImpacts($id_product)
|
||||
{
|
||||
$tab = array();
|
||||
$result = Db::getInstance()->ExecuteS(
|
||||
'SELECT ai.`id_attribute`, ai.`price`, ai.`weight`
|
||||
FROM `'._DB_PREFIX_.'attribute_impact` ai
|
||||
WHERE ai.`id_product` = '.(int)($id_product));
|
||||
if (!$result)
|
||||
return array();
|
||||
foreach ($result AS $impact)
|
||||
{
|
||||
$tab[$impact['id_attribute']]['price'] = (float)($impact['price']);
|
||||
$tab[$impact['id_attribute']]['weight'] = (float)($impact['weight']);
|
||||
}
|
||||
return $tab;
|
||||
}
|
||||
|
||||
private function displayGroupeTable($attributeJs, $attributesGroups)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$combinationsGroups = $this->product->getAttributesGroups((int)($cookie->id_lang));
|
||||
$attributes = array();
|
||||
$impacts = self::getAttributesImpacts($this->product->id);
|
||||
foreach ($combinationsGroups AS &$combination)
|
||||
{
|
||||
$target = &$attributes[$combination['id_attribute_group']][$combination['id_attribute']];
|
||||
$target = $combination;
|
||||
if (isset($impacts[$combination['id_attribute']]))
|
||||
{
|
||||
$target['price'] = $impacts[$combination['id_attribute']]['price'];
|
||||
$target['weight'] = $impacts[$combination['id_attribute']]['weight'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($attributesGroups AS $k => $attributeGroup)
|
||||
{
|
||||
$idGroup = $attributeGroup['id_attribute_group'];
|
||||
if (isset($attributeJs[$idGroup]))
|
||||
{
|
||||
echo '
|
||||
<br class="clear"/>
|
||||
<table class="table" cellpadding="0" cellspacing="0" align="left" style="margin-bottom: 10px; display: none;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th id="tab_h1" style="width: 150px">'.htmlspecialchars(stripslashes($attributeGroup['name'])).'</th>
|
||||
<th id="tab_h2" style="width: 350px" colspan="2">'.$this->l('Price impact').' ('.$currency->sign.')'.'</th>
|
||||
<th style="width: 150px">'.$this->l('Weight impact').' ('.Configuration::get('PS_WEIGHT_UNIT').')'.'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table_'.$idGroup.'" name="result_table">
|
||||
</tbody>
|
||||
</table>';
|
||||
if (isset($attributes[$idGroup]))
|
||||
foreach ($attributes[$idGroup] AS $k => $attribute)
|
||||
echo '<script type="text/javascript">$(\'#table_'.$idGroup.'\').append(create_attribute_row('.$k.', '.$idGroup.', \''.addslashes($attribute['attribute_name']).'\', '.$attribute['price'].', '.$attribute['weight'].'));toggle(getE(\'table_\' + '.$idGroup.').parentNode, true);</script>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
$jsAttributes = self::displayAndReturnAttributeJs();
|
||||
$attributesGroups = AttributeGroup::getAttributesGroups((int)($cookie->id_lang));
|
||||
$this->product = new Product((int)(Tools::getValue('id_product')));
|
||||
|
||||
// JS Init
|
||||
echo
|
||||
'<script type="text/javascript">
|
||||
i18n_tax_exc = "'.$this->l('Tax Excl.:').'";
|
||||
i18n_tax_inc = "'.$this->l('Tax Incl.:').'";
|
||||
|
||||
var product_tax = "'.Tax::getProductTaxRate($this->product->id, NULL).'";
|
||||
|
||||
function calcPrice(element, element_has_tax)
|
||||
{
|
||||
name = element.attr("name");
|
||||
var element_price = element.val().replace(/,/g, ".");
|
||||
var other_element_price = "0";
|
||||
|
||||
if (!isNaN(element_price) && element_price > 0)
|
||||
{
|
||||
if (element_has_tax)
|
||||
other_element_price = parseFloat(element_price / ((product_tax / 100) + 1));
|
||||
else
|
||||
other_element_price = ps_round(parseFloat(element_price * ((product_tax / 100) + 1)), 2);
|
||||
}
|
||||
|
||||
$("#related_to_"+name).val(other_element_price);
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$(".price_impact").each(function()
|
||||
{
|
||||
calcPrice($(this), false);
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
|
||||
if (isset($_POST['generate']) AND !sizeof($this->_errors))
|
||||
echo '
|
||||
<div class="module_confirmation conf confirm">
|
||||
<img src="../img/admin/ok.gif" alt="" title="" style="margin-right:5px; float:left;" />
|
||||
'.sizeof($this->combinations).' '.$this->l('product(s) successfully created.').'
|
||||
</div>';
|
||||
echo '
|
||||
<script type="text/javascript" src="../js/attributesBack.js"></script>
|
||||
<form enctype="multipart/form-data" method="post" id="generator" action="'.$currentIndex.'&&id_product='.(int)(Tools::getValue('id_product')).'&id_category='.(int)(Tools::getValue('id_category')).'&attributegenerator&token='.Tools::getValue('token').'">
|
||||
<fieldset style="margin-bottom: 35px;"><legend><img src="../img/admin/asterisk.gif" />'.$this->l('Attributes generator').'</legend>'.
|
||||
$this->l('Add or modify attributes for product:').' <b>'.$this->product->name[$cookie->id_lang].'</b>
|
||||
<br /><br />
|
||||
';
|
||||
echo '
|
||||
<div style="padding-top:10px; float: left; width: 570px;">
|
||||
<div style="float:left;">
|
||||
<label>'.$this->l('Quantity').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="20" name="quantity" value="0"/>
|
||||
</div>
|
||||
<label>'.$this->l('Reference').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="20" name="reference" value="'.$this->product->reference.'"/>
|
||||
</div>
|
||||
</div>
|
||||
<div style="float:left; text-align:center; margin-left:20px;">
|
||||
<input type="submit" class="button" style="margin-bottom:5px;" name="generate" value="'.$this->l('Generate').'" /><br />
|
||||
<input type="submit" class="button" name="back" value="'.$this->l('Back to product').'" />
|
||||
</div>
|
||||
<br style="clear:both;" />
|
||||
<div style="margin-top: 15px;">';
|
||||
self::displayGroupeTable($jsAttributes, $attributesGroups);
|
||||
echo '
|
||||
</div>
|
||||
</div>
|
||||
<div style="float: left; margin-left: 60px;">
|
||||
';
|
||||
self::displayGroupSelect($jsAttributes, $attributesGroups);
|
||||
echo '
|
||||
<div>
|
||||
<p style="text-align: center;">
|
||||
<input class="button" type="button" style="margin: 0 0 10px 20px;" value="'.$this->l('Add').'" class="button" onclick="add_attr_multiple();" />
|
||||
<input class="button" type="button" style="margin: 0 0 10px 20px;" value="'.$this->l('Delete').'" class="button" onclick="del_attr_multiple();" /><br />
|
||||
<input type="submit" class="button" name="back" value="'.$this->l('Back to product').'" />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7465 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminAttributes extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'attribute';
|
||||
$this->className = 'Attribute';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->fieldImageSettings = array('name' => 'texture', 'dir' => 'co');
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display form
|
||||
*
|
||||
* @global string $currentIndex Current URL in order to keep current Tab
|
||||
*/
|
||||
public function displayForm($token = NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$color = ($obj->color ? $obj->color : 0);
|
||||
$attributes_groups = AttributeGroup::getAttributesGroups($this->_defaultFormLanguage);
|
||||
$strAttributesGroups = '';
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
var attributesGroups = {';
|
||||
foreach ($attributes_groups AS $attribute_group)
|
||||
$strAttributesGroups .= '"'.$attribute_group['id_attribute_group'].'" : '.$attribute_group['is_color_group'].',';
|
||||
echo $strAttributesGroups.'};
|
||||
</script>
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.($token ? $token : $this->token).'" method="post" enctype="multipart/form-data">
|
||||
'.($obj->id ? '<input type="hidden" name="id_attribute" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/asterisk.gif" />'.$this->l('Attribute').'</legend>
|
||||
<label>'.$this->l('Name:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="name_'.$language['id_lang'].'" value="'.htmlspecialchars($this->getFieldValue($obj, 'name', (int)($language['id_lang']))).'" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name');
|
||||
echo '
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<label>'.$this->l('Group:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_attribute_group" id="id_attribute_group" onchange="showAttributeColorGroup(\'id_attribute_group\', \'colorAttributeProperties\')">';
|
||||
|
||||
foreach ($attributes_groups AS $attribute_group)
|
||||
echo '<option value="'.$attribute_group['id_attribute_group'].'"'.($this->getFieldValue($obj, 'id_attribute_group') == $attribute_group['id_attribute_group'] ? ' selected="selected"' : '').'>'.$attribute_group['name'].'</option>';
|
||||
echo '
|
||||
</select><sup> *</sup>
|
||||
</div>';
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoGroupShop();
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
|
||||
<div id="colorAttributeProperties" style="'.((Validate::isLoadedObject($obj) AND $obj->isColorAttribute()) ? 'display: block;' : 'display: none;').'">
|
||||
<label>'.$this->l('Color').'</label>
|
||||
<div class="margin-form">
|
||||
<input width="20px" type="color" data-hex="true" class="color mColorPickerInput" name="color" value="'.(Tools::getValue('color', $color) ? htmlentities(Tools::getValue('color', $color)) : '#000000').'" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('HTML colors only (e.g.,').' "lightblue", "#CC6600")</p>
|
||||
</div>
|
||||
<label>'.$this->l('Texture:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="file" name="texture" />
|
||||
<p>'.$this->l('Upload color texture from your computer').'<br />'.$this->l('This will override the HTML color!').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Current texture:').' </label>
|
||||
<div class="margin-form">
|
||||
<p>'.(file_exists(_PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.$obj->id.'.jpg')
|
||||
? '<img src="../img/'.$this->fieldImageSettings['dir'].'/'.$obj->id.'.jpg" alt="" title="" /> <a href="'.$_SERVER['REQUEST_URI'].'&deleteImage=1"><img src="../img/admin/delete.gif" alt="'.$this->l('delete').'" title="" /></a>'
|
||||
: $this->l('None')
|
||||
).'</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAddattribute" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
<script>
|
||||
showAttributeColorGroup(\'id_attribute_group\', \'colorAttributeProperties\');
|
||||
</script>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage page processing
|
||||
*
|
||||
* @global string $currentIndex Current URL in order to keep current Tab
|
||||
*/
|
||||
public function postProcess($token = NULL)
|
||||
{
|
||||
global $currentIndex;
|
||||
if (Tools::getValue('submitDel'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (isset($_POST[$this->table.$_POST['groupid'].'Box']))
|
||||
{
|
||||
$object = new $this->className();
|
||||
if ($object->deleteSelection($_POST[$this->table.$_POST['groupid'].'Box']))
|
||||
Tools::redirectAdmin($currentIndex.'&conf=2'.'&token='.($token ? $token : $this->token));
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,235 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7465 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
include_once(PS_ADMIN_DIR.'/tabs/AdminAttributes.php');
|
||||
|
||||
class AdminAttributesGroups extends AdminTab
|
||||
{
|
||||
/** @var object AdminAttributes() instance */
|
||||
private $adminAttributes;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->adminAttributes = new AdminAttributes();
|
||||
$this->table = 'attribute_group';
|
||||
$this->className = 'AttributeGroup';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 140, 'filter_key' => 'b!name'),
|
||||
'attribute' => array('title' => $this->l('Attributes'), 'width' => 240, 'orderby' => false, 'search' => false));
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if ((isset($_POST['submitAddattribute']) AND sizeof($this->adminAttributes->_errors))
|
||||
OR isset($_GET['updateattribute']) OR isset($_GET['addattribute']))
|
||||
{
|
||||
$this->adminAttributes->displayForm($this->token);
|
||||
echo '<br /><br /><a href="'.$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
|
||||
}
|
||||
else
|
||||
{
|
||||
parent::display();
|
||||
$this->displayAssoGroupShop();
|
||||
}
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
|
||||
$this->adminAttributes->postProcess($this->token);
|
||||
|
||||
if(Tools::getValue('submitDel'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (isset($_POST[$this->table.'Box']))
|
||||
{
|
||||
$object = new $this->className();
|
||||
if ($object->deleteSelection($_POST[$this->table.'Box']))
|
||||
Tools::redirectAdmin($currentIndex.'&conf=2'.'&token='.$this->token);
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
public function displayErrors()
|
||||
{
|
||||
$this->adminAttributes->displayErrors();
|
||||
parent::displayErrors();
|
||||
}
|
||||
|
||||
/* Report to AdminTab::displayList() for more details */
|
||||
public function displayList()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
echo '<br /><a href="'.$currentIndex.'&add'.$this->table.'&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> <b>'.$this->l('Add attributes group').'</b></a><br />
|
||||
<a href="'.$currentIndex.'&addattribute&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add attribute').'</a><br /><br />
|
||||
'.$this->l('Click on the group name to view its attributes. Click again to hide them.').'<br /><br />';
|
||||
if ($this->_list === false)
|
||||
Tools::displayError('No elements found');
|
||||
|
||||
$this->displayListHeader();
|
||||
echo '<input type="hidden" name="groupid" value="0">';
|
||||
|
||||
if (!sizeof($this->_list))
|
||||
echo '<tr><td class="center" colspan="'.sizeof($this->_list).'">'.$this->l('No elements found').'</td></tr>';
|
||||
|
||||
$irow = 0;
|
||||
foreach ($this->_list AS $tr)
|
||||
{
|
||||
$id = (int)($tr['id_'.$this->table]);
|
||||
echo '
|
||||
<tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
|
||||
<td style="vertical-align: top; padding: 4px 0 4px 0" class="center"><input type="checkbox" name="'.$this->table.'Box[]" value="'.$id.'" class="noborder" /></td>
|
||||
<td style="width: 140px; vertical-align: top; padding: 4px 0 4px 0; cursor: pointer" onclick="$(\'#attributes_'.$id.'\').slideToggle();">'.$tr['name'].'</td>
|
||||
<td style="vertical-align: top; padding: 4px 0 4px 0; width: 340px">
|
||||
<div id="attributes_'.$id.'" style="display: none">
|
||||
<table class="table" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'attribute'.$id.'Box[]\', this.checked)" /></th>
|
||||
<th width="100%">'.$this->l('Attribute').'</th>
|
||||
<th>'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$attributes = AttributeGroup::getAttributes((int)($cookie->id_lang), $id);
|
||||
foreach ($attributes AS $attribute)
|
||||
{
|
||||
echo '
|
||||
<tr>
|
||||
<td class="center"><input type="checkbox" name="attribute'.$id.'Box[]" value="'.$attribute['id_attribute'].'" class="noborder" /></td>
|
||||
<td>
|
||||
'.($tr['is_color_group'] ? '<div style="float: left; width: 18px; height: 12px; border: 1px solid #996633; background-color: '.$attribute['color'].'; margin-right: 4px;"></div>' : '')
|
||||
.$attribute['name'].'
|
||||
</td>
|
||||
<td class="center">
|
||||
<a href="'.$currentIndex.'&id_attribute='.$attribute['id_attribute'].'&updateattribute&token='.$this->token.'">
|
||||
<img src="../img/admin/edit.gif" border="0" alt="'.$this->l('Edit').'" title="'.$this->l('Edit').'" /></a>
|
||||
<a href="'.$currentIndex.'&id_attribute='.$attribute['id_attribute'].'&deleteattribute&token='.$this->token.'"
|
||||
onclick="return confirm(\''.$this->l('Delete attribute', __CLASS__, true, false).' : '.$attribute['name'].'?\');">
|
||||
<img src="../img/admin/delete.gif" border="0" alt="'.$this->l('Delete').'" title="'.$this->l('Delete').'" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
</table>
|
||||
<p><input type="Submit" class="button" name="submitDelattribute" value="'.$this->l('Delete selection').'"
|
||||
onclick="changeFormParam(this.form, \''.$currentIndex.'\', '.$id.'); return confirm(\''.$this->l('Delete selected items?', __CLASS__, true, false).'\');" /></p>
|
||||
</div>
|
||||
</td>';
|
||||
|
||||
echo '
|
||||
<td style="vertical-align: top; padding: 4px 0 4px 0" class="center">
|
||||
<a href="'.$currentIndex.'&id_'.$this->table.'='.$id.'&update'.$this->table.'&token='.$this->token.'">
|
||||
<img src="../img/admin/edit.gif" border="0" alt="'.$this->l('Edit').'" title="'.$this->l('Edit').'" /></a>
|
||||
<a href="'.$currentIndex.'&id_'.$this->table.'='.$id.'&delete'.$this->table.'&token='.$this->token.'" onclick="return confirm(\''.$this->l('Delete item', __CLASS__, true, false).' : '.$tr['name'].'?\');">
|
||||
<img src="../img/admin/delete.gif" border="0" alt="'.$this->l('Delete').'" title="'.$this->l('Delete').'" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
$this->displayListFooter();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&token='.$this->token.'" method="post">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/asterisk.gif" />'.$this->l('Attributes group').'</legend>
|
||||
<label>'.$this->l('Name:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="name_'.$language['id_lang'].'" value="'.htmlspecialchars($this->getFieldValue($obj, 'name', (int)($language['id_lang']))).'" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name¤public_name', 'name');
|
||||
echo '
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<label>'.$this->l('Public name:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="public_name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="public_name_'.$language['id_lang'].'" value="'.htmlspecialchars($this->getFieldValue($obj, 'public_name', (int)($language['id_lang']))).'" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
<p style="clear: both">'.$this->l('Term or phrase displayed to the customer').'</p>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name¤public_name', 'public_name');
|
||||
echo '
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<label>'.$this->l('Color group:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="is_color_group" id="is_color_group_on" value="1" '.($this->getFieldValue($obj, 'is_color_group') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="is_color_group_on"><img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Yes').'" /></label>
|
||||
<input type="radio" name="is_color_group" id="is_color_group_off" value="0" '.(!$this->getFieldValue($obj, 'is_color_group') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="is_color_group_off"><img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('No').'" /></label>
|
||||
<p>'.$this->l('This is a color group').'</p>
|
||||
</div>';
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoGroupShop();
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,307 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7320 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminBackup extends AdminTab
|
||||
{
|
||||
/** @var string The field we are sorting on */
|
||||
protected $_sortBy = 'date';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'backup';
|
||||
$this->className = 'Backup';
|
||||
parent::__construct();
|
||||
|
||||
$this->edit = false;
|
||||
$this->delete = true;
|
||||
$this->view = true;
|
||||
|
||||
$this->deleted = false;
|
||||
|
||||
$this->requiredDatabase = false;
|
||||
|
||||
$this->fieldsDisplay = array (
|
||||
'date' => array('title' => $this->l('Date'), 'type' => 'datetime', 'width' => 120, 'align' => 'right'),
|
||||
'age' => array('title' => $this->l('Age')),
|
||||
'filename' => array('title' => $this->l('File name'), 'width' => 200),
|
||||
'filesize' => array('title' => $this->l('File size')));
|
||||
$this->optionTitle = $this->l('Backup options');
|
||||
$this->_fieldsOptions = array(
|
||||
'PS_BACKUP_ALL' => array('title' => $this->l('Ignore statistics tables:'),
|
||||
'desc' => $this->l('The following tables will NOT be backed up if you enable this option:').'<br />'._DB_PREFIX_.'connections, '._DB_PREFIX_.'connections_page, '._DB_PREFIX_.'connections_source, '._DB_PREFIX_.'guest, '._DB_PREFIX_.'statssearch', 'cast' => 'intval', 'type' => 'bool'),
|
||||
'PS_BACKUP_DROP_TABLE' => array('title' => $this->l('Drop existing tables during import:'),
|
||||
'desc' => $this->l('Select this option to instruct the backup file to drop your tables prior to restoring the backed up data').'<br />(ie. "DROP TABLE IF EXISTS")', 'cast' => 'intval', 'type' => 'bool'));
|
||||
|
||||
$this->identifier = 'filename';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load class object using identifier in $_GET (if possible)
|
||||
* otherwise return an empty object
|
||||
* This method overrides the one in AdminTab because AdminTab assumes the id is a UnsignedInt
|
||||
* "Backups" Directory in admin directory must be writeable (CHMOD 777)
|
||||
* @param boolean $opt Return an empty object if load fail
|
||||
* @return object
|
||||
*/
|
||||
protected function loadObject($opt = false)
|
||||
{
|
||||
if ($id = Tools::getValue($this->identifier))
|
||||
return new $this->className($id);
|
||||
return new $this->className();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new backup, and then displays the normal menu
|
||||
*/
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
if(is_writable(PS_ADMIN_DIR.'/backups/'))
|
||||
{
|
||||
if (!($object = $this->loadObject()))
|
||||
return;
|
||||
if ($object->add())
|
||||
{
|
||||
echo '<div class="conf confirm"><img src="../img/admin/ok.gif" /> '.$this->l('It appears that the Backup was successful, however, you must download and carefully verify the Backup file.').'</div>';
|
||||
if ($this->tabAccess['view'] === '1')
|
||||
echo '
|
||||
<fieldset style="margin: 40px 0;" class="width3">
|
||||
<legend><img src="../img/admin/AdminBackup.gif" alt="" class="icon" /> '.$this->l('Download').'</legend>
|
||||
<p style="font-size: 13px;"><a href="'.$object->getBackupURL().'"><img src="../img/admin/AdminBackup.gif" alt="" class="icon" /></a><b><a href="'.$object->getBackupURL().'">'.$this->l('Download the Backup file').' ('.number_format((filesize($object->id)*0.000001), 2, '.', '').$this->l('Mb').')</a></b><br /><br />
|
||||
'.$this->l('Tip: You can also download this file by FTP, Backup files are located in "admin/backups" directory.').'</p>
|
||||
</fieldset>';
|
||||
|
||||
$this->displayHowTo(false);
|
||||
}
|
||||
elseif ($object->error)
|
||||
$this->_errors[] = $object->error;
|
||||
}
|
||||
else
|
||||
$this->_errors[] = $this->l('"Backups" Directory in admin directory must be writeable (CHMOD 755 / 777)');
|
||||
$this->displayErrors();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the page which allows the backup to be downloaded
|
||||
*/
|
||||
public function viewbackup()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (!($object = $this->loadObject()))
|
||||
return;
|
||||
if ($object->id)
|
||||
{
|
||||
$url = $object->getBackupURL();
|
||||
echo '<div class="conf confirm"><img src="../img/admin/ok.gif" /> '.$this->l('Beginning download ...').'</div>';
|
||||
echo '<br />'.$this->l('Back-up file should automatically download.');
|
||||
echo '<br /><br />'.$this->l('If not,').' <b><a href="'.$url.'">'.$this->l('please click here!').'</a></b>';
|
||||
echo '<iframe width="0" height="0" scrolling="no" frameborder="0" src="'.$url.'"></iframe>';
|
||||
echo '<br /><br /><br /><a href="'.$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
|
||||
}
|
||||
elseif ($object->error)
|
||||
$this->_errors[] = $object->error;
|
||||
$this->displayErrors();
|
||||
}
|
||||
|
||||
public function displayHowTo($showForm = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
echo '
|
||||
<div class="error width1" style="float: left; margin-right: 10px;">
|
||||
<p>'.$this->l('Disclaimer before creating a new Backup').'</p>
|
||||
<ol style="font-size: 11px; font-weight: normal; line-height: 20px; padding-left: 10px;">
|
||||
<li>'.$this->l('PrestaShop is not responsible for your database, Backups, restore and data.').'</li>
|
||||
<li>'.$this->l('PrestaShop is an Open-source software, you are using it at your own risk under the licence agreement.').'</li>
|
||||
<li>'.$this->l('You should Backup your data on a regular basis (both files and database).').'</li>
|
||||
<li>'.$this->l('This function only backs up your database, not your files.').'</li>
|
||||
<li>'.$this->l('By default, your existing database tables will be deleted during Backup restore (see options).').'</li>
|
||||
<li>'.$this->l('Always verify the quality and integrity of your Backups files.').'</li>
|
||||
<li>'.$this->l('Always verify that your Backups files are complete, up-to-date and valid. Even if you had a success message during the Backup process.').'</li>
|
||||
<li>'.$this->l('Always check your data.').'</li>
|
||||
<li>'.$this->l('Never restore a Backup on a live site.').'</li>
|
||||
</ol>';
|
||||
|
||||
if ($showForm)
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&add'.$this->table.'&token='.$this->token.'" method="post" style="text-align: center;">
|
||||
<input type="submit" class="button" value="'.$this->l('I read the disclaimer - Create a new Backup').'" style="padding: 10px; font-weight: bold; border: 1px solid;" />
|
||||
</form>';
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<div class="warn width2" style="float: left;">
|
||||
<p>'.$this->l('How-to restore a database Backup in 10 easy steps').'</p>
|
||||
<ol style="font-size: 11px; font-weight: normal; line-height: 20px;">
|
||||
<li>'.$this->l('Turn off the "Enable Shop" option in the "Preferences" tab.').'</li>
|
||||
<li>'.$this->l('Download the Backup from the list below or from your FTP server (in the folder "admin/backups").').'</li>
|
||||
<li>'.$this->l('Check the Backup integrity: look for errors, incomplete file. Verify all your data.').'</li>
|
||||
<li>'.$this->l('Ask your hosting provider for a "phpMyAdmin" access to your database').'</li>
|
||||
<li>'.$this->l('Connect to "phpMyAdmin" and select your current database').'</li>
|
||||
<li>'.$this->l('Unless you enabled the "Drop existing tables" option, you must delete all tables from your current database.').'</li>
|
||||
<li>'.$this->l('At the top of the screen select the tab "Import"').'</li>
|
||||
<li>'.$this->l('Click on the "Browse..." button and select the Backup file from your hard drive').'</li>
|
||||
<li>'.$this->l('Check the max. allowed filesize (ie. Max: 16Mb)').'<br />'.$this->l('If your Backup file exceeds this limit, contact your hosting provider').'</li>
|
||||
<li>'.$this->l('Click on the "Go" button and wait during the import, the process can take several minutes').'</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="clear"></div>';
|
||||
}
|
||||
|
||||
public function displayList()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
// Test if the backup dir is writable
|
||||
if(!is_writable(PS_ADMIN_DIR.'/backups/'))
|
||||
$this->displayWarning($this->l('"Backups" Directory in admin directory must be writeable (CHMOD 755 / 777)'));
|
||||
|
||||
$this->displayErrors();
|
||||
$this->displayHowTo();
|
||||
|
||||
parent::displayList();
|
||||
}
|
||||
|
||||
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (!Validate::isTableOrIdentifier($this->table))
|
||||
die('filter is corrupted');
|
||||
if (empty($orderBy))
|
||||
$orderBy = Tools::getValue($this->table.'Orderby', $this->_defaultOrderBy);
|
||||
if (empty($orderWay))
|
||||
$orderWay = Tools::getValue($this->table.'Orderway', 'ASC');
|
||||
|
||||
// Try and obtain getList arguments from $_GET
|
||||
$orderBy = Tools::getValue($this->table.'Orderby');
|
||||
$orderWay = Tools::getValue($this->table.'Orderway');
|
||||
|
||||
// Validate the orderBy and orderWay fields
|
||||
switch ($orderBy)
|
||||
{
|
||||
case 'filename':
|
||||
case 'filesize':
|
||||
case 'date':
|
||||
case 'age':
|
||||
break;
|
||||
default:
|
||||
$orderBy = 'date';
|
||||
}
|
||||
switch ($orderWay)
|
||||
{
|
||||
case 'asc':
|
||||
case 'desc':
|
||||
break;
|
||||
default:
|
||||
$orderWay = 'desc';
|
||||
}
|
||||
if (empty($limit))
|
||||
$limit = ((!isset($cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $cookie->{$this->table.'_pagination'});
|
||||
$limit = (int)(Tools::getValue('pagination', $limit));
|
||||
$cookie->{$this->table.'_pagination'} = $limit;
|
||||
|
||||
/* Determine offset from current page */
|
||||
if (!empty($_POST['submitFilter'.$this->table]) AND is_numeric($_POST['submitFilter'.$this->table]))
|
||||
$start = (int)($_POST['submitFilter'.$this->table] - 1) * $limit;
|
||||
$this->_lang = (int)($id_lang);
|
||||
$this->_orderBy = $orderBy;
|
||||
$this->_orderWay = strtoupper($orderWay);
|
||||
$this->_list = array();
|
||||
|
||||
// Find all the backups
|
||||
$dh = @opendir(PS_ADMIN_DIR.'/backups/');
|
||||
if ($dh === false)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Unable to open backup directory .').addslashes(PS_ADMIN_DIR.'/backups/').'"';
|
||||
return;
|
||||
}
|
||||
while (($file = readdir($dh)) !== false)
|
||||
{
|
||||
if (preg_match('/^([\d]+-[a-z\d]+)\.sql(\.gz|\.bz2)?$/', $file, $matches) == 0)
|
||||
continue;
|
||||
$timestamp = (int)($matches[1]);
|
||||
$date = date('Y-m-d h:i:s', $timestamp);
|
||||
$age = time() - $timestamp;
|
||||
if ($age < 3600)
|
||||
$age = '< 1 '.$this->l('hour');
|
||||
else if ($age < 86400)
|
||||
{
|
||||
$age = floor($age / 3600);
|
||||
$age = $age.' '.(($age == 1) ? $this->l('hour') : $this->l('hours'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$age = floor($age / 86400);
|
||||
$age = $age.' '.(($age == 1) ? $this->l('day') : $this->l('days'));
|
||||
}
|
||||
$size = filesize(PS_ADMIN_DIR.'/backups/'.$file);
|
||||
$this->_list[] = array(
|
||||
'filename' => $file,
|
||||
'age' => $age,
|
||||
'date' => $date,
|
||||
'filesize' => number_format($size / 1000, 2).' Kb',
|
||||
'timestamp' => $timestamp,
|
||||
'filesize_sort' => $size,
|
||||
);
|
||||
}
|
||||
closedir($dh);
|
||||
$this->_listTotal = count($this->_list);
|
||||
|
||||
// Sort the _list based on the order requirements
|
||||
switch ($this->_orderBy)
|
||||
{
|
||||
case 'filename':
|
||||
$this->_sortBy = 'filename';
|
||||
$sorter = 'str_sort';
|
||||
break;
|
||||
case 'filesize':
|
||||
$this->_sortBy = 'filesize_sort';
|
||||
$sorter = 'int_sort';
|
||||
break;
|
||||
case 'age':
|
||||
case 'date':
|
||||
$this->_sortBy = 'timestamp';
|
||||
$sorter = 'int_sort';
|
||||
break;
|
||||
}
|
||||
usort($this->_list, array($this, $sorter));
|
||||
$this->_list = array_slice($this->_list, $start, $limit);
|
||||
}
|
||||
|
||||
public function int_sort($a, $b)
|
||||
{
|
||||
return $this->_orderWay == 'ASC' ? $a[$this->_sortBy] - $b[$this->_sortBy] : $b[$this->_sortBy] - $a[$this->_sortBy];
|
||||
}
|
||||
|
||||
public function str_sort($a, $b)
|
||||
{
|
||||
return $this->_orderWay == 'ASC' ? strcmp($a[ $this->_sortBy], $b[$this->_sortBy]) : strcmp($b[ $this->_sortBy], $a[$this->_sortBy]);
|
||||
}
|
||||
}
|
||||
@@ -1,357 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7300 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminCMS extends AdminTab
|
||||
{
|
||||
private $_category;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'cms';
|
||||
$this->className = 'CMS';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->view = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_cms' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'link_rewrite' => array('title' => $this->l('URL'), 'width' => 200),
|
||||
'meta_title' => array('title' => $this->l('Title'), 'width' => 300),
|
||||
'position' => array('title' => $this->l('Position'), 'width' => 40,'filter_key' => 'position', 'align' => 'center', 'position' => 'position'),
|
||||
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
|
||||
);
|
||||
|
||||
$this->_category = AdminCMSContent::getCurrentCMSCategory();
|
||||
$this->_join = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category` c ON (c.`id_cms_category` = a.`id_cms_category`)';
|
||||
$this->_select = 'a.position ';
|
||||
$this->_filter = 'AND c.id_cms_category = '.(int)($this->_category->id);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
private function _displayDraftWarning($active)
|
||||
{
|
||||
return
|
||||
'<div class="warn draft" style="'.($active ? 'display:none' : '').'">
|
||||
<p>
|
||||
<span style="float: left">
|
||||
<img src="../img/admin/warn2.png" />
|
||||
'.$this->l('Your CMS page will be saved as a draft').'
|
||||
</span>
|
||||
<input type="button" class="button" style="float: right;" value="'.$this->l('Save and preview').'" onclick="submitAddcmsAndPreview();">
|
||||
<input type="hidden" name="previewSubmitAddcmsAndPreview" id="previewSubmitAddcmsAndPreview" />
|
||||
<br class="clear" />
|
||||
</p>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
$obj = $this->loadObject(true);
|
||||
$iso = Language::getIsoById((int)($cookie->id_lang));
|
||||
$divLangName = 'meta_title¤meta_description¤meta_keywords¤ccontent¤link_rewrite';
|
||||
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.Tools::getAdminTokenLite('AdminCMSContent').'" method="post" name="cms" id="cms">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
'.$this->_displayDraftWarning($obj->active).'
|
||||
<fieldset><legend><img src="../img/admin/cms.gif" />'.$this->l('CMS page').'</legend>';
|
||||
|
||||
// META TITLE
|
||||
echo '<label>'.$this->l('CMS Category:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_cms_category">';
|
||||
$categories = CMSCategory::getCategories((int)($cookie->id_lang), false);
|
||||
CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($obj, 'id_cms_category'));
|
||||
echo '
|
||||
</select>
|
||||
</div>
|
||||
<label>'.$this->l('Meta title').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="meta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="40" type="text" onkeyup="copyMeta2friendlyURL();" id="name_'.$language['id_lang'].'" name="meta_title_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_title', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
</div>';
|
||||
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_title');
|
||||
echo ' </div><div class="clear space"> </div>';
|
||||
|
||||
// META DESCRIPTION
|
||||
echo ' <label>'.$this->l('Meta description').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="meta_description_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="50" type="text" name="meta_description_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_description');
|
||||
echo ' </div><div class="clear space"> </div>';
|
||||
|
||||
// META KEYWORDS
|
||||
echo ' <label>'.$this->l('Meta keywords').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="meta_keywords_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="50" type="text" name="meta_keywords_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_keywords', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_keywords');
|
||||
echo ' </div><div class="clear space"> </div>';
|
||||
|
||||
// LINK REWRITE
|
||||
echo ' <label>'.$this->l('Friendly URL').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="link_rewrite_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="30" type="text" id="input_link_rewrite_'.$language['id_lang'].'" name="link_rewrite_'.$language['id_lang'].'" onkeyup="this.value = str2url(this.value); updateFriendlyURL();" value="'.htmlentities($this->getFieldValue($obj, 'link_rewrite', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'link_rewrite');
|
||||
echo ' </div><div class="clear space"> </div>';
|
||||
|
||||
// CONTENT
|
||||
echo ' <label>'.$this->l('Page content').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="ccontent_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').';float: left;">
|
||||
<textarea class="rte" cols="80" rows="30" id="content_'.$language['id_lang'].'" name="content_'.$language['id_lang'].'">'.htmlentities(stripslashes($this->getFieldValue($obj, 'content', $language['id_lang'])), ENT_COMPAT, 'UTF-8').'</textarea>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'ccontent');
|
||||
echo ' </div><div class="clear space"> </div>
|
||||
<label>'.$this->l('Enable:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" onclick="toggleDraftWarning(false);" value="1" '.($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" onclick="toggleDraftWarning(true);" value="0" '.(!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
</div>';
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoShop();
|
||||
echo '</div>';
|
||||
}
|
||||
// SUBMIT
|
||||
echo ' <div class="margin-form space">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset><br />
|
||||
'.$this->_displayDraftWarning($obj->active).'
|
||||
</form>';
|
||||
// TinyMCE
|
||||
global $cookie;
|
||||
$iso = Language::getIsoById((int)($cookie->id_lang));
|
||||
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
|
||||
$ad = dirname($_SERVER["PHP_SELF"]);
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
var iso = \''.$isoTinyMCE.'\' ;
|
||||
var pathCSS = \''._THEME_CSS_DIR_.'\' ;
|
||||
var ad = \''.$ad.'\' ;
|
||||
</script>
|
||||
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tiny_mce/tiny_mce.js"></script>
|
||||
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce.inc.js"></script>';
|
||||
}
|
||||
|
||||
public function display($token = NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
if (($id_cms_category = (int)Tools::getValue('id_cms_category')))
|
||||
$currentIndex .= '&id_cms_category='.$id_cms_category;
|
||||
$this->getList((int)($cookie->id_lang), !$cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$cookie->__get($this->table.'Orderway') ? 'ASC' : NULL);
|
||||
//$this->getList((int)($cookie->id_lang));
|
||||
if (!$id_cms_category)
|
||||
$id_cms_category = 1;
|
||||
echo '<h3>'.(!$this->_listTotal ? ($this->l('No pages found')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('pages') : $this->l('page')))).' '.
|
||||
$this->l('in category').' "'.stripslashes(CMSCategory::hideCMSCategoryPosition($this->_category->getName())).'"</h3>';
|
||||
echo '<a href="'.$currentIndex.'&id_cms_category='.$id_cms_category.'&add'.$this->table.'&token='.Tools::getAdminTokenLite('AdminCMSContent').'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new page').'</a>
|
||||
<div style="margin:10px;">';
|
||||
$this->displayList($token);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
public function displayList($token = NULL)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
/* Display list header (filtering, pagination and column names) */
|
||||
$this->displayListHeader($token);
|
||||
if (!sizeof($this->_list))
|
||||
echo '<tr><td class="center" colspan="'.(sizeof($this->fieldsDisplay) + 2).'">'.$this->l('No items found').'</td></tr>';
|
||||
|
||||
/* Show the content of the table */
|
||||
$this->displayListContent($token);
|
||||
|
||||
/* Close list table and submit button */
|
||||
$this->displayListFooter($token);
|
||||
}
|
||||
|
||||
function postProcess()
|
||||
{
|
||||
global $cookie, $link, $currentIndex;
|
||||
|
||||
if (Tools::isSubmit('viewcms') AND ($id_cms = (int)(Tools::getValue('id_cms'))) AND $cms = new CMS($id_cms, (int)($cookie->id_lang)) AND Validate::isLoadedObject($cms))
|
||||
{
|
||||
$redir = $link->getCMSLink($cms);
|
||||
if (!$cms->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
|
||||
$redir .= '?adtoken='.Tools::encrypt('PreviewCMS'.$cms->id).'&ad='.$admin_dir;
|
||||
}
|
||||
Tools::redirectAdmin($redir);
|
||||
}
|
||||
elseif (Tools::isSubmit('deletecms'))
|
||||
{
|
||||
if (Tools::getValue('id_cms') == Configuration::get('PS_CONDITIONS_CMS_ID'))
|
||||
{
|
||||
Configuration::updateValue('PS_CONDITIONS', 0);
|
||||
Configuration::updateValue('PS_CONDITIONS_CMS_ID', 0);
|
||||
}
|
||||
$cms = new CMS((int)(Tools::getValue('id_cms')));
|
||||
$cms->cleanPositions($cms->id_cms_category);
|
||||
if (!$cms->delete())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.' ('.mysql_error().')</b>';
|
||||
else
|
||||
Tools::redirectAdmin($currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=1&token='.Tools::getAdminTokenLite('AdminCMSContent'));
|
||||
}/* Delete multiple objects */
|
||||
elseif (Tools::getValue('submitDel'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (isset($_POST[$this->table.'Box']))
|
||||
{
|
||||
$cms = new CMS();
|
||||
$result = true;
|
||||
$result = $cms->deleteSelection(Tools::getValue($this->table.'Box'));
|
||||
if ($result)
|
||||
{
|
||||
$cms->cleanPositions((int)(Tools::getValue('id_cms_category')));
|
||||
Tools::redirectAdmin($currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCMSContent').'&id_category='.(int)(Tools::getValue('id_cms_category')));
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
elseif (Tools::isSubmit('submitAddcms') OR Tools::isSubmit('submitAddcmsAndPreview'))
|
||||
{
|
||||
parent::validateRules();
|
||||
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
if (!$id_cms = (int)(Tools::getValue('id_cms')))
|
||||
{
|
||||
$cms = new CMS();
|
||||
$this->copyFromPost($cms, 'cms');
|
||||
if (!$cms->add())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.' ('.mysql_error().')</b>';
|
||||
elseif (Tools::isSubmit('submitAddcmsAndPreview'))
|
||||
{
|
||||
$preview_url = $link->getCMSLink($cms, $this->getFieldValue($object, 'link_rewrite', $this->_defaultFormLanguage), (int)($cookie->id_lang));
|
||||
if (!$cms->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
|
||||
$token = Tools::encrypt('PreviewCMS'.$cms->id);
|
||||
|
||||
$preview_url .= $object->active ? '' : '&adtoken='.$token.'&ad='.$admin_dir;
|
||||
}
|
||||
Tools::redirectAdmin($preview_url);
|
||||
}
|
||||
else
|
||||
Tools::redirectAdmin($currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=3&token='.Tools::getAdminTokenLite('AdminCMSContent'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$cms = new CMS($id_cms);
|
||||
$this->copyFromPost($cms, 'cms');
|
||||
if (!$cms->update())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.' ('.mysql_error().')</b>';
|
||||
elseif (Tools::isSubmit('submitAddcmsAndPreview'))
|
||||
{
|
||||
$preview_url = $link->getCMSLink($cms, $this->getFieldValue($object, 'link_rewrite', $this->_defaultFormLanguage), (int)($cookie->id_lang));
|
||||
if (!$cms->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
|
||||
$token = Tools::encrypt('PreviewCMS'.$cms->id);
|
||||
|
||||
$preview_url .= $object->active ? '' : '&adtoken='.$token.'&ad='.$admin_dir;
|
||||
}
|
||||
Tools::redirectAdmin($preview_url);
|
||||
}
|
||||
else
|
||||
Tools::redirectAdmin($currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=4&token='.Tools::getAdminTokenLite('AdminCMSContent'));
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (Tools::getValue('position'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
elseif (!Validate::isLoadedObject($object = $this->loadObject()))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
elseif (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position'))))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
Tools::redirectAdmin($currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=4'.(($id_category = (int)(Tools::getValue('id_cms_category'))) ? ('&id_cms_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCMSContent'));
|
||||
}
|
||||
/* Change object statuts (active, inactive) */
|
||||
elseif (Tools::isSubmit('status') AND Tools::isSubmit($this->identifier))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->toggleStatus())
|
||||
Tools::redirectAdmin($currentIndex.'&conf=5'.((int)Tools::getValue('id_cms_category') ? '&id_cms_category='.(int)Tools::getValue('id_cms_category') : '').'&token='.Tools::getValue('token'));
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else
|
||||
parent::postProcess(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,293 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminCMSCategories extends AdminTab
|
||||
{
|
||||
protected $maxImageSize = 300000;
|
||||
|
||||
/** @var object CMSCategory() instance for navigation*/
|
||||
private $_CMSCategory;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'cms_category';
|
||||
$this->className = 'CMSCategory';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->view = true;
|
||||
$this->delete = true;
|
||||
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_cms_category' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 100, 'callback' => 'hideCMSCategoryPosition'),
|
||||
'description' => array('title' => $this->l('Description'), 'width' => 500, 'maxlength' => 90, 'orderby' => false),
|
||||
'position' => array('title' => $this->l('Position'), 'width' => 40,'filter_key' => 'position', 'align' => 'center', 'position' => 'position'),
|
||||
'active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
|
||||
|
||||
$this->_CMSCategory = AdminCMSContent::getCurrentCMSCategory();
|
||||
$this->_filter = 'AND `id_parent` = '.(int)($this->_CMSCategory->id);
|
||||
$this->_select = 'position ';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function displayList($token = NULL)
|
||||
{
|
||||
global $currentIndex;
|
||||
/* Display list header (filtering, pagination and column names) */
|
||||
$this->displayListHeader($token);
|
||||
if (!sizeof($this->_list))
|
||||
echo '<tr><td class="center" colspan="'.(sizeof($this->fieldsDisplay) + 2).'">'.$this->l('No items found').'</td></tr>';
|
||||
|
||||
/* Show the content of the table */
|
||||
$this->displayListContent($token);
|
||||
|
||||
/* Close list table and submit button */
|
||||
$this->displayListFooter($token);
|
||||
}
|
||||
|
||||
public function display($token = NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$id_cms_category = (int)(Tools::getValue('id_cms_category', 1));
|
||||
|
||||
$this->getList((int)($cookie->id_lang), !$cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$cookie->__get($this->table.'Orderway') ? 'ASC' : NULL);
|
||||
|
||||
echo '<h3>'.(!$this->_listTotal ? ($this->l('There are no subcategories')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('subcategories') : $this->l('subCMS Category')))).' '.$this->l('in CMS Category').' "'.stripslashes(CMSCategory::hideCMSCategoryPosition($this->_CMSCategory->getName())).'"</h3>';
|
||||
echo '<a href="'.__PS_BASE_URI__.substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)).'?tab=AdminCMSContent&add'.$this->table.'&id_parent='.Tools::getValue('id_cms_category').'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new sub CMS Category').'</a>
|
||||
<div style="margin:10px;">';
|
||||
$this->displayList($token);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
public function postProcess($token = NULL)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
|
||||
|
||||
|
||||
if (Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
|
||||
if ($id_cms_category = (int)(Tools::getValue('id_cms_category')))
|
||||
{
|
||||
if (!CMSCategory::checkBeforeMove($id_cms_category, (int)(Tools::getValue('id_parent'))))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('CMS Category cannot be moved here');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Change object statuts (active, inactive) */
|
||||
elseif (isset($_GET['statuscms_category']) AND Tools::getValue($this->identifier))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->toggleStatus())
|
||||
Tools::redirectAdmin($currentIndex.'&conf=5'.((int)$object->id_parent ? '&id_cms_category='.(int)$object->id_parent : '').'&token='.Tools::getValue('token'));
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
/* Delete object */
|
||||
elseif (isset($_GET['delete'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()) AND isset($this->fieldImageSettings))
|
||||
{
|
||||
// check if request at least one object with noZeroObject
|
||||
if (isset($object->noZeroObject) AND sizeof($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
|
||||
$this->_errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
else
|
||||
{
|
||||
$this->deleteImage($object->id);
|
||||
if ($this->deleted)
|
||||
{
|
||||
$object->deleted = 1;
|
||||
if ($object->update())
|
||||
Tools::redirectAdmin($currentIndex.'&conf=1&token='.Tools::getValue('token'));
|
||||
}
|
||||
elseif ($object->delete())
|
||||
Tools::redirectAdmin($currentIndex.'&conf=1&token='.Tools::getValue('token'));
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
elseif (isset($_GET['position']))
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
elseif (!Validate::isLoadedObject($object = new CMSCategory((int)(Tools::getValue($this->identifier, Tools::getValue('id_cms_category_to_move', 1))))))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
elseif (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position'))))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
Tools::redirectAdmin($currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier, Tools::getValue('id_cms_category_parent', 1)))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCMSContent'));
|
||||
}
|
||||
/* Delete multiple objects */
|
||||
elseif (Tools::getValue('submitDel'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (isset($_POST[$this->table.'Box']))
|
||||
{
|
||||
$cms_category = new CMSCategory();
|
||||
$result = true;
|
||||
$result = $cms_category->deleteSelection(Tools::getValue($this->table.'Box'));
|
||||
if ($result)
|
||||
{
|
||||
$cms_category->cleanPositions((int)(Tools::getValue('id_cms_category')));
|
||||
Tools::redirectAdmin($currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCMSContent').'&id_category='.(int)(Tools::getValue('id_cms_category')));
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
parent::postProcess(true);
|
||||
}
|
||||
|
||||
public function displayForm($token=NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$active = $this->getFieldValue($obj, 'active');
|
||||
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.($token!=NULL ? $token : $this->token).'" method="post" enctype="multipart/form-data">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset style="width:520px"><legend><img src="../img/admin/tab-categories.gif" />'.$this->l('CMS Category').'</legend>
|
||||
<label>'.$this->l('Name:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" style="width: 260px" name="name_'.$language['id_lang'].'" id="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" '.((!$obj->id) ? ' onkeyup="copy2friendlyURL();"' : '').' /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Displayed:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.($active ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"><img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.(!$active ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"><img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
</div>
|
||||
<label>'.$this->l('Parent CMS Category:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_parent">';
|
||||
$categories = CMSCategory::getCategories((int)($cookie->id_lang), false);
|
||||
CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($obj, 'id_parent'));
|
||||
echo '
|
||||
</select>
|
||||
</div>
|
||||
<label>'.$this->l('Description:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<textarea name="description_'.$language['id_lang'].'" rows="5" cols="40">'.htmlentities($this->getFieldValue($obj, 'description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'</textarea>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<div class="clear"><br /></div>
|
||||
<label>'.$this->l('Meta title:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_title_'.$language['id_lang'].'" id="meta_title_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_title', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Meta description:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_description_'.$language['id_lang'].'" id="meta_description_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Meta keywords:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_keywords_'.$language['id_lang'].'" id="meta_keywords_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_keywords', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Friendly URL:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="link_rewrite_'.$language['id_lang'].'" id="link_rewrite_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'link_rewrite', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" onkeyup="this.value = str2url(this.value);" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Only letters and the minus (-) character are allowed').'<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l('Save and back to parent CMS Category').'" name="submitAdd'.$this->table.'AndBackToParent" class="button" />
|
||||
<input type="submit" class="button" name="submitAdd'.$this->table.'" value="'.$this->l('Save').'"/>
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
<p class="clear"></p>';
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
include(PS_ADMIN_DIR.'/tabs/AdminCMSCategories.php');
|
||||
include(PS_ADMIN_DIR.'/tabs/AdminCMS.php');
|
||||
|
||||
class AdminCMSContent extends AdminTab
|
||||
{
|
||||
/** @var object adminCMSCategories() instance */
|
||||
private $adminCMSCategories;
|
||||
|
||||
/** @var object adminCMS() instance */
|
||||
private $adminCMS;
|
||||
|
||||
/** @var object Category() instance for navigation*/
|
||||
private static $_category = NULL;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
/* Get current category */
|
||||
$id_cms_category = (int)(Tools::getValue('id_cms_category', Tools::getValue('id_cms_category_parent', 1)));
|
||||
self::$_category = new CMSCategory($id_cms_category);
|
||||
if (!Validate::isLoadedObject(self::$_category))
|
||||
die('Category cannot be loaded');
|
||||
|
||||
$this->table = array('cms_category', 'cms');
|
||||
$this->adminCMSCategories = new adminCMSCategories();
|
||||
$this->adminCMS = new adminCMS();
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current category
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public static function getCurrentCMSCategory()
|
||||
{
|
||||
return self::$_category;
|
||||
}
|
||||
|
||||
public function viewAccess($disable = false)
|
||||
{
|
||||
$result = parent::viewAccess($disable);
|
||||
$this->adminCMSCategories->tabAccess = $this->tabAccess;
|
||||
$this->adminCMS->tabAccess = $this->tabAccess;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitDelcms') OR Tools::isSubmit('previewSubmitAddcmsAndPreview') OR Tools::isSubmit('submitAddcms') OR isset($_GET['deletecms']) OR Tools::isSubmit('viewcms') OR (Tools::isSubmit('statuscms') AND Tools::isSubmit('id_cms')) OR (Tools::isSubmit('position') AND !Tools::isSubmit('id_cms_category_to_move')))
|
||||
$this->adminCMS->postProcess();
|
||||
if(Tools::isSubmit('submitDelcms_category') OR Tools::isSubmit('submitAddcms_categoryAndBackToParent') OR Tools::isSubmit('submitAddcms_category') OR isset($_GET['deletecms_category']) OR (Tools::isSubmit('statuscms_category') AND Tools::isSubmit('id_cms_category')) OR (Tools::isSubmit('position') AND Tools::isSubmit('id_cms_category_to_move')))
|
||||
$this->adminCMSCategories->postProcess();
|
||||
|
||||
}
|
||||
|
||||
public function displayErrors()
|
||||
{
|
||||
parent::displayErrors();
|
||||
$this->adminCMS->displayErrors();
|
||||
$this->adminCMSCategories->displayErrors();
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (((Tools::isSubmit('submitAddcms_category') OR Tools::isSubmit('submitAddcms_categoryAndStay')) AND sizeof($this->adminCMSCategories->_errors)) OR isset($_GET['updatecms_category']) OR isset($_GET['addcms_category']))
|
||||
{
|
||||
$this->adminCMSCategories->displayForm($this->token);
|
||||
echo '<br /><br /><a href="'.$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
|
||||
|
||||
}
|
||||
elseif (((Tools::isSubmit('submitAddcms') OR Tools::isSubmit('submitAddcmsAndStay')) AND sizeof($this->adminCMS->_errors)) OR isset($_GET['updatecms']) OR isset($_GET['addcms']))
|
||||
{
|
||||
$this->adminCMS->displayForm($this->token);
|
||||
echo '<br /><br /><a href="'.$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$id_cms_category = (int)(Tools::getValue('id_cms_category'));
|
||||
if (!$id_cms_category)
|
||||
$id_cms_category = 1;
|
||||
$cms_tabs = array('cms_category', 'cms');
|
||||
// Cleaning links
|
||||
$catBarIndex = $currentIndex;
|
||||
foreach ($cms_tabs AS $tab)
|
||||
if (Tools::getValue($tab.'Orderby') && Tools::getValue($tab.'Orderway'))
|
||||
$catBarIndex = preg_replace('/&'.$tab.'Orderby=([a-z _]*)&'.$tab.'Orderway=([a-z]*)/i', '', $currentIndex);
|
||||
echo '<div class="cat_bar"><span style="color: #3C8534;">'.$this->l('Current category').' :</span> '.getPath($catBarIndex, $id_cms_category,'','','cms').'</div>';
|
||||
echo '<h2>'.$this->l('Categories').'</h2>';
|
||||
$this->adminCMSCategories->display($this->token);
|
||||
echo '<div style="margin:10px"> </div>';
|
||||
echo '<h2>'.$this->l('Pages in this category').'</h2>';
|
||||
$this->adminCMS->display($this->token);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,379 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7321 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminCarriers extends AdminTab
|
||||
{
|
||||
protected $maxImageSize = 30000;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'carrier';
|
||||
$this->className = 'Carrier';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->deleted = true;
|
||||
$this->fieldImageSettings = array('name' => 'logo', 'dir' => 's');
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_carrier' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 100),
|
||||
'logo' => array('title' => $this->l('Logo'), 'align' => 'center', 'image' => 's', 'orderby' => false, 'search' => false),
|
||||
'delay' => array('title' => $this->l('Delay'), 'width' => 300, 'orderby' => false),
|
||||
'active' => array('title' => $this->l('Status'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
|
||||
'is_free' => array('title' => $this->l('Is Free'), 'align' => 'center', 'icon' => array(0 => 'disabled.gif', 1 => 'enabled.gif', 'default' => 'disabled.gif'), 'type' => 'bool', 'orderby' => false));
|
||||
|
||||
$this->optionTitle = $this->l('Carrier options');
|
||||
$this->_fieldsOptions = array(
|
||||
'PS_CARRIER_DEFAULT' => array('title' => $this->l('Default carrier:'), 'desc' => $this->l('The default carrier used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_carrier', 'list' => Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, ALL_CARRIERS)),
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function displayTop()
|
||||
{
|
||||
echo
|
||||
'<div class="hint clear" style="display:block;">'.
|
||||
' <b>'.$this->l('How to create a new carrier?').'</b>'.
|
||||
'<br />'.
|
||||
'<ul>'.'
|
||||
<li>'.$this->l('Click "Add new".').'<br />'.'</li>
|
||||
<li>'.$this->l('Fill in the fields and click "Save".').'</li>
|
||||
<li>'.$this->l('You need to decide a price range or a weight range for which the new carrier will be available. Under the "Shipping" tab, click either "Price Ranges" or "Weight Ranges".').'</li>
|
||||
<li>'.$this->l('Click "Add new".').'</li>
|
||||
<li>'.$this->l('Select the name of the carrier and define the price range or the weight range. For example the carrier can be made available for a weight range between 0 and 5kgs. Another carrier will have a range between 5 and 10kgs.').'</li>
|
||||
<li>'.$this->l('When you are done, click "Save".').'</li>
|
||||
<li>'.$this->l('Click on the "Shipping" tab.').'</li>
|
||||
<li>'.$this->l('You need to choose the fees that will be applied for this carrier. At the bottom on the page, in the "Fees" section, select the name of the carrier.').'</li>
|
||||
<li>'.$this->l('For each zone, enter a price. Click "Save".').'</li>
|
||||
<li>'.$this->l('You\'re set! The new carrier will be displayed to your customers.').'</li>
|
||||
</ul>
|
||||
</div><br />';
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$currentLanguage = (int)($cookie->id_lang);
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
// At the loading
|
||||
($("input[name=\'is_free\']:checked").val() == 0) ? $("#shipping_costs_div").show(): $("#shipping_costs_div").hide();
|
||||
|
||||
$("input[name=\'is_free\']").live("change", function(){
|
||||
($("input[name=\'is_free\']:checked").val() == 0) ? $("#shipping_costs_div").show(): $("#shipping_costs_div").hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post" enctype="multipart/form-data">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/delivery.gif" />'.$this->l('Carriers').'</legend>
|
||||
<label>'.$this->l('Company:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="25" name="name" value="'.htmlentities($this->getFieldValue($obj, 'name'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Allowed characters: letters, spaces and').' ().-<span class="hint-pointer"> </span></span>
|
||||
<p class="clear">'.$this->l('Carrier name displayed during checkout').'<br />'.$this->l('With a value of 0, the carrier name will be replaced by the shop name').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Logo:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="file" name="logo" />
|
||||
<p>'.$this->l('Upload logo from your computer').' (.gif, .jpg, .jpeg '.$this->l('or').' .png)</p>
|
||||
</div>
|
||||
<label>'.$this->l('Transit time:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="delay_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" size="41" maxlength="128" name="delay_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'delay', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'delay', 'delay');
|
||||
echo '
|
||||
<p style="clear: both">'.$this->l('Time taken for product delivery; displayed during checkout').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('URL:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="40" name="url" value="'.htmlentities($this->getFieldValue($obj, 'url'), ENT_COMPAT, 'UTF-8').'" />
|
||||
<p class="clear">'.$this->l('URL for the tracking number; type \'@\' where the tracking number will appear').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Zone').'</label>
|
||||
<div class="margin-form">';
|
||||
$carrier_zones = $obj->getZones();
|
||||
$zones = Zone::getZones(false);
|
||||
foreach ($zones AS $zone)
|
||||
echo '<input type="checkbox" id="zone_'.$zone['id_zone'].'" name="zone_'.$zone['id_zone'].'" value="true" '.(Tools::getValue('zone_'.$zone['id_zone'], (is_array($carrier_zones) AND in_array(array('id_carrier' => $obj->id, 'id_zone' => $zone['id_zone'], 'name' => $zone['name'], 'active' => $zone['active']), $carrier_zones))) ? ' checked="checked"' : '').'><label class="t" for="zone_'.$zone['id_zone'].'"> <b>'.$zone['name'].'</b></label><br />';
|
||||
echo '<p>'.$this->l('The zone in which this carrier is to be used').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Group access').'</label>
|
||||
<div class="margin-form">';
|
||||
$groups = Group::getGroups((int)($cookie->id_lang));
|
||||
if (sizeof($groups))
|
||||
{
|
||||
echo '
|
||||
<table cellspacing="0" cellpadding="0" class="table" style="width: 28em;">
|
||||
<tr>
|
||||
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'groupBox[]\', this.checked)"'.(!isset($obj->id) ? 'checked="checked" ' : '').' /></th>
|
||||
<th>'.$this->l('ID').'</th>
|
||||
<th>'.$this->l('Group name').'</th>
|
||||
</tr>';
|
||||
$irow = 0;
|
||||
foreach ($groups as $group)
|
||||
echo '
|
||||
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
|
||||
<td><input type="checkbox" name="groupBox[]" class="groupBox" id="groupBox_'.$group['id_group'].'" value="'.$group['id_group'].'" '.((Db::getInstance()->getValue('SELECT id_group FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier='.(int)($obj->id).' AND id_group='.(int)($group['id_group'])) OR (!isset($obj->id))) ? 'checked="checked" ' : '').'/></td>
|
||||
<td>'.$group['id_group'].'</td>
|
||||
<td><label for="groupBox_'.$group['id_group'].'" class="t">'.$group['name'].'</label></td>
|
||||
</tr>';
|
||||
echo '
|
||||
</table>
|
||||
<p style="padding:0px; margin:10px 0px 10px 0px;">'.$this->l('Mark all groups you want to give access to this carrier').'</p>
|
||||
';
|
||||
}
|
||||
else
|
||||
echo '<p>'.$this->l('No group created').'</p>';
|
||||
echo ' </div>
|
||||
<label>'.$this->l('Status:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.(!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Include or exclude carrier from list of carriers on Front Office').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Apply shipping cost:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="is_free" id="is_free_on" value="0" '.(!$this->getFieldValue($obj, 'is_free') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" /></label>
|
||||
<input type="radio" name="is_free" id="is_free_off" value="1" '.($this->getFieldValue($obj, 'is_free') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" /></label>
|
||||
<p>'.$this->l('Apply shipping costs and additional shipping costs by products in carrier price').'</p>
|
||||
</div>
|
||||
<div id="shipping_costs_div">
|
||||
<label>'.$this->l('Tax').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="id_tax_rules_group" id="id_tax_rules_group" '.(Tax::excludeTaxeOption() ? 'disabled="disabled"' : '' ).'>
|
||||
<option value="0">'.$this->l('No Tax').'</option>';
|
||||
foreach (TaxRulesGroup::getTaxRulesGroups(true) AS $tax_rules_group)
|
||||
echo '<option value="'.$tax_rules_group['id_tax_rules_group'].'" '.(($this->getFieldValue($obj, 'id_tax_rules_group') == $tax_rules_group['id_tax_rules_group']) ? ' selected="selected"' : '').'>'.$tax_rules_group['name'].'</option>';
|
||||
echo '</select>
|
||||
</div>
|
||||
<label>'.$this->l('Shipping & handling:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="shipping_handling" id="shipping_handling_on" value="1" '.($this->getFieldValue($obj, 'shipping_handling') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="shipping_handling_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="shipping_handling" id="shipping_handling_off" value="0" '.(!$this->getFieldValue($obj, 'shipping_handling') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="shipping_handling_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Include the shipping & handling costs in carrier price').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Billing:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="shipping_method" id="billing_default" value="'.Carrier::SHIPPING_METHOD_DEFAULT.'" '.($this->getFieldValue($obj, 'shipping_method') == Carrier::SHIPPING_METHOD_DEFAULT ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="billing_default">'.$this->l('Default behavior').'</label><br />
|
||||
<input type="radio" name="shipping_method" id="billing_price" value="'.Carrier::SHIPPING_METHOD_PRICE.'" '.($this->getFieldValue($obj, 'shipping_method') == Carrier::SHIPPING_METHOD_PRICE ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="billing_price">'.$this->l('According to total price').'</label><br />
|
||||
<input type="radio" name="shipping_method" id="billing_weight" value="'.Carrier::SHIPPING_METHOD_WEIGHT.'" '.($this->getFieldValue($obj, 'shipping_method') == Carrier::SHIPPING_METHOD_WEIGHT ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="billing_weight">'.$this->l('According to total weight').'</label><br />
|
||||
</div>
|
||||
<label>'.$this->l('Out-of-range behavior:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="range_behavior">
|
||||
<option value="0"'.(!$this->getFieldValue($obj, 'range_behavior') ? ' selected="selected"' : '').'>'.$this->l('Apply the cost of the highest defined range').'</option>
|
||||
<option value="1"'.($this->getFieldValue($obj, 'range_behavior') ? ' selected="selected"' : '').'>'.$this->l('Disable carrier').'</option>
|
||||
</select>
|
||||
<p>'.$this->l('Out-of-range behavior when none is defined (e.g., when a customer\'s cart weight is greater than the highest range limit)').'</p>
|
||||
</div>';
|
||||
if($this->getFieldValue($obj, 'is_module'))
|
||||
{
|
||||
echo '<label>'.$this->l('Module:').' </label>
|
||||
<div class="margin-form"><p> - '.
|
||||
$this->l('This carrier is bound to this module ').' => '.$this->getFieldValue($obj, 'external_module_name').'</p>
|
||||
<input type="hidden" name="is_module" value="1">
|
||||
<input type="hidden" name="external_module_name" value="'.$this->getFieldValue($obj, 'external_module_name').'">';
|
||||
|
||||
if($this->getFieldValue($obj, 'shipping_external'))
|
||||
{
|
||||
echo '<p> - '.$this->l('The shipping costs are calculated outside of your shop').'</p>
|
||||
<input type="hidden" name="shipping_external" value="1">';
|
||||
}
|
||||
if($this->getFieldValue($obj, 'need_range'))
|
||||
{
|
||||
echo '<p> - '.$this->l('This carrier uses PrestaShop range to calculate shipping costs').'</p>
|
||||
<input type="hidden" name="need_range" value="1">';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoShop();
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
public function beforeDelete($object)
|
||||
{
|
||||
return $object->isUsed();
|
||||
}
|
||||
|
||||
public function afterDelete($object, $oldId)
|
||||
{
|
||||
$object->copyCarrierData((int)($oldId));
|
||||
}
|
||||
|
||||
private function changeGroups($id_carrier, $delete = true)
|
||||
{
|
||||
if ($delete)
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier='.(int)($id_carrier));
|
||||
$groups = Db::getInstance()->ExecuteS('SELECT id_group FROM `'._DB_PREFIX_.'group`');
|
||||
foreach ($groups as $group)
|
||||
if (in_array($group['id_group'], $_POST['groupBox']))
|
||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'carrier_group (id_group, id_carrier) VALUES('.(int)($group['id_group']).','.(int)($id_carrier).')');
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::getValue('submitAdd'.$this->table))
|
||||
{
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
$id = (int)(Tools::getValue('id_'.$this->table));
|
||||
|
||||
/* Object update */
|
||||
if (isset($id) AND !empty($id))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
$object = new $this->className($id);
|
||||
if (Validate::isLoadedObject($object))
|
||||
{
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier='.(int)($id));
|
||||
$object->deleted = 1;
|
||||
$object->update();
|
||||
$objectNew = new $this->className();
|
||||
$this->copyFromPost($objectNew, $this->table);
|
||||
$result = $objectNew->add();
|
||||
if (Validate::isLoadedObject($objectNew))
|
||||
{
|
||||
$this->afterDelete($objectNew, $object->id);
|
||||
Hook::updateCarrier((int)($object->id), $objectNew);
|
||||
}
|
||||
$this->changeGroups($objectNew->id);
|
||||
if (!$result)
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b>';
|
||||
elseif ($this->postImage($objectNew->id))
|
||||
{
|
||||
$this->changeZones($objectNew->id);
|
||||
Tools::redirectAdmin($currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
/* Object creation */
|
||||
else
|
||||
{
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
{
|
||||
$object = new $this->className();
|
||||
$this->copyFromPost($object, $this->table);
|
||||
if (!$object->add())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
|
||||
elseif (($_POST['id_'.$this->table] = $object->id /* voluntary */) AND $this->postImage($object->id) AND $this->_redirect)
|
||||
{
|
||||
$this->changeZones($object->id);
|
||||
$this->changeGroups($object->id);
|
||||
Tools::redirectAdmin($currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=3'.'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox')))
|
||||
OR (isset($_GET['delete'.$this->table]) AND Tools::getValue('id_carrier') == Configuration::get('PS_CARRIER_DEFAULT')))
|
||||
$this->_errors[] = $this->l('Please set another carrier as default before deleting');
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function changeZones($id)
|
||||
{
|
||||
$carrier = new $this->className($id);
|
||||
if (!Validate::isLoadedObject($carrier))
|
||||
die (Tools::displayError('Object cannot be loaded'));
|
||||
$zones = Zone::getZones(true);
|
||||
foreach ($zones as $zone)
|
||||
if (sizeof($carrier->getZone($zone['id_zone'])))
|
||||
{
|
||||
if (!isset($_POST['zone_'.$zone['id_zone']]) OR !$_POST['zone_'.$zone['id_zone']])
|
||||
$carrier->deleteZone($zone['id_zone']);
|
||||
}
|
||||
else
|
||||
if (isset($_POST['zone_'.$zone['id_zone']]) AND $_POST['zone_'.$zone['id_zone']])
|
||||
$carrier->addZone($zone['id_zone']);
|
||||
}
|
||||
|
||||
public function displayListContent($token = NULL)
|
||||
{
|
||||
foreach ($this->_list as $key => $list)
|
||||
if ($list['name'] == '0')
|
||||
$this->_list[$key]['name'] = Configuration::get('PS_SHOP_NAME');
|
||||
parent::displayListContent($token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,344 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7310 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminCarts extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'cart';
|
||||
$this->className = 'Cart';
|
||||
$this->lang = false;
|
||||
$this->edit = false;
|
||||
$this->view = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->_select = 'CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) `customer`, a.id_cart total, ca.name carrier, o.id_order ';
|
||||
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'customer c ON (c.id_customer = a.id_customer)
|
||||
LEFT JOIN '._DB_PREFIX_.'currency cu ON (cu.id_currency = a.id_currency)
|
||||
LEFT JOIN '._DB_PREFIX_.'carrier ca ON (ca.id_carrier = a.id_carrier)
|
||||
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_cart = a.id_cart) ';
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_cart' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'id_order' => array('title' => $this->l('ID Order'), 'align' => 'center', 'width' => 25),
|
||||
'customer' => array('title' => $this->l('Customer'), 'width' => 80, 'filter_key' => 'c!lastname'),
|
||||
'total' => array('title' => $this->l('Total'), 'callback' => 'getOrderTotalUsingTaxCalculationMethod', 'orderby' => false, 'search' => false, 'width' => 50, 'align' => 'right', 'prefix' => '<b>', 'suffix' => '</b>', 'currency' => true),
|
||||
'carrier' => array('title' => $this->l('Carrier'), 'width' => 25, 'align' => 'center', 'callback' => 'replaceZeroByShopName', 'filter_key' => 'ca!name'),
|
||||
'date_add' => array('title' => $this->l('Date'), 'width' => 90, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'));
|
||||
$this->shopLinkType = 'shop';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function viewDetails()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
if (!($cart = $this->loadObject(true)))
|
||||
return;
|
||||
$customer = new Customer($cart->id_customer);
|
||||
$customerStats = $customer->getStats();
|
||||
$products = $cart->getProducts();
|
||||
$customizedDatas = Product::getAllCustomizedDatas((int)($cart->id));
|
||||
Product::addCustomizationPrice($products, $customizedDatas);
|
||||
$summary = $cart->getSummaryDetails();
|
||||
$discounts = $cart->getDiscounts();
|
||||
|
||||
$currency = new Currency($cart->id_currency);
|
||||
$currentLanguage = new Language((int)($cookie->id_lang));
|
||||
|
||||
// display cart header
|
||||
echo '<h2>'.(($customer->id) ? $customer->firstname.' '.$customer->lastname : $this->l('Guest')).' - '.$this->l('Cart #').sprintf('%06d', $cart->id).' '.$this->l('from').' '.$cart->date_upd.'</h2>';
|
||||
|
||||
/* Display customer information */
|
||||
echo '
|
||||
<br />
|
||||
<div style="float: left;">
|
||||
<fieldset style="width: 400px">
|
||||
<legend><img src="../img/admin/tab-customers.gif" /> '.$this->l('Customer information').'</legend>
|
||||
<span style="font-weight: bold; font-size: 14px;">';
|
||||
if ($customer->id)
|
||||
echo '
|
||||
<a href="?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'"> '.$customer->firstname.' '.$customer->lastname.'</a></span> ('.$this->l('#').$customer->id.')<br />
|
||||
(<a href="mailto:'.$customer->email.'">'.$customer->email.'</a>)<br /><br />
|
||||
'.$this->l('Account registered:').' '.Tools::displayDate($customer->date_add, (int)($cookie->id_lang), true).'<br />
|
||||
'.$this->l('Valid orders placed:').' <b>'.$customerStats['nb_orders'].'</b><br />
|
||||
'.$this->l('Total paid since registration:').' <b>'.Tools::displayPrice($customerStats['total_orders'], $currency, false).'</b><br />';
|
||||
else
|
||||
echo $this->l('Guest not registered').'</span>';
|
||||
echo '</fieldset>';
|
||||
echo '
|
||||
</div>
|
||||
<div style="float: left; margin-left: 40px">';
|
||||
|
||||
/* Display order information */
|
||||
$id_order = (int)(Order::getOrderByCartId($cart->id));
|
||||
$order = new Order($id_order);
|
||||
|
||||
if ($order->getTaxCalculationMethod() == PS_TAX_EXC)
|
||||
{
|
||||
$total_products = $summary['total_products'];
|
||||
$total_discount = $summary['total_discounts_tax_exc'];
|
||||
$total_wrapping = $summary['total_wrapping_tax_exc'];
|
||||
$total_price = $summary['total_price_without_tax'];
|
||||
$total_shipping = $summary['total_shipping_tax_exc'];
|
||||
} else {
|
||||
$total_products = $summary['total_products_wt'];
|
||||
$total_discount = $summary['total_discounts'];
|
||||
$total_wrapping = $summary['total_wrapping'];
|
||||
$total_price = $summary['total_price'];
|
||||
$total_shipping = $summary['total_shipping'];
|
||||
}
|
||||
|
||||
echo '
|
||||
<fieldset style="width: 400px">
|
||||
<legend><img src="../img/admin/cart.gif" /> '.$this->l('Order information').'</legend>
|
||||
<span style="font-weight: bold; font-size: 14px;">';
|
||||
if ($order->id)
|
||||
echo '
|
||||
<a href="?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'"> '.$this->l('Order #').sprintf('%06d', $order->id).'</a></span>
|
||||
<br /><br />
|
||||
'.$this->l('Made on:').' '.Tools::displayDate($order->date_add, (int)$cookie->id_lang, true).'<br /><br /><br /><br />';
|
||||
else
|
||||
echo $this->l('No order created from this cart').'</span>';
|
||||
echo '</fieldset>';
|
||||
echo '
|
||||
</div>';
|
||||
|
||||
|
||||
// List of products
|
||||
echo '
|
||||
<br style="clear:both;" />
|
||||
<fieldset style="margin-top:25px; width: 715px; ">
|
||||
<legend><img src="../img/admin/cart.gif" alt="'.$this->l('Products').'" />'.$this->l('Cart summary').'</legend>
|
||||
<div style="float:left;">
|
||||
<table style="width: 700px;" cellspacing="0" cellpadding="0" class="table" id="orderProducts">
|
||||
<tr>
|
||||
<th align="center" style="width: 60px"> </th>
|
||||
<th>'.$this->l('Product').'</th>
|
||||
<th style="width: 80px; text-align: center">'.$this->l('UP').'</th>
|
||||
<th style="width: 20px; text-align: center">'.$this->l('Qty').'</th>
|
||||
<th style="width: 30px; text-align: center">'.$this->l('Stock').'</th>
|
||||
<th style="width: 90px; text-align: right; font-weight:bold;">'.$this->l('Total').'</th>
|
||||
</tr>';
|
||||
$tokenCatalog = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee));
|
||||
foreach ($products as $k => $product)
|
||||
{
|
||||
if ($order->getTaxCalculationMethod() == PS_TAX_EXC)
|
||||
{
|
||||
$product_price = $product['price'];
|
||||
$product_total = $product['total'];
|
||||
} else {
|
||||
$product_price = $product['price_wt'];
|
||||
$product_total = $product['total_wt'];
|
||||
}
|
||||
|
||||
|
||||
$image = array();
|
||||
if (isset($product['id_product_attribute']) AND (int)($product['id_product_attribute']))
|
||||
$image = Db::getInstance()->getRow('
|
||||
SELECT id_image
|
||||
FROM '._DB_PREFIX_.'product_attribute_image
|
||||
WHERE id_product_attribute = '.(int)($product['id_product_attribute']));
|
||||
if (!isset($image['id_image']))
|
||||
$image = Db::getInstance()->getRow('
|
||||
SELECT id_image
|
||||
FROM '._DB_PREFIX_.'image
|
||||
WHERE id_product = '.(int)($product['id_product']).' AND cover = 1');
|
||||
|
||||
$productObj = new Product($product['id_product']);
|
||||
|
||||
/* Customization display */
|
||||
$this->displayCustomizedDatas($customizedDatas, $product, $currency, $image, $tokenCatalog, $stock);
|
||||
if ($product['cart_quantity'] > $product['customizationQuantityTotal'])
|
||||
{
|
||||
$imageProduct = new Image($image['id_image']);
|
||||
echo '
|
||||
<tr>
|
||||
<td align="center">'.(isset($image['id_image']) ? cacheImage(_PS_IMG_DIR_.'p/'.$imageProduct->getExistingImgPath().'.jpg',
|
||||
'product_mini_'.(int)($product['id_product']).(isset($product['id_product_attribute']) ? '_'.(int)($product['id_product_attribute']) : '').'.jpg', 45, 'jpg') : '--').'</td>
|
||||
<td><a href="index.php?tab=AdminCatalog&id_product='.$product['id_product'].'&updateproduct&token='.$tokenCatalog.'">
|
||||
<span class="productName">'.$product['name'].'</span><br />
|
||||
'.($product['reference'] ? $this->l('Ref:').' '.$product['reference'] : '')
|
||||
.(($product['reference'] AND $product['supplier_reference']) ? ' / '.$product['supplier_reference'] : '')
|
||||
.'</a></td>
|
||||
<td align="center">'.Tools::displayPrice($product_price, $currency, false).'</td>
|
||||
<td align="center" class="productQuantity">'.((int)($product['cart_quantity']) - $product['customizationQuantityTotal']).'</td>
|
||||
<td align="center" class="productQuantity">'.$productObj->getStock(isset($product['id_product_attribute']) ? $product['id_product_attribute'] : 0).'</td>
|
||||
<td align="right">'.Tools::displayPrice($product_total, $currency, false).'</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
echo '
|
||||
<tr class="cart_total_product">
|
||||
<td colspan="5">'.$this->l('Total products:').'</td>
|
||||
<td class="price bold right">'.Tools::displayPrice($total_products, $currency, false).'</td>
|
||||
</tr>';
|
||||
|
||||
if ($summary['total_discounts'] != 0)
|
||||
echo '
|
||||
<tr class="cart_total_voucher">
|
||||
<td colspan="5">'.$this->l('Total vouchers:').'</td>
|
||||
<td class="price-discount bold right">'.Tools::displayPrice($total_discount, $currency, false).'</td>
|
||||
</tr>';
|
||||
if ($summary['total_wrapping'] > 0)
|
||||
echo '
|
||||
<tr class="cart_total_voucher">
|
||||
<td colspan="5">'.$this->l('Total gift-wrapping:').'</td>
|
||||
<td class="price-discount bold right">'.Tools::displayPrice($total_wrapping, $currency, false).'</td>
|
||||
</tr>';
|
||||
if ($cart->getOrderTotal(true, Cart::ONLY_SHIPPING) > 0)
|
||||
echo '
|
||||
<tr class="cart_total_delivery">
|
||||
<td colspan="5">'.$this->l('Total shipping:').'</td>
|
||||
<td class="price bold right">'.Tools::displayPrice($total_shipping, $currency, false).'</td>
|
||||
</tr>';
|
||||
echo '
|
||||
<tr class="cart_total_price">
|
||||
<td colspan="5" class="bold">'.$this->l('Total:').'</td>
|
||||
<td class="price bold right">'.Tools::displayPrice($total_price, $currency, false).'</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
if (sizeof($discounts))
|
||||
{
|
||||
echo '
|
||||
<table cellspacing="0" cellpadding="0" class="table" style="width:280px; margin:15px 0px 0px 420px;">
|
||||
<tr>
|
||||
<th><img src="../img/admin/coupon.gif" alt="'.$this->l('Discounts').'" />'.$this->l('Discount name').'</th>
|
||||
<th align="center" style="width: 100px">'.$this->l('Value').'</th>
|
||||
</tr>';
|
||||
|
||||
foreach ($discounts as $discount)
|
||||
echo '
|
||||
<tr>
|
||||
<td><a href="?tab=AdminDiscounts&id_discount='.$discount['id_discount'].'&updatediscount&token='.Tools::getAdminToken('AdminDiscounts'.(int)(Tab::getIdFromClassName('AdminDiscounts')).(int)($cookie->id_employee)).'">'.$discount['name'].'</a></td>
|
||||
<td align="center">- '.Tools::displayPrice($discount['value_real'], $currency, false).'</td>
|
||||
</tr>';
|
||||
echo '
|
||||
</table>';
|
||||
}
|
||||
echo '<div style="float:left; margin-top:15px;">'.
|
||||
$this->l('According to the group of this customer, prices are printed:').' '.($order->getTaxCalculationMethod() == PS_TAX_EXC ? $this->l('tax excluded.') : $this->l('tax included.')).'
|
||||
</div></div>';
|
||||
|
||||
// Cancel product
|
||||
echo '
|
||||
</fieldset>
|
||||
<div class="clear" style="height:20px;"> </div>';
|
||||
}
|
||||
|
||||
private function displayCustomizedDatas(&$customizedDatas, &$product, &$currency, &$image, $tokenCatalog, &$stock)
|
||||
{
|
||||
if (!($order = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
if (is_array($customizedDatas) AND isset($customizedDatas[(int)($product['id_product'])][(int)($product['id_product_attribute'])]))
|
||||
{
|
||||
$image = new Image($image['id_image']);
|
||||
echo '
|
||||
<tr>
|
||||
<td align="center">'.(isset($image['id_image']) ? cacheImage(_PS_IMG_DIR_.'p/'.$image->getExistingImgPath().'.jpg',
|
||||
'product_mini_'.(int)($product['id_product']).(isset($product['id_product_attribute']) ? '_'.(int)($product['id_product_attribute']) : '').'.jpg', 45, 'jpg') : '--').'</td>
|
||||
<td><a href="index.php?tab=AdminCatalog&id_product='.$product['id_product'].'&updateproduct&token='.$tokenCatalog.'">
|
||||
<span class="productName">'.$product['name'].'</span><br />
|
||||
'.($product['reference'] ? $this->l('Ref:').' '.$product['reference'] : '')
|
||||
.(($product['reference'] AND $product['supplier_reference']) ? ' / '.$product['supplier_reference'] : '')
|
||||
.'</a></td>
|
||||
<td align="center">'.Tools::displayPrice($product['price_wt'], $currency, false).'</td>
|
||||
<td align="center" class="productQuantity">'.$product['customizationQuantityTotal'].'</td>
|
||||
<td align="center" class="productQuantity">'.(int)($stock['quantity']).'</td>
|
||||
<td align="right">'.Tools::displayPrice($product['total_customization_wt'], $currency, false).'</td>
|
||||
</tr>';
|
||||
foreach ($customizedDatas[(int)($product['id_product'])][(int)($product['id_product_attribute'])] AS $customization)
|
||||
{
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="2">';
|
||||
foreach ($customization['datas'] AS $type => $datas)
|
||||
if ($type == _CUSTOMIZE_FILE_)
|
||||
{
|
||||
$i = 0;
|
||||
echo '<ul style="margin: 4px 0px 4px 0px; padding: 0px; list-style-type: none;">';
|
||||
foreach ($datas AS $data)
|
||||
echo '<li style="display: inline; margin: 2px;">
|
||||
<a href="displayImage.php?img='.$data['value'].'&name='.(int)($order->id).'-file'.++$i.'" target="_blank"><img src="'._THEME_PROD_PIC_DIR_.$data['value'].'_small" alt="" /></a>
|
||||
</li>';
|
||||
echo '</ul>';
|
||||
}
|
||||
elseif ($type == _CUSTOMIZE_TEXTFIELD_)
|
||||
{
|
||||
$i = 0;
|
||||
echo '<ul style="margin: 0px 0px 4px 0px; padding: 0px 0px 0px 6px; list-style-type: none;">';
|
||||
foreach ($datas AS $data)
|
||||
echo '<li>'.($data['name'] ? $data['name'] : $this->l('Text #').++$i).$this->l(':').' '.$data['value'].'</li>';
|
||||
echo '</ul>';
|
||||
}
|
||||
echo '</td>
|
||||
<td align="center"></td>
|
||||
<td align="center" class="productQuantity">'.$customization['quantity'].'</td>
|
||||
<td align="center" class="productQuantity"></td>
|
||||
<td align="center"></td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (isset($_GET['view'.$this->table]))
|
||||
$this->viewDetails();
|
||||
else
|
||||
{
|
||||
$this->getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$this->displayList();
|
||||
}
|
||||
}
|
||||
|
||||
protected function _displayDeleteLink($token = NULL, $id)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
foreach ($this->_list as $cart)
|
||||
if ($id == $cart['id_cart'])
|
||||
if ($cart['id_order'])
|
||||
return;
|
||||
|
||||
$_cacheLang['Delete'] = $this->l('Delete', __CLASS__, true, false);
|
||||
$_cacheLang['DeleteItem'] = $this->l('Delete item #', __CLASS__, true, false).$id.' ?)';
|
||||
|
||||
echo '
|
||||
<a href="'.$currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&token='.($token != null ? $token : $this->token).'" onclick="return confirm(\''.$_cacheLang['DeleteItem'].'\');">
|
||||
<img src="../img/admin/delete.gif" alt="'.$_cacheLang['Delete'].'" title="'.$_cacheLang['Delete'].'" /></a>
|
||||
';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,204 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7499 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
include(PS_ADMIN_DIR.'/tabs/AdminCategories.php');
|
||||
include(PS_ADMIN_DIR.'/tabs/AdminProducts.php');
|
||||
|
||||
class AdminCatalog extends AdminTab
|
||||
{
|
||||
/** @var object AdminCategories() instance */
|
||||
private $adminCategories;
|
||||
|
||||
/** @var object AdminProducts() instance */
|
||||
private $adminProducts;
|
||||
|
||||
/** @var object AttributeGenerator() instance */
|
||||
private $attributeGenerator;
|
||||
|
||||
/** @var object imageResize() instance */
|
||||
private $imageResize;
|
||||
|
||||
/** @var object Category() instance for navigation*/
|
||||
private static $_category = NULL;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
/* Get current category */
|
||||
$id_category = abs(Tools::getValue('id_category'));
|
||||
$shop = new Shop(Shop::getCurrentShop(true));
|
||||
if (!$id_category)
|
||||
$id_category = $shop->id_category;
|
||||
else if ($id_category != $shop->id_category)
|
||||
{
|
||||
// Check if current category is "inside" shop default category
|
||||
$sql = 'SELECT nleft, nright FROM '._DB_PREFIX_.'category
|
||||
WHERE id_category = '.$shop->id_category;
|
||||
if ($result = Db::getInstance()->getRow($sql))
|
||||
{
|
||||
$sql = 'SELECT id_category FROM '._DB_PREFIX_.'category
|
||||
WHERE id_category = '.(int)$id_category.'
|
||||
AND nleft >= '.$result['nleft'].'
|
||||
AND nright <= '.$result['nright'];
|
||||
if (!Db::getInstance()->getValue($sql))
|
||||
$id_category = $shop->id_category;
|
||||
}
|
||||
}
|
||||
|
||||
self::$_category = new Category($id_category, NULL, Shop::getCurrentShop(true));
|
||||
if (!Validate::isLoadedObject(self::$_category))
|
||||
die('Category cannot be loaded');
|
||||
|
||||
$this->table = array('category', 'product');
|
||||
$this->adminCategories = new AdminCategories();
|
||||
$this->adminProducts = new AdminProducts();
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current category
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public static function getCurrentCategory()
|
||||
{
|
||||
return self::$_category;
|
||||
}
|
||||
|
||||
public function viewAccess($disable = false)
|
||||
{
|
||||
$result = parent::viewAccess($disable);
|
||||
$this->adminCategories->tabAccess = $this->tabAccess;
|
||||
$this->adminProducts->tabAccess = $this->tabAccess;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (!Tools::getValue('id_product'))
|
||||
$this->adminCategories->postProcess();
|
||||
elseif (isset($_GET['attributegenerator']))
|
||||
{
|
||||
if (!isset($this->attributeGenerator))
|
||||
{
|
||||
include_once(PS_ADMIN_DIR.'/tabs/AdminAttributeGenerator.php');
|
||||
$this->attributeGenerator = new AdminAttributeGenerator();
|
||||
}
|
||||
$this->attributeGenerator->postProcess();
|
||||
}
|
||||
elseif (isset($_GET['imageresize']))
|
||||
{
|
||||
if (!isset($this->imageResize))
|
||||
{
|
||||
include_once(PS_ADMIN_DIR.'/tabs/AdminImageResize.php');
|
||||
$this->imageResize = new AdminImageResize();
|
||||
}
|
||||
$this->imageResize->postProcess();
|
||||
}
|
||||
$this->adminProducts->postProcess($this->token);
|
||||
}
|
||||
|
||||
public function displayErrors()
|
||||
{
|
||||
parent::displayErrors();
|
||||
$this->adminProducts->displayErrors();
|
||||
$this->adminCategories->displayErrors();
|
||||
if (Validate::isLoadedObject($this->attributeGenerator))
|
||||
$this->attributeGenerator->displayErrors();
|
||||
if (Validate::isLoadedObject($this->imageResize))
|
||||
$this->imageResize->displayErrors();
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (((Tools::isSubmit('submitAddcategory') OR Tools::isSubmit('submitAddcategoryAndStay')) AND sizeof($this->adminCategories->_errors)) OR isset($_GET['updatecategory']) OR isset($_GET['addcategory']))
|
||||
{
|
||||
$this->adminCategories->displayForm($this->token);
|
||||
echo '<br /><br /><a href="'.$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
|
||||
}
|
||||
elseif (((Tools::isSubmit('submitAddproduct') OR Tools::isSubmit('submitAddproductAndPreview') OR Tools::isSubmit('submitAddproductAndStay') OR Tools::isSubmit('submitSpecificPricePriorities') OR Tools::isSubmit('submitPriceAddition') OR Tools::isSubmit('submitPricesModification')) AND sizeof($this->adminProducts->_errors)) OR Tools::isSubmit('updateproduct') OR Tools::isSubmit('addproduct'))
|
||||
{
|
||||
$this->adminProducts->displayForm($this->token);
|
||||
if (Tools::getValue('id_category') > 1)
|
||||
echo '<br /><br /><a href="index.php?tab='.Tools::getValue('tab').'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to home').'</a><br />';
|
||||
else
|
||||
echo '<br /><br /><a href="index.php?tab='.Tools::getValue('tab').'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to catalog').'</a><br />';
|
||||
}
|
||||
elseif (isset($_GET['attributegenerator']))
|
||||
{
|
||||
if (!isset($this->attributeGenerator))
|
||||
{
|
||||
include_once(PS_ADMIN_DIR.'/tabs/AdminAttributeGenerator.php');
|
||||
$this->attributeGenerator = new AdminAttributeGenerator();
|
||||
}
|
||||
$this->attributeGenerator->displayForm();
|
||||
}
|
||||
elseif (isset($_GET['imageresize']))
|
||||
{
|
||||
if (!isset($this->imageResize))
|
||||
{
|
||||
include_once(PS_ADMIN_DIR.'/tabs/AdminImageResize.php');
|
||||
$this->imageResize = new AdminImageResize();
|
||||
}
|
||||
$this->imageResize->displayForm();
|
||||
}
|
||||
elseif (!isset($_GET['editImage']))
|
||||
{
|
||||
$home = false;
|
||||
$id_category = (int)(Tools::getValue('id_category'));
|
||||
if (!$id_category)
|
||||
{
|
||||
$home = true;
|
||||
if (Shop::getContextType() == Shop::CONTEXT_SHOP)
|
||||
{
|
||||
$shop = new Shop((int)Shop::getCurrentShop());
|
||||
$id_category = $shop->id_category;
|
||||
}
|
||||
else
|
||||
$id_category = 1;
|
||||
}
|
||||
$catalog_tabs = array('category', 'product');
|
||||
// Cleaning links
|
||||
$catBarIndex = $currentIndex;
|
||||
foreach ($catalog_tabs AS $tab)
|
||||
if (Tools::getValue($tab.'Orderby') && Tools::getValue($tab.'Orderway'))
|
||||
$catBarIndex = preg_replace('/&'.$tab.'Orderby=([a-z _]*)&'.$tab.'Orderway=([a-z]*)/i', '', $currentIndex);
|
||||
|
||||
echo '<div class="cat_bar"><span style="color: #3C8534;">'.$this->l('Current category').' :</span> '.getPath($catBarIndex, $id_category, '', '', 'catalog', $home).'</div>';
|
||||
echo '<h2>'.$this->l('Categories').'</h2>';
|
||||
$this->adminCategories->display($this->token);
|
||||
echo '<div style="margin:10px"> </div>';
|
||||
echo '<h2>'.$this->l('Products in this category').'</h2>';
|
||||
$this->adminProducts->display($this->token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,355 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7499 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminCategories extends AdminTab
|
||||
{
|
||||
protected $maxImageSize = 300000;
|
||||
|
||||
/** @var object Category() instance for navigation*/
|
||||
private $_category;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'category';
|
||||
$this->className = 'Category';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->view = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->fieldImageSettings = array('name' => 'image', 'dir' => 'c');
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_category' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 100),
|
||||
'description' => array('title' => $this->l('Description'), 'width' => 500, 'maxlength' => 90, 'orderby' => false),
|
||||
'position' => array('title' => $this->l('Position'), 'width' => 40,'filter_key' => 'position', 'align' => 'center', 'position' => 'position'),
|
||||
'active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
|
||||
|
||||
$this->_category = AdminCatalog::getCurrentCategory();
|
||||
$this->_filter = 'AND `id_parent` = '.(int)($this->_category->id);
|
||||
$this->_select = 'position ';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function displayList($token = NULL)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
/* Display list header (filtering, pagination and column names) */
|
||||
$this->displayListHeader($token);
|
||||
if (!sizeof($this->_list))
|
||||
echo '<tr><td class="center" colspan="'.(sizeof($this->fieldsDisplay) + 2).'">'.$this->l('No items found').'</td></tr>';
|
||||
|
||||
/* Show the content of the table */
|
||||
$this->displayListContent($token);
|
||||
|
||||
/* Close list table and submit button */
|
||||
$this->displayListFooter($token);
|
||||
}
|
||||
|
||||
public function display($token = NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$this->getList((int)($cookie->id_lang), !$cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$cookie->__get($this->table.'Orderway') ? 'ASC' : NULL, 0, NULL, (int)Shop::getCurrentShop(true));
|
||||
echo '<h3>'.(!$this->_listTotal ? ($this->l('There are no subcategories')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('subcategories') : $this->l('subcategory')))).' '.$this->l('in category').' "'.stripslashes($this->_category->getName()).'"</h3>';
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
echo '<a href="'.__PS_BASE_URI__.substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)).'?tab=AdminCatalog&add'.$this->table.'&id_parent='.$this->_category->id.'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new subcategory').'</a>';
|
||||
echo '<div style="margin:10px;">';
|
||||
$this->displayList($token);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
public function postProcess($token = NULL)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
|
||||
|
||||
if (Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
if ($id_category = (int)(Tools::getValue('id_category')))
|
||||
{
|
||||
if (!Category::checkBeforeMove($id_category, $this->_category->id))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Category cannot be moved here');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Change object statuts (active, inactive) */
|
||||
elseif (isset($_GET['status']) AND Tools::getValue($this->identifier))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->toggleStatus())
|
||||
{
|
||||
$target = '';
|
||||
if (($id_category = (int)(Tools::getValue('id_category'))) AND Tools::getValue('id_product'))
|
||||
$target = '&id_category='.(int)($id_category);
|
||||
else
|
||||
{
|
||||
$referrer = Tools::secureReferrer($_SERVER['HTTP_REFERER']);
|
||||
if (preg_match('/id_category=(\d+)/', $referrer, $matches))
|
||||
$target = '&id_category='.(int)($matches[1]);
|
||||
}
|
||||
Module::hookExec('categoryUpdate');
|
||||
Tools::redirectAdmin($currentIndex.'&conf=5'.$target.'&token='.Tools::getValue('token'));
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
/* Delete object */
|
||||
elseif (isset($_GET['delete'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()) AND isset($this->fieldImageSettings))
|
||||
{
|
||||
// check if request at least one object with noZeroObject
|
||||
if (isset($object->noZeroObject) AND sizeof($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1)
|
||||
$this->_errors[] = Tools::displayError('You need at least one object.').' <b>'.$this->table.'</b><br />'.Tools::displayError('You cannot delete all of the items.');
|
||||
else
|
||||
{
|
||||
if ($this->deleted)
|
||||
{
|
||||
$object->deleteImage();
|
||||
$object->deleted = 1;
|
||||
if ($object->update())
|
||||
Tools::redirectAdmin($currentIndex.'&conf=1&token='.Tools::getValue('token').'&id_category='.(int)($object->id_parent));
|
||||
}
|
||||
elseif ($object->delete())
|
||||
Tools::redirectAdmin($currentIndex.'&conf=1&token='.Tools::getValue('token').'&id_category='.(int)($object->id_parent));
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
elseif (isset($_GET['position']))
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
elseif (!Validate::isLoadedObject($object = new Category((int)(Tools::getValue($this->identifier, Tools::getValue('id_category_to_move', 1))))))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
if (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position'))))
|
||||
$this->_errors[] = Tools::displayError('Failed to update the position.');
|
||||
else
|
||||
Tools::redirectAdmin($currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier, Tools::getValue('id_category_parent', 1)))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCatalog'));
|
||||
}
|
||||
/* Delete multiple objects */
|
||||
elseif (Tools::getValue('submitDel'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (isset($_POST[$this->table.'Box']))
|
||||
{
|
||||
$category = new Category();
|
||||
$result = true;
|
||||
$result = $category->deleteSelection(Tools::getValue($this->table.'Box'));
|
||||
if ($result)
|
||||
{
|
||||
$category->cleanPositions((int)(Tools::getValue('id_category')));
|
||||
Tools::redirectAdmin($currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCatalog').'&id_category='.(int)(Tools::getValue('id_category')));
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
return;
|
||||
}
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
protected function postImage($id)
|
||||
{
|
||||
$ret = parent::postImage($id);
|
||||
if (($id_category = (int)(Tools::getValue('id_category'))) AND isset($_FILES) AND sizeof($_FILES) AND $_FILES['image']['name'] != NULL AND file_exists(_PS_CAT_IMG_DIR_.$id_category.'.jpg'))
|
||||
{
|
||||
$imagesTypes = ImageType::getImagesTypes('categories');
|
||||
foreach ($imagesTypes AS $k => $imageType)
|
||||
imageResize(_PS_CAT_IMG_DIR_.$id_category.'.jpg', _PS_CAT_IMG_DIR_.$id_category.'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height']));
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function displayForm($token = NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$active = $this->getFieldValue($obj, 'active');
|
||||
$customer_groups = $obj->getGroups();
|
||||
if (Shop::getContextType() == Shop::CONTEXT_SHOP)
|
||||
{
|
||||
$shop = new Shop(Shop::getCurrentShop());
|
||||
$id_category = $shop->id_category;
|
||||
}
|
||||
else
|
||||
$id_category = (int)Tools::getValue('id_parent');
|
||||
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.($token!=NULL ? $token : $this->token).'" method="post" enctype="multipart/form-data">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/tab-categories.gif" />'.$this->l('Category').'</legend>
|
||||
<label>'.$this->l('Name:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages AS $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" style="width: 260px" name="name_'.$language['id_lang'].'" id="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" '.((!$obj->id) ? ' onkeyup="copy2friendlyURL();"' : '').' /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}'.($obj->id ? '<br />'.$this->youEditFieldFor() : '').'<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Displayed:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.($active ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"><img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.(!$active ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"><img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
</div>
|
||||
<label>'.$this->l('Parent category:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_parent">';
|
||||
$categories = Category::getCategories((int)$cookie->id_lang, false);
|
||||
Category::recurseCategory($categories, $categories[0][1], 1, ($obj->id ? $this->getFieldValue($obj, 'id_parent') : $id_category));
|
||||
echo '
|
||||
</select>
|
||||
</div>
|
||||
<label>'.$this->l('Description:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages AS $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<textarea name="description_'.$language['id_lang'].'" rows="5" cols="40">'.htmlentities($this->getFieldValue($obj, 'description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'</textarea>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Image:').' </label>
|
||||
<div class="margin-form">';
|
||||
echo $this->displayImage($obj->id, _PS_IMG_DIR_.'c/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)), true);
|
||||
echo ' <br /><input type="file" name="image" />
|
||||
<p>'.$this->l('Upload category logo from your computer').'</p>
|
||||
</div>
|
||||
<div class="clear"><br /></div>
|
||||
<label>'.$this->l('Meta title:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages AS $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_title_'.$language['id_lang'].'" id="meta_title_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_title', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}'.($obj->id ? '<br />'.$this->youEditFieldFor() : '').'<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Meta description:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages AS $language)
|
||||
echo '<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_description_'.$language['id_lang'].'" id="meta_description_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}'.($obj->id ? '<br />'.$this->youEditFieldFor() : '').'<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Meta keywords:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages AS $language)
|
||||
echo '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="meta_keywords_'.$language['id_lang'].'" id="meta_keywords_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_keywords', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}'.($obj->id ? '<br />'.$this->youEditFieldFor() : '').'<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Friendly URL:').' </label>
|
||||
<div class="margin-form translatable">';
|
||||
foreach ($this->_languages AS $language)
|
||||
echo '<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="link_rewrite_'.$language['id_lang'].'" id="link_rewrite_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'link_rewrite', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" onchange="this.value = str2url(this.value);" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Only letters and the minus (-) character are allowed').($obj->id ? '<br />'.$this->youEditFieldFor() : '').'<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
echo ' <p class="clear"></p>
|
||||
</div>
|
||||
<label>'.$this->l('Groups access:').' </label>
|
||||
<div class="margin-form">';
|
||||
$groups = Group::getGroups((int)($cookie->id_lang));
|
||||
if (sizeof($groups))
|
||||
{
|
||||
echo '
|
||||
<table cellspacing="0" cellpadding="0" class="table" style="width: 28em;">
|
||||
<tr>
|
||||
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'groupBox[]\', this.checked)"'.(!isset($obj->id) ? 'checked="checked" ' : '').' /></th>
|
||||
<th>'.$this->l('ID').'</th>
|
||||
<th>'.$this->l('Group name').'</th>
|
||||
</tr>';
|
||||
$irow = 0;
|
||||
foreach ($groups AS $group)
|
||||
echo '
|
||||
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
|
||||
<td><input type="checkbox" name="groupBox[]" class="groupBox" id="groupBox_'.$group['id_group'].'" value="'.$group['id_group'].'" '.((in_array($group['id_group'], $customer_groups) OR (!isset($obj->id))) ? 'checked="checked" ' : '').'/></td>
|
||||
<td>'.$group['id_group'].'</td>
|
||||
<td><label for="groupBox_'.$group['id_group'].'" class="t">'.$group['name'].'</label></td>
|
||||
</tr>';
|
||||
echo '
|
||||
</table>
|
||||
<p style="padding:0px; margin:10px 0px 10px 0px;">'.$this->l('Mark all groups you want to give access to this category').'</p>
|
||||
';
|
||||
} else
|
||||
echo '<p>'.$this->l('No group created').'</p>';
|
||||
echo '
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l('Save and back to parent category').'" name="submitAdd'.$this->table.'AndBackToParent" class="button" />
|
||||
<input type="submit" class="button" name="submitAdd'.$this->table.'" value="'.$this->l('Save').'"/>
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
<p class="clear"></p>';
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7060 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
|
||||
|
||||
class AdminContact extends AdminPreferences
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->className = 'Configuration';
|
||||
$this->table = 'configuration';
|
||||
|
||||
$temporyArrayFields = $this->_getDefaultFieldsContent();
|
||||
$this->_buildOrderedFieldsShop($temporyArrayFields);
|
||||
|
||||
parent::__construct();
|
||||
|
||||
}
|
||||
|
||||
private function _getDefaultFieldsContent()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$countryList = array();
|
||||
$countryList[] = array('id' => '0', 'name' => $this->l('Choose your country'));
|
||||
foreach (Country::getCountries(intval($cookie->id_lang)) AS $country)
|
||||
$countryList[] = array('id' => $country['id_country'], 'name' => $country['name']);
|
||||
$stateList = array();
|
||||
$stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)'));
|
||||
foreach (State::getStates(intval($cookie->id_lang)) AS $state)
|
||||
$stateList[] = array('id' => $state['id_state'], 'name' => $state['name']);
|
||||
|
||||
$formFields = array(
|
||||
'PS_SHOP_NAME' => array('title' => $this->l('Shop name:'), 'desc' => $this->l('Displayed in e-mails and page titles'), 'validation' => 'isGenericName', 'required' => true, 'size' => 30, 'type' => 'text'),
|
||||
'PS_SHOP_EMAIL' => array('title' => $this->l('Shop e-mail:'), 'desc' => $this->l('Displayed in e-mails sent to customers'), 'validation' => 'isEmail', 'required' => true, 'size' => 30, 'type' => 'text'),
|
||||
'PS_SHOP_DETAILS' => array('title' => $this->l('Registration:'), 'desc' => $this->l('Shop registration information (e.g., SIRET or RCS)'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'textarea', 'cols' => 30, 'rows' => 5),
|
||||
'PS_SHOP_ADDR1' => array('title' => $this->l('Shop address line 1:'), 'validation' => 'isAddress', 'size' => 30, 'type' => 'text'),
|
||||
'PS_SHOP_ADDR2' => array('title' => 'Address line 2', 'validation' => 'isAddress', 'size' => 30, 'type' => 'text'),
|
||||
'PS_SHOP_CODE' => array('title' => $this->l('Post/Zip code:'), 'validation' => 'isGenericName', 'size' => 6, 'type' => 'text'),
|
||||
'PS_SHOP_CITY' => array('title' => $this->l('City:'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text'),
|
||||
'PS_SHOP_COUNTRY_ID' => array('title' => $this->l('Country:'), 'validation' => 'isInt', 'size' => 30, 'type' => 'select', 'list' => $countryList, 'identifier' => 'id', 'cast' => 'intval'),
|
||||
'PS_SHOP_STATE_ID' => array('title' => $this->l('State:'), 'validation' => 'isInt', 'size' => 30, 'type' => 'select', 'list' => $stateList, 'identifier' => 'id', 'cast' => 'intval'),
|
||||
'PS_SHOP_PHONE' => array('title' => $this->l('Phone:'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text'),
|
||||
'PS_SHOP_FAX' => array('title' => $this->l('Fax:'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text'),
|
||||
);
|
||||
return $formFields;
|
||||
}
|
||||
|
||||
private function _buildOrderedFieldsShop($formFields)
|
||||
{
|
||||
$associatedOrderKey = array(
|
||||
'PS_SHOP_NAME' => 'company',
|
||||
'PS_SHOP_ADDR1' => 'address1',
|
||||
'PS_SHOP_ADDR2' => 'address2',
|
||||
'PS_SHOP_CITY' => 'city',
|
||||
'PS_SHOP_STATE_ID' => 'State:name',
|
||||
'PS_SHOP_CODE' => 'postcode',
|
||||
'PS_SHOP_COUNTRY_ID' => 'Country:name',
|
||||
'PS_SHOP_PHONE' => 'phone');
|
||||
|
||||
$this->_fieldsShop = array();
|
||||
$orderedFields = AddressFormat::getOrderedAddressFields(Configuration::get('PS_SHOP_COUNTRY_ID'));
|
||||
|
||||
foreach($orderedFields as $lineFields)
|
||||
if (($patterns = explode(' ', $lineFields)))
|
||||
foreach($patterns as $pattern)
|
||||
if (($key = array_search($pattern, $associatedOrderKey)))
|
||||
$this->_fieldsShop[$key] = $formFields[$key];
|
||||
foreach($formFields as $key => $value)
|
||||
if (!isset($this->_fieldsShop[$key]))
|
||||
$this->_fieldsShop[$key] = $formFields[$key];
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (isset($_POST['PS_SHOP_STATE_ID']) && $_POST['PS_SHOP_STATE_ID'] != '0')
|
||||
{
|
||||
$isStateOk = Db::getInstance()->getValue('SELECT `active` FROM `'._DB_PREFIX_.'state` WHERE `id_country` = '.(int)(Tools::getValue('PS_SHOP_COUNTRY_ID')).' AND `id_state` = '.(int)(Tools::getValue('PS_SHOP_STATE_ID')));
|
||||
if ($isStateOk != 1)
|
||||
$this->_errors[] = Tools::displayError('This state is not in this country.');
|
||||
}
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
protected function _postConfig($fields)
|
||||
{
|
||||
global $cookie;
|
||||
if (!$this->_errors && isset($_POST['PS_SHOP_COUNTRY_ID']))
|
||||
{
|
||||
$country = new Country((int)($_POST['PS_SHOP_COUNTRY_ID']), intval($cookie->id_lang));
|
||||
Configuration::updateValue('PS_SHOP_COUNTRY', pSQL($country->name));
|
||||
}
|
||||
if (!$this->_errors && isset($_POST['PS_SHOP_STATE_ID']))
|
||||
{
|
||||
$state = new State((int)($_POST['PS_SHOP_STATE_ID']));
|
||||
Configuration::updateValue('PS_SHOP_STATE', pSQL($state->name));
|
||||
}
|
||||
parent::_postConfig($fields);
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
$this->_displayForm('shop', $this->_fieldsShop, $this->l('Contact details'), 'width3', 'tab-contact');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7300 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminContacts extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'contact';
|
||||
$this->className = 'Contact';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_contact' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Title'), 'width' => 130),
|
||||
'email' => array('title' => $this->l('E-mail address'), 'width' => 130),
|
||||
'description' => array('title' => $this->l('Description'), 'width' => 150));
|
||||
|
||||
$this->optionTitle = $this->l('Contact options');
|
||||
$this->_fieldsOptions = array(
|
||||
'PS_CUSTOMER_SERVICE_FILE_UPLOAD' => array('title' => $this->l('Allow file upload'), 'desc' => $this->l('Allow customers to upload file using contact page'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array(
|
||||
'0' => array('value' => 0, 'name' => $this->l('No')),
|
||||
'1' => array('value' => 1, 'name' => $this->l('Yes'))
|
||||
)),
|
||||
'PS_CUSTOMER_SERVICE_SIGNATURE' => array('title' => $this->l('Pre-defined message'), 'desc' => $this->l('Please fill the message that appears by default when you answer a thread on the customer service page'), 'cast' => 'pSQL', 'type' => 'textareaLang', 'identifier' => 'value',
|
||||
'cols' => 40, 'rows' => 8
|
||||
));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/contact.gif" />'.$this->l('Contacts').'</legend>
|
||||
<label>'.$this->l('Title:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name¤description', 'name');
|
||||
echo ' <p style="clear: both">'.$this->l('Contact name, e.g., Technical Support').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('E-mail address').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="email" value="'.htmlentities($this->getFieldValue($obj, 'email'), ENT_COMPAT, 'UTF-8').'" />
|
||||
<p style="clear: both">'.$this->l('E-mails will be sent to this address').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Save in Customer Service?').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="customer_service" id="customer_service_on" value="1" '.($this->getFieldValue($obj, 'customer_service') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="customer_service_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="customer_service" id="customer_service_off" value="0" '.(!$this->getFieldValue($obj, 'customer_service') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="customer_service_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('The messages will be saved in the Customer Service tab').'</p>
|
||||
</div><div class="clear"> </div>
|
||||
<label>'.$this->l('Description').'</label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="description_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<textarea name="description_'.$language['id_lang'].'" cols="36" rows="5">'.htmlentities($this->getFieldValue($obj, 'description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'</textarea>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name¤description', 'description');
|
||||
echo '
|
||||
<p style="clear: both">'.$this->l('Additional information about this contact').'</p>
|
||||
</div>';
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoShop();
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,347 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7310 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminCountries extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'country';
|
||||
$this->className = 'Country';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->deleted = false;
|
||||
$this->_select = 'z.`name` AS zone';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = a.`id_zone`)';
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_country' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Country'), 'width' => 130, 'filter_key' => 'b!name'),
|
||||
'iso_code' => array('title' => $this->l('ISO code'), 'width' => 70, 'align' => 'center'),
|
||||
'call_prefix' => array('title' => $this->l('Call prefix'), 'width' => 40, 'align' => 'center', 'callback' => 'displayCallPrefix'),
|
||||
'zone' => array('title' => $this->l('Zone'), 'width' => 100, 'filter_key' => 'z!name'),
|
||||
'a!active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'a!active'));
|
||||
|
||||
$this->optionTitle = $this->l('Countries options');
|
||||
$this->_fieldsOptions = array('PS_COUNTRY_DEFAULT' => array('title' => $this->l('Default country:'), 'desc' => $this->l('The default country used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_country', 'list' => Country::getCountries((int)($cookie->id_lang))));
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (isset($_GET['delete'.$this->table]) OR Tools::getValue('submitDel'.$this->table))
|
||||
$this->_errors[] = Tools::displayError('You cannot delete a country. If you do not want it available for customers, please disable it.');
|
||||
else
|
||||
{
|
||||
if (Tools::getValue('submitAdd'.$this->table))
|
||||
{
|
||||
$id_country = Tools::getValue('id_country');
|
||||
$tmp_addr_format = new AddressFormat($id_country);
|
||||
|
||||
$save_status = false;
|
||||
|
||||
$is_new = is_null($tmp_addr_format->id_country);
|
||||
if ($is_new)
|
||||
{
|
||||
$tmp_addr_format = new AddressFormat();
|
||||
$tmp_addr_format->id_country = $id_country;
|
||||
}
|
||||
|
||||
$tmp_addr_format->format = Tools::getValue('address_layout');
|
||||
|
||||
if (strlen($tmp_addr_format->format) > 0)
|
||||
{
|
||||
if ($tmp_addr_format->checkFormatFields())
|
||||
$save_status = ($is_new) ? $tmp_addr_format->save(): $tmp_addr_format->update();
|
||||
else
|
||||
{
|
||||
$errorList = $tmp_addr_format->getErrorList();
|
||||
foreach($errorList as $numError => $error)
|
||||
$this->_errors[] = $error;
|
||||
}
|
||||
|
||||
|
||||
if (!$save_status)
|
||||
$this->_errors[] = Tools::displayError('Invalid address layout'.Db::getInstance()->getMsgError());
|
||||
}
|
||||
unset($tmp_addr_format);
|
||||
}
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
private function _displayValidFields()
|
||||
{
|
||||
$html = '<ul>';
|
||||
$appendContainer = '';
|
||||
|
||||
$objectList = AddressFormat::getLiableClass('Address');
|
||||
$objectList['Address'] = NULL;
|
||||
|
||||
// Get the available properties for each class
|
||||
foreach($objectList as $className => &$object)
|
||||
{
|
||||
$fields = array();
|
||||
|
||||
$html .= '<li>
|
||||
<a href="javascript:void(0);" onClick="displayAvailableFields(\''.$className.'\')">'.$className.'</a>';
|
||||
foreach(AddressFormat::getValidateFields($className) as $name)
|
||||
$fields[] = '<a style="color:#4B8;" href="javascript:void(0);" class="addPattern" id="'.$className.':'.$name.'">
|
||||
'.$name.'</a>';
|
||||
$html .= '
|
||||
<div class="availableFieldsList" id="availableListFieldsFor_'.$className.'" style="width:300px;">
|
||||
'.implode(', ', $fields).'</div></li>';
|
||||
unset($object);
|
||||
}
|
||||
return $html .= '</ul>';
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
$defaultLayout = '';
|
||||
|
||||
$defaultLayoutTab = array(
|
||||
array('firstname', 'lastname'),
|
||||
array('company'),
|
||||
array('vat_number'),
|
||||
array('address1'),
|
||||
array('address2'),
|
||||
array('postcode', 'city'),
|
||||
array('Country:name'),
|
||||
array('phone'));
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
foreach ($defaultLayoutTab as $line)
|
||||
$defaultLayout .= implode(' ', $line)."\r\n";
|
||||
|
||||
echo '
|
||||
<script type="text/javascript" language="javascript" src="'._PS_JS_DIR_.'jquery/jquery-fieldselection.js"></script>
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
lastLayoutModified = "";
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$(".availableFieldsList").css("display", "none");
|
||||
$(".addPattern").click(function()
|
||||
{
|
||||
addFieldsToCursorPosition($(this).attr("id"))
|
||||
lastLayoutModified = $("#ordered_fields").val();
|
||||
});
|
||||
$("#ordered_fields").keyup(function()
|
||||
{
|
||||
lastLayoutModified = $(this).val();
|
||||
});
|
||||
$("#useLastDefaultLayout").mouseover(function()
|
||||
{
|
||||
switchExplanationText("'.$this->l('Will display back your last registered layout').'");
|
||||
});
|
||||
$("#useDefaultLayoutSystem").mouseover(function()
|
||||
{
|
||||
switchExplanationText("'.$this->l('Will display a default layout for this country').'");
|
||||
});
|
||||
$("#useCurrentLastModifiedLayout").mouseover(function()
|
||||
{
|
||||
switchExplanationText("'.$this->l('Will display back you\'re current editing layout').'");
|
||||
});
|
||||
$("#eraseCurrentLayout").mouseover(function()
|
||||
{
|
||||
switchExplanationText("'.$this->l('Will delete the current layout').'");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function switchExplanationText(text)
|
||||
{
|
||||
$("#explanationText").fadeOut("fast", function()
|
||||
{
|
||||
$(this).html(text);
|
||||
$(this).fadeIn("fast");
|
||||
});
|
||||
}
|
||||
|
||||
function addFieldsToCursorPosition(pattern)
|
||||
{
|
||||
$("#ordered_fields").replaceSelection(pattern + " ");
|
||||
}
|
||||
|
||||
function displayAvailableFields(containerName)
|
||||
{
|
||||
$(".availableFieldsList").each( function (){
|
||||
if ($(this).attr(\'id\') != \'availableListFieldsFor_\'+containerName)
|
||||
$(this).slideUp();
|
||||
});
|
||||
$("#availableListFieldsFor_" + containerName).slideToggle();
|
||||
}
|
||||
|
||||
function resetLayout(defaultLayout, type)
|
||||
{
|
||||
if (confirm("'.$this->l('Are you sure to apply this selection ?').'"))
|
||||
{
|
||||
$("#ordered_fields").val(unescape(defaultLayout.replace(/\+/g, " ")));
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/world.gif" />'.$this->l('Countries').'</legend>
|
||||
<label>'.$this->l('Country:').' </label>
|
||||
<div class="margin-form">';
|
||||
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="30" type="text" name="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name');
|
||||
echo ' <p style="clear: both">'.$this->l('Name of country').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('ISO code:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="4" maxlength="3" name="iso_code" value="'.htmlentities($this->getFieldValue($obj, 'iso_code'), ENT_COMPAT, 'UTF-8').'" style="text-transform: uppercase;" /> <sup>*</sup>
|
||||
<p>'.$this->l('2- or 3-letter ISO code, e.g., FR for France').'. <a href="http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html" target="_blank">'.$this->l('Official list here').'</a>.</p>
|
||||
</div>
|
||||
<label>'.$this->l('Call prefix:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="4" maxlength="3" name="call_prefix" value="'.(int)($this->getFieldValue($obj, 'call_prefix')).'" style="text-transform: uppercase;" /> <sup>*</sup>
|
||||
<p>'.$this->l('International call prefix, e.g., 33 for France.').'.</p>
|
||||
</div>
|
||||
<label>'.$this->l('Default currency:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_currency">
|
||||
<option value="0" '.(Tools::getValue('id_currency', $obj->id_currency) == 0 ? 'selected' : '').'>'.$this->l('Default store currency').'</option>
|
||||
';
|
||||
$currencies = Currency::getCurrencies();
|
||||
foreach ($currencies AS $currency)
|
||||
echo '<option value="'.intval($currency['id_currency']).'" '.(Tools::getValue('id_currency', $obj->id_currency) == $currency['id_currency'] ? 'selected' : '').'>'.Tools::htmlentitiesUTF8($currency['name']).'</option>';
|
||||
echo '
|
||||
</select>
|
||||
</div>
|
||||
<label>'.$this->l('Zone:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_zone">';
|
||||
$zones = Zone::getZones();
|
||||
foreach ($zones AS $zone)
|
||||
echo ' <option value="'.(int)($zone['id_zone']).'"'.(($this->getFieldValue($obj, 'id_zone') == $zone['id_zone']) ? ' selected="selected"' : '').'>'.$zone['name'].'</option>';
|
||||
$address_layout = AddressFormat::getAddressCountryFormat($obj->id);
|
||||
if ($value = Tools::getValue('address_layout'))
|
||||
$address_layout = $value;
|
||||
|
||||
echo ' </select>
|
||||
<p>'.$this->l('Geographical zone where country is located').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Need zip code:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="need_zip_code" id="need_zip_code_on" value="1" onchange="disableZipFormat();" '.((!$obj->id OR $this->getFieldValue($obj, 'need_zip_code')) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="need_zip_code_on"> <img src="../img/admin/enabled.gif" alt="" title="'.$this->l('Yes').'" /></label>
|
||||
<input type="radio" name="need_zip_code" id="need_zip_code_off" value="0" onchange="disableZipFormat();" '.((!$this->getFieldValue($obj, 'need_zip_code') AND $obj->id) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="need_zip_code_off"> <img src="../img/admin/disabled.gif" alt="" title="'.$this->l('No').'" /></label>
|
||||
</div>
|
||||
<label class="zip_code_format">'.$this->l('Zip code format:').' </label>
|
||||
<div class="margin-form zip_code_format">
|
||||
<input type="text" name="zip_code_format" id="zip_code_format" value="'.$this->getFieldValue($obj, 'zip_code_format').'" onkeyup="$(\'#zip_code_format\').val($(\'#zip_code_format\').val().toUpperCase());" /> <sup>*</sup>
|
||||
<p>'.$this->l('National zip code (L for a letter, N for a number and C for the Iso code), e.g., NNNNN for France. No verification if undefined').'.</p>
|
||||
</div>
|
||||
<label class="address_layout">'.$this->l('Address layout:').' </label>
|
||||
<div class="margin-form" style="vertical-align: top;">
|
||||
<div style="float:left">
|
||||
<textarea id="ordered_fields" name="address_layout" style="width: 300px;height: 140px;">'.$address_layout.'</textarea>
|
||||
</div>
|
||||
<div style="float:left; margin-left:20px; width:340px;">
|
||||
'.$this->l('Liable fields for the address information (click to have more details)').': '.$this->_displayValidFields().'
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div style="margin:10px 0 10px 0;">
|
||||
<a id="useLastDefaultLayout" style="margin-left:5px;" href="javascript:void(0)" onClick="resetLayout(\''.urlencode($address_layout).'\', \'lastDefault\');" class="button">'.
|
||||
$this->l('Use the last registered layout').'</a>
|
||||
<a id="useDefaultLayoutSystem" style="margin-left:5px;" href="javascript:void(0)" onClick="resetLayout(\''.urlencode($defaultLayout).'\', \'defaultSystem\');" class="button">'.
|
||||
$this->l('Use a default layout').'</a>
|
||||
<a id="useCurrentLastModifiedLayout" style="margin-left:5px;" href="javascript:void(0)" onClick="resetLayout(lastLayoutModified, \'currentModified\')" class="button">'.
|
||||
$this->l('Use my current modified layout').'</a>
|
||||
<a id="eraseCurrentLayout" style="margin-left:5px;" href="javascript:void(0)" onClick="resetLayout(\'\', \'erase\');" class="button">'.
|
||||
$this->l('Clean layout').'</a>
|
||||
<div style="margin-top:10px; padding-top:5px; height:10px;" id="explanationText"></div>
|
||||
</div>
|
||||
</div>
|
||||
<label>'.$this->l('Status:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.((!$obj->id OR $this->getFieldValue($obj, 'active')) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.((!$this->getFieldValue($obj, 'active') AND $obj->id) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Enabled or disabled').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Contains states:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="contains_states" id="contains_states_on" value="1" '.((!$obj->id OR $this->getFieldValue($obj, 'contains_states')) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="contains_states_on"> <img src="../img/admin/enabled.gif" alt="" title="" />'.$this->l('Yes').'</label>
|
||||
<input type="radio" name="contains_states" id="contains_states_off" value="0" '.((!$this->getFieldValue($obj, 'contains_states') AND $obj->id) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="contains_states_off"> <img src="../img/admin/disabled.gif" alt="" title="" />'.$this->l('No').'</label>
|
||||
</div>
|
||||
<label>'.$this->l('Need tax identification number?').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="need_identification_number" id="need_identification_number_on" value="1" '.((!$obj->id OR $this->getFieldValue($obj, 'need_identification_number')) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="need_identification_number_on"> <img src="../img/admin/enabled.gif" alt="" title="" />'.$this->l('Yes').'</label>
|
||||
<input type="radio" name="need_identification_number" id="need_identification_number_off" value="0" '.((!$this->getFieldValue($obj, 'need_identification_number') AND $obj->id) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="need_identification_number_off"> <img src="../img/admin/disabled.gif" alt="" title="" />'.$this->l('No').'</label>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<label>'.$this->l('Display tax label:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="display_tax_label" id="display_tax_label_on" value="1" '.((!$obj->id OR $this->getFieldValue($obj, 'display_tax_label')) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="display_tax_label_on"> <img src="../img/admin/enabled.gif" alt="" title="" />'.$this->l('Yes').'</label>
|
||||
<input type="radio" name="display_tax_label" id="display_tax_label_off" value="0" '.((!$this->getFieldValue($obj, 'display_tax_label') AND $obj->id) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="display_tax_label_off"> <img src="../img/admin/disabled.gif" alt="" title="" />'.$this->l('No').'</label>
|
||||
</div>';
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoShop();
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
<script type="text/javascript">disableZipFormat();</script>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,219 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminCounty extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'county';
|
||||
$this->className = 'County';
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->_select = 's.`name` AS state';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_state` = a.`id_state`)';
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_county' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('County'), 'width' => 130, 'filter_key' => 'b!name'),
|
||||
'state' => array('title' => $this->l('State'), 'width' => 70, 'filter_key' => 's!name'),
|
||||
'a!active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'a!active'));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function renderJS()
|
||||
{
|
||||
return
|
||||
'<script type="text/javascript">
|
||||
function addZipCode()
|
||||
{
|
||||
zipcodes = $("#zipcodes").val();
|
||||
id_county = $("#id_county").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: "ajaxAddZipCode=1&zipcodes="+zipcodes+"&id_county="+id_county+"&token='.$this->token.'",
|
||||
async : true,
|
||||
success: function(msg) {
|
||||
res = msg.split(":");
|
||||
if (res.length == 2)
|
||||
{
|
||||
$("#error-msg").html(res[1]);
|
||||
$("#zipcodes").css("border", "2px solid #FF0000");
|
||||
} else {
|
||||
$("#error-msg").html("");
|
||||
$("#zipcodes").val("");
|
||||
$("#zipcodes").css("border", "1px solid #E0D0B1");
|
||||
$("#zipcodes-list").html(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function populateStates(id_country, id_state)
|
||||
{
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
cache: false,
|
||||
data: "ajaxStates=1&no_empty=false&id_country="+id_country+"&id_state="+id_state,
|
||||
success: function(html){
|
||||
$("#id_state").html(html);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function removeZipCodes(zipcodes)
|
||||
{
|
||||
id_county = $("#id_county").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: "ajaxRemoveZipCode=1&zipcodes="+zipcodes+"&id_county="+id_county+"&token='.$this->token.'",
|
||||
async : true,
|
||||
success: function(msg) {
|
||||
$("#zipcodes-list").html(msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$cur_id_country = 0;
|
||||
$cur_id_state = 0;
|
||||
if (isset($obj->id_state))
|
||||
{
|
||||
$cur_state = new State($obj->id_state);
|
||||
if (Validate::isLoadedObject($cur_state))
|
||||
{
|
||||
$cur_id_country = $cur_state->id_country;
|
||||
$cur_id_state = $cur_state->id;
|
||||
}
|
||||
}
|
||||
|
||||
echo $this->renderJS().
|
||||
'<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
'.($obj->id ? '<input type="hidden" id="id_county" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/world.gif" />'.$this->l('Counties').'</legend>';
|
||||
|
||||
if (!isset($obj->id))
|
||||
echo '<div class="hint clear" style="display:block;">'.$this->l('Save this county then you will be able to associate zipcodes').'</div><br />';
|
||||
|
||||
$countries = Country::getCountries($cookie->id_lang, true, true);
|
||||
echo '<label>'.$this->l('Country:').' </label>
|
||||
<div class="margin-form"><select id="id_country" onchange="populateStates($(this).val(), '.(int)($this->getFieldValue($obj, 'id_state')).');">';
|
||||
|
||||
foreach ($countries AS $country)
|
||||
echo '<option value="'.(int)$country['id_country'].'" '.($cur_id_country == $country['id_country'] ? 'selected' : '').'>'.Tools::htmlentitiesUTF8($country['name']).'</option>';
|
||||
|
||||
echo '</select></div>';
|
||||
|
||||
|
||||
echo '<label>'.$this->l('State:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_state" id="id_state">
|
||||
</select>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
id_country = $("#id_country").val();
|
||||
populateStates(id_country,'.(int)$cur_id_state.');
|
||||
</script>';
|
||||
|
||||
echo
|
||||
'<label>'.$this->l('Name:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="30" maxlength="64" name="name" value="'.htmlentities($this->getFieldValue($obj, 'name'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
</div>
|
||||
<label>'.$this->l('Status:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.((!$obj->id OR $this->getFieldValue($obj, 'active')) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.((!$this->getFieldValue($obj, 'active') AND $obj->id) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Enabled or disabled').'</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
<input type="submit" value="'.$this->l('Save and stay').'" name="submitAdd'.$this->table.'AndStay" class="button" />
|
||||
</div>';
|
||||
|
||||
echo '<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>';
|
||||
|
||||
if (isset($obj->id))
|
||||
{
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
'.$this->_renderZipCodeForm().'<br />
|
||||
<div id="zipcodes-list">
|
||||
'.AdminCounty::renderZipCodeList($obj->getZipCodes()).'
|
||||
</div></div>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
|
||||
protected function _renderZipCodeForm()
|
||||
{
|
||||
return '
|
||||
<div>
|
||||
Add Zip Codes:<br /> <input type="text" id="zipcodes" name="zipcodes" />
|
||||
<a href="#" class="button" onclick="addZipCode()">Add</a>
|
||||
<div id="error-msg" style="color: #FF0000"></div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
public static function renderZipCodeList($zip_codes)
|
||||
{
|
||||
$html = '';
|
||||
foreach ($zip_codes AS $zip_code)
|
||||
{
|
||||
$full_zip_code = $zip_code['from_zip_code'];
|
||||
if ($zip_code['to_zip_code'] != 0)
|
||||
$full_zip_code .= '-'.$zip_code['to_zip_code'];
|
||||
|
||||
$html .= '<div>'.Tools::htmlentitiesUTF8($full_zip_code).' <a href="#" onclick="removeZipCodes(\''.Tools::htmlentitiesUTF8($full_zip_code).'\')"><img src="../img/admin/delete.gif" alt="" /></a></div>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7300 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
|
||||
|
||||
class AdminCurrencies extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'currency';
|
||||
$this->className = 'Currency';
|
||||
$this->lang = false;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_currency' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Currency'), 'width' => 100),
|
||||
'iso_code' => array('title' => $this->l('ISO code'), 'align' => 'center', 'width' => 35),
|
||||
'iso_code_num' => array('title' => $this->l('ISO code num'), 'align' => 'center', 'width' => 35),
|
||||
'sign' => array('title' => $this->l('Symbol'), 'width' => 20, 'align' => 'center', 'orderby' => false, 'search' => false),
|
||||
'conversion_rate' => array('title' => $this->l('Conversion rate'), 'float' => true, 'align' => 'center', 'width' => 50, 'search' => false),
|
||||
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false));
|
||||
|
||||
$this->optionTitle = $this->l('Currencies options');
|
||||
$this->_fieldsOptions = array(
|
||||
'PS_CURRENCY_DEFAULT' => array(
|
||||
'title' => $this->l('Default currency:'),
|
||||
'desc' => $this->l('The default currency used in shop')
|
||||
.'<div class=warn"><img src="../img/admin/warn2.png" />'.$this->l('If you change default currency, you will have to manually edit every product price.').'</div>',
|
||||
'cast' => 'intval',
|
||||
'type' => 'select',
|
||||
'identifier' => 'id_currency',
|
||||
'list' => Currency::getCurrencies()
|
||||
),
|
||||
);
|
||||
$this->_where = 'AND a.`deleted` = 0';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (isset($_GET['delete'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
|
||||
$this->_errors[] = $this->l('You can\'t delete the default currency');
|
||||
elseif ($object->delete())
|
||||
Tools::redirectAdmin($currentIndex.'&conf=1'.'&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
elseif ((isset($_GET['status'.$this->table]) OR isset($_GET['status'])) AND Tools::getValue($this->identifier))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->active AND $object->id == Configuration::get('PS_CURRENCY_DEFAULT'))
|
||||
$this->_errors[] = $this->l('You can\'t disable the default currency');
|
||||
elseif ($object->toggleStatus())
|
||||
Tools::redirectAdmin($currentIndex.'&conf=5'.((($id_category = (int)(Tools::getValue('id_category'))) AND Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
elseif (Tools::getValue('submitOptions'.$this->table))
|
||||
{
|
||||
foreach ($this->_fieldsOptions as $key => $field)
|
||||
{
|
||||
Configuration::updateValue($key, $field['cast'](Tools::getValue($key)));
|
||||
if ($key == 'PS_CURRENCY_DEFAULT')
|
||||
Currency::refreshCurrencies();
|
||||
}
|
||||
Tools::redirectAdmin($currentIndex.'&conf=6'.'&token='.$this->token);
|
||||
}
|
||||
elseif (Tools::isSubmit('submitExchangesRates'))
|
||||
{
|
||||
if (!$this->_errors[] = Currency::refreshCurrencies())
|
||||
Tools::redirectAdmin($currentIndex.'&conf=6'.'&token='.$this->token);
|
||||
}
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
public function displayOptionsList()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
parent::displayOptionsList();
|
||||
echo '<br /><br />
|
||||
<form action="'.$currentIndex.'&token='.$this->token.'" method="post">
|
||||
<fieldset>
|
||||
<legend><img src="../img/admin/exchangesrate.gif" />'.$this->l('Currency rates').'</legend>
|
||||
<label>'.$this->l('Update currency rates').'</label>
|
||||
<div class="margin-form">
|
||||
<p>'.$this->l('Update your currencies exchanges rates with a real-time tool').'</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l('Update currency rates').'" name="submitExchangesRates" class="button" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/money.gif" />'.$this->l('Currencies').'</legend>
|
||||
<label>'.$this->l('Currency:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="30" maxlength="32" name="name" value="'.htmlentities($this->getFieldValue($obj, 'name'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Only letters and the minus character are allowed').'<span class="hint-pointer"> </span></span>
|
||||
<p class="clear">'.$this->l('Will appear on Front Office, e.g., euro, dollar').'...</p>
|
||||
</div>
|
||||
<label>'.$this->l('ISO code:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="30" maxlength="32" name="iso_code" value="'.htmlentities($this->getFieldValue($obj, 'iso_code'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<span class="hint-pointer"> </span>
|
||||
<p class="clear">'.$this->l('ISO code, e.g., USD for dollar, EUR for euro').'...</p>
|
||||
</div>
|
||||
<label>'.$this->l('Numeric ISO code:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="30" maxlength="32" name="iso_code_num" value="'.htmlentities($this->getFieldValue($obj, 'iso_code_num'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<span class="hint-pointer"> </span>
|
||||
<p class="clear">'.$this->l('Numeric ISO code, e.g., 840 for dollar, 978 for euro').'...</p>
|
||||
</div>
|
||||
<label>'.$this->l('Symbol:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="3" maxlength="8" name="sign" value="'.htmlentities($this->getFieldValue($obj, 'sign'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Will appear on Front Office, e.g., €, $').'...</p>
|
||||
</div>
|
||||
<label>'.$this->l('Conversion rate:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="3" maxlength="11" name="conversion_rate" value="'.htmlentities($this->getFieldValue($obj, 'conversion_rate')).'" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Conversion rate from one unit of your shop\'s default currency (for example, 1€) to this currency. For example, if the default currency is euros and this currency is dollars, type \'1.20\'').' 1€ = $1.20</p>
|
||||
</div>
|
||||
<label>'.$this->l('Formatting:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="format">';
|
||||
$currency_formats = array(
|
||||
1 => 'X0,000.00 ('.$this->l('as with dollars').')',
|
||||
2 => '0 000,00X ('.$this->l('as with euros').')',
|
||||
3 => 'X0.000,00',
|
||||
4 => '0,000.00X',
|
||||
);
|
||||
foreach ($currency_formats AS $nb => $desc)
|
||||
echo '<option value="'.$nb.'"'.($this->getFieldValue($obj, 'format') == $nb ? 'selected="selected"' : '').'>'.$desc.'</option>';
|
||||
echo '
|
||||
</select>
|
||||
<p class="clear">'.$this->l('Applies to all prices, e.g.,').' $1,240.15</p>
|
||||
</div>
|
||||
<label>'.$this->l('Decimals:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="decimals" id="decimals_on" value="1" '.($this->getFieldValue($obj, 'decimals') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="decimals_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" /></label>
|
||||
<input type="radio" name="decimals" id="decimals_off" value="0" '.(!$this->getFieldValue($obj, 'decimals') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="decimals_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" /></label>
|
||||
<p>'.$this->l('Display decimals on prices').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Blank:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="blank" id="blank_on" value="1" '.($this->getFieldValue($obj, 'blank') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="blank_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="blank" id="blank_off" value="0" '.(!$this->getFieldValue($obj, 'blank') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="blank_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Include a blank between sign and price, e.g.,').'<br />$1,240.15 -> $ 1,240.15</p>
|
||||
</div>
|
||||
<label>'.$this->l('Enable:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.(!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
</div>';
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoShop();
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,605 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7471 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminCustomerThreads extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'customer_thread';
|
||||
$this->lang = false;
|
||||
$this->className = 'CustomerThread';
|
||||
$this->edit = false;
|
||||
$this->view = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->_select = 'CONCAT(c.firstname," ",c.lastname) as customer, cl.name as contact, l.name as language, group_concat(message) as messages, (
|
||||
SELECT IFNULL(CONCAT(LEFT(e.firstname, 1),". ",e.lastname), "--")
|
||||
FROM '._DB_PREFIX_.'customer_message cm2 INNER JOIN '._DB_PREFIX_.'employee e ON e.id_employee = cm2.id_employee
|
||||
WHERE cm2.id_employee > 0 AND cm2.`id_customer_thread` = a.`id_customer_thread`
|
||||
ORDER BY cm2.date_add DESC LIMIT 1) as employee';
|
||||
$this->_group = 'GROUP BY cm.id_customer_thread';
|
||||
$this->_join = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON c.`id_customer` = a.`id_customer`
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer_message` cm ON cm.`id_customer_thread` = a.`id_customer_thread`
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang` l ON l.`id_lang` = a.`id_lang`
|
||||
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (cl.`id_contact` = a.`id_contact` AND cl.`id_lang` = '.(int)$cookie->id_lang.')';
|
||||
|
||||
$contactArray = array();
|
||||
$contacts = Contact::getContacts($cookie->id_lang);
|
||||
foreach ($contacts AS $contact)
|
||||
$contactArray[$contact['id_contact']] = $contact['name'];
|
||||
|
||||
$languageArray = array();
|
||||
$languages = Language::getLanguages();
|
||||
foreach ($languages AS $language)
|
||||
$languageArray[$language['id_lang']] = $language['name'];
|
||||
|
||||
$statusArray = array(
|
||||
'open' => $this->l('Open'),
|
||||
'closed' => $this->l('Closed'),
|
||||
'pending1' => $this->l('Pending 1'),
|
||||
'pending2' => $this->l('Pending 2')
|
||||
);
|
||||
|
||||
$imagesArray = array(
|
||||
'open' => 'status_green.gif',
|
||||
'closed' => 'status_red.gif',
|
||||
'pending1' => 'status_orange.gif',
|
||||
'pending2' => 'status_orange.gif'
|
||||
);
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_customer_thread' => array('title' => $this->l('ID'), 'width' => 25),
|
||||
'customer' => array('title' => $this->l('Customer'), 'width' => 100, 'filter_key' => 'customer', 'tmpTableFilter' => true),
|
||||
'email' => array('title' => $this->l('E-mail'), 'width' => 100, 'filter_key' => 'a!email'),
|
||||
'contact' => array('title' => $this->l('Type'), 'width' => 75, 'type' => 'select', 'select' => $contactArray, 'filter_key' => 'cl!id_contact', 'filter_type' => 'int'),
|
||||
'language' => array('title' => $this->l('Language'), 'width' => 60, 'type' => 'select', 'select' => $languageArray, 'filter_key' => 'l!id_lang', 'filter_type' => 'int'),
|
||||
'status' => array('title' => $this->l('Status'), 'width' => 50, 'type' => 'select', 'select' => $statusArray, 'icon' => $imagesArray, 'align' => 'center', 'filter_key' => 'a!status', 'filter_type' => 'string'),
|
||||
'employee' => array('title' => $this->l('Employee'), 'width' => 100, 'filter_key' => 'employee', 'tmpTableFilter' => true),
|
||||
'messages' => array('title' => $this->l('Messages'), 'width' => 50, 'filter_key' => 'messages', 'tmpTableFilter' => true, 'maxlength' => 0),
|
||||
'date_upd' => array('title' => $this->l('Last message'), 'width' => 90)
|
||||
);
|
||||
$this->shopLinkType = 'shop';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex, $cookie, $link;
|
||||
|
||||
if ($id_customer_thread = (int)Tools::getValue('id_customer_thread'))
|
||||
{
|
||||
if (($id_contact = (int)Tools::getValue('id_contact')))
|
||||
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer_thread SET id_contact = '.(int)$id_contact.' WHERE id_customer_thread = '.(int)$id_customer_thread);
|
||||
if ($id_status = (int)Tools::getValue('setstatus'))
|
||||
{
|
||||
$statusArray = array(1 => 'open', 2 => 'closed', 3 => 'pending1', 4 => 'pending2');
|
||||
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer_thread SET status = "'.$statusArray[$id_status].'" WHERE id_customer_thread = '.(int)$id_customer_thread.' LIMIT 1');
|
||||
}
|
||||
if (isset($_POST['id_employee_forward']))
|
||||
{
|
||||
// Todo: need to avoid doubles
|
||||
$messages = Db::getInstance()->ExecuteS('
|
||||
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
|
||||
FROM '._DB_PREFIX_.'customer_thread ct
|
||||
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$cookie->id_lang.')
|
||||
LEFT OUTER JOIN '._DB_PREFIX_.'employee e ON e.id_employee = cm.id_employee
|
||||
LEFT OUTER JOIN '._DB_PREFIX_.'customer c ON (c.email = ct.email)
|
||||
WHERE ct.id_customer_thread = '.(int)Tools::getValue('id_customer_thread').'
|
||||
ORDER BY cm.date_add DESC');
|
||||
$output = '';
|
||||
foreach ($messages AS $message)
|
||||
$output .= $this->displayMsg($message, true, (int)Tools::getValue('id_employee_forward'));
|
||||
|
||||
$cm = new CustomerMessage();
|
||||
$cm->id_employee = (int)$cookie->id_employee;
|
||||
$cm->id_customer_thread = (int)Tools::getValue('id_customer_thread');
|
||||
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
|
||||
$currentEmployee = new Employee($cookie->id_employee);
|
||||
if (($id_employee = (int)Tools::getValue('id_employee_forward')) AND ($employee = new Employee($id_employee)) AND Validate::isLoadedObject($employee))
|
||||
{
|
||||
$params = array(
|
||||
'{messages}' => $output,
|
||||
'{employee}' => $currentEmployee->firstname.' '.$currentEmployee->lastname,
|
||||
'{comment}' => stripslashes($_POST['message_forward']));
|
||||
Mail::Send((int)($cookie->id_lang), 'forward_msg', Mail::l('Fwd: Customer message'), $params,
|
||||
$employee->email, $employee->firstname.' '.$employee->lastname,
|
||||
$currentEmployee->email, $currentEmployee->firstname.' '.$currentEmployee->lastname);
|
||||
$cm->message = $this->l('Message forwarded to').' '.$employee->firstname.' '.$employee->lastname."\n".$this->l('Comment:').' '.$_POST['message_forward'];
|
||||
$cm->add();
|
||||
}
|
||||
elseif (($email = Tools::getValue('email')) AND Validate::isEmail($email))
|
||||
{
|
||||
$params = array(
|
||||
'{messages}' => $output,
|
||||
'{employee}' => $currentEmployee->firstname.' '.$currentEmployee->lastname,
|
||||
'{comment}' => stripslashes($_POST['message_forward']));
|
||||
Mail::Send((int)($cookie->id_lang), 'forward_msg', Mail::l('Fwd: Customer message'), $params,
|
||||
$email, NULL,
|
||||
$currentEmployee->email, $currentEmployee->firstname.' '.$currentEmployee->lastname);
|
||||
$cm->message = $this->l('Message forwarded to').' '.$email."\n".$this->l('Comment:').' '.$_POST['message_forward'];
|
||||
$cm->add();
|
||||
}
|
||||
else
|
||||
echo '<div class="alert error">'.Tools::displayError('Email invalid.').'</div>';
|
||||
}
|
||||
if (Tools::isSubmit('submitReply'))
|
||||
{
|
||||
$ct = new CustomerThread($id_customer_thread);
|
||||
$cm = new CustomerMessage();
|
||||
$cm->id_employee = (int)$cookie->id_employee;
|
||||
$cm->id_customer_thread = $ct->id;
|
||||
$cm->message = Tools::htmlentitiesutf8(nl2br2(Tools::getValue('reply_message')));
|
||||
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
|
||||
if (isset($_FILES) AND !empty($_FILES['joinFile']['name']) AND $_FILES['joinFile']['error'] != 0)
|
||||
$this->_errors[] = Tools::displayError('An error occurred with the file upload.');
|
||||
else if ($cm->add())
|
||||
{
|
||||
$fileAttachment = NULL;
|
||||
if (!empty($_FILES['joinFile']['name']))
|
||||
{
|
||||
$fileAttachment['content'] = file_get_contents($_FILES['joinFile']['tmp_name']);
|
||||
$fileAttachment['name'] = $_FILES['joinFile']['name'];
|
||||
$fileAttachment['mime'] = $_FILES['joinFile']['type'];
|
||||
}
|
||||
$params = array(
|
||||
'{reply}' => nl2br2(Tools::getValue('reply_message')),
|
||||
'{link}' => Tools::url($link->getPageLink('contact', true), 'id_customer_thread='.(int)($ct->id).'&token='.$ct->token),
|
||||
);
|
||||
Mail::Send($ct->id_lang, 'reply_msg', Mail::l('An answer to your message is available'), $params, Tools::getValue('msg_email'), NULL, NULL, NULL, $fileAttachment);
|
||||
$ct->status = 'closed';
|
||||
$ct->update();
|
||||
Tools::redirectAdmin($currentIndex.'&id_customer_thread='.(int)$id_customer_thread.'&viewcustomer_thread&token='.Tools::getValue('token'));
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred, your message was not sent. Please contact your system administrator.');
|
||||
}
|
||||
}
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (isset($_GET['filename']) AND file_exists(_PS_UPLOAD_DIR_.$_GET['filename']))
|
||||
self::openUploadedFile();
|
||||
else if (isset($_GET['view'.$this->table]))
|
||||
$this->viewcustomer_thread();
|
||||
else
|
||||
{
|
||||
$this->getList((int)$cookie->id_lang, !Tools::getValue($this->table.'Orderby') ? 'date_upd' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$this->displayList();
|
||||
}
|
||||
}
|
||||
|
||||
public function displayListHeader($token = NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$contacts = Db::getInstance()->ExecuteS('
|
||||
SELECT cl.*, COUNT(*) as total, (
|
||||
SELECT id_customer_thread
|
||||
FROM '._DB_PREFIX_.'customer_thread ct2
|
||||
WHERE status = "open" AND ct.id_contact = ct2.id_contact
|
||||
ORDER BY date_upd ASC
|
||||
LIMIT 1
|
||||
) as id_customer_thread
|
||||
FROM '._DB_PREFIX_.'customer_thread ct
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.$cookie->id_lang.')
|
||||
WHERE ct.status = "open"
|
||||
GROUP BY ct.id_contact HAVING COUNT(*) > 0');
|
||||
$categories = Db::getInstance()->ExecuteS('
|
||||
SELECT cl.*
|
||||
FROM '._DB_PREFIX_.'contact ct
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.$cookie->id_lang.')
|
||||
WHERE ct.customer_service = 1');
|
||||
$dim = count($categories);
|
||||
|
||||
echo '<div style="float:left;border:0;width:640px;">';
|
||||
foreach ($categories as $key => $val)
|
||||
{
|
||||
$totalThread = 0;
|
||||
$id_customer_thread = 0;
|
||||
foreach ($contacts as $tmp => $tmp2)
|
||||
if ($val['id_contact'] == $tmp2['id_contact'])
|
||||
{
|
||||
$totalThread = $tmp2['total'];
|
||||
$id_customer_thread = $tmp2['id_customer_thread'];
|
||||
break;
|
||||
}
|
||||
echo '<div style="background-color:#EFEFEF;float:left;margin:0 10px 10px 0;width:'.($dim > 6 ? '200' : '300').'px;border:1px solid #CFCFCF" >
|
||||
<h3 style="overflow:hidden;line-height:25px;color:#812143;height:25px;margin:0;"> '.$val['name'].'</h3>'.
|
||||
($dim > 6 ? '' : '<p style="overflow:hidden;line-height:15px;height:45px;margin:0;padding:0 5px;">'.$val['description'].'</p>').
|
||||
($totalThread == 0 ? '<h3 style="padding:0 5px;margin:0;height:23px;line-height:23px;background-color:#DEDEDE">'.$this->l('No new message').'</h3>'
|
||||
: '<a href="'.$currentIndex.'&token='.Tools::getValue('token').'&id_customer_thread='.$id_customer_thread.'&viewcustomer_thread" style="padding:0 5px;display:block;height:23px;line-height:23px;border:0;" class="button">'.$totalThread.' '.($totalThread > 1 ? $this->l('new messages'): $this->l('new message')).'</a>').'
|
||||
</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
$params = array(
|
||||
$this->l('Total threads') => $all = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'customer_thread'),
|
||||
$this->l('Threads pending') => $pending = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'customer_thread WHERE status LIKE "%pending%"'),
|
||||
$this->l('Total customer messages') => Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'customer_message WHERE id_employee = 0'),
|
||||
$this->l('Total employee messages') => Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'customer_message WHERE id_employee != 0'),
|
||||
$this->l('Threads unread') => $unread = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'customer_thread WHERE status = "open"'),
|
||||
$this->l('Threads closed') => $all - ($unread + $pending));
|
||||
|
||||
echo '<div style="float:right;padding 0px;border:1px solid #CFCFCF;width:280px;">
|
||||
<h3 class="button" style="margin:0;line-height:23px;height:23px;border:0;padding:0 5px;">'.$this->l('Customer service').' : '.$this->l('Statistics').'</h3>
|
||||
<table cellspacing="1" class="table" style="border-collapse:separate;width:280px;border:0">';
|
||||
$count = 0;
|
||||
foreach ($params as $key => $val)
|
||||
echo '<tr '.(++$count % 2 == 0 ? 'class="alt_row"' : '').'><td>'.$key.'</td><td>'.$val.'</td></tr>';
|
||||
echo ' </table>
|
||||
</div><p class="clear"> </p>';
|
||||
parent::displayListHeader($token);
|
||||
}
|
||||
|
||||
private function openUploadedFile()
|
||||
{
|
||||
$filename = $_GET['filename'];
|
||||
|
||||
$extensions = array('.txt' => 'text/plain', '.rtf' => 'application/rtf', '.doc' => 'application/msword', '.docx'=> 'application/msword',
|
||||
'.pdf' => 'application/pdf', '.zip' => 'multipart/x-zip', '.png' => 'image/png', '.jpeg' => 'image/jpeg', '.gif' => 'image/gif', '.jpg' => 'image/jpeg');
|
||||
|
||||
$extension = '';
|
||||
foreach ($extensions AS $key => $val)
|
||||
if (substr($filename, -4) == $key OR substr($filename, -5) == $key)
|
||||
{
|
||||
$extension = $val;
|
||||
break;
|
||||
}
|
||||
|
||||
ob_end_clean();
|
||||
header('Content-Type: '.$extension);
|
||||
header('Content-Disposition:attachment;filename="'.$filename.'"');
|
||||
readfile(_PS_UPLOAD_DIR_.$filename);
|
||||
die;
|
||||
}
|
||||
private function displayMsg($message, $email = false, $id_employee = null)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$customersToken = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee));
|
||||
$contacts = Contact::getContacts($cookie->id_lang);
|
||||
|
||||
if (!$email)
|
||||
{
|
||||
if (!empty($message['id_product']) AND empty($message['employee_name']))
|
||||
$id_order_product = Db::getInstance()->getValue('
|
||||
SELECT o.id_order
|
||||
FROM '._DB_PREFIX_.'orders o
|
||||
LEFT JOIN '._DB_PREFIX_.'order_detail od ON o.id_order = od.id_order
|
||||
WHERE o.id_customer = '.(int)$message['id_customer'].'
|
||||
AND od.product_id = '.(int)$message['id_product'].'
|
||||
ORDER BY o.date_add DESC');
|
||||
|
||||
$output = '
|
||||
<fieldset style="'.(!empty($message['employee_name']) ? 'background: rgb(255,236,242);' : '').'width:600px;margin-top:10px">
|
||||
<legend '.(empty($message['employee_name']) ? '' : 'style="background:rgb(255,210,225)"').'>'.(
|
||||
!empty($message['employee_name'])
|
||||
? '<img src="../img/t/AdminCustomers.gif" alt="'.Configuration::get('PS_SHOP_NAME').'" /> '.Configuration::get('PS_SHOP_NAME').' - '.$message['employee_name']
|
||||
: '<img src="'.__PS_BASE_URI__.'img/admin/tab-customers.gif" alt="'.Configuration::get('PS_SHOP_NAME').'" /> '.(
|
||||
!empty($message['id_customer'])
|
||||
? '<a href="index.php?tab=AdminCustomers&id_customer='.(int)($message['id_customer']).'&viewcustomer&token='.$customersToken.'" title="'.$this->l('View customer').'">'.$message['customer_name'].'</a>'
|
||||
: $message['email']
|
||||
)
|
||||
).'</legend>
|
||||
<div style="font-size:11px">'.(
|
||||
(!empty($message['id_customer']) AND empty($message['employee_name']))
|
||||
? '<b>'.$this->l('Customer ID:').'</b> <a href="index.php?tab=AdminCustomers&id_customer='.(int)($message['id_customer']).'&viewcustomer&token='.$customersToken.'" title="'.$this->l('View customer').'">'.(int)($message['id_customer']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
|
||||
: ''
|
||||
).'
|
||||
<b>'.$this->l('Sent on:').'</b> '.Tools::displayDate($message['date_add'], (int)($cookie->id_lang), true).'<br />'.(
|
||||
empty($message['employee_name'])
|
||||
? '<b>'.$this->l('Browser:').'</b> '.strip_tags($message['user_agent']).'<br />'
|
||||
: ''
|
||||
).(
|
||||
(!empty($message['file_name']) AND file_exists(_PS_UPLOAD_DIR_.$message['file_name']))
|
||||
? '<b>'.$this->l('File attachment').'</b> <a href="index.php?tab=AdminCustomerThreads&id_customer_thread='.$message['id_customer_thread'].'&viewcustomer_thread&token='.Tools::getAdminToken('AdminCustomerThreads'.(int)(Tab::getIdFromClassName('AdminCustomerThreads')).(int)($cookie->id_employee)).'&filename='.$message['file_name'].'" title="'.$this->l('View file').'"><img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
|
||||
: ''
|
||||
).(
|
||||
(!empty($message['id_order']) AND empty($message['employee_name']))
|
||||
? '<b>'.$this->l('Order #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($message['id_order']).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_order']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
|
||||
: ''
|
||||
).(
|
||||
(!empty($message['id_product']) AND empty($message['employee_name']))
|
||||
? '<b>'.$this->l('Product #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($id_order_product).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_product']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
|
||||
: ''
|
||||
).'<br />
|
||||
<form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post">
|
||||
<b>'.$this->l('Subject:').'</b>
|
||||
<input type="hidden" name="id_customer_message" value="'.$message['id_customer_message'].'" />
|
||||
<select name="id_contact" onchange="this.form.submit();">';
|
||||
foreach ($contacts as $contact)
|
||||
$output .= '<option value="'.(int)$contact['id_contact'].'" '.($contact['id_contact'] == $message['id_contact'] ? 'selected="selected"' : '').'>'.Tools::htmlentitiesutf8($contact['name']).'</option>';
|
||||
$output .= '</select>
|
||||
</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = '<div style="font-size:11px">
|
||||
'.($id_employee ? '<a href="'.Tools::getHttpHost(true).$currentIndex.'&token='.Tools::getAdminToken('AdminCustomerThreads'.(int)(Tab::getIdFromClassName('AdminCustomerThreads')).(int)($id_employee)).'&id_customer_thread='.(int)$message['id_customer_thread'].'&viewcustomer_thread">'.$this->l('View this thread').'</a><br />' : '').'
|
||||
<b>'.$this->l('Sent by:').'</b> '.(!empty($message['customer_name']) ? $message['customer_name'].' ('.$message['email'].')' : $message['email'])
|
||||
.((!empty($message['id_customer']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Customer ID:').'</b> '.(int)($message['id_customer']).'<br />' : '')
|
||||
.((!empty($message['id_order']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Order #').':</b> '.(int)($message['id_order']).'<br />' : '')
|
||||
.((!empty($message['id_product']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Product #').':</b> '.(int)($message['id_product']).'<br />' : '')
|
||||
.'<br /><b>'.$this->l('Subject:').'</b> '.$message['subject'];
|
||||
}
|
||||
|
||||
$message['message'] = preg_replace('/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui', '<a href="\1">\1</a>\2', html_entity_decode($message['message'], ENT_NOQUOTES, 'UTF-8'));
|
||||
$output .= '<br /><br />
|
||||
<b>'.$this->l('Thread ID:').'</b> '.(int)$message['id_customer_thread'].'<br />
|
||||
<b>'.$this->l('Message ID:').'</b> '.(int)$message['id_customer_message'].'<br />
|
||||
<b>'.$this->l('Message:').'</b><br />
|
||||
'.$message['message'].'
|
||||
</div>';
|
||||
|
||||
if (!$email)
|
||||
{
|
||||
if (empty($message['employee_name']))
|
||||
$output .= '
|
||||
<p style="text-align:right">
|
||||
<button style="font-family: Verdana; font-size: 11px; font-weight:bold; height: 65px; width: 120px;" onclick="$(\'#reply_to_'.(int)($message['id_customer_message']).'\').show(500); $(this).hide();">
|
||||
<img src="'.__PS_BASE_URI__.'img/admin/contact.gif" alt="" style="margin-bottom: 5px;" /><br />'.$this->l('Reply to this message').'
|
||||
</button>
|
||||
</p>
|
||||
<div id="reply_to_'.(int)($message['id_customer_message']).'" style="display: none; margin-top: 20px;"">
|
||||
<form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
|
||||
<p>'.$this->l('Please type your reply below:').'</p>
|
||||
<textarea style="width: 450px; height: 175px;" name="reply_message">'.str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang'])).'</textarea>
|
||||
<div style="width: 450px; text-align: right; font-style: italic; font-size: 9px; margin-top: 2px;">
|
||||
'.$this->l('Your reply will be sent to:').' '.$message['email'].'
|
||||
</div>
|
||||
<div style="width: 450px; margin-top: 0px;">
|
||||
<input type="file" name="joinFile"/>
|
||||
<div>
|
||||
<div style="width: 450px; text-align: center;">
|
||||
<input type="submit" class="button" name="submitReply" value="'.$this->l('Send my reply').'" style="margin-top:20px;" />
|
||||
<input type="hidden" name="id_customer_thread" value="'.(int)($message['id_customer_thread']).'" />
|
||||
<input type="hidden" name="msg_email" value="'.$message['email'].'" />
|
||||
</div>
|
||||
</form>
|
||||
</div>';
|
||||
$output .= '
|
||||
</fieldset>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function viewcustomer_thread()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
if (!($thread = $this->loadObject()))
|
||||
return;
|
||||
$cookie->{'customer_threadFilter_cl!id_contact'} = $thread->id_contact;
|
||||
|
||||
$employees = Db::getInstance()->ExecuteS('
|
||||
SELECT e.id_employee, e.firstname, e.lastname FROM '._DB_PREFIX_.'employee e
|
||||
WHERE e.active = 1 ORDER BY e.lastname ASC');
|
||||
|
||||
echo '
|
||||
<h2>'.$this->l('Messages').'</h2>
|
||||
<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
|
||||
<p>
|
||||
<img src="../img/admin/msg-forward.png" alt="" style="vertical-align: middle;" /> '.$this->l('Forward this discussion to an employee:').'
|
||||
<select name="id_employee_forward" style="vertical-align: middle;" onchange="
|
||||
if ($(this).val() >= 0)
|
||||
$(\'#message_forward\').show(400);
|
||||
else
|
||||
$(\'#message_forward\').hide(200);
|
||||
if ($(this).val() == 0)
|
||||
$(\'#message_forward_email\').show(200);
|
||||
else
|
||||
$(\'#message_forward_email\').hide(200);
|
||||
">
|
||||
<option value="-1">'.$this->l('-- Choose --').'</option>
|
||||
<option value="0">'.$this->l('Someone else').'</option>';
|
||||
foreach ($employees AS $employee)
|
||||
echo ' <option value="'.(int)($employee['id_employee']).'">'.substr($employee['firstname'], 0, 1).'. '.$employee['lastname'].'</option>';
|
||||
echo ' </select>
|
||||
<div id="message_forward_email" style="display:none">
|
||||
<b>'.$this->l('E-mail').'</b> <input type="text" name="email" />
|
||||
</div>
|
||||
<div id="message_forward" style="display:none;margin-bottom:10px">
|
||||
<textarea name="message_forward" style="width: 500px; height: 80px; margin-top: 15px;" onclick="if ($(this).val() == \''.addslashes($this->l('You can add a comment here.')).'\') { $(this).val(\'\'); }">'.$this->l('You can add a comment here.').'</textarea><br />
|
||||
<input type="Submit" name="submitForward" class="button" value="'.$this->l('Forward this discussion').'" style="margin-top: 10px;" />
|
||||
</div>
|
||||
</p>
|
||||
</form>
|
||||
<div class="clear"> </div>';
|
||||
|
||||
$messages = Db::getInstance()->ExecuteS('
|
||||
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
|
||||
FROM '._DB_PREFIX_.'customer_thread ct
|
||||
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
|
||||
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$cookie->id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'employee e ON e.id_employee = cm.id_employee
|
||||
LEFT JOIN '._DB_PREFIX_.'customer c ON (IFNULL(ct.id_customer, ct.email) = IFNULL(c.id_customer, c.email))
|
||||
WHERE ct.id_customer_thread = '.(int)Tools::getValue('id_customer_thread').'
|
||||
ORDER BY cm.date_add DESC');
|
||||
|
||||
echo '<div style="float:right">';
|
||||
|
||||
$nextThread = Db::getInstance()->getValue('
|
||||
SELECT id_customer_thread FROM '._DB_PREFIX_.'customer_thread ct
|
||||
WHERE ct.status = "open" AND ct.date_upd = (
|
||||
SELECT date_add FROM '._DB_PREFIX_.'customer_message
|
||||
WHERE (id_employee IS NULL OR id_employee = 0) AND id_customer_thread = '.(int)$thread->id.'
|
||||
ORDER BY date_add DESC LIMIT 1
|
||||
)
|
||||
'.($cookie->{'customer_threadFilter_cl!id_contact'} ? 'AND ct.id_contact = '.(int)$cookie->{'customer_threadFilter_cl!id_contact'} : '').'
|
||||
'.($cookie->{'customer_threadFilter_l!id_lang'} ? 'AND ct.id_lang = '.(int)$cookie->{'customer_threadFilter_l!id_lang'} : '').
|
||||
' ORDER BY ct.date_upd ASC');
|
||||
|
||||
if ($nextThread)
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&id_customer_thread='.(int)$nextThread.'&viewcustomer_thread&token='.$this->token.'">
|
||||
<img src="../img/admin/next-msg.png" title="'.$this->l('Go to the oldest next unanswered message').'" style="margin-bottom: 10px;" />
|
||||
<br />'.$this->l('Answer to the next unanswered message in this category').' >
|
||||
</a>');
|
||||
else
|
||||
echo $this->displayButton('
|
||||
<img src="../img/admin/msg-ok.png" title="'.$this->l('Go to the oldest next unanswered message').'" style="margin-bottom: 10px;" />
|
||||
<br />'.$this->l('The other messages in this category have been answered'));
|
||||
|
||||
if ($thread->status != "closed")
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=2&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<img src="../img/admin/msg-ok.png" style="margin-bottom:10px" />
|
||||
<br />'.$this->l('Set this message as handled').'
|
||||
</a>');
|
||||
|
||||
if ($thread->status != "pending1")
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=3&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<img src="../img/admin/msg-pending.png" style="margin-bottom:10px" />
|
||||
<br />'.$this->l('Declare this message').'<br />'.$this->l('as "pending 1"').'<br />'.$this->l('(will be answered later)').'
|
||||
</a>');
|
||||
else
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=1&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<img src="../img/admin/msg-is-pending.png" style="margin-bottom:10px" />
|
||||
<br />'.$this->l('Click here to disable pending status').'
|
||||
</a>');
|
||||
|
||||
if ($thread->status != "pending2")
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=4&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<img src="../img/admin/msg-pending.png" style="margin-bottom:10px" />
|
||||
<br />'.$this->l('Declare this message').'<br />'.$this->l('as "pending 2"').'<br />'.$this->l('(will be answered later)').'
|
||||
</a>');
|
||||
else
|
||||
echo $this->displayButton('
|
||||
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=1&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
|
||||
<img src="../img/admin/msg-is-pending.png" style="margin-bottom:10px" />
|
||||
<br />'.$this->l('Click here to disable pending status').'
|
||||
</a>');
|
||||
|
||||
echo '</div>';
|
||||
|
||||
if ($thread->id_customer)
|
||||
{
|
||||
$customer = new Customer($thread->id_customer);
|
||||
$products = $customer->getBoughtProducts();
|
||||
$orders = Order::getCustomerOrders($customer->id);
|
||||
|
||||
echo '<div style="float:left;width:600px">';
|
||||
if ($orders AND sizeof($orders))
|
||||
{
|
||||
$totalOK = 0;
|
||||
$ordersOK = array();
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee));
|
||||
foreach ($orders as $order)
|
||||
if ($order['valid'])
|
||||
{
|
||||
$ordersOK[] = $order;
|
||||
$totalOK += $order['total_paid_real'];
|
||||
}
|
||||
if ($countOK = sizeof($ordersOK))
|
||||
{
|
||||
echo '<div style="float:left;margin-right:20px;">
|
||||
<h2>'.$this->l('Orders').'</h2>
|
||||
<table cellspacing="0" cellpadding="0" class="table float">
|
||||
<tr>
|
||||
<th class="center">'.$this->l('ID').'</th>
|
||||
<th class="center">'.$this->l('Date').'</th>
|
||||
<th class="center">'.$this->l('Products').'</th>
|
||||
<th class="center">'.$this->l('Total paid').'</th>
|
||||
<th class="center">'.$this->l('Payment').'</th>
|
||||
<th class="center">'.$this->l('State').'</th>
|
||||
<th class="center">'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$irow = 0;
|
||||
foreach ($ordersOK AS $order)
|
||||
echo '<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'\'">
|
||||
<td class="center">'.$order['id_order'].'</td>
|
||||
<td>'.Tools::displayDate($order['date_add'], (int)($cookie->id_lang)).'</td>
|
||||
<td align="right">'.$order['nb_products'].'</td>
|
||||
<td align="right">'.Tools::displayPrice($order['total_paid_real'], new Currency((int)($order['id_currency']))).'</td>
|
||||
<td>'.$order['payment'].'</td>
|
||||
<td>'.$order['order_state'].'</td>
|
||||
<td align="center"><a href="?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td>
|
||||
</tr>';
|
||||
echo '</table>
|
||||
<h3 style="color:green;font-weight:700;margin-top:10px">'.$this->l('Validated Orders:').' '.$countOK.' '.$this->l('for').' '.Tools::displayPrice($totalOK, new Currency(Configuration::get('PS_CURRENCY_DEFAULT'))).'</h3>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
if ($products AND sizeof($products))
|
||||
{
|
||||
echo '<div style="float:left;margin-right:20px">
|
||||
<h2>'.$this->l('Products').'</h2>
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
<tr>
|
||||
<th class="center">'.$this->l('Date').'</th>
|
||||
<th class="center">'.$this->l('ID').'</th>
|
||||
<th class="center">'.$this->l('Name').'</th>
|
||||
<th class="center">'.$this->l('Quantity').'</th>
|
||||
<th class="center">'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$irow = 0;
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee));
|
||||
foreach ($products AS $product)
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$product['id_order'].'&vieworder&token='.$tokenOrders.'\'">
|
||||
<td>'.Tools::displayDate($product['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td>'.$product['product_id'].'</td>
|
||||
<td>'.$product['product_name'].'</td>
|
||||
<td align="right">'.$product['product_quantity'].'</td>
|
||||
<td align="center"><a href="?tab=AdminOrders&id_order='.$product['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td>
|
||||
</tr>';
|
||||
echo '</table></div>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '<div style="float:left;margin-top:10px">';
|
||||
foreach ($messages AS $message)
|
||||
echo $this->displayMsg($message);
|
||||
echo '</div><div class="clear"> </div>';
|
||||
}
|
||||
|
||||
private function displayButton($content)
|
||||
{
|
||||
return '
|
||||
<div style="margin-bottom:10px;border:1px solid #005500;width:200px;height:130px;padding:10px;background:#EFE">
|
||||
<p style="text-align:center;font-size:15px;font-weight:bold">
|
||||
'.$content.'
|
||||
</p>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,861 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7320 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminCustomers extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'customer';
|
||||
$this->className = 'Customer';
|
||||
$this->lang = false;
|
||||
$this->edit = true;
|
||||
$this->view = true;
|
||||
$this->delete = true;
|
||||
$this->deleted = true;
|
||||
$this->requiredDatabase = true;
|
||||
|
||||
$this->_select = '(YEAR(CURRENT_DATE)-YEAR(`birthday`)) - (RIGHT(CURRENT_DATE, 5)<RIGHT(`birthday`, 5)) as age, (
|
||||
SELECT c.date_add FROM '._DB_PREFIX_.'guest g
|
||||
LEFT JOIN '._DB_PREFIX_.'connections c ON c.id_guest = g.id_guest
|
||||
WHERE g.id_customer = a.id_customer
|
||||
ORDER BY c.date_add DESC
|
||||
LIMIT 1
|
||||
) as connect';
|
||||
$genders = array(1 => $this->l('M'), 2 => $this->l('F'), 9 => $this->l('?'));
|
||||
$this->fieldsDisplay = array(
|
||||
'id_customer' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'id_gender' => array('title' => $this->l('Gender'), 'width' => 25, 'align' => 'center', 'icon' => array(1 => 'male.gif', 2 => 'female.gif', 'default' => 'unknown.gif'), 'orderby' => false, 'type' => 'select', 'select' => $genders, 'filter_key' => 'a!id_gender'),
|
||||
'lastname' => array('title' => $this->l('Last Name'), 'width' => 80),
|
||||
'firstname' => array('title' => $this->l('First name'), 'width' => 60),
|
||||
'email' => array('title' => $this->l('E-mail address'), 'width' => 120, 'maxlength' => 19),
|
||||
'age' => array('title' => $this->l('Age'), 'width' => 30, 'search' => false),
|
||||
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
|
||||
'newsletter' => array('title' => $this->l('News.'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'callback' => 'printNewsIcon', 'orderby' => false),
|
||||
'optin' => array('title' => $this->l('Opt.'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'callback' => 'printOptinIcon', 'orderby' => false),
|
||||
'date_add' => array('title' => $this->l('Registration'), 'width' => 30, 'type' => 'date', 'align' => 'right'),
|
||||
'connect' => array('title' => $this->l('Connection'), 'width' => 60, 'type' => 'datetime', 'search' => false));
|
||||
|
||||
$this->shopLinkType = 'shop';
|
||||
$this->shopShareDatas = true;
|
||||
$this->optionTitle = $this->l('Customers options');
|
||||
$this->_fieldsOptions = array(
|
||||
'PS_PASSWD_TIME_FRONT' => array('title' => $this->l('Regenerate password:'), 'desc' => $this->l('Security minimum time to wait to regenerate the password'),'validation' => 'isUnsignedInt', 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes'))
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::isSubmit('submitDel'.$this->table) OR Tools::isSubmit('delete'.$this->table))
|
||||
{
|
||||
$deleteForm = '
|
||||
<form action="'.htmlentities($_SERVER['REQUEST_URI']).'" method="post">
|
||||
<fieldset><legend>'.$this->l('How do you want to delete your customer(s)?').'</legend>
|
||||
'.$this->l('You have two ways to delete a customer, please choose what you want to do.').'
|
||||
<p>
|
||||
<input type="radio" name="deleteMode" value="real" id="deleteMode_real" />
|
||||
<label for="deleteMode_real" style="float:none">'.$this->l('I want to delete my customer(s) for real, all data will be removed from the database. A customer with the same e-mail address will be able to register again.').'</label>
|
||||
</p>
|
||||
<p>
|
||||
<input type="radio" name="deleteMode" value="deleted" id="deleteMode_deleted" />
|
||||
<label for="deleteMode_deleted" style="float:none">'.$this->l('I don\'t want my customer(s) to register again. The customer(s) will be removed from this list but all data will be kept in the database.').'</label>
|
||||
</p>';
|
||||
foreach ($_POST as $key => $value)
|
||||
if (is_array($value))
|
||||
foreach ($value as $val)
|
||||
$deleteForm .= '<input type="hidden" name="'.htmlentities($key).'[]" value="'.htmlentities($val).'" />';
|
||||
else
|
||||
$deleteForm .= '<input type="hidden" name="'.htmlentities($key).'" value="'.htmlentities($value).'" />';
|
||||
$deleteForm .= ' <br /><input type="submit" class="button" value="'.$this->l(' Delete ').'" />
|
||||
</fieldset>
|
||||
</form>
|
||||
<div class="clear"> </div>';
|
||||
}
|
||||
|
||||
if (Tools::getValue('submitAdd'.$this->table))
|
||||
{
|
||||
$groupList = Tools::getValue('groupBox');
|
||||
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
$id = (int)(Tools::getValue('id_'.$this->table));
|
||||
if (isset($id) AND !empty($id))
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== '1')
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
else
|
||||
{
|
||||
$object = new $this->className($id);
|
||||
if (Validate::isLoadedObject($object))
|
||||
{
|
||||
$customer_email = strval(Tools::getValue('email'));
|
||||
|
||||
// check if e-mail already used
|
||||
if ($customer_email != $object->email)
|
||||
{
|
||||
$customer = new Customer();
|
||||
$customer->getByEmail($customer_email);
|
||||
if ($customer->id)
|
||||
$this->_errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email;
|
||||
}
|
||||
|
||||
if (!is_array($groupList) OR sizeof($groupList) == 0)
|
||||
$this->_errors[] = Tools::displayError('Customer must be in at least one group.');
|
||||
else
|
||||
if (!in_array(Tools::getValue('id_default_group'), $groupList))
|
||||
$this->_errors[] = Tools::displayError('Default customer group must be selected in group box.');
|
||||
|
||||
// Updating customer's group
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
$object->cleanGroups();
|
||||
if (is_array($groupList) AND sizeof($groupList) > 0)
|
||||
$object->addGroups($groupList);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while loading object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
{
|
||||
$object = new $this->className();
|
||||
$this->copyFromPost($object, $this->table);
|
||||
$shop = new Shop((int)$object->id_shop);
|
||||
$object->id_group_shop = (int)$shop->id_group_shop;
|
||||
if (!$object->add())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.' ('.mysql_error().')</b>';
|
||||
elseif (($_POST[$this->identifier] = $object->id /* voluntary */) AND $this->postImage($object->id) AND !sizeof($this->_errors) AND $this->_redirect)
|
||||
{
|
||||
// Add Associated groups
|
||||
$group_list = Tools::getValue('groupBox');
|
||||
if (is_array($group_list) && sizeof($group_list) > 0)
|
||||
$object->addGroups($group_list, true);
|
||||
$parent_id = (int)(Tools::getValue('id_parent', 1));
|
||||
// Save and stay on same form
|
||||
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
|
||||
Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$this->token);
|
||||
// Save and back to parent
|
||||
if (Tools::isSubmit('submitAdd'.$this->table.'AndBackToParent'))
|
||||
Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=3&token='.$this->token);
|
||||
// Default behavior (save and back)
|
||||
Tools::redirectAdmin($currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$this->token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (Tools::isSubmit('delete'.$this->table) AND $this->tabAccess['delete'] === '1')
|
||||
{
|
||||
switch (Tools::getValue('deleteMode'))
|
||||
{
|
||||
case 'real':
|
||||
$this->deleted = false;
|
||||
Discount::deleteByIdCustomer((int)(Tools::getValue('id_customer')));
|
||||
break;
|
||||
case 'deleted':
|
||||
$this->deleted = true;
|
||||
break;
|
||||
default:
|
||||
echo $deleteForm;
|
||||
if (isset($_POST['delete'.$this->table]))
|
||||
unset($_POST['delete'.$this->table]);
|
||||
if (isset($_GET['delete'.$this->table]))
|
||||
unset($_GET['delete'.$this->table]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
elseif (Tools::isSubmit('submitDel'.$this->table) AND $this->tabAccess['delete'] === '1')
|
||||
{
|
||||
switch (Tools::getValue('deleteMode'))
|
||||
{
|
||||
case 'real':
|
||||
$this->deleted = false;
|
||||
foreach (Tools::getValue('customerBox') as $id_customer)
|
||||
Discount::deleteByIdCustomer((int)($id_customer));
|
||||
break;
|
||||
case 'deleted':
|
||||
$this->deleted = true;
|
||||
break;
|
||||
default:
|
||||
echo $deleteForm;
|
||||
if (isset($_POST['submitDel'.$this->table]))
|
||||
unset($_POST['submitDel'.$this->table]);
|
||||
if (isset($_GET['submitDel'.$this->table]))
|
||||
unset($_GET['submitDel'.$this->table]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
elseif (Tools::isSubmit('submitGuestToCustomer') AND Tools::getValue('id_customer'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
$customer = new Customer((int)Tools::getValue('id_customer'));
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
$this->_errors[] = Tools::displayError('This customer does not exist.');
|
||||
if(Customer::customerExists($customer->email))
|
||||
$this->_errors[] = Tools::displayError('This customer already exist as non-guest.');
|
||||
elseif ($customer->transformToCustomer(Tools::getValue('id_lang', Configuration::get('PS_LANG_DEFAULT'))))
|
||||
Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$customer->id.'&conf=3&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}elseif (Tools::isSubmit('changeNewsletterVal') AND Tools::getValue('id_customer'))
|
||||
{
|
||||
$id_customer = (int)Tools::getValue('id_customer');
|
||||
$customer = new Customer($id_customer);
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
$update = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer` SET newsletter = '.($customer->newsletter ? 0 : 1).' WHERE `id_customer` = '.(int)($customer->id));
|
||||
if (!$update)
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
Tools::redirectAdmin($currentIndex.'&token='.$this->token);
|
||||
|
||||
}elseif (Tools::isSubmit('changeOptinVal') AND Tools::getValue('id_customer'))
|
||||
{
|
||||
$id_customer = (int)Tools::getValue('id_customer');
|
||||
$customer = new Customer($id_customer);
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
$update = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer` SET optin = '.($customer->optin ? 0 : 1).' WHERE `id_customer` = '.(int)($customer->id));
|
||||
if (!$update)
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating customer.');
|
||||
Tools::redirectAdmin($currentIndex.'&token='.$this->token);
|
||||
}
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
public function viewcustomer()
|
||||
{
|
||||
global $currentIndex, $cookie, $link;
|
||||
|
||||
$irow = 0;
|
||||
$configurations = Configuration::getMultiple(array('PS_LANG_DEFAULT', 'PS_CURRENCY_DEFAULT'));
|
||||
$defaultLanguage = (int)($configurations['PS_LANG_DEFAULT']);
|
||||
$defaultCurrency = (int)($configurations['PS_CURRENCY_DEFAULT']);
|
||||
if (!($customer = $this->loadObject()))
|
||||
return;
|
||||
$customerStats = $customer->getStats();
|
||||
$addresses = $customer->getAddresses($defaultLanguage);
|
||||
$products = $customer->getBoughtProducts();
|
||||
$discounts = Discount::getCustomerDiscounts($defaultLanguage, (int)$customer->id, false, false);
|
||||
$orders = Order::getCustomerOrders((int)$customer->id, true);
|
||||
$carts = Cart::getCustomerCarts((int)$customer->id);
|
||||
$groups = $customer->getGroups();
|
||||
$messages = CustomerThread::getCustomerMessages((int)$customer->id);
|
||||
$referrers = Referrer::getReferrers((int)$customer->id);
|
||||
if ($totalCustomer = Db::getInstance()->getValue('SELECT SUM(total_paid_real) FROM '._DB_PREFIX_.'orders WHERE id_customer = '.$customer->id.' AND valid = 1'))
|
||||
{
|
||||
Db::getInstance()->getValue('SELECT SQL_CALC_FOUND_ROWS COUNT(*) FROM '._DB_PREFIX_.'orders WHERE valid = 1 GROUP BY id_customer HAVING SUM(total_paid_real) > '.$totalCustomer);
|
||||
$countBetterCustomers = (int)Db::getInstance()->getValue('SELECT FOUND_ROWS()') + 1;
|
||||
}
|
||||
else
|
||||
$countBetterCustomers = '-';
|
||||
|
||||
$shop = new Shop((int)$customer->id_shop);
|
||||
|
||||
echo '
|
||||
<fieldset style="width:400px;float: left"><div style="float: right"><a href="'.$currentIndex.'&addcustomer&id_customer='.$customer->id.'&token='.$this->token.'"><img src="../img/admin/edit.gif" /></a></div>
|
||||
<span style="font-weight: bold; font-size: 14px;">'.$customer->firstname.' '.$customer->lastname.'</span>
|
||||
<img src="../img/admin/'.($customer->id_gender == 2 ? 'female' : ($customer->id_gender == 1 ? 'male' : 'unknown')).'.gif" style="margin-bottom: 5px" /><br />
|
||||
<a href="mailto:'.$customer->email.'" style="text-decoration: underline; color: blue">'.$customer->email.'</a><br /><br />
|
||||
'.$this->l('ID:').' '.sprintf('%06d', $customer->id).'<br />
|
||||
'.$this->l('Registration date:').' '.Tools::displayDate($customer->date_add, (int)($cookie->id_lang), true).'<br />
|
||||
'.$this->l('Last visit:').' '.($customerStats['last_visit'] ? Tools::displayDate($customerStats['last_visit'], (int)($cookie->id_lang), true) : $this->l('never')).'<br />
|
||||
'.($countBetterCustomers != '-' ? $this->l('Rank: #').' '.(int)$countBetterCustomers.'<br />' : '')
|
||||
.(Tools::isMultiShopActivated() ? '<br />'.$this->l('Shop:').' '.$shop->name : '').'
|
||||
</fieldset>
|
||||
<fieldset style="width:300px;float:left;margin-left:50px">
|
||||
<div style="float: right">
|
||||
<a href="'.$currentIndex.'&addcustomer&id_customer='.$customer->id.'&token='.$this->token.'"><img src="../img/admin/edit.gif" /></a>
|
||||
</div>
|
||||
'.$this->l('Newsletter:').' '.($customer->newsletter ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />').'<br />
|
||||
'.$this->l('Opt-in:').' '.($customer->optin ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />').'<br />
|
||||
'.$this->l('Age:').' '.$customerStats['age'].' '.((!empty($customer->birthday['age'])) ? '('.Tools::displayDate($customer->birthday, (int)($cookie->id_lang)).')' : $this->l('unknown')).'<br /><br />
|
||||
'.$this->l('Last update:').' '.Tools::displayDate($customer->date_upd, (int)($cookie->id_lang), true).'<br />
|
||||
'.$this->l('Status:').' '.($customer->active ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />');
|
||||
if ($customer->isGuest())
|
||||
{
|
||||
echo '
|
||||
<div>
|
||||
'.$this->l('This customer is registered as').' <b>'.$this->l('guest').'</b>';
|
||||
if(!Customer::customerExists($customer->email))
|
||||
{
|
||||
echo '
|
||||
<form method="POST" action="index.php?tab=AdminCustomers&id_customer='.(int)$customer->id.'&token='.Tools::getAdminTokenLite('AdminCustomers').'">
|
||||
<input type="hidden" name="id_lang" value="'.(int)(sizeof($orders) ? $orders[0]['id_lang'] : Configuration::get('PS_LANG_DEFAULT')).'" />
|
||||
<p class="center"><input class="button" type="submit" name="submitGuestToCustomer" value="'.$this->l('Transform to customer').'" /></p>
|
||||
'.$this->l('This feature generates a random password and sends an e-mail to the customer
|
||||
</form>');
|
||||
}
|
||||
else
|
||||
echo '</div><div><b style="color:red;">'.$this->l('A registered customer account exists with the same email address').'</b>';
|
||||
echo '
|
||||
</div>
|
||||
';
|
||||
}
|
||||
echo '
|
||||
</fieldset>
|
||||
<div class="clear"> </div>';
|
||||
|
||||
echo '<fieldset style="height:190px"><legend><img src="../img/admin/cms.gif" /> '.$this->l('Add a private note').'</legend>
|
||||
<p>'.$this->l('This note will be displayed to all the employees but not to the customer.').'</p>
|
||||
<form action="ajax.php" method="post" onsubmit="saveCustomerNote();return false;" id="customer_note">
|
||||
<textarea name="note" id="noteContent" style="width:600px;height:100px" onkeydown="$(\'#submitCustomerNote\').removeAttr(\'disabled\');">'.Tools::htmlentitiesUTF8($customer->note).'</textarea><br />
|
||||
<input type="submit" id="submitCustomerNote" class="button" value="'.$this->l(' Save ').'" style="float:left;margin-top:5px" disabled="disabled" />
|
||||
<span id="note_feedback" style="float:left;margin:10px 0 0 10px"></span>
|
||||
</form>
|
||||
</fieldset>
|
||||
<div class="clear"> </div>
|
||||
<script type="text/javascript">
|
||||
function saveCustomerNote()
|
||||
{
|
||||
$("#note_feedback").html("<img src=\"../img/loader.gif\" />").show();
|
||||
var noteContent = $("#noteContent").val();
|
||||
$.post("ajax.php", {submitCustomerNote:1,id_customer:'.(int)$customer->id.',note:noteContent}, function (r) {
|
||||
$("#note_feedback").html("").hide();
|
||||
if (r == "ok")
|
||||
{
|
||||
$("#note_feedback").html("<b style=\"color:green\">'.addslashes($this->l('Your note has been saved')).'</b>").fadeIn(400);
|
||||
$("#submitCustomerNote").attr("disabled", "disabled");
|
||||
}
|
||||
else if (r == "error:validation")
|
||||
$("#note_feedback").html("<b style=\"color:red\">'.addslashes($this->l('Error: your note is not valid')).'</b>").fadeIn(400);
|
||||
else if (r == "error:update")
|
||||
$("#note_feedback").html("<b style=\"color:red\">'.addslashes($this->l('Error: cannot save your note')).'</b>").fadeIn(400);
|
||||
$("#note_feedback").fadeOut(3000);
|
||||
});
|
||||
}
|
||||
</script>';
|
||||
|
||||
|
||||
echo '<h2>'.$this->l('Messages').' ('.sizeof($messages).')</h2>';
|
||||
if (sizeof($messages))
|
||||
{
|
||||
echo '
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
<tr>
|
||||
<th class="center">'.$this->l('Status').'</th>
|
||||
<th class="center">'.$this->l('Message').'</th>
|
||||
<th class="center">'.$this->l('Sent on').'</th>
|
||||
</tr>';
|
||||
foreach ($messages AS $message)
|
||||
echo '<tr>
|
||||
<td>'.$message['status'].'</td>
|
||||
<td><a href="index.php?tab=AdminCustomerThreads&id_customer_thread='.(int)($message['id_customer_thread']).'&viewcustomer_thread&token='.Tools::getAdminTokenLite('AdminCustomerThreads').'">'.substr(strip_tags(html_entity_decode($message['message'], ENT_NOQUOTES, 'UTF-8')), 0, 75).'...</a></td>
|
||||
<td>'.Tools::displayDate($message['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
</tr>';
|
||||
echo '</table>
|
||||
<div class="clear"> </div>';
|
||||
}
|
||||
else
|
||||
echo $customer->firstname.' '.$customer->lastname.' '.$this->l('has never contacted you.');
|
||||
|
||||
// display hook specified to this page : AdminCustomers
|
||||
if (($hook = Module::hookExec('adminCustomers', array('id_customer' => $customer->id))) !== false)
|
||||
echo '<div>'.$hook.'</div>';
|
||||
echo '<div class="clear"> </div>';
|
||||
|
||||
echo '<h2>'.$this->l('Groups').' ('.sizeof($groups).')</h2>';
|
||||
if ($groups AND sizeof($groups))
|
||||
{
|
||||
echo '
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
<tr>
|
||||
<th class="center">'.$this->l('ID').'</th>
|
||||
<th class="center">'.$this->l('Name').'</th>
|
||||
<th class="center">'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$tokenGroups = Tools::getAdminToken('AdminGroups'.(int)(Tab::getIdFromClassName('AdminGroups')).(int)($cookie->id_employee));
|
||||
foreach ($groups AS $group)
|
||||
{
|
||||
$objGroup = new Group($group);
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminGroups&id_group='.$objGroup->id.'&viewgroup&token='.$tokenGroups.'\'">
|
||||
<td class="center">'.$objGroup->id.'</td>
|
||||
<td>'.$objGroup->name[$defaultLanguage].'</td>
|
||||
<td align="center"><a href="?tab=AdminGroups&id_group='.$objGroup->id.'&viewgroup&token='.$tokenGroups.'"><img src="../img/admin/details.gif" /></a></td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
</table>';
|
||||
}
|
||||
echo '<div class="clear"> </div>';
|
||||
echo '<h2>'.$this->l('Orders').' ('.sizeof($orders).')</h2>';
|
||||
if ($orders AND sizeof($orders))
|
||||
{
|
||||
$totalOK = 0;
|
||||
$ordersOK = array();
|
||||
$ordersKO = array();
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)Tab::getIdFromClassName('AdminOrders').(int)$cookie->id_employee);
|
||||
foreach ($orders AS $order)
|
||||
if ($order['valid'])
|
||||
{
|
||||
$ordersOK[] = $order;
|
||||
$totalOK += $order['total_paid_real'];
|
||||
}
|
||||
else
|
||||
$ordersKO[] = $order;
|
||||
$orderHead = '
|
||||
<table cellspacing="0" cellpadding="0" class="table float">
|
||||
<tr>
|
||||
<th class="center">'.$this->l('ID').'</th>
|
||||
<th class="center">'.$this->l('Date').'</th>
|
||||
<th class="center">'.$this->l('Products').'</th>
|
||||
<th class="center">'.$this->l('Total paid').'</th>
|
||||
<th class="center">'.$this->l('Payment').'</th>
|
||||
<th class="center">'.$this->l('State').'</th>
|
||||
<th class="center">'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$orderFoot = '</table>';
|
||||
if ($countOK = sizeof($ordersOK))
|
||||
{
|
||||
echo '<div style="float:left;margin-right:20px"><h3 style="color:green;font-weight:700">'.$this->l('Valid orders:').' '.$countOK.' '.$this->l('for').' '.Tools::displayPrice($totalOK, new Currency($defaultCurrency)).'</h3>'.$orderHead;
|
||||
foreach ($ordersOK AS $order)
|
||||
echo '<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'\'">
|
||||
<td class="center">'.$order['id_order'].'</td>
|
||||
<td>'.Tools::displayDate($order['date_add'], (int)($cookie->id_lang)).'</td>
|
||||
<td align="right">'.$order['nb_products'].'</td>
|
||||
<td align="right">'.Tools::displayPrice($order['total_paid_real'], new Currency((int)($order['id_currency']))).'</td>
|
||||
<td>'.$order['payment'].'</td>
|
||||
<td>'.$order['order_state'].'</td>
|
||||
<td align="center"><a href="?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td>
|
||||
</tr>';
|
||||
echo $orderFoot.'</div>';
|
||||
}
|
||||
if ($countKO = sizeof($ordersKO))
|
||||
{
|
||||
echo '<div style="float:left;margin-right:20px"><h3 style="color:red;font-weight:700">'.$this->l('Invalid orders:').' '.$countKO.'</h3>'.$orderHead;
|
||||
foreach ($ordersKO AS $order)
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'\'">
|
||||
<td class="center">'.$order['id_order'].'</td>
|
||||
<td>'.Tools::displayDate($order['date_add'], (int)($cookie->id_lang)).'</td>
|
||||
<td align="right">'.$order['nb_products'].'</td>
|
||||
<td align="right">'.Tools::displayPrice($order['total_paid_real'], new Currency((int)($order['id_currency']))).'</td>
|
||||
<td>'.$order['payment'].'</td>
|
||||
<td>'.$order['order_state'].'</td>
|
||||
<td align="center"><a href="?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td>
|
||||
</tr>';
|
||||
echo $orderFoot.'</div><div class="clear"> </div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
echo $customer->firstname.' '.$customer->lastname.' '.$this->l('has not placed any orders yet');
|
||||
|
||||
if ($products AND sizeof($products))
|
||||
{
|
||||
echo '<div class="clear"> </div>
|
||||
<h2>'.$this->l('Products').' ('.sizeof($products).')</h2>
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
<tr>
|
||||
<th class="center">'.$this->l('Date').'</th>
|
||||
<th class="center">'.$this->l('Name').'</th>
|
||||
<th class="center">'.$this->l('Quantity').'</th>
|
||||
<th class="center">'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee));
|
||||
foreach ($products AS $product)
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$product['id_order'].'&vieworder&token='.$tokenOrders.'\'">
|
||||
<td>'.Tools::displayDate($product['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td>'.$product['product_name'].'</td>
|
||||
<td align="right">'.$product['product_quantity'].'</td>
|
||||
<td align="center"><a href="?tab=AdminOrders&id_order='.$product['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td>
|
||||
</tr>';
|
||||
echo '
|
||||
</table>';
|
||||
}
|
||||
echo '<div class="clear"> </div>
|
||||
<h2>'.$this->l('Addresses').' ('.sizeof($addresses).')</h2>';
|
||||
if (sizeof($addresses))
|
||||
{
|
||||
echo '
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
<tr>
|
||||
<th>'.$this->l('Company').'</th>
|
||||
<th>'.$this->l('Name').'</th>
|
||||
<th>'.$this->l('Address').'</th>
|
||||
<th>'.$this->l('Country').'</th>
|
||||
<th>'.$this->l('Phone number(s)').'</th>
|
||||
<th>'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$tokenAddresses = Tools::getAdminToken('AdminAddresses'.(int)(Tab::getIdFromClassName('AdminAddresses')).(int)($cookie->id_employee));
|
||||
foreach ($addresses AS $address)
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').'>
|
||||
<td>'.($address['company'] ? $address['company'] : '--').'</td>
|
||||
<td>'.$address['firstname'].' '.$address['lastname'].'</td>
|
||||
<td>'.$address['address1'].($address['address2'] ? ' '.$address['address2'] : '').' '.$address['postcode'].' '.$address['city'].'</td>
|
||||
<td>'.$address['country'].'</td>
|
||||
<td>'.($address['phone'] ? ($address['phone'].($address['phone_mobile'] ? '<br />'.$address['phone_mobile'] : '')) : ($address['phone_mobile'] ? '<br />'.$address['phone_mobile'] : '--')).'</td>
|
||||
<td align="center">
|
||||
<a href="?tab=AdminAddresses&id_address='.$address['id_address'].'&addaddress&token='.$tokenAddresses.'"><img src="../img/admin/edit.gif" /></a>
|
||||
<a href="?tab=AdminAddresses&id_address='.$address['id_address'].'&deleteaddress&token='.$tokenAddresses.'"><img src="../img/admin/delete.gif" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
echo '
|
||||
</table>';
|
||||
}
|
||||
else
|
||||
echo $customer->firstname.' '.$customer->lastname.' '.$this->l('has not registered any addresses yet').'.';
|
||||
echo '<div class="clear"> </div>
|
||||
<h2>'.$this->l('Discounts').' ('.sizeof($discounts).')</h2>';
|
||||
if (sizeof($discounts))
|
||||
{
|
||||
echo '
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
<tr>
|
||||
<th>'.$this->l('ID').'</th>
|
||||
<th>'.$this->l('Code').'</th>
|
||||
<th>'.$this->l('Type').'</th>
|
||||
<th>'.$this->l('Value').'</th>
|
||||
<th>'.$this->l('Qty available').'</th>
|
||||
<th>'.$this->l('Status').'</th>
|
||||
<th>'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$tokenDiscounts = Tools::getAdminToken('AdminDiscounts'.(int)(Tab::getIdFromClassName('AdminDiscounts')).(int)($cookie->id_employee));
|
||||
foreach ($discounts AS $discount)
|
||||
{
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').'>
|
||||
<td align="center">'.$discount['id_discount'].'</td>
|
||||
<td>'.$discount['name'].'</td>
|
||||
<td>'.$discount['type'].'</td>
|
||||
<td align="right">'.$discount['value'].'</td>
|
||||
<td align="center">'.$discount['quantity_for_user'].'</td>
|
||||
<td align="center"><img src="../img/admin/'.($discount['active'] ? 'enabled.gif' : 'disabled.gif').'" alt="'.$this->l('Status').'" title="'.$this->l('Status').'" /></td>
|
||||
<td align="center">
|
||||
<a href="?tab=AdminDiscounts&id_discount='.$discount['id_discount'].'&adddiscount&token='.$tokenDiscounts.'"><img src="../img/admin/edit.gif" /></a>
|
||||
<a href="?tab=AdminDiscounts&id_discount='.$discount['id_discount'].'&deletediscount&token='.$tokenDiscounts.'"><img src="../img/admin/delete.gif" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
</table>';
|
||||
|
||||
}
|
||||
else
|
||||
echo $customer->firstname.' '.$customer->lastname.' '.$this->l('has no discount vouchers').'.';
|
||||
echo '<div class="clear"> </div>';
|
||||
|
||||
echo '<div style="float:left">
|
||||
<h2>'.$this->l('Carts').' ('.sizeof($carts).')</h2>';
|
||||
if ($carts AND sizeof($carts))
|
||||
{
|
||||
echo '
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
<tr>
|
||||
<th class="center">'.$this->l('ID').'</th>
|
||||
<th class="center">'.$this->l('Date').'</th>
|
||||
<th class="center">'.$this->l('Total').'</th>
|
||||
<th class="center">'.$this->l('Carrier').'</th>
|
||||
<th class="center">'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$tokenCarts = Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)($cookie->id_employee));
|
||||
foreach ($carts AS $cart)
|
||||
{
|
||||
$cartI = new Cart((int)($cart['id_cart']));
|
||||
$summary = $cartI->getSummaryDetails();
|
||||
$currency = new Currency((int)($cart['id_currency']));
|
||||
$carrier = new Carrier((int)($cart['id_carrier']));
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminCarts&id_cart='.$cart['id_cart'].'&viewcart&token='.$tokenCarts.'\'">
|
||||
<td class="center">'.sprintf('%06d', $cart['id_cart']).'</td>
|
||||
<td>'.Tools::displayDate($cart['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td align="right">'.Tools::displayPrice($summary['total_price'], $currency).'</td>
|
||||
<td>'.$carrier->name.'</td>
|
||||
<td align="center"><a href="index.php?tab=AdminCarts&id_cart='.$cart['id_cart'].'&viewcart&token='.$tokenCarts.'"><img src="../img/admin/details.gif" /></a></td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
</table>';
|
||||
}
|
||||
else
|
||||
echo $this->l('No cart available').'.';
|
||||
echo '</div>';
|
||||
|
||||
$interested = Db::getInstance()->ExecuteS('SELECT DISTINCT id_product, c.id_cart, c.id_shop
|
||||
FROM '._DB_PREFIX_.'cart_product cp
|
||||
JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = cp.id_cart)
|
||||
WHERE c.id_customer = '.(int)$customer->id.'
|
||||
AND cp.id_product NOT IN (SELECT product_id
|
||||
FROM '._DB_PREFIX_.'orders o
|
||||
JOIN '._DB_PREFIX_.'order_detail od ON (o.id_order = od.id_order)
|
||||
WHERE o.valid = 1 AND o.id_customer = '.(int)$customer->id.')');
|
||||
if (count($interested))
|
||||
{
|
||||
echo '<div style="float:left;margin-left:20px">
|
||||
<h2>'.$this->l('Products').' ('.count($interested).')</h2>
|
||||
<table cellspacing="0" cellpadding="0" class="table">';
|
||||
foreach ($interested as $p)
|
||||
{
|
||||
$product = new Product((int)$p['id_product'], false, $cookie->id_lang, (int)$p['id_shop']);
|
||||
echo '
|
||||
<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \''.$link->getProductLink((int)$product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, (int)($cookie->id_lang))).'\'">
|
||||
<td>'.(int)$product->id.'</td>
|
||||
<td>'.Tools::htmlentitiesUTF8($product->name).'</td>
|
||||
<td align="center"><a href="'.$link->getProductLink((int)$product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, (int)($cookie->id_lang))).'"><img src="../img/admin/details.gif" /></a></td>
|
||||
</tr>';
|
||||
}
|
||||
echo '</table></div>';
|
||||
}
|
||||
|
||||
echo '<div class="clear"> </div>';
|
||||
|
||||
/* Last connections */
|
||||
$connections = $customer->getLastConnections();
|
||||
if (sizeof($connections))
|
||||
{
|
||||
echo '<h2>'.$this->l('Last connections').'</h2>
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
<tr>
|
||||
<th style="width: 200px">'.$this->l('Date').'</th>
|
||||
<th style="width: 100px">'.$this->l('Pages viewed').'</th>
|
||||
<th style="width: 100px">'.$this->l('Total time').'</th>
|
||||
<th style="width: 100px">'.$this->l('Origin').'</th>
|
||||
<th style="width: 100px">'.$this->l('IP Address').'</th>
|
||||
</tr>';
|
||||
foreach ($connections as $connection)
|
||||
echo '<tr>
|
||||
<td>'.Tools::displayDate($connection['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td>'.(int)($connection['pages']).'</td>
|
||||
<td>'.$connection['time'].'</td>
|
||||
<td>'.($connection['http_referer'] ? preg_replace('/^www./', '', parse_url($connection['http_referer'], PHP_URL_HOST)) : $this->l('Direct link')).'</td>
|
||||
<td>'.$connection['ipaddress'].'</td>
|
||||
</tr>';
|
||||
echo '</table><div class="clear"> </div>';
|
||||
}
|
||||
if (sizeof($referrers))
|
||||
{
|
||||
echo '<h2>'.$this->l('Referrers').'</h2>
|
||||
<table cellspacing="0" cellpadding="0" class="table">
|
||||
<tr>
|
||||
<th style="width: 200px">'.$this->l('Date').'</th>
|
||||
<th style="width: 200px">'.$this->l('Name').'</th>
|
||||
</tr>';
|
||||
foreach ($referrers as $referrer)
|
||||
echo '<tr>
|
||||
<td>'.Tools::displayDate($referrer['date_add'], (int)($cookie->id_lang), true).'</td>
|
||||
<td>'.$referrer['name'].'</td>
|
||||
</tr>';
|
||||
echo '</table><div class="clear"> </div>';
|
||||
}
|
||||
echo '<a href="'.$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to customer list').'</a><br />';
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$birthday = explode('-', $this->getFieldValue($obj, 'birthday'));
|
||||
$customer_groups = Tools::getValue('groupBox', $obj->getGroups());
|
||||
$groups = Group::getGroups($this->_defaultFormLanguage, true);
|
||||
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post" autocomplete="off">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/tab-customers.gif" />'.$this->l('Customer').'</legend>
|
||||
<label>'.$this->l('Gender:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" size="33" name="id_gender" id="gender_1" value="1" '.($this->getFieldValue($obj, 'id_gender') == 1 ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="gender_1"> '.$this->l('Male').'</label>
|
||||
<input type="radio" size="33" name="id_gender" id="gender_2" value="2" '.($this->getFieldValue($obj, 'id_gender') == 2 ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="gender_2"> '.$this->l('Female').'</label>
|
||||
<input type="radio" size="33" name="id_gender" id="gender_3" value="9" '.(($this->getFieldValue($obj, 'id_gender') == 9 OR !$this->getFieldValue($obj, 'id_gender')) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="gender_3"> '.$this->l('Unknown').'</label>
|
||||
</div>
|
||||
<label>'.$this->l('Last name:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="lastname" value="'.htmlentities($this->getFieldValue($obj, 'lastname'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer"> </span></span>
|
||||
</div>
|
||||
<label>'.$this->l('First name:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="firstname" value="'.htmlentities($this->getFieldValue($obj, 'firstname'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer"> </span></span>
|
||||
</div>
|
||||
<label>'.$this->l('Password:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="password" size="33" name="passwd" value="" /> '.(!$obj->id ? '<sup>*</sup>' : '').'
|
||||
<p>'.($obj->id ? $this->l('Leave blank if no change') : $this->l('5 characters min., only letters, numbers, or').' -_').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('E-mail address:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="email" value="'.htmlentities($this->getFieldValue($obj, 'email'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
</div>
|
||||
<label>'.$this->l('Birthday:').' </label>';
|
||||
$sl_year = ($this->getFieldValue($obj, 'birthday')) ? $birthday[0] : 0;
|
||||
$years = Tools::dateYears();
|
||||
$sl_month = ($this->getFieldValue($obj, 'birthday')) ? $birthday[1] : 0;
|
||||
$months = Tools::dateMonths();
|
||||
$sl_day = ($this->getFieldValue($obj, 'birthday')) ? $birthday[2] : 0;
|
||||
$days = Tools::dateDays();
|
||||
$tab_months = array(
|
||||
$this->l('January'),
|
||||
$this->l('February'),
|
||||
$this->l('March'),
|
||||
$this->l('April'),
|
||||
$this->l('May'),
|
||||
$this->l('June'),
|
||||
$this->l('July'),
|
||||
$this->l('August'),
|
||||
$this->l('September'),
|
||||
$this->l('October'),
|
||||
$this->l('November'),
|
||||
$this->l('December'));
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
<select name="days">
|
||||
<option value="">-</option>';
|
||||
foreach ($days as $v)
|
||||
echo '<option value="'.$v.'" '.($sl_day == $v ? 'selected="selected"' : '').'>'.$v.'</option>';
|
||||
echo '
|
||||
</select>
|
||||
<select name="months">
|
||||
<option value="">-</option>';
|
||||
foreach ($months as $k => $v)
|
||||
echo '<option value="'.$k.'" '.($sl_month == $k ? 'selected="selected"' : '').'>'.$this->l($v).'</option>';
|
||||
echo '</select>
|
||||
<select name="years">
|
||||
<option value="">-</option>';
|
||||
foreach ($years as $v)
|
||||
echo '<option value="'.$v.'" '.($sl_year == $v ? 'selected="selected"' : '').'>'.$v.'</option>';
|
||||
echo '</select>
|
||||
</div>';
|
||||
echo '<label>'.$this->l('Status:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"><img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.(!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"><img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Allow or disallow this customer to log in').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Newsletter:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="newsletter" id="newsletter_on" value="1" '.($this->getFieldValue($obj, 'newsletter') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="newsletter_on"><img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="newsletter" id="newsletter_off" value="0" '.(!$this->getFieldValue($obj, 'newsletter') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="newsletter_off"><img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Customer will receive your newsletter via e-mail').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Opt-in:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="optin" id="optin_on" value="1" '.($this->getFieldValue($obj, 'optin') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="optin_on"><img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="optin" id="optin_off" value="0" '.(!$this->getFieldValue($obj, 'optin') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="optin_off"><img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Customer will receive your ads via e-mail').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Default group:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_default_group" onchange="checkDefaultGroup(this.value);">';
|
||||
foreach ($groups as $group)
|
||||
echo '<option value="'.(int)($group['id_group']).'"'.($group['id_group'] == $obj->id_default_group ? ' selected="selected"' : '').'>'.htmlentities($group['name'], ENT_NOQUOTES, 'utf-8').'</option>';
|
||||
echo '
|
||||
</select>
|
||||
<p>'.$this->l('Apply non-cumulative rules (e.g., price, display method, reduction)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Groups:').' </label>
|
||||
<div class="margin-form">';
|
||||
if (sizeof($groups))
|
||||
{
|
||||
echo '
|
||||
<table cellspacing="0" cellpadding="0" class="table" style="width: 29.5em;">
|
||||
<tr>
|
||||
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'groupBox[]\', this.checked)" /></th>
|
||||
<th>'.$this->l('ID').'</th>
|
||||
<th>'.$this->l('Group name').'</th>
|
||||
</tr>';
|
||||
$irow = 0;
|
||||
foreach ($groups as $group)
|
||||
{
|
||||
echo '
|
||||
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
|
||||
<td>'.'<input type="checkbox" name="groupBox[]" class="groupBox" id="groupBox_'.$group['id_group'].'" value="'.$group['id_group'].'" '.(in_array($group['id_group'], $customer_groups) ? 'checked="checked" ' : '').'/></td>
|
||||
<td>'.$group['id_group'].'</td>
|
||||
<td><label for="groupBox_'.$group['id_group'].'" class="t">'.$group['name'].'</label></td>
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
</table>
|
||||
<p style="padding:0px; margin:10px 0px 10px 0px;">'.$this->l('Check all the box(es) of groups of which the customer is to be a member').'<sup> *</sup></p>
|
||||
';
|
||||
} else
|
||||
echo '<p>'.$this->l('No group created').'</p>';
|
||||
echo '
|
||||
</div>';
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
$shops = Shop::getShops();
|
||||
echo '
|
||||
<label>'.$this->l('Shop:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_shop">';
|
||||
foreach ($shops as $shop)
|
||||
echo '<option value="'.(int)($shop['id_shop']).'"'.($shop['id_shop'] == (int)Configuration::get('PS_SHOP_DEFAULT') ? ' selected="selected"' : '').'>'.$shop['name'].'</option>';
|
||||
echo '
|
||||
</select>';
|
||||
}
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
|
||||
{
|
||||
global $cookie;
|
||||
return parent::getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
}
|
||||
|
||||
public function beforeDelete($object)
|
||||
{
|
||||
return $object->isUsed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,150 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7465 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
|
||||
|
||||
class AdminDb extends AdminPreferences
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->className = 'Configuration';
|
||||
$this->table = 'configuration';
|
||||
|
||||
$this->_fieldsDatabase = array(
|
||||
'db_server' => array('title' => $this->l('Server:'), 'desc' => $this->l('IP or server name; \'localhost\' will work in most cases'), 'size' => 30, 'type' => 'text', 'required' => true, 'visibility' => Shop::CONTEXT_ALL),
|
||||
'db_name' => array('title' => $this->l('Database:'), 'desc' => $this->l('Database name (e.g., \'prestashop\')'), 'size' => 30, 'type' => 'text', 'required' => true, 'visibility' => Shop::CONTEXT_ALL),
|
||||
'db_prefix' => array('title' => $this->l('Prefix:'), 'size' => 30, 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL),
|
||||
'db_user' => array('title' => $this->l('User:'), 'size' => 30, 'type' => 'text', 'required' => true, 'visibility' => Shop::CONTEXT_ALL),
|
||||
'db_passwd' => array('title' => $this->l('Password:'), 'size' => 30, 'type' => 'password', 'desc' => $this->l('Leave blank if no change')), 'visibility' => Shop::CONTEXT_ALL);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (isset($_POST['submitDatabase'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
foreach ($this->_fieldsDatabase AS $field => $values)
|
||||
if (isset($values['required']) AND $values['required'])
|
||||
if (($value = Tools::getValue($field)) == false AND (string)$value != '0')
|
||||
$this->_errors[] = Tools::displayError('field').' <b>'.$values['title'].'</b> '.Tools::displayError('is required.');
|
||||
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
/* Datas are not saved in database but in config/settings.inc.php */
|
||||
$settings = array();
|
||||
foreach ($_POST as $k => $value)
|
||||
if ($value)
|
||||
$settings['_'.Tools::strtoupper($k).'_'] = $value;
|
||||
rewriteSettingsFile(NULL, NULL, $settings);
|
||||
Tools::redirectAdmin($currentIndex.'&conf=6'.'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
if (Tools::isSubmit('submitEngine'))
|
||||
{
|
||||
if (!isset($_POST['tablesBox']) OR !sizeof($_POST['tablesBox']))
|
||||
$this->_errors[] = Tools::displayError('You did not select any tables');
|
||||
else
|
||||
{
|
||||
$available_engines = $this->_getEngines();
|
||||
$tables_status = $this->_getTablesStatus();
|
||||
$tables_engine = array();
|
||||
|
||||
foreach ($tables_status AS $table)
|
||||
$tables_engine[$table['Name']] = $table['Engine'];
|
||||
|
||||
$engineType = pSQL(Tools::getValue('engineType'));
|
||||
foreach ($_POST['tablesBox'] AS $table)
|
||||
{
|
||||
if ($engineType == $tables_engine[$table])
|
||||
$this->_errors[] = $table.' '.$this->l('is already in').' '.$engineType;
|
||||
else
|
||||
if (!Db::getInstance()->Execute('ALTER TABLE '.pSQL($table).' ENGINE='.pSQL($engineType)))
|
||||
$this->_errors[] = $this->l('Can\'t change engine for').' '.$table;
|
||||
else
|
||||
echo '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Engine change of').' '.$table.' '.$this->l('to').' '.$engineType.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
echo $this->displayWarning($this->l('Be VERY CAREFUL with these settings, as changes may cause your PrestaShop online store to malfunction. For all issues, check the config/settings.inc.php file.')).'<br />';
|
||||
$this->_displayForm('database', $this->_fieldsDatabase, $this->l('Database'), 'width2', 'database_gear');
|
||||
$engines = $this->_getEngines();
|
||||
$irow = 0;
|
||||
echo '<br /><fieldset class="width2"><legend>'.$this->l('MySQL Engine').'</legend><form name="updateEngine" action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post"><table cellspacing="0" cellpadding="0" class="table width2 clear">
|
||||
<tr><th><input type="checkbox" onclick="checkDelBoxes(this.form, \'tablesBox[]\', this.checked)" class="noborder" name="checkme"></th><th>'.$this->l('Table').'</th><th>'.$this->l('Table Engine').'</th></tr>';
|
||||
$tables_status = $this->_getTablesStatus();
|
||||
foreach ($tables_status AS $table)
|
||||
{
|
||||
if (!preg_match('/^'._DB_PREFIX_.'.*/Ui', $table['Name']))
|
||||
continue;
|
||||
echo '<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
|
||||
<td class="noborder"><input type="checkbox" name="tablesBox[]" value="'.$table['Name'].'"/></td><td>'.$table['Name'].'</td><td>'.$table['Engine'].'</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '</table><br />
|
||||
<label for="dbEngine">'.$this->l('Change Engine to').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="engineType">';
|
||||
foreach ($engines AS $engine)
|
||||
echo '<option value="'.$engine.'">'.$engine.'</option>';
|
||||
echo '</select>
|
||||
<input style="margin-left:15px;" class="button" type="submit" value="Submit" name="submitEngine" />
|
||||
</div>
|
||||
</fieldset>';
|
||||
}
|
||||
|
||||
private function _getEngines()
|
||||
{
|
||||
$engines = Db::getInstance()->ExecuteS('SHOW ENGINES');
|
||||
$allowed_engines = array();
|
||||
foreach ($engines AS $engine)
|
||||
{
|
||||
if (in_array($engine['Engine'], array('InnoDB', 'MyISAM')) AND in_array($engine['Support'], array('DEFAULT', 'YES')))
|
||||
$allowed_engines[] = $engine['Engine'];
|
||||
}
|
||||
return $allowed_engines;
|
||||
}
|
||||
|
||||
private function _getTablesStatus()
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('SHOW TABLE STATUS');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7060 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminDeliverySlip extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'delivery';
|
||||
|
||||
$this->optionTitle = $this->l('Delivery slips options');
|
||||
$this->_fieldsOptions = array(
|
||||
'PS_DELIVERY_PREFIX' => array('title' => $this->l('Delivery prefix:'), 'desc' => $this->l('Prefix used for delivery slips'), 'size' => 6, 'type' => 'textLang'),
|
||||
'PS_DELIVERY_NUMBER' => array('title' => $this->l('Delivery number:'), 'desc' => $this->l('The next delivery slip will begin with this number, and then increase with each additional slip'), 'size' => 6, 'type' => 'text'),
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
$output = '
|
||||
<h2>'.$this->l('Print PDF delivery slips').'</h2>
|
||||
<fieldset>
|
||||
<form action="'.$currentIndex.'&submitPrint=1&token='.$this->token.'" method="post">
|
||||
<label>'.$this->l('From:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="4" maxlength="10" name="date_from" value="'.(date('Y-m-d')).'" style="width: 120px;" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Format: 2007-12-31 (inclusive)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('To:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="4" maxlength="10" name="date_to" value="'.(date('Y-m-d')).'" style="width: 120px;" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Format: 2008-12-31 (inclusive)').'</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l('Generate PDF file').'" name="submitPrint" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required fields').'</div>
|
||||
</form>
|
||||
</fieldset>';
|
||||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
$this->displayForm();
|
||||
$this->displayOptionsList();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::getValue('submitPrint'))
|
||||
{
|
||||
if (!Validate::isDate($_POST['date_from']))
|
||||
$this->_errors[] = $this->l('Invalid from date');
|
||||
if (!Validate::isDate($_POST['date_to']))
|
||||
$this->_errors[] = $this->l('Invalid end date');
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
$orders = Order::getOrdersIdByDate($_POST['date_from'], $_POST['date_to'], NULL, 'delivery');
|
||||
if (sizeof($orders))
|
||||
Tools::redirectAdmin('pdf.php?deliveryslips='.urlencode(serialize($orders)).'&token='.$this->token);
|
||||
else
|
||||
$this->_errors[] = $this->l('No delivery slip found for this period');
|
||||
}
|
||||
}
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,504 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7060 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminDiscounts extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'discount';
|
||||
$this->className = 'Discount';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->_select = 'dtl.`name` AS discount_type, s.name shop_name,
|
||||
IF(a.id_discount_type = 1, CONCAT(a.value, " %"),
|
||||
IF(a.id_discount_type = 2, CONCAT(a.value, " ", c.sign),
|
||||
"--")) as strvalue';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'currency` c ON (c.`id_currency` = a.`id_currency`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'discount_type` dt ON (dt.`id_discount_type` = a.`id_discount_type`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'shop` s ON (s.`id_shop` = a.`id_shop`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'discount_type_lang` dtl ON (dt.`id_discount_type` = dtl.`id_discount_type` AND dtl.`id_lang` = '.(int)($cookie->id_lang).')';
|
||||
|
||||
$typesArray = array();
|
||||
$types = Discount::getDiscountTypes((int)($cookie->id_lang));
|
||||
foreach ($types AS $type)
|
||||
$typesArray[$type['id_discount_type']] = $type['name'];
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_discount' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Code'), 'width' => 85, 'prefix' => '<span class="discount_name">', 'suffix' => '</span>', 'filter_key' => 'a!name'),
|
||||
'shop_name' => array('title' => $this->l('Shop'), 'width' => 85, 'filter_key' => 's!name'),
|
||||
'description' => array('title' => $this->l('Description'), 'width' => 100, 'filter_key' => 'b!description'),
|
||||
'discount_type' => array('title' => $this->l('Type'), 'type' => 'select', 'select' => $typesArray, 'filter_key' => 'dt!id_discount_type'),
|
||||
'strvalue' => array('title' => $this->l('Value'), 'width' => 50, 'align' => 'right', 'filter_key' => 'a!value'),
|
||||
'quantity' => array('title' => $this->l('Qty'), 'width' => 40, 'align' => 'right'),
|
||||
'date_to' => array('title' => $this->l('To'), 'width' => 60, 'type' => 'date', 'align' => 'right'),
|
||||
'active' => array('title' => $this->l('Status'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false));
|
||||
|
||||
$this->optionTitle = $this->l('Discounts options');
|
||||
$this->_fieldsOptions = array(
|
||||
'PS_VOUCHERS' => array('title' => $this->l('Enable vouchers:'), 'desc' => $this->l('Allow the use of vouchers in shop'), 'cast' => 'intval', 'type' => 'bool'),
|
||||
);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function copyFromPost(&$object, $table)
|
||||
{
|
||||
parent::copyFromPost($object, $table);
|
||||
|
||||
$object->cumulable = (!isset($_POST['cumulable']) ? false : true);
|
||||
$object->cumulable_reduction = (!isset($_POST['cumulable_reduction']) ? false : true);
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
|
||||
|
||||
if ($discountName = Tools::getValue('name') AND Validate::isDiscountName($discountName) AND Discount::discountExists($discountName, Tools::getValue('id_discount')))
|
||||
$this->_errors[] = Tools::displayError('A voucher of this name already exists. Please choose another name.');
|
||||
|
||||
if (Tools::getValue('submitAdd'.$this->table))
|
||||
{
|
||||
if (Tools::getValue('id_discount_type') == 0)
|
||||
$this->_errors[] = Tools::displayError('Please set a type for this voucher.');
|
||||
if (Tools::getValue('id_discount_type') == 2 AND Tools::getValue('id_currency') == 0)
|
||||
$this->_errors[] = Tools::displayError('Please set a currency for this voucher.');
|
||||
if ((Tools::getValue('id_discount_type') == 1 || Tools::getValue('id_discount_type') == 2) && !Tools::getValue('value'))
|
||||
$this->_errors[] = Tools::displayError('Please set a amount for this voucher.');
|
||||
if (!Validate::isBool_Id(Tools::getValue('id_target')))
|
||||
$this->_errors[] = Tools::displayError('Invalid customer or group ID field');
|
||||
else
|
||||
{
|
||||
$rules = explode('_', Tools::getValue('id_target'));
|
||||
/* In form, there is one field for two differents fields in object*/
|
||||
$_POST[($rules[0] ? 'id_group' : 'id_customer')] = $rules[1];
|
||||
}
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
if (!sizeof($this->_errors))
|
||||
{
|
||||
$id = (int)(Tools::getValue($this->identifier));
|
||||
/* Object update */
|
||||
if (isset($id) AND !empty($id))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
$object = new $this->className($id);
|
||||
if (Validate::isLoadedObject($object))
|
||||
{
|
||||
/* Specific to objects which must not be deleted */
|
||||
if ($this->deleted AND $this->beforeDelete($object))
|
||||
{
|
||||
$object->deleted = 1;
|
||||
$object->update();
|
||||
$objectNew = new $this->className();
|
||||
$this->copyFromPost($objectNew, $this->table);
|
||||
$shop = new Shop((int)$objectNew->id_shop);
|
||||
$objectNew->id_group_shop = (int)$shop->id_group_shop;
|
||||
$result = $objectNew->add();
|
||||
if (Validate::isLoadedObject($objectNew))
|
||||
$this->afterDelete($objectNew, $object->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (($categories = Tools::getValue('categoryBox')) === false OR (!empty($categories) AND !is_array($categories)))
|
||||
$this->_errors[] = Tools::displayError('Please set a category for this voucher.');
|
||||
$this->copyFromPost($object, $this->table);
|
||||
$shop = new Shop((int)$objectNew->id_shop);
|
||||
$objectNew->id_group_shop = (int)$shop->id_group_shop;
|
||||
$result = $object->update(true, false, $categories);
|
||||
}
|
||||
if (!$result)
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b>';
|
||||
elseif ($this->postImage($object->id))
|
||||
{
|
||||
if ($back = Tools::getValue('back'))
|
||||
Tools::redirectAdmin(urldecode($back).'&conf=4');
|
||||
if (Tools::getValue('stay_here') == 'on' || Tools::getValue('stay_here') == 'true' || Tools::getValue('stay_here') == '1')
|
||||
Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&updatescene&token='.$token);
|
||||
Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&token='.$token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
/* Object creation */
|
||||
else
|
||||
{
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
{
|
||||
$object = new $this->className();
|
||||
$this->copyFromPost($object, $this->table);
|
||||
$shop = new Shop((int)$objectNew->id_shop);
|
||||
$objectNew->id_group_shop = (int)$shop->id_group_shop;
|
||||
$categories = Tools::getValue('categoryBox', null);
|
||||
if (!$object->add(true, false, $categories))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
|
||||
elseif (($_POST[$this->identifier] = $object->id /* voluntary */) AND $this->postImage($object->id) AND $this->_redirect)
|
||||
Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&token='.$token);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
}
|
||||
$this->_errors = array_unique($this->_errors);
|
||||
}
|
||||
else
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
function discountType()
|
||||
{
|
||||
if ($("#id_discount_type").val() == 0)
|
||||
$("#value-div").css("display", "none");
|
||||
else if ($("#id_discount_type").val() == 1)
|
||||
{
|
||||
$("#value-div").css("display", "block");
|
||||
$("#percent-span").css("display", "block");
|
||||
$("#id_currency").css("display", "none");
|
||||
}
|
||||
else if ($("#id_discount_type").val() == 2)
|
||||
{
|
||||
$("#value-div").css("display", "block");
|
||||
$("#percent-span").css("display", "none");
|
||||
$("#id_currency").css("display", "block");
|
||||
$(\'#behavior_not_exhausted\').show();
|
||||
|
||||
}
|
||||
else if ($("#id_discount_type").val() == 3)
|
||||
$("#value-div").css("display", "none");
|
||||
if ($(\'#id_discount_type\').val() != 2)
|
||||
$(\'#behavior_not_exhausted\').hide();
|
||||
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$("#id_discount_type").change(function(){discountType();});
|
||||
discountType();
|
||||
});
|
||||
</script>
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" id="discount" name="discount" method="post" enctype="multipart/form-data">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/coupon.gif" />'.$this->l('Vouchers').'</legend>
|
||||
<label>'.$this->l('Code:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="30" maxlength="32" name="name" value="'.htmlentities($this->getFieldValue($obj, 'name'), ENT_COMPAT, 'UTF-8').'" id="code" />
|
||||
<sup>*</sup>
|
||||
<img src="../img/admin/news-new.gif" onclick="gencode(8);" style="cursor: pointer" />
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters: numbers and').' !<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer"> </span></span>
|
||||
<p class="clear">'.$this->l('The voucher\'s code, at least 3 characters long, which the customer types in during check-out').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Type:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_discount_type" id="id_discount_type" onchange="free_shipping()">
|
||||
<option value="0">'.$this->l('-- Choose --').'</option>';
|
||||
$discountTypes = Discount::getDiscountTypes((int)($cookie->id_lang));
|
||||
foreach ($discountTypes AS $discountType)
|
||||
echo '<option value="'.(int)($discountType['id_discount_type']).'"'.
|
||||
(($this->getFieldValue($obj, 'id_discount_type') == $discountType['id_discount_type']) ? ' selected="selected"' : '').'>'.$discountType['name'].'</option>';
|
||||
echo ' </select> <sup>*</sup>
|
||||
</div>
|
||||
<div id="value-div" style="display:none">
|
||||
<label>'.$this->l('Value').'</label>
|
||||
<div class="margin-form">
|
||||
<input style="float:left;width:80px" type="text" name="value" id="discount_value" value="'.(float)($this->getFieldValue($obj, 'value')).'" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\'); " />
|
||||
<select id="id_currency" name="id_currency" style="float:left;margin-left:10px;width:50px;display:none">
|
||||
<option value="0">--</option>';
|
||||
foreach (Currency::getCurrencies() as $row)
|
||||
echo ' <option value="'.(int)$row['id_currency'].'" '.(($this->getFieldValue($obj, 'id_currency') == $row['id_currency']) ? 'selected="selected"' : '').'>'.$row['sign'].'</option>';
|
||||
echo ' </select>
|
||||
<span id="percent-span" style="margin-left:10px;display:none;float:left;font-size:12px;font-weight:bold;color:black"> %</span>
|
||||
<sup style="float:left;margin-left:5px">*</sup>
|
||||
<p class="clear">'.$this->l('Either the monetary amount or the %, depending on Type selected above').'</p>
|
||||
</div>
|
||||
<div id="behavior_not_exhausted" style="display:none;">
|
||||
<label>'.$this->l('Behavior not exhausted:').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="behavior_not_exhausted">
|
||||
<option value="1" '.($obj->behavior_not_exhausted === 1 ? 'selected="selected"' : '').'>'.$this->l('Reduce the voucher to the total order amount').'</option>
|
||||
<option value="2" '.($obj->behavior_not_exhausted == 2 ? 'selected="selected"' : '').'>'.$this->l('Create a new voucher with remaining amount').'</option>
|
||||
<option value="3" '.($obj->behavior_not_exhausted == 3 ? 'selected="selected"' : '').'>'.$this->l('Create negative invoice').'</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<label>'.$this->l('Description:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo ' <div id="description_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="description_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
<p class="clear">'.$this->l('Will appear in cart next to voucher code').'</p>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'description', 'description');
|
||||
echo ' </div>
|
||||
<div class="clear" / >
|
||||
<label>'.$this->l('Categories:').' </label>
|
||||
<div class="margin-form">
|
||||
<table cellspacing="0" cellpadding="0" class="table" style="width: 600px;">
|
||||
<tr>
|
||||
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'categoryBox[]\', this.checked)" /></th>
|
||||
<th>'.$this->l('ID').'</th>
|
||||
<th>'.$this->l('Name').'</th>
|
||||
</tr>';
|
||||
$done = array();
|
||||
$index = array();
|
||||
$indexedCategories = isset($_POST['categoryBox']) ? $_POST['categoryBox'] : ($obj->id ? Discount::getCategories($obj->id) : array());
|
||||
$categories = Category::getCategories((int)($cookie->id_lang), false);
|
||||
foreach ($indexedCategories AS $k => $row)
|
||||
$index[] = $row['id_category'];
|
||||
$this->recurseCategoryForInclude((int)(Tools::getValue($this->identifier)), $index, $categories, $categories[0][1], 1, $obj->id);
|
||||
echo '
|
||||
</table>
|
||||
<p style="padding:0px; margin:0px 0px 10px 0px;">'.$this->l('Mark all checkbox(es) of categories to which the discount is to be applied').'<sup> *</sup></p>
|
||||
</div>
|
||||
<div class="clear" / >
|
||||
<label>'.$this->l('Total quantity:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="15" name="quantity" value="'.(int)($this->getFieldValue($obj, 'quantity')).'" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Total quantity available (mainly for vouchers open to everyone)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Qty per each user:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="15" name="quantity_per_user" value="'.(int)($this->getFieldValue($obj, 'quantity_per_user')).'" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Number of times a single customer can use this voucher').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Minimum amount').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="15" name="minimal" value="'.($this->getFieldValue($obj, 'minimal') ? (float)($this->getFieldValue($obj, 'minimal')) : '0').'" onkeyup="javascript:this.value = this.value.replace(/,/g, \'.\'); " /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('0 if not applicable').'</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<p>
|
||||
<input type="checkbox" name="cumulable"'.(($this->getFieldValue($obj, 'cumulable') == 1) ? ' checked="checked"' : '').' id="cumulable_on" value="1" />
|
||||
<label class="t" for="cumulable_on"> '.$this->l('Cumulative with other vouchers').'</label>
|
||||
</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<p>
|
||||
<input type="checkbox" name="cumulable_reduction"'.(($this->getFieldValue($obj, 'cumulable_reduction') == 1) ? ' checked="checked"' : '').' id="cumulable_reduction_on" value="1" />
|
||||
<label class="t" for="cumulable_reduction_on"> '.$this->l('Cumulative with price reductions').'</label>
|
||||
</p>
|
||||
</div>
|
||||
<label for="id_shop">'.$this->l('Shop:').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="id_shop" id="id_shop">';
|
||||
$shops = Shop::getShops();
|
||||
foreach ($shops AS $shop)
|
||||
echo '<option value="'.$shop['id_shop'].'" '.($this->getFieldValue($obj, 'id_shop') == $shop['id_shop'] ? 'selected="selected"' : '').'>'.$shop['name'].'</option>';
|
||||
echo '</select>
|
||||
</div>
|
||||
</label>
|
||||
<label>'.$this->l('To be used by:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="hidden" name="id_customer" value="0">
|
||||
<input type="hidden" name="id_group" value="0">
|
||||
<select name="id_target" id="id_target">
|
||||
<option value="0_0">-- '.$this->l('All customers').' --</option>
|
||||
<optgroup label="'.$this->l('Groups').'" id="id_target_group">
|
||||
</optgroup>
|
||||
<optgroup label="'.$this->l('Customers').'" id="id_target_customers">
|
||||
</optgroup>
|
||||
</select><br />'.$this->l('Filter:').' <input type="text" size="25" name="filter" id="filter" onkeyup="fillCustomersAjax();" class="space" value="" />
|
||||
<script type="text/javascript">
|
||||
var formDiscount = document.layers ? document.forms.discount : document.discount;
|
||||
function fillCustomersAjax()
|
||||
{
|
||||
var filterValue = \''.(($value = (int)($this->getFieldValue($obj, 'id_customer'))) ? '0_'.$value : (($value = (int)($this->getFieldValue($obj, 'id_group'))) ? '1_'.$value : '')).'\';
|
||||
if ($(\'#filter\').val())
|
||||
filterValue = $(\'#filter\').val();
|
||||
|
||||
$.getJSON("'.dirname($currentIndex).'/ajax.php",{ajaxDiscountCustomers:1,filter:filterValue},
|
||||
function(obj) {
|
||||
var groups_length = obj.groups.length;
|
||||
if (obj.groups.length == 0)
|
||||
groups_length = 1;
|
||||
var customers_length = obj.customers.length;
|
||||
if (obj.customers.length == 0)
|
||||
customers_length = 1;
|
||||
formDiscount.id_target.length = 1 + customers_length + groups_length;
|
||||
|
||||
if (obj.groups.length == 0)
|
||||
{
|
||||
formDiscount.id_target.options[1].value = -1;
|
||||
formDiscount.id_target.options[1].text = \''.$this->l('No match found').'\';
|
||||
formDiscount.id_target.options[1].className = "groups_filtered";
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < obj.groups.length && i < 50; i++)
|
||||
{
|
||||
formDiscount.id_target.options[i+1].value = obj.groups[i]["value"];
|
||||
formDiscount.id_target.options[i+1].text = obj.groups[i]["text"];
|
||||
formDiscount.id_target.options[i+1].className = "groups_filtered";
|
||||
}
|
||||
if (obj.groups.length >= 50)
|
||||
{
|
||||
formDiscount.id_target.options[50].text = "'.$this->l('Too many results...',__CLASS__ , true, false).'";
|
||||
formDiscount.id_target.options[50].value = "_";
|
||||
formDiscount.id_target.options[50].className = "groups_filtered";
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.customers.length == 0)
|
||||
{
|
||||
formDiscount.id_target.options[groups_length+1].value = -1;
|
||||
formDiscount.id_target.options[groups_length+1].text = \''.$this->l('No match found').'\';
|
||||
formDiscount.id_target.options[groups_length+1].className = "customers_filtered";
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < obj.customers.length && i < 50; i++)
|
||||
{
|
||||
formDiscount.id_target.options[groups_length+1+i].value = obj.customers[i]["value"];
|
||||
formDiscount.id_target.options[groups_length+1+i].text = obj.customers[i]["text"];
|
||||
formDiscount.id_target.options[groups_length+1+i].className = "customers_filtered";
|
||||
}
|
||||
if (obj.customers.length >= 50)
|
||||
{
|
||||
formDiscount.id_target.options[groups_length+50+i].text = "'.$this->l('Too many results...',__CLASS__ , true, false).'";
|
||||
formDiscount.id_target.options[groups_length+50+i].value = "_";
|
||||
formDiscount.id_target.options[groups_length+50+i].className = "customers_filtered";
|
||||
}
|
||||
}
|
||||
$(".groups_filtered").appendTo($("#id_target_group"));
|
||||
$(".customers_filtered").appendTo($("#id_target_customers"));
|
||||
if ($(\'#filter\').val())
|
||||
{
|
||||
if (formDiscount.id_target.options[1].value != -1)
|
||||
formDiscount.id_target.options.selectedIndex = 1;
|
||||
else
|
||||
formDiscount.id_target.options.selectedIndex = 2;
|
||||
}
|
||||
else if(filterValue)
|
||||
for (i = 0; i < (customers_length + groups_length); i++)
|
||||
if (formDiscount.id_target.options[i+1].value == filterValue)
|
||||
formDiscount.id_target.options.selectedIndex = i + 1;
|
||||
}
|
||||
);
|
||||
}
|
||||
fillCustomersAjax();
|
||||
</script>
|
||||
</div><br />';
|
||||
includeDatepicker(array('date_from', 'date_to'), true);
|
||||
echo '
|
||||
<label>'.$this->l('From:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="20" id="date_from" name="date_from" value="'.($this->getFieldValue($obj, 'date_from') ? htmlentities($this->getFieldValue($obj, 'date_from'), ENT_COMPAT, 'UTF-8') : date('Y-m-d H:i:s')).'" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('Start date/time from which voucher can be used').'<br />'.$this->l('Format: YYYY-MM-DD HH:MM:SS').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('To:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="20" id="date_to" name="date_to" value="'.($this->getFieldValue($obj, 'date_to') ? htmlentities($this->getFieldValue($obj, 'date_to'), ENT_COMPAT, 'UTF-8') : (date('Y') + 1).date('-m-d H:i:s')).'" /> <sup>*</sup>
|
||||
<p class="clear">'.$this->l('End date/time at which voucher is no longer valid').'<br />'.$this->l('Format: YYYY-MM-DD HH:MM:SS').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Display the voucher in the cart summary:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="cart_display" id="cart_active_on" value="1" '.($this->getFieldValue($obj, 'cart_display') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="cart_display_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="cart_display" id="cart_active_off" value="0" '.(!$this->getFieldValue($obj, 'cart_display') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="cart_display_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
</div>
|
||||
<div class="clear" / >
|
||||
<label>'.$this->l('Status:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.(!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Enable or disable voucher').'</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
/**
|
||||
* Build a categories tree
|
||||
*
|
||||
* @param array $indexedCategories Array with categories where product is indexed (in order to check checkbox)
|
||||
* @param array $categories Categories to list
|
||||
* @param array $current Current category
|
||||
* @param integer $id_category Current category id
|
||||
*/
|
||||
public static function recurseCategoryForInclude($id_obj, $indexedCategories, $categories, $current, $id_category = 1, $id_category_default = NULL, $has_suite = array())
|
||||
{
|
||||
global $done;
|
||||
static $irow;
|
||||
|
||||
if (!isset($done[$current['infos']['id_parent']]))
|
||||
$done[$current['infos']['id_parent']] = 0;
|
||||
$done[$current['infos']['id_parent']] += 1;
|
||||
|
||||
$todo = sizeof($categories[$current['infos']['id_parent']]);
|
||||
$doneC = $done[$current['infos']['id_parent']];
|
||||
|
||||
$level = $current['infos']['level_depth'] + 1;
|
||||
|
||||
echo '
|
||||
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
|
||||
<td>
|
||||
<input type="checkbox" name="categoryBox[]" class="categoryBox'.($id_category_default == $id_category ? ' id_category_default' : '').'" id="categoryBox_'.$id_category.'" value="'.$id_category.'"'.((in_array($id_category, $indexedCategories) OR ((int)(Tools::getValue('id_category')) == $id_category AND !(int)($id_obj)) OR Tools::getIsset('adddiscount')) ? ' checked="checked"' : '').' />
|
||||
</td>
|
||||
<td>
|
||||
'.$id_category.'
|
||||
</td>
|
||||
<td>';
|
||||
for ($i = 2; $i < $level; $i++)
|
||||
echo '<img src="../img/admin/lvl_'.$has_suite[$i - 2].'.gif" alt="" style="vertical-align: middle;"/>';
|
||||
echo '<img src="../img/admin/'.($level == 1 ? 'lv1.gif' : 'lv2_'.($todo == $doneC ? 'f' : 'b').'.gif').'" alt="" style="vertical-align: middle;"/>
|
||||
<label for="categoryBox_'.$id_category.'" class="t">'.stripslashes($current['infos']['name']).'</label></td>
|
||||
</tr>';
|
||||
|
||||
if ($level > 1)
|
||||
$has_suite[] = ($todo == $doneC ? 0 : 1);
|
||||
if (isset($categories[$id_category]))
|
||||
foreach ($categories[$id_category] AS $key => $row)
|
||||
if ($key != 'infos')
|
||||
self::recurseCategoryForInclude($id_obj, $indexedCategories, $categories, $categories[$id_category][$key], $key, $id_category_default, $has_suite);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7465 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
|
||||
|
||||
class AdminEmails extends AdminPreferences
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->className = 'Configuration';
|
||||
$this->table = 'configuration';
|
||||
|
||||
foreach (Contact::getContacts((int)$cookie->id_lang) AS $contact)
|
||||
$arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']);
|
||||
|
||||
$this->_fieldsEmail = array(
|
||||
'PS_MAIL_EMAIL_MESSAGE' => array('title' => $this->l('Send e-mail to:'), 'desc' => $this->l('When customers send message from order page'), 'validation' => 'isUnsignedId', 'type' => 'select', 'cast' => 'intval', 'identifier' => 'email_message', 'list' => $arr),
|
||||
'PS_MAIL_METHOD' => array('title' => '', 'validation' => 'isGenericName', 'required' => true, 'type' => 'radio', 'choices' => array(1 => $this->l('Use PHP mail() function. Recommended; works in most cases'), 2 => $this->l('Set my own SMTP parameters. For advanced users ONLY')), 'js' => array(1 => 'onclick="$(\'#SMTP_CONTAINER\').slideUp();"', 2 => 'onclick="$(\'#SMTP_CONTAINER\').slideDown();"'), 'visibility' => Shop::CONTEXT_ALL),
|
||||
'PS_MAIL_TYPE' => array('title' => '', 'validation' => 'isGenericName', 'required' => true, 'type' => 'radio', 'choices' => array(1 => $this->l('Send e-mail as HTML'), 2 => $this->l('Send e-mail as Text'), 3 => $this->l('Both'))),
|
||||
'SMTP_CONTAINER' => array('title' => '', 'type' => 'container'),
|
||||
'PS_MAIL_DOMAIN' => array('title' => $this->l('Mail domain:'), 'desc' => $this->l('Fully qualified domain name (keep it empty if you do not know)'), 'validation' => 'isUrl', 'size' => 30, 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL),
|
||||
'PS_MAIL_SERVER' => array('title' => $this->l('SMTP server:'), 'desc' => $this->l('IP or server name (e.g., smtp.mydomain.com)'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL),
|
||||
'PS_MAIL_USER' => array('title' => $this->l('SMTP user:'), 'desc' => $this->l('Leave blank if not applicable'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL),
|
||||
'PS_MAIL_PASSWD' => array('title' => $this->l('SMTP password:'), 'desc' => $this->l('Leave blank if not applicable'), 'validation' => 'isAnything', 'size' => 30, 'type' => 'password', 'visibility' => Shop::CONTEXT_ALL),
|
||||
'PS_MAIL_SMTP_ENCRYPTION' => array('title' => $this->l('Encryption:'), 'desc' => $this->l('Use an encrypt protocol'), 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => array(array('mode' => 'off', 'name' => $this->l('None')), array('mode' => 'tls', 'name' => $this->l('TLS')), array('mode' => 'ssl', 'name' => $this->l('SSL'))), 'visibility' => Shop::CONTEXT_ALL),
|
||||
'PS_MAIL_SMTP_PORT' => array('title' => $this->l('Port:'), 'desc' => $this->l('Number of port to use'), 'validation' => 'isInt', 'size' => 5, 'type' => 'text', 'cast' => 'intval', 'visibility' => Shop::CONTEXT_ALL),
|
||||
'SMTP_CONTAINER_END' => array('title' => '', 'type' => 'container_end', 'content' => '<script type="text/javascript">if (getE("PS_MAIL_METHOD2_on").checked == false) { $(\'#SMTP_CONTAINER\').hide(); }</script>'));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (isset($_POST['submitEmail'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if ($_POST['PS_MAIL_METHOD'] == 2 AND (empty($_POST['PS_MAIL_SERVER']) OR empty($_POST['PS_MAIL_SMTP_PORT'])))
|
||||
$this->_errors[] = Tools::displayError('You must define a SMTP server and a SMTP port. If you do not know, use the PHP mail() function instead.');
|
||||
else
|
||||
$this->_postConfig($this->_fieldsEmail);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
}
|
||||
|
||||
public function display() {
|
||||
$this->_displayForm('email', $this->_fieldsEmail, $this->l('E-mail'), 'width2', 'email');
|
||||
$this->_displayMailTest();
|
||||
}
|
||||
|
||||
private function _displayMailTest()
|
||||
{
|
||||
echo '
|
||||
<fieldset class="width2" style="margin-top: 10px;">
|
||||
<legend><img src="../img/admin/email.gif" alt="" /> '.$this->l('Test your e-mail configuration').'</legend>
|
||||
<script type="text/javascript">
|
||||
var textMsg = "'.$this->l('This is a test message, your server is now available to send email').'";
|
||||
var textSubject = "'.$this->l('Test message - Prestashop').'";
|
||||
var textSendOk = "'.$this->l('Mail is sent').'";
|
||||
var textSendError= "'.$this->l('Error: please check your configuration').'";
|
||||
var errorMail = "'.$this->l('This email address is wrong!').'";
|
||||
</script>
|
||||
<script type="text/javascript" src="'._PS_JS_DIR_.'sendMailTest.js"></script>
|
||||
<div style="clear: both; padding-top: 15px;">
|
||||
<label>'.$this->l('Send a test e-mail to').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="testEmail" id="testEmail" value="'.Configuration::get('PS_SHOP_EMAIL').'" style="width:210px;margin-bottom:4px;" /><br />
|
||||
<input type="hidden" id="PS_MAIL_METHOD" name="PS_MAIL_METHOD" value="'.Configuration::get('PS_MAIL_METHOD').'" />
|
||||
<input type="hidden" id="PS_MAIL_SERVER" name="PS_MAIL_SERVER" value="'.Configuration::get('PS_MAIL_SERVER').'" />
|
||||
<input type="hidden" id="PS_MAIL_USER" name="PS_MAIL_USER" value="'.Configuration::get('PS_MAIL_USER').'" />
|
||||
<input type="hidden" id="PS_MAIL_PASSWD" name="PS_MAIL_PASSWD" value="'.Configuration::get('PS_MAIL_PASSWD').'" />
|
||||
<input type="hidden" id="PS_MAIL_SMTP_PORT" name="PS_MAIL_SMTP_PORT" value="'.Configuration::get('PS_MAIL_SMTP_PORT').'" />
|
||||
<input type="hidden" id="PS_MAIL_SMTP_ENCRYPTION" name="PS_MAIL_SMTP_ENCRYPTION" value="'.Configuration::get('PS_MAIL_SMTP_ENCRYPTION').'" />
|
||||
<input type="button" class="button" name="btEmailTest" id="btEmailTest" value="'.$this->l('Send an e-mail test').'" onClick="verifyMail();" /><br />
|
||||
<p id="mailResultCheck" style="display:none;"></p>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>';
|
||||
}
|
||||
}
|
||||
@@ -1,221 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7210 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminEmployees extends AdminTab
|
||||
{
|
||||
/** @var array profiles list */
|
||||
private $profilesArray = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'employee';
|
||||
$this->className = 'Employee';
|
||||
$this->lang = false;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->_select = 'pl.`name` AS profile';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'profile` p ON a.`id_profile` = p.`id_profile`
|
||||
LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (pl.`id_profile` = p.`id_profile` AND pl.`id_lang` = '.(int)($cookie->id_lang).')';
|
||||
|
||||
$profiles = Profile::getProfiles((int)($cookie->id_lang));
|
||||
if (!$profiles)
|
||||
$this->_errors[] = Tools::displayError('No profile');
|
||||
else
|
||||
foreach ($profiles AS $profile)
|
||||
$this->profilesArray[$profile['name']] = $profile['name'];
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_employee' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'lastname' => array('title' => $this->l('Last name'), 'width' => 130),
|
||||
'firstname' => array('title' => $this->l('First name'), 'width' => 130),
|
||||
'email' => array('title' => $this->l('E-mail address'), 'width' => 180),
|
||||
'profile' => array('title' => $this->l('Profile'), 'width' => 90, 'type' => 'select', 'select' => $this->profilesArray, 'filter_key' => 'pl!name'),
|
||||
'active' => array('title' => $this->l('Can log in'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'));
|
||||
|
||||
$this->optionTitle = $this->l('Employees options');
|
||||
$this->_fieldsOptions = array(
|
||||
'PS_PASSWD_TIME_BACK' => array('title' => $this->l('Password regenerate:'), 'desc' => $this->l('Security minimum time to wait to regenerate a new password'), 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes'), 'visibility' => Shop::CONTEXT_ALL),
|
||||
'PS_BO_ALLOW_EMPLOYEE_FORM_LANG' => array('title' => $this->l('Memorize form language:'), 'desc' => $this->l('Allow employees to save their own default form language'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array(
|
||||
'0' => array('value' => 0, 'name' => $this->l('No')),
|
||||
'1' => array('value' => 1, 'name' => $this->l('Yes'))
|
||||
), 'visibility' => Shop::CONTEXT_ALL)
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function _childValidation()
|
||||
{
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return false;
|
||||
$email = $this->getFieldValue($obj, 'email');
|
||||
if (!Validate::isEmail($email))
|
||||
$this->_errors[] = Tools::displayError('Invalid e-mail');
|
||||
else if (Employee::employeeExists($email) AND !Tools::getValue('id_employee'))
|
||||
$this->_errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$email;
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$profiles = Profile::getProfiles((int)($cookie->id_lang));
|
||||
|
||||
echo '<script type="text/javascript" src="'._PS_JS_DIR_.'/jquery/jquery-colorpicker.js"></script>
|
||||
<script type="text/javascript">
|
||||
var employeePage = true;
|
||||
</script>
|
||||
|
||||
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.((int)$this->tabAccess['view'] ? '' : '&updateemployee&id_employee='.(int)$obj->id).'" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
'.((int)$this->tabAccess['view'] ? '' : '<input type="hidden" name="back" value="'.$currentIndex.'&token='.$this->token.'&updateemployee&id_employee='.(int)$obj->id.'" />').'
|
||||
<fieldset class="width3"><legend><img src="../img/admin/nav-user.gif" />'.$this->l('Employees').'</legend>
|
||||
<label>'.$this->l('Last name:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="lastname" value="'.htmlentities($this->getFieldValue($obj, 'lastname'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
</div>
|
||||
<label>'.$this->l('First name:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="firstname" value="'.htmlentities($this->getFieldValue($obj, 'firstname'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
</div>
|
||||
<label>'.$this->l('Password:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="password" size="33" name="passwd" value="" /> <sup>*</sup>
|
||||
<p>'.($obj->id ? $this->l('Leave blank if you do not want to change your password') : $this->l('Min. 8 characters; use only letters, numbers or').' -_').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('E-mail address:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="33" name="email" value="'.htmlentities($this->getFieldValue($obj, 'email'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
|
||||
</div><div class="clear"> </div>
|
||||
<label>'.$this->l('Back office color:').' </label>
|
||||
<div class="margin-form">';
|
||||
// Note : width= fix Firefox 4 display bug related to colorpicker librarie
|
||||
echo '<input type="color" width="50px" data-hex="true" class="color mColorPickerInput" name="bo_color" value="'.htmlentities($this->getFieldValue($obj, 'bo_color'), ENT_COMPAT, 'UTF-8').'" />
|
||||
<p>'.$this->l('Back office background will be displayed in this color. HTML colors only (e.g.,').' "lightblue", "#CC6600")</p>
|
||||
</div><div class="clear"> </div>
|
||||
<label>'.$this->l('Language:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_lang">';
|
||||
foreach (Language::getLanguages() as $lang)
|
||||
echo ' <option value="'.(int)$lang['id_lang'].'" '.($this->getFieldValue($obj, 'id_lang') == $lang['id_lang'] ? 'selected="selected"' : '').'>'.Tools::htmlentitiesUTF8($lang['name']).'</option>';
|
||||
echo ' </select> <sup>*</sup>
|
||||
</div><div class="clear"> </div>
|
||||
<label>'.$this->l('Theme:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="bo_theme">';
|
||||
$path = dirname(__FILE__).'/../themes/';
|
||||
foreach (scandir($path) as $theme)
|
||||
if ($theme[0] != '.' AND file_exists($path.$theme.'/admin.css'))
|
||||
echo ' <option value="'.Tools::htmlentitiesUTF8($theme).'" '.($this->getFieldValue($obj, 'bo_theme') == $theme ? 'selected="selected"' : '').'>'.Tools::htmlentitiesUTF8($theme).'</option>';
|
||||
echo ' </select> <sup>*</sup>
|
||||
</div>';
|
||||
if ((int)$this->tabAccess['edit'])
|
||||
{
|
||||
echo '<div class="clear"> </div>
|
||||
<label>'.$this->l('UI mode:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="bo_uimode" id="uimode_on" value="hover" '.($this->getFieldValue($obj, 'bo_uimode') == 'hover' ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="uimode_on">'.$this->l('Hover on tabs').'</label>
|
||||
<input type="radio" name="bo_uimode" id="uimode_off" value="click" '.($this->getFieldValue($obj, 'bo_uimode') == 'click' ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="uimode_off">'.$this->l('Click on tabs').'</label>
|
||||
</div><div class="clear"> </div>
|
||||
<label>'.$this->l('Status:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.(!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Allow or disallow this employee to log into this Back Office').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Profile:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_profile">
|
||||
<option value="">'.$this->l('-- Choose --').'</option>';
|
||||
foreach ($profiles AS $profile)
|
||||
echo '<option value="'.$profile['id_profile'].'"'.($profile['id_profile'] === $this->getFieldValue($obj, 'id_profile') ? ' selected="selected"' : '').'>'.$profile['name'].'</option>';
|
||||
echo '</select> <sup>*</sup>
|
||||
</div>';
|
||||
}
|
||||
echo '<div class="clear"> </div>
|
||||
<center>
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</center><div class="clear"> </div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (Tools::isSubmit('deleteemployee') OR Tools::isSubmit('status') OR Tools::isSubmit('statusemployee'))
|
||||
{
|
||||
if ($cookie->id_employee == Tools::getValue('id_employee'))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('You cannot disable or delete your own account.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$employee = new Employee(Tools::getValue('id_employee'));
|
||||
if ($employee->isLastAdmin())
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('You cannot disable or delete the last administrator account.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif (Tools::isSubmit('submitAddemployee'))
|
||||
{
|
||||
$employee = new Employee((int)Tools::getValue('id_employee'));
|
||||
if (!(int)$this->tabAccess['edit'])
|
||||
$_POST['id_profile'] = $_GET['id_profile'] = $employee->id_profile;
|
||||
|
||||
if ($employee->isLastAdmin())
|
||||
{
|
||||
if (Tools::getValue('id_profile') != (int)_PS_ADMIN_PROFILE_)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('You should have at least one employee in the administrator group.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Tools::getvalue('active') == 0)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('You cannot disable or delete the last administrator account.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7331 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(PS_ADMIN_DIR.'/tabs/AdminFeaturesValues.php');
|
||||
|
||||
class AdminFeatures extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->adminFeaturesValues = new AdminFeaturesValues();
|
||||
$this->table = 'feature';
|
||||
$this->className = 'Feature';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 128, 'filter_key' => 'b!name'),
|
||||
'value' => array('title' => $this->l('Values'), 'width' => 255, 'orderby' => false, 'search' => false));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if ((isset($_POST['submitAddfeature_value']) AND sizeof($this->adminFeaturesValues->_errors))
|
||||
OR isset($_GET['updatefeature_value']) OR isset($_GET['addfeature_value']))
|
||||
{
|
||||
$this->adminFeaturesValues->displayForm($this->token);
|
||||
echo '<br /><br /><a href="'.$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" alt="" /> '.$this->l('Back to the features list').'</a><br />';
|
||||
}
|
||||
else
|
||||
{
|
||||
parent::display();
|
||||
$this->displayAssoGroupShop();
|
||||
}
|
||||
}
|
||||
|
||||
/* Report to AdminTab::displayList() for more details */
|
||||
public function displayList()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
echo '<br />
|
||||
<a href="'.$currentIndex.'&add'.$this->table.'&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> <b>'.$this->l('Add a new feature').'</b></a><br />
|
||||
<a href="'.$currentIndex.'&addfeature_value&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new feature value').'</a><br /><br />
|
||||
'.$this->l('Click on a feature name to view its values and then click again if you want to hide them.').'<br /><br />';
|
||||
|
||||
$this->displayListHeader();
|
||||
echo '<input type="hidden" name="groupid" value="0">';
|
||||
|
||||
if (!sizeof($this->_list))
|
||||
echo '<tr><td class="center" colspan="'.sizeof($this->_list).'">'.$this->l('No features found.').'</td></tr>';
|
||||
|
||||
$irow = 0;
|
||||
foreach ($this->_list AS $tr)
|
||||
{
|
||||
$id = (int)($tr['id_'.$this->table]);
|
||||
echo '
|
||||
<tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
|
||||
<td style="vertical-align: top; padding: 4px 0 4px 0" class="center"><input type="checkbox" name="'.$this->table.'Box[]" value="'.$id.'" class="noborder" /></td>
|
||||
<td style="width: 140px; vertical-align: top; padding: 4px 0 4px 0; cursor: pointer" onclick="$(\'#features_values_'.$id.'\').slideToggle();">'.$tr['name'].'</td>
|
||||
<td style="vertical-align: top; padding: 4px 0 4px 0; width: 340px">
|
||||
<div id="features_values_'.$id.'" style="display: none">
|
||||
<table class="table" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'feature_value'.$id.'Box[]\', this.checked)" /></th>
|
||||
<th width="100%">'.$this->l('Value').'</th>
|
||||
<th>'.$this->l('Actions').'</th>
|
||||
</tr>';
|
||||
$features = FeatureValue::getFeatureValuesWithLang((int)(Configuration::get('PS_LANG_DEFAULT')), $id);
|
||||
foreach ($features AS $feature)
|
||||
{
|
||||
echo '
|
||||
<tr>
|
||||
<td class="center"><input type="checkbox" name="feature_value'.$id.'Box[]" value="'.$feature['id_feature_value'].'" class="noborder" /></td>
|
||||
<td>'.$feature['value'].'</td>
|
||||
<td class="center">
|
||||
<a href="'.$currentIndex.'&id_feature_value='.$feature['id_feature_value'].'&updatefeature_value&token='.$this->token.'">
|
||||
<img src="../img/admin/edit.gif" border="0" alt="'.$this->l('Edit').'" title="'.$this->l('Edit').'" /></a>
|
||||
<a href="'.$currentIndex.'&id_feature_value='.$feature['id_feature_value'].'&deletefeature_value&token='.$this->token.'"
|
||||
onclick="return confirm(\''.$this->l('Delete value', __CLASS__, true, false).' #'.$feature['id_feature_value'].'?\');">
|
||||
<img src="../img/admin/delete.gif" border="0" alt="'.$this->l('Delete').'" title="'.$this->l('Delete').'" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
if (!sizeof($features))
|
||||
echo '
|
||||
<tr><td colspan="3" style="text-align:center">'.$this->l('No values defined').'</td></tr>';
|
||||
echo '
|
||||
</table>
|
||||
<p><input type="Submit" class="button" name="submitDelfeature_value" value="'.$this->l('Delete selection').'"
|
||||
onclick="changeFormParam(this.form, \'?tab=AdminFeatures\', '.$id.'); return confirm(\''.$this->l('Delete selected items?', __CLASS__, true, false).'\');" /></p>
|
||||
</div>
|
||||
</td>';
|
||||
|
||||
echo '
|
||||
<td style="vertical-align: top; padding: 4px 0 4px 0" class="center">
|
||||
<a href="'.$currentIndex.'&id_'.$this->table.'='.$id.'&update'.$this->table.'&token='.$this->token.'">
|
||||
<img src="../img/admin/edit.gif" border="0" alt="'.$this->l('Edit').'" title="'.$this->l('Edit').'" /></a>
|
||||
<a href="'.$currentIndex.'&id_'.$this->table.'='.$id.'&delete'.$this->table.'&token='.$this->token.'" onclick="return confirm(\''.$this->l('Delete item', __CLASS__, true, false).' #'.$id.'?\');">
|
||||
<img src="../img/admin/delete.gif" border="0" alt="'.$this->l('Delete').'" title="'.$this->l('Delete').'" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
$this->displayListFooter();
|
||||
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo '
|
||||
<h2>'.$this->l('Add a new feature').'</h2>
|
||||
<form action="'.$currentIndex.'&token='.$this->token.'"" method="post">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset class="width2">
|
||||
<legend><img src="../img/t/AdminFeatures.gif" />'.$this->l('Add a new feature').'</legend>
|
||||
<label>'.$this->l('Name:').'</label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages AS $language)
|
||||
echo '
|
||||
<div id="name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name');
|
||||
echo '
|
||||
<div class="clear"></div>
|
||||
</div>';
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoGroupShop();
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
public function displayErrors()
|
||||
{
|
||||
$this->adminFeaturesValues->displayErrors();
|
||||
parent::displayErrors();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
$this->adminFeaturesValues->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
|
||||
$this->adminFeaturesValues->postProcess($this->token);
|
||||
|
||||
if(Tools::getValue('submitDel'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (isset($_POST[$this->table.'Box']))
|
||||
{
|
||||
$object = new $this->className();
|
||||
if ($object->deleteSelection($_POST[$this->table.'Box']))
|
||||
Tools::redirectAdmin($currentIndex.'&conf=2'.'&token='.$this->token);
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminFeaturesValues extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'feature_value';
|
||||
$this->className = 'FeatureValue';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display form
|
||||
*
|
||||
* @global string $currentIndex Current URL in order to keep current Tab
|
||||
*/
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo '
|
||||
<h2>'.$this->l('Add a new feature value').'</h2>
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.Tools::getValue('token').'" method="post">
|
||||
'.($obj->id ? '<input type="hidden" name="id_feature_value" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset class="width2">
|
||||
<legend><img src="../img/t/AdminFeatures.gif" />'.$this->l('Add a new feature value').'</legend>
|
||||
<label>'.$this->l('Value:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="value_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="value_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'value', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'value', 'value');
|
||||
echo '
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<label>'.$this->l('Feature:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_feature">';
|
||||
$features = Feature::getFeatures($this->_defaultFormLanguage);
|
||||
foreach ($features AS $feature)
|
||||
echo '<option value="'.$feature['id_feature'].'"'.($this->getFieldValue($obj, 'id_feature') == $feature['id_feature']? ' selected="selected"' : '').'>'.$feature['name'].'</option>';
|
||||
echo '
|
||||
</select><sup> *</sup>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage page processing
|
||||
*
|
||||
* @global string $currentIndex Current URL in order to keep current Tab
|
||||
*/
|
||||
public function postProcess($token = NULL)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if(Tools::getValue('submitDel'.$this->table))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (isset($_POST[$this->table.$_POST['groupid'].'Box']))
|
||||
{
|
||||
$object = new $this->className();
|
||||
if ($object->deleteSelection($_POST[$this->table.$_POST['groupid'].'Box']))
|
||||
Tools::redirectAdmin($currentIndex.'&conf=2'.'&token='.($token ? $token : $this->token));
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminGenerator extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->_htFile = dirname(__FILE__).'/../../.htaccess';
|
||||
$this->_rbFile = dirname(__FILE__).'/../../robots.txt';
|
||||
$this->_smFile = dirname(__FILE__).'/../../sitemap.xml';
|
||||
$this->_rbData = $this->_getRobotsContent();
|
||||
return parent::__construct();
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
// Htaccess
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&token='.$this->token.'" method="post" enctype="multipart/form-data">
|
||||
<fieldset><legend><img src="../img/admin/htaccess.gif" />'.$this->l('Htaccess file generation').'</legend>
|
||||
<p><b>'.$this->l('Warning:').'</b> '.$this->l('this tool can ONLY be used if you are hosted by an Apache web server. Please ask your webhost.').'</p>
|
||||
<p>'.$this->l('This tool will automatically generate a ".htaccess" file that will give you the ability to do URL rewriting and to catch 404 errors.').'</p>
|
||||
<p>'.$this->l('If you do not have "Friendly URL" enabled when generating the ".htaccess" file, this feature won\'t be available.').'</p>';
|
||||
if ($this->_checkConfiguration($this->_htFile))
|
||||
echo '
|
||||
<div class="clear"> </div>
|
||||
<label for="imageCacheControl">'.$this->l('Optimization').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="checkbox" name="PS_HTACCESS_CACHE_CONTROL" id="PS_HTACCESS_CACHE_CONTROL" value="1" '.(Configuration::get('PS_HTACCESS_CACHE_CONTROL') == 1 ? 'checked="checked"' : '').' />
|
||||
<p>'.$this->l('This will add directives to your .htaccess file which should improve caching and compression.').'</p>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
<label for="imageCacheControl">'.$this->l('Friendly URL').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="checkbox" name="PS_REWRITING_SETTINGS" id="PS_REWRITING_SETTINGS" value="1" '.(Configuration::get('PS_REWRITING_SETTINGS') ? 'checked="checked"' : '').' />
|
||||
<p>'.$this->l('Enable only if your server allows URL rewriting.').'</p>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
<label for="specific_configuration">'.$this->l('Specific configuration').'</label>
|
||||
<div class="margin-form">
|
||||
<textarea rows="10" class="width3" id="specific_configuration" name="ps_htaccess_specific">'.Configuration::get('PS_HTACCESS_SPECIFIC').'</textarea>
|
||||
<p>'.$this->l('Add here the specific directives of your host (SetEnv PHP_VER 5, AddType x-mapp-php5 .php...).').'</p>
|
||||
</div>
|
||||
<p class="clear" style="font-weight:bold;">'.$this->l('Generate your ".htaccess" file by clicking on the following button:').'<br /><br />
|
||||
<input type="submit" value="'.$this->l('Generate .htaccess file').'" name="submitHtaccess" class="button" /></p>
|
||||
<p>'.$this->l('This will erase your').'<b> '.$this->l('old').'</b> '.$this->l('.htaccess file!').'</p>';
|
||||
else
|
||||
echo '
|
||||
<p style="color:red; font-weight:bold;">'.$this->l('Before being able to use this tool, you need to:').'</p>
|
||||
<p>'.$this->l('- create a').' <b>'. $this->l('.htaccess').'</b> '.$this->l('blank file in directory').' <b>'.__PS_BASE_URI__.'</b>
|
||||
<br />'.$this->l('- give it write permissions (CHMOD 666 on Unix system)').'</p>';
|
||||
echo '</p></fieldset></form>';
|
||||
|
||||
// Robots
|
||||
echo '<br /><br />
|
||||
<form action="'.$currentIndex.'&token='.$this->token.'" method="post" enctype="multipart/form-data">
|
||||
<fieldset><legend><img src="../img/admin/robots.gif" />'.$this->l('Robots file generation').'</legend>
|
||||
<p><b>'.$this->l('Warning:').' </b>'.$this->l('Your file robots.txt MUST be in your website\'s root directory and nowhere else.').'</p>
|
||||
<p>'.$this->l('eg: http://www.yoursite.com/robots.txt').'.</p>
|
||||
<p>'.$this->l('This tool will automatically generate a "robots.txt" file that you can configure to deny access to search engines for some pages.').'</p>';
|
||||
if ($this->_checkConfiguration($this->_rbFile))
|
||||
echo '
|
||||
<p style="font-weight:bold;">'.$this->l('Generate your "robots.txt" file by clicking on the following button:').'<br /><br />
|
||||
<input type="submit" value="'.$this->l('Generate robots.txt file').'" name="submitRobots" class="button" /></p>
|
||||
<p>'.$this->l('This will erase your').'<b> '.$this->l('old').'</b> '.$this->l('robots.txt file!').'</p>';
|
||||
else
|
||||
echo '
|
||||
<p style="color:red; font-weight:bold;">'.$this->l('Before being able to use this tool, you need to:').'</p>
|
||||
<p>'.$this->l('- create a').' <b>'. $this->l('robots.txt').'</b> '.$this->l('blank file in dir:').' <b>'.__PS_BASE_URI__.'</b>
|
||||
<br />'.$this->l('- give it write permissions (CHMOD 666 on Unix system)').'</p>';
|
||||
echo '</p></fieldset></form>';
|
||||
}
|
||||
|
||||
public function _checkConfiguration($file)
|
||||
{
|
||||
if (file_exists($file))
|
||||
return is_writable($file);
|
||||
return is_writable(dirname($file));
|
||||
}
|
||||
|
||||
function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::isSubmit('submitHtaccess'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
Configuration::updateValue('PS_HTACCESS_CACHE_CONTROL', (int)Tools::getValue('PS_HTACCESS_CACHE_CONTROL'));
|
||||
Configuration::updateValue('PS_REWRITING_SETTINGS', (int)Tools::getValue('PS_REWRITING_SETTINGS'));
|
||||
Configuration::updateValue('PS_HTACCESS_SPECIFIC', Tools::getValue('ps_htaccess_specific'), true);
|
||||
if (Tools::generateHtaccess($this->_htFile, Configuration::get('PS_REWRITING_SETTINGS'), Configuration::get('PS_HTACCESS_CACHE_CONTROL'), Tools::getValue('ps_htaccess_specific')))
|
||||
Tools::redirectAdmin($currentIndex.'&conf=4&token='.$this->token);
|
||||
$this->_errors[] = $this->l('Cannot write into file:').' <b>'.$this->_htFile.'</b><br />'.$this->l('Please check write permissions.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitRobots'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
if (!$writeFd = @fopen($this->_rbFile, 'w'))
|
||||
die ($this->l('Cannot write into file:').' <b>'.$this->_rbFile.'</b><br />'.$this->l('Please check write permissions.'));
|
||||
else
|
||||
{
|
||||
// PS Comments
|
||||
fwrite($writeFd, "# robots.txt automaticaly generated by PrestaShop e-commerce open-source solution\n");
|
||||
fwrite($writeFd, "# http://www.prestashop.com - http://www.prestashop.com/forums\n\n");
|
||||
fwrite($writeFd, "# This file is to prevent the crawling and indexing of certain parts\n");
|
||||
fwrite($writeFd, "# of your site by web crawlers and spiders run by sites like Yahoo!\n");
|
||||
fwrite($writeFd, "# and Google. By telling these \"robots\" where not to go on your site,\n");
|
||||
fwrite($writeFd, "# you save bandwidth and server resources.\n\n");
|
||||
fwrite($writeFd, "# For more information about the robots.txt standard, see:\n");
|
||||
fwrite($writeFd, "# http://www.robotstxt.org/wc/robots.html\n\n");
|
||||
|
||||
// User-Agent
|
||||
fwrite($writeFd, "User-agent: *\n");
|
||||
|
||||
// Directories
|
||||
fwrite($writeFd, "# Directories\n");
|
||||
foreach ($this->_rbData['Directories'] as $dir)
|
||||
fwrite($writeFd, 'Disallow: '.__PS_BASE_URI__.$dir."\n");
|
||||
|
||||
// Files
|
||||
fwrite($writeFd, "# Files\n");
|
||||
foreach ($this->_rbData['Files'] as $file)
|
||||
fwrite($writeFd, 'Disallow: '.__PS_BASE_URI__.$file."\n");
|
||||
|
||||
// Sitemap
|
||||
fwrite($writeFd, "# Sitemap\n");
|
||||
if (file_exists($this->_smFile))
|
||||
if (filesize($this->_smFile))
|
||||
fwrite($writeFd, 'Sitemap: '.(Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].__PS_BASE_URI__.'sitemap.xml'."\n");
|
||||
fwrite($writeFd, "\n");
|
||||
|
||||
fclose($writeFd);
|
||||
Tools::redirectAdmin($currentIndex.'&conf=4&token='.$this->token);
|
||||
}
|
||||
} else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
}
|
||||
|
||||
public function _getRobotsContent()
|
||||
{
|
||||
$tab = array();
|
||||
|
||||
// Directories
|
||||
$tab['Directories'] = array('classes/', 'config/', 'download/', 'mails/', 'modules/', 'translations/', 'tools/', 'lang-'.Language::getIsoById(Configuration::get('PS_LANG_DEFAULT')).'/');
|
||||
|
||||
// Files
|
||||
$tab['Files'] = array('addresses.php', 'address.php', 'authentication.php', 'cart.php', 'discount.php', 'footer.php',
|
||||
'get-file.php', 'header.php', 'history.php', 'identity.php', 'images.inc.php', 'init.php', 'my-account.php', 'order.php', 'order-opc.php',
|
||||
'order-slip.php', 'order-detail.php', 'order-follow.php', 'order-return.php', 'order-confirmation.php', 'pagination.php', 'password.php',
|
||||
'pdf-invoice.php', 'pdf-order-return.php', 'pdf-order-slip.php', 'product-sort.php', 'search.php', 'statistics.php','attachment.php', 'guest-tracking',
|
||||
'*orderby=','*orderway=','*tag=','*id_currency=','*search_query=','*id_lang=','*back=','*utm_source=','*utm_medium=','*utm_campaign=','*n=');
|
||||
|
||||
return $tab;
|
||||
}
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminGeolocation extends AdminTab
|
||||
{
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
echo '
|
||||
<h2>'.$this->l('Geolocation').'</h2>
|
||||
';
|
||||
|
||||
if (!$this->_isGeoLiteCityAvailable())
|
||||
$this->displayWarning($this->l('In order to use Geolocation, please download').' <a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz">'.$this->l('this file').'</a> '.$this->l('and decompress it into tools/geoip/ directory'));
|
||||
|
||||
echo '
|
||||
<form method="POST" action="'.$currentIndex.'&token='.Tools::getValue('token').'">
|
||||
<fieldset>
|
||||
<legend><img src="../img/admin/world.gif" alt="" /> '.$this->l('Geolocation by IP').'</legend>
|
||||
|
||||
<label>'.$this->l('Geolocation by IP:').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="PS_GEOLOCATION_ENABLED" id="PS_GEOLOCATION_ENABLED_1" value="1" '.(Configuration::get('PS_GEOLOCATION_ENABLED') ? 'checked="checked"' : '').' /> <label class="t" for="PS_GEOLOCATION_ENABLED_1"><img src="../img/admin/enabled.gif" alt="" /> '.$this->l('Enabled').'</label>
|
||||
<input type="radio" name="PS_GEOLOCATION_ENABLED" id="PS_GEOLOCATION_ENABLED_0" value="0" '.(!Configuration::get('PS_GEOLOCATION_ENABLED') ? 'checked="checked"' : '').' /> <label class="t" for="PS_GEOLOCATION_ENABLED_0"><img src="../img/admin/disabled.gif" alt="" /> '.$this->l('Disabled').'</label>
|
||||
<p>'.$this->l('This option allows you, among other things, to restrict access to your shop for many countries. See below.').'</p>
|
||||
</div>
|
||||
|
||||
<div class="margin-form">
|
||||
<input type="submit" class="button" name="submitGeolocationConfiguration" value="'.$this->l('Save').'" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
';
|
||||
$allowedCountries = explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'));
|
||||
echo '
|
||||
<form method="POST" action="'.$currentIndex.'&token='.Tools::getValue('token').'">
|
||||
<fieldset style="margin-top:10px;">
|
||||
<legend><img src="../img/admin/world.gif" alt="" /> '.$this->l('Options').'</legend>
|
||||
|
||||
<div class="hint" style="display:block;margin-bottom:20px;">
|
||||
'.$this->l('The following features are only available if you enable the Geolocation by IP feature.').'
|
||||
</div>
|
||||
|
||||
<label>'.$this->l('Geolocation behavior for restricted countries:').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="PS_GEOLOCATION_BEHAVIOR">
|
||||
<option value="'._PS_GEOLOCATION_NO_CATALOG_.'" '.(Configuration::get('PS_GEOLOCATION_BEHAVIOR') == _PS_GEOLOCATION_NO_CATALOG_ ? 'selected' : '').'>'.$this->l('Visitors can\'t see your catalog').'</option>
|
||||
<option value="'._PS_GEOLOCATION_NO_ORDER_.'" '.(Configuration::get('PS_GEOLOCATION_BEHAVIOR') == _PS_GEOLOCATION_NO_ORDER_ ? 'selected' : '').'>'.$this->l('Visitors can see your catalog but can\'t make an order').'</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="clear" style="margin-top:10px;"></div>
|
||||
|
||||
<label>'.$this->l('Geolocation behavior for undefined countries:').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="PS_GEOLOCATION_NA_BEHAVIOR">
|
||||
<option value="-1" '.(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR') == -1 ? 'selected' : '').'>'.$this->l('All features are available').'</option>
|
||||
<option value="'._PS_GEOLOCATION_NO_CATALOG_.'" '.(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR') == _PS_GEOLOCATION_NO_CATALOG_ ? 'selected' : '').'>'.$this->l('Visitors can\'t see your catalog').'</option>
|
||||
<option value="'._PS_GEOLOCATION_NO_ORDER_.'" '.(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR') == _PS_GEOLOCATION_NO_ORDER_ ? 'selected' : '').'>'.$this->l('Visitors can see your catalog but can\'t make an order').'</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="clear" style="margin-top:10px;"></div>
|
||||
|
||||
<label>'.$this->l('Select countries that can access your store:').'</label>
|
||||
<div class="margin-form">
|
||||
<table class="table" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" name="checkAll" onclick="checkDelBoxes(this.form, \'countries[]\', this.checked)" /></th>
|
||||
<th>'.$this->l('Name').'</th>
|
||||
<tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
';
|
||||
foreach (Country::getCountries(intval($cookie->id_lang)) AS $country)
|
||||
echo '
|
||||
<tr>
|
||||
<td><input type="checkbox" name="countries[]" value="'.strtoupper(Tools::htmlentitiesUTF8($country['iso_code'])).'" '.(in_array(strtoupper($country['iso_code']), $allowedCountries) ? 'checked="checked"' : '').' /></td>
|
||||
<td>'.Tools::htmlentitiesUTF8($country['name']).'</td>
|
||||
</tr>
|
||||
';
|
||||
echo '
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="margin-form">
|
||||
<input type="submit" class="button" name="submitGeolocationCountries" value="'.$this->l('Save').'" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<form method="POST" action="'.$currentIndex.'&token='.Tools::getValue('token').'">
|
||||
<fieldset style="margin-top:10px;">
|
||||
<legend><img src="../img/admin/world.gif" alt="" /> '.$this->l('Whitelist of IP addresses').'</legend>
|
||||
|
||||
<div class="hint" style="display:block;margin-bottom:20px;">
|
||||
'.$this->l('You can add many IP addresses, these addresses will always be allowed to access your shop (e.g. Google bots IP).').'
|
||||
</div>
|
||||
|
||||
<label for="PS_GEOLOCATION_WHITELIST">'.$this->l('Allowed IP addresses:').'</label>
|
||||
<div class="margin-form">
|
||||
<textarea name="PS_GEOLOCATION_WHITELIST" id="PS_GEOLOCATION_WHITELIST" cols="80" rows="30">'.Tools::htmlentitiesUTF8(str_replace(';', "\n", Configuration::get('PS_GEOLOCATION_WHITELIST'))).'</textarea>
|
||||
</div>
|
||||
|
||||
<div class="margin-form">
|
||||
<input type="submit" class="button" name="submitGeolocationWhitelist" value="'.$this->l('Save').'" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
';
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::isSubmit('submitGeolocationConfiguration'))
|
||||
{
|
||||
if ($this->_isGeoLiteCityAvailable())
|
||||
{
|
||||
Configuration::updateValue('PS_GEOLOCATION_ENABLED', intval(Tools::getValue('PS_GEOLOCATION_ENABLED')));
|
||||
Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Geolocation database is unavailable.');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitGeolocationCountries'))
|
||||
{
|
||||
if (!is_array(Tools::getValue('countries')) OR !sizeof(Tools::getValue('countries')))
|
||||
$this->_errors[] = Tools::displayError('Country selection is invalid');
|
||||
else
|
||||
{
|
||||
Configuration::updateValue('PS_GEOLOCATION_BEHAVIOR', (!(int)(Tools::getValue('PS_GEOLOCATION_BEHAVIOR')) ? _PS_GEOLOCATION_NO_CATALOG_ : _PS_GEOLOCATION_NO_ORDER_));
|
||||
Configuration::updateValue('PS_GEOLOCATION_NA_BEHAVIOR', (int)Tools::getValue('PS_GEOLOCATION_NA_BEHAVIOR'));
|
||||
Configuration::updateValue('PS_ALLOWED_COUNTRIES', implode(';', Tools::getValue('countries')));
|
||||
Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4');
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitGeolocationWhitelist'))
|
||||
{
|
||||
if (!Validate::isCleanHtml(Tools::getValue('PS_GEOLOCATION_WHITELIST')))
|
||||
$this->_errors[] = Tools::displayError('Invalid whitelist');
|
||||
else
|
||||
{
|
||||
Configuration::updateValue('PS_GEOLOCATION_WHITELIST', str_replace("\n", ';', str_replace("\r", '', Tools::getValue('PS_GEOLOCATION_WHITELIST'))));
|
||||
Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4');
|
||||
}
|
||||
}
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
private function _isGeoLiteCityAvailable()
|
||||
{
|
||||
if (file_exists(_PS_GEOIP_DIR_.'GeoLiteCity.dat'))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 1.4 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
|
||||
class AdminGroupShop extends AdminTab
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'group_shop';
|
||||
$this->className = 'GroupShop';
|
||||
$this->edit = true;
|
||||
$this->delete = false;
|
||||
$this->deleted = false;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_group_shop' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('County'), 'width' => 130, 'filter_key' => 'b!name'),
|
||||
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'active'));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('delete'.$this->table) OR Tools::isSubmit('status') OR Tools::isSubmit('status'.$this->table))
|
||||
{
|
||||
$object = $this->loadObject();
|
||||
if(GroupShop::getTotalGroupShops() == 1)
|
||||
$this->_errors[] = Tools::displayError('You cannot delete or disable the last groupshop.');
|
||||
elseif($object->haveShops())
|
||||
$this->_errors[] = Tools::displayError('You cannot delete or disable a groupshop which have this shops using it.');
|
||||
|
||||
if (sizeof($this->_errors))
|
||||
return false;
|
||||
}
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm($isMainTab);
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
if (Shop::getTotalShops() > 1 AND $obj->id)
|
||||
$disabled = 'disabled="disabled"';
|
||||
else
|
||||
$disabled = '';
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend>'.$this->l('GroupShop').'</legend><span class="hint" name="help_box" style="display:block;">'.$this->l('You can\'t edit GroupShop when you have more than one Shop').'</span><br />
|
||||
<label for="name">'.$this->l('GroupShop name').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="name" id="name" value="'.$this->getFieldValue($obj, 'name').'" />
|
||||
</div>
|
||||
<label for="share_datas">'.$this->l('Share datas').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="share_datas" '.$disabled.' id="share_datas_on" value="1" '.($this->getFieldValue($obj, 'share_datas') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="share_datas_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="share_datas" '.$disabled.' id="share_datas_off" value="0" '.(!$this->getFieldValue($obj, 'share_datas') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Share customers, orders and carts between shops of this group').'</p>
|
||||
</div>
|
||||
<label for="share_stock">'.$this->l('Share stock').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="share_stock" '.$disabled.' id="share_stock_on" value="1" '.($this->getFieldValue($obj, 'share_stock') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="share_stock_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="share_stock" '.$disabled.' id="share_datas_off" value="0" '.(!$this->getFieldValue($obj, 'share_stock') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Sare stock between shops of this group').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Status:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="active" id="active_off" value="0" '.(!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('Enable or disable shop').'</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
@@ -1,383 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7332 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminGroups extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'group';
|
||||
$this->className = 'Group';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->view = true;
|
||||
$this->delete = true;
|
||||
|
||||
$this->_select = '
|
||||
(SELECT COUNT(jcg.`id_customer`)
|
||||
FROM `'._DB_PREFIX_.'customer_group` jcg
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` jc ON (jc.`id_customer` = jcg.`id_customer`)
|
||||
WHERE jc.`deleted` != 1
|
||||
AND jcg.`id_group` = a.`id_group`) AS nb
|
||||
';
|
||||
$this->_group = 'GROUP BY a.id_group';
|
||||
$this->_listSkipDelete = array(1);
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_group' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 80, 'filter_key' => 'b!name'),
|
||||
'reduction' => array('title' => $this->l('Discount'), 'width' => 50, 'align' => 'right'),
|
||||
'nb' => array('title' => $this->l('Members'), 'width' => 25, 'align' => 'center'),
|
||||
'date_add' => array('title' => $this->l('Creation date'), 'width' => 60, 'type' => 'date', 'align' => 'right'));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$groupReductions = $obj->id ? GroupReduction::getGroupReductions($obj->id, (int)($cookie->id_lang)) : array();
|
||||
$categories = Category::getSimpleCategories((int)($cookie->id_lang));
|
||||
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/tab-groups.gif" />'.$this->l('Group').'</legend>
|
||||
<label>'.$this->l('Name:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="33" type="text" name="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name');
|
||||
$reduction = htmlentities($this->getFieldValue($obj, 'reduction'), ENT_COMPAT, 'UTF-8');
|
||||
echo '
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
<label>'.$this->l('Discount:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" size="5" name="reduction" value="'.($reduction ? $reduction : '0').'" /> '.$this->l('%').'
|
||||
<p>'.$this->l('Will automatically apply this value as a discount on ALL shop\'s products for this group\'s members.').'</p>
|
||||
</div>';
|
||||
if ($obj->id)
|
||||
{
|
||||
echo '
|
||||
<label>'.$this->l('Current category discount:').'</label>
|
||||
<div class="margin-form">';
|
||||
if ($groupReductions)
|
||||
{
|
||||
echo '<table>
|
||||
<tr>
|
||||
<th>'.$this->l('Category').'</th>
|
||||
<th>'.$this->l('Value').'</th>
|
||||
<th>'.$this->l('Action').'</th>
|
||||
</tr>';
|
||||
foreach ($groupReductions AS $groupReduction)
|
||||
echo '
|
||||
<tr>
|
||||
<td>'.Tools::htmlentitiesUTF8($groupReduction['category_name']).'</td>
|
||||
<td><input type="hidden" name="gr_id_group_reduction[]" value="'.(int)($groupReduction['id_group_reduction']).'" /><input type="text" name="gr_reduction[]" value="'.($groupReduction['reduction'] * 100).'" /></td>
|
||||
<td><a href="'.$currentIndex.'&deleteGroupReduction&id_group_reduction='.(int)($groupReduction['id_group_reduction']).'&id_group='.(int)($obj->id).'&token='.$this->token.'"><img src="" alt="'.$this->l('Delete').'" /></a></td>
|
||||
</tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
else
|
||||
echo $this->l('No discount');
|
||||
echo ' </div>';
|
||||
}
|
||||
echo '
|
||||
<label>'.$this->l('Price display method:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="price_display_method">
|
||||
<option value="'.PS_TAX_EXC.'"'.((int)($this->getFieldValue($obj, 'price_display_method')) == PS_TAX_EXC ? ' selected="selected"' : '').'>'.$this->l('Tax excluded').'</option>
|
||||
<option value="'.PS_TAX_INC.'"'.((int)($this->getFieldValue($obj, 'price_display_method')) == PS_TAX_INC ? ' selected="selected"' : '').'>'.$this->l('Tax included').'</option>
|
||||
</select>
|
||||
<p>'.$this->l('How the prices are displayed on order summary for this customer group (tax included or excluded).').'</p>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>';
|
||||
if (Tools::isMultiShopActivated())
|
||||
{
|
||||
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
|
||||
$this->displayAssoGroupShop();
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form><br />';
|
||||
|
||||
if ($obj->id)
|
||||
{
|
||||
echo '
|
||||
<form action="'.$currentIndex.'&update'.$this->table.'&id_group='.$obj->id.'&token='.$this->token.'" method="post" class="width3">
|
||||
<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />
|
||||
<fieldset><legend><img src="../img/admin/tab-groups.gif" />'.$this->l('New group discount').'</legend>
|
||||
<label>'.$this->l('Category:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_category">';
|
||||
foreach ($categories AS $category)
|
||||
echo ' <option value="'.(int)($category['id_category']).'">'.Tools::htmlentitiesUTF8($category['name']).'</option>';
|
||||
echo ' </select><sup>*</sup>
|
||||
</div>
|
||||
<label>'.$this->l('Discount (in %):').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="reduction" value="" /><sup>*</sup>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Add ').'" name="submitAddGroupReduction" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
|
||||
public function viewgroup()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$currentIndex = 'index.php?tab=AdminGroups';
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
|
||||
echo '
|
||||
<fieldset style="width: 400px">
|
||||
<div style="float: right"><a href="'.$currentIndex.'&updategroup&id_group='.$obj->id.'&token='.$this->token.'"><img src="../img/admin/edit.gif" /></a></div>
|
||||
<span style="font-weight: bold; font-size: 14px;">'.strval($obj->name[(int)($cookie->id_lang)]).'</span>
|
||||
<div class="clear"> </div>
|
||||
'.$this->l('Discount:').' '.(float)($obj->reduction).$this->l('%').'
|
||||
</fieldset>
|
||||
<div class="clear"> </div>';
|
||||
|
||||
$this->fieldsDisplay = (array(
|
||||
'ID' => array('title' => $this->l('ID')),
|
||||
'sex' => array('title' => $this->l('Sex')),
|
||||
'name' => array('title' => $this->l('Name')),
|
||||
'e-mail' => array('title' => $this->l('e-mail')),
|
||||
'birthdate' => array('title' => $this->l('Birth date')),
|
||||
'register_date' => array('title' => $this->l('Registration date')),
|
||||
'orders' => array('title' => $this->l('Orders')),
|
||||
'status' => array('title' => $this->l('Status')),
|
||||
'actions' => array('title' => $this->l('Actions'))
|
||||
));
|
||||
|
||||
if ($nbCustomers = $obj->getCustomers(true))
|
||||
{
|
||||
echo '<h2>'.$this->l('Customer members of this group').' ('.$nbCustomers.')</h2>';
|
||||
|
||||
// Pagination Begin
|
||||
$customersPerPage = (Tools::getValue('customerPerPage') ? (int)Tools::getValue('customerPerPage') : 50);
|
||||
$totalPages = ceil($nbCustomers / $customersPerPage);
|
||||
$perPageOptions = array(20, 50, 100, 300);
|
||||
|
||||
$customerPageIndex = (Tools::getValue('customerPageIndex') && Tools::getValue('customerPageIndex') <= $totalPages ? (int)Tools::getValue('customerPageIndex') : 1);
|
||||
$from = (Tools::getValue('customerPageIndex') ? ((int)$customerPageIndex - 1) * ((int)$customersPerPage) : 0);
|
||||
|
||||
$customers = $obj->getCustomers(false, $from, $customersPerPage);
|
||||
|
||||
echo '<tr>
|
||||
<form method="post" action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'">
|
||||
<td style="vertical-align: bottom;"><span style="float: left; height:30px">';
|
||||
|
||||
if ($customerPageIndex > 1)
|
||||
{
|
||||
echo ' <input type="image" onclick="document.getElementById(\'customerPageIndex\').value=1" src="../img/admin/list-prev2.gif"> ';
|
||||
echo ' <input type="image" onclick="document.getElementById(\'customerPageIndex\').value='.($customerPageIndex-1).'" src="../img/admin/list-prev.gif"> ';
|
||||
}
|
||||
|
||||
echo 'Page <b><select onChange="submit()" name="customerPageIndex" id="customerPageIndex">';
|
||||
for ($i=1; $i <= $totalPages; $i++)
|
||||
echo '<option value="'.$i.'"'.((int)$customerPageIndex === $i ? 'selected="selected"' : '').'>'.$i.'</option>';
|
||||
echo '</select></b> / '.$totalPages;
|
||||
|
||||
if ($customerPageIndex < $totalPages)
|
||||
{
|
||||
echo ' <input type="image" onclick="document.getElementById(\'customerPageIndex\').value='.((int)$customerPageIndex+1).'" src="../img/admin/list-next.gif">';
|
||||
echo ' <input type="image" onclick="document.getElementById(\'customerPageIndex\').value='.$totalPages.'" src="../img/admin/list-next2.gif">';
|
||||
}
|
||||
|
||||
echo ' | Display
|
||||
<select onchange="document.getElementById(\'customerPageIndex\').value=1; submit();" name="customerPerPage">';
|
||||
foreach ($perPageOptions as $option)
|
||||
echo '<option value="'.$option.'"'.((int)$customersPerPage == $option ? 'selected="selected"' : '').'>'.$option.'</option>';
|
||||
echo ' </select> / '.$nbCustomers.' result(s)
|
||||
</span><span class="clear"></span></td>
|
||||
</form>
|
||||
</tr>';
|
||||
// Pagination End
|
||||
|
||||
echo '<table cellspacing="0" cellpadding="0" class="table widthfull">
|
||||
<tr>';
|
||||
foreach ($this->fieldsDisplay AS $field)
|
||||
echo '<th'.(isset($field['width']) ? 'style="width: '.$field['width'].'"' : '').'>'.$field['title'].'</th>';
|
||||
echo '
|
||||
</tr>';
|
||||
$irow = 0;
|
||||
|
||||
foreach ($customers AS $k => $customer)
|
||||
{
|
||||
$imgGender = $customer['id_gender'] == 1 ? '<img src="../img/admin/male.gif" alt="'.$this->l('Male').'" />' : ($customer['id_gender'] == 2 ? '<img src="../img/admin/female.gif" alt="'.$this->l('Female').'" />' : '');
|
||||
echo '
|
||||
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
|
||||
<td>'.$customer['id_customer'].'</td>
|
||||
<td class="center">'.$imgGender.'</td>
|
||||
<td>'.stripslashes($customer['lastname']).' '.stripslashes($customer['firstname']).'</td>
|
||||
<td>'.stripslashes($customer['email']).'<a href="mailto:'.stripslashes($customer['email']).'"> <img src="../img/admin/email_edit.gif" alt="'.$this->l('Write to this customer').'" /></a></td>
|
||||
<td>'.Tools::displayDate($customer['birthday'], (int)($cookie->id_lang)).'</td>
|
||||
<td>'.Tools::displayDate($customer['date_add'], (int)($cookie->id_lang)).'</td>
|
||||
<td>'.Order::getCustomerNbOrders($customer['id_customer']).'</td>
|
||||
<td class="center"><img src="../img/admin/'.($customer['active'] ? 'enabled.gif' : 'forbbiden.gif').'" alt="" /></td>
|
||||
<td class="center" width="60px">
|
||||
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'">
|
||||
<img src="../img/admin/details.gif" alt="'.$this->l('View orders').'" /></a>
|
||||
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&addcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'">
|
||||
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this customer').'" /></a>
|
||||
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&deletecustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
|
||||
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this customer').'" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
else
|
||||
echo '<p><img src="../img/admin/information.png" style="float:left;margin-right:5px;" alt="" /> '.$this->l('No user in this group.').'</p>';
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
|
||||
|
||||
if (Tools::isSubmit('deleteGroupReduction'))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (!$id_group_reduction = Tools::getValue('id_group_reduction'))
|
||||
$this->_errors[] = Tools::displayError('Invalid group reduction ID');
|
||||
else
|
||||
{
|
||||
$groupReduction = new GroupReduction((int)($id_group_reduction));
|
||||
if (!$groupReduction->delete())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting the group reduction');
|
||||
else
|
||||
Tools::redirectAdmin($currentIndex.'&update'.$this->table.'&id_group='.(int)(Tools::getValue('id_group')).'&conf=1&token='.$token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
if (Tools::isSubmit('submitAddGroupReduction'))
|
||||
{
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
{
|
||||
if (!($obj = $this->loadObject()))
|
||||
return;
|
||||
$groupReduction = new GroupReduction();
|
||||
if (!$id_category = Tools::getValue('id_category') OR !Validate::isUnsignedId($id_category))
|
||||
$this->_errors[] = Tools::displayError('Wrong category ID');
|
||||
elseif (!$reduction = Tools::getValue('reduction') OR !Validate::isPrice($reduction))
|
||||
$this->_errors[] = Tools::displayError('Invalid reduction (must be a percentage)');
|
||||
elseif (GroupReduction::doesExist((int)($obj->id), $id_category))
|
||||
$this->_errors[] = Tools::displayError('A reduction already exists for this category.');
|
||||
else
|
||||
{
|
||||
$groupReduction->id_category = (int)($id_category);
|
||||
$groupReduction->id_group = (int)($obj->id);
|
||||
$groupReduction->reduction = (float)($reduction) / 100;
|
||||
if (!$groupReduction->add())
|
||||
$this->_errors[] = Tools::displayError('An error occurred while adding a category group reduction.');
|
||||
else
|
||||
Tools::redirectAdmin($currentIndex.'&update'.$this->table.'&id_group='.(int)(Tools::getValue('id_group')).'&conf=3&token='.$this->token);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
if (Tools::isSubmit('submitAddgroup'))
|
||||
{
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
{
|
||||
if (Tools::getValue('reduction') > 100 OR Tools::getValue('reduction') < 0)
|
||||
$this->_errors[] = Tools::displayError('Reduction value is incorrect');
|
||||
else
|
||||
{
|
||||
$id_group_reductions = Tools::getValue('gr_id_group_reduction');
|
||||
$reductions = Tools::getValue('gr_reduction');
|
||||
if ($id_group_reductions)
|
||||
foreach ($id_group_reductions AS $key => $id_group_reduction)
|
||||
if (!Validate::isUnsignedId($id_group_reductions[$key]) OR !Validate::isPrice($reductions[$key]))
|
||||
$this->_errors[] = Tools::displayError();
|
||||
else
|
||||
{
|
||||
$groupReduction = new GroupReduction((int)($id_group_reductions[$key]));
|
||||
$groupReduction->reduction = $reductions[$key] / 100;
|
||||
if (!$groupReduction->update())
|
||||
$this->errors[] = Tools::displayError('Cannot update group reductions');
|
||||
}
|
||||
if (!sizeof($this->_errors))
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
|
||||
}
|
||||
elseif (isset($_GET['delete'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
{
|
||||
if ($object->id == 1)
|
||||
$this->_errors[] = Tools::displayError('You cannot delete default group.');
|
||||
else
|
||||
{
|
||||
if ($object->delete())
|
||||
Tools::redirectAdmin($currentIndex.'&conf=1&token='.$token);
|
||||
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||
}
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user