Completed
Push — master ( 625e32...22cdbd )
by Michael
02:37
created

index.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/************************************************************************/
3
/* Donations - Paypal financial management module for Xoops 2           */
4
/* Copyright (c) 2004 by Xoops2 Donations Module Dev Team			    */
5
/* http://dev.xoops.org/modules/xfmod/project/?group_id=1060			*/
6
/* $Id: index.php 8193 2011-11-07 02:42:53Z beckmi $      */
0 ignored issues
show
Unused Code Comprehensibility introduced by
47% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
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
include 'header.php';
33
include_once 'include' . DIRECTORY_SEPARATOR . 'functions.php';
34
$xoopsOption['template_main'] = 'donations_main.html';
35
include XOOPS_ROOT_PATH . DIRECTORY_SEPARATOR . 'header.php';
36
37
$tr_config  = configInfo(); //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
$curr_sign     = define_curr($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")
67
. " WHERE name = 'don_text'";
68
$Recordset = $xoopsDB->query($sql);
69
$row = $xoopsDB->fetchArray($Recordset);
70
$DON_TEXT = $row['text'];
71
72
$sql = "SELECT * FROM ".$xoopsDB->prefix("donations_config")
73
. " WHERE name='don_amount' ORDER BY subtype";
74
$Recordset1 = $xoopsDB->query($sql);
75
76
$DONATION_AMOUNTS = "";
77 View Code Duplication
while ($row_Recordset1 = $xoopsDB->fetchArray($Recordset1)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
78
    if( is_numeric($row_Recordset1['value']) && $row_Recordset1['value'] > 0 ) {
79
        if( $row_Recordset1['subtype'] == $tr_config['don_amt_checked'] ) {
80
            $checked = " selected";
81
            $xoopsTpl->assign('BASEDONATION', $row_Recordset1['value']);
82
        } else {
83
            $checked = "";
84
        }
85
        $DONATION_AMOUNTS .= '<option value="'
86
        .  $row_Recordset1['value'] . '" '
87
        .  $checked . ' > ' . $curr_sign . $row_Recordset1['value'] . '</option>' . "\n";
88
    }
89
}
90
$DONATION_AMOUNTS .= '<option value="0"> '._MD_DON_OTHER.' </option>';
91
92
$uid = (is_object($xoopsUser)) ? $xoopsUser->getVar('uid') : 0 ;
93
94
// Ok, output the page
95
96
$xoopsTpl->assign('CUSTOM',            $uid);
97
$xoopsTpl->assign('DON_TITLE',         _MD_DON_TITLE);
98
$xoopsTpl->assign('PP_RECEIVER_EMAIL', $PP_RECEIVER_EMAIL);
99
$xoopsTpl->assign('PP_ITEMNAME',       $PP_ITEMNAME);
100
$xoopsTpl->assign('DONATION_AMOUNTS',  $DONATION_AMOUNTS);
101
$xoopsTpl->assign('DON_TEXT',          $DON_TEXT);
102
$xoopsTpl->assign('DON_NAME_YES',      $tr_config['don_name_yes']);
103
$xoopsTpl->assign('DON_NAME_NO',       $tr_config['don_name_no']);
104
$xoopsTpl->assign('PP_NO_SHIP',        $PP_NO_SHIP);
105
$xoopsTpl->assign('PP_CURR_CODE',      $PP_CURR_CODE);
106
$xoopsTpl->assign('PP_CANCEL_URL',     $PP_CANCEL_URL);
107
$xoopsTpl->assign('PP_TY_URL',         $PP_TY_URL);
108
$xoopsTpl->assign('PP_IMAGE_URL',      $PP_IMAGE_URL);
109
$xoopsTpl->assign('DON_SUB_IMG_DIMS',  $DON_SUB_IMG_DIMS);
110
$xoopsTpl->assign('DON_BUTTON_SUBMIT', $DON_BUTTON_SUBMIT);
111
$xoopsTpl->assign('MAKEADON',          _MD_DON_MAKEADON);
112
$xoopsTpl->assign('SELECTAMT',         _MD_DON_SELECTAMT);
113
$xoopsTpl->assign('SHOWNAME',          $tr_config['don_name_prompt']);
114
$xoopsTpl->assign('DONTHISMONTH',      _MD_DON_DONTHISMONTH);
115
$xoopsTpl->assign('DON_NAME',          _MD_DON_NAME);
116
$xoopsTpl->assign('DON_DIR',           $xoopsModule->getVar('dirname'));
117
$xoopsTpl->assign('SUBMIT_BUTTON',     _MD_DON_SUBMIT_BUTTON);
118
$xoopsTpl->assign('PAYPAL_URL',        $paypal_url);
119
120
include 'footer.php';
121