Issues (143)

Labels
Severity
1
<?php
2
/************************************************************************/
3
/* Donations - Paypal financial management module for Xoops 2           */
4
/* Copyright (c) 2016 XOOPS Project                                     */
5
/* http://dev.xoops.org/modules/xfmod/project/?group_id=1060            */
6
/*
7
/************************************************************************/
8
/*                                                                      */
9
/* Based on NukeTreasury for PHP-Nuke - by Dave Lawrence AKA Thrash     */
10
/* NukeTreasury - Financial management for PHP-Nuke                     */
11
/* Copyright (c) 2004 by Dave Lawrence AKA Thrash                       */
12
/*                       [email protected]                         */
13
/*                       [email protected]                          */
14
/*                                                                      */
15
/************************************************************************/
16
/*                                                                      */
17
/* This program is free software; you can redistribute it and/or modify */
18
/* it under the terms of the GNU General Public License as published by */
19
/* the Free Software Foundation; either version 2 of the License.       */
20
/*                                                                      */
21
/* This program is distributed in the hope that it will be useful, but  */
22
/* WITHOUT ANY WARRANTY; without even the implied warranty of           */
23
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU     */
24
/* General Public License for more details.                             */
25
/*                                                                      */
26
/* You should have received a copy of the GNU General Public License    */
27
/* along with this program; if not, write to the Free Software          */
28
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  */
29
/* USA                                                                  */
30
/************************************************************************/
31
32
require_once __DIR__   . '/header.php';
33
require_once __DIR__ . '/class/Utility.php';
34
$GLOBALS['xoopsOption']['template_main'] = 'donations_main.tpl';
35
require_once XOOPS_ROOT_PATH . '/header.php';
0 ignored issues
show
The constant XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
36
37
$tr_config  = $utility::getConfigInfo(); //load the module configuration settings
38
$paypal_url = explode('|', $tr_config['paypal_url']);
39
$paypal_url = $paypal_url[0];
40
41
//determine the currency
42
$PP_CURR_CODE = explode('|', $tr_config['pp_curr_code']); // [USD,GBP,JPY,CAD,EUR]
43
$PP_CURR_CODE = $PP_CURR_CODE[0];
44
$currencySign = $utility::defineCurrency($PP_CURR_CODE);
45
46
$swingd            = $tr_config['swing_day'];
47
$PP_RECEIVER_EMAIL = $tr_config['receiver_email'];
48
$PP_ITEMNAME       = $tr_config['pp_itemname'];
49
$PP_TY_URL         = $tr_config['ty_url'];
50
$PP_CANCEL_URL     = $tr_config['pp_cancel_url'];
51
52
// Fill out some more template tags
53
$DON_BUTTON_SUBMIT = $tr_config['don_button_submit'];
54
55
$PP_NO_SHIP   = $tr_config['pp_get_addr'] ? '0' : '1';
56
$PP_IMAGE_URL = $tr_config['pp_image_url'];
57
58
$DON_SUB_IMG_DIMS = '';
59
if (is_numeric($tr_config['don_sub_img_width'])) {
60
    $DON_SUB_IMG_DIMS .= 'width=' . $tr_config['don_sub_img_width'] . ' ';
61
}
62
if (is_numeric($tr_config['don_sub_img_height'])) {
63
    $DON_SUB_IMG_DIMS .= 'height=' . $tr_config['don_sub_img_height'] . ' ';
64
}
65
66
$sql       = 'SELECT * FROM ' . $xoopsDB->prefix('donations_config') . " WHERE name = 'don_text'";
67
$Recordset = $xoopsDB->query($sql);
68
$row       = $xoopsDB->fetchArray($Recordset);
69
$DON_TEXT  = $row['text'];
70
71
$sql        = 'SELECT * FROM ' . $xoopsDB->prefix('donations_config') . " WHERE name='don_amount' ORDER BY subtype";
72
$Recordset1 = $xoopsDB->query($sql);
73
74
$DONATION_AMOUNTS = '';
75
while (false !== ($row_Recordset1 = $xoopsDB->fetchArray($Recordset1))) {
76
    if (is_numeric($row_Recordset1['value']) && $row_Recordset1['value'] > 0) {
77
        if ($row_Recordset1['subtype'] == $tr_config['don_amt_checked']) {
78
            $checked = ' selected';
79
            $xoopsTpl->assign('BASEDONATION', $row_Recordset1['value']);
80
        } else {
81
            $checked = '';
82
        }
83
        $DONATION_AMOUNTS .= '<option value="' . $row_Recordset1['value'] . '" ' . $checked . ' > ' . $currencySign . $row_Recordset1['value'] . '</option>' . "\n";
84
    }
85
}
86
$DONATION_AMOUNTS .= '<option value="0"> ' . _MD_XDONATION_OTHER . ' </option>';
87
88
$uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
89
90
// Ok, output the page
91
92
$xoopsTpl->assign('CUSTOM', $uid);
93
$xoopsTpl->assign('DON_TITLE', _MD_XDONATION_TITLE);
94
$xoopsTpl->assign('PP_RECEIVER_EMAIL', $PP_RECEIVER_EMAIL);
95
$xoopsTpl->assign('PP_ITEMNAME', $PP_ITEMNAME);
96
$xoopsTpl->assign('DONATION_AMOUNTS', $DONATION_AMOUNTS);
97
$xoopsTpl->assign('DON_TEXT', $DON_TEXT);
98
$xoopsTpl->assign('DON_NAME_YES', $tr_config['don_name_yes']);
99
$xoopsTpl->assign('DON_NAME_NO', $tr_config['don_name_no']);
100
$xoopsTpl->assign('PP_NO_SHIP', $PP_NO_SHIP);
101
$xoopsTpl->assign('PP_CURR_CODE', $PP_CURR_CODE);
102
$xoopsTpl->assign('PP_CANCEL_URL', $PP_CANCEL_URL);
103
$xoopsTpl->assign('PP_TY_URL', $PP_TY_URL);
104
$xoopsTpl->assign('PP_IMAGE_URL', $PP_IMAGE_URL);
105
$xoopsTpl->assign('DON_SUB_IMG_DIMS', $DON_SUB_IMG_DIMS);
106
$xoopsTpl->assign('DON_BUTTON_SUBMIT', $DON_BUTTON_SUBMIT);
107
$xoopsTpl->assign('MAKEADON', _MD_XDONATION_MAKEADON);
108
$xoopsTpl->assign('SELECTAMT', _MD_XDONATION_SELECTAMT);
109
$xoopsTpl->assign('SHOWNAME', $tr_config['don_name_prompt']);
110
$xoopsTpl->assign('DONTHISMONTH', _MD_XDONATION_DONTHISMONTH);
111
$xoopsTpl->assign('DON_NAME', _MD_XDONATION_NAME);
112
$xoopsTpl->assign('DON_DIR', $xoopsModule->getVar('dirname'));
113
$xoopsTpl->assign('SUBMIT_BUTTON', _MD_XDONATION_SUBMIT_BUTTON);
114
$xoopsTpl->assign('PAYPAL_URL', $paypal_url);
115
116
require_once __DIR__   . '/footer.php';
117