mambax7 /
xdonations
| 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 | require_once XOOPS_ROOT_PATH . '/include/cp_functions.php'; |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 32 | |||||||
| 33 | $moduleDirName = basename(dirname(__DIR__)); |
||||||
| 34 | global $xoopsConfig, $xoopsUser; |
||||||
| 35 | |||||||
| 36 | /* |
||||||
| 37 | |||||||
| 38 | echo "<hr>language: {$xoopsConfig['language']}<hr>"; |
||||||
| 39 | |||||||
| 40 | $n = '_AD_XDONATION_z_test'; if (defined($n)) {echo $n . " = " . constant($n)."<br>";} else {echo $n . " = ?<br>";} |
||||||
| 41 | $n = '_MD_XDONATION_z_test'; if (defined($n)) {echo $n . " = " . constant($n)."<br>";} else {echo $n . " = ?<br>";} |
||||||
| 42 | $n = '_MI_XDONATION_z_test'; if (defined($n)) {echo $n . " = " . constant($n)."<br>";} else {echo $n . " = ?<br>";} |
||||||
| 43 | $n = '_MB_XDONATION_z_test'; if (defined($n)) {echo $n . " = " . constant($n)."<br>";} else {echo $n . " = ?<br>";} |
||||||
| 44 | */ |
||||||
| 45 | |||||||
| 46 | xoops_loadLanguage('main', $moduleDirName); |
||||||
|
0 ignored issues
–
show
The function
xoops_loadLanguage was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 47 | |||||||
| 48 | /** |
||||||
| 49 | * @param XoopsObject|null $module |
||||||
|
0 ignored issues
–
show
The type
XoopsObject was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 50 | * @return bool |
||||||
| 51 | */ |
||||||
| 52 | function xoops_module_install_xyp_base($module = null) |
||||||
|
0 ignored issues
–
show
The parameter
$module is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||
| 53 | { |
||||||
| 54 | global $xoopsDB, $xoopsUser; |
||||||
| 55 | $moduleDirName = basename(dirname(__DIR__)); |
||||||
| 56 | |||||||
| 57 | //---------------------------------------------------------------- |
||||||
| 58 | //patch JJD pour francisation ou autre langue |
||||||
| 59 | //---------------------------------------------------------------- |
||||||
| 60 | update_lg(); |
||||||
| 61 | //---------------------------------------------------------------- |
||||||
| 62 | |||||||
| 63 | $sql1 = 'UPDATE ' . $xoopsDB->prefix('donations_config') . ' SET `value` = "' . XOOPS_URL . '/modules/' . $moduleDirName . '/success.php" WHERE `name` = "ty_url"'; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 64 | $sql2 = 'UPDATE ' . $xoopsDB->prefix('donations_config') . ' SET `value` = "' . XOOPS_URL . '/modules/' . $moduleDirName . '/cancel.php" WHERE `name` = "pp_cancel_url"'; |
||||||
| 65 | |||||||
| 66 | $retVal = false; |
||||||
| 67 | if ($xoopsUser && $xoopsDB->query($sql1) && $xoopsDB->query($sql2)) { |
||||||
| 68 | $retVal = true; |
||||||
| 69 | } |
||||||
| 70 | |||||||
| 71 | return $retVal; |
||||||
| 72 | } |
||||||
| 73 | |||||||
| 74 | /************************************************************************ |
||||||
| 75 | * |
||||||
| 76 | ************************************************************************/ |
||||||
| 77 | function update_lg() |
||||||
| 78 | { |
||||||
| 79 | global $xoopsDB; |
||||||
| 80 | |||||||
| 81 | // $moduleDirName = basename ( dirname( __DIR__ ) ) ; |
||||||
| 82 | |||||||
| 83 | if (defined('_AD_XDONATION_DONATIONS')) { |
||||||
| 84 | $prefixV = '_AD_XDONATION_V_'; |
||||||
| 85 | $prefixT = '_AD_XDONATION_T_'; |
||||||
| 86 | } else { |
||||||
| 87 | $prefixV = '_MI_XDONATION_V_'; |
||||||
| 88 | $prefixT = '_MI_XDONATION_T_'; |
||||||
| 89 | } |
||||||
| 90 | |||||||
| 91 | $lstName = 'receiver_email_;paypal_url_array;use_goal_array;' |
||||||
| 92 | . 'week_goal_1st;week_goal_2nd;week_goal_3rd;week_goal_4th;' |
||||||
| 93 | . 'month_goal_Jan;month_goal_Feb;month_goal_Mar;month_goal_Apr;' |
||||||
| 94 | . 'month_goal_May;month_goal_Jun;month_goal_Jul;' |
||||||
| 95 | . 'month_goal_Aug;month_goal_Sep;month_goal_Oct;' |
||||||
| 96 | . 'month_goal_Nov;month_goal_Dec;quarter_goal_1st;quarter_goal_2nd;' |
||||||
| 97 | . 'quarter_goal_3rd;quarter_goal_4th;swing_day_;ty_url_;' |
||||||
| 98 | . 'pp_itemname_;don_button_submit_;don_button_top_;pp_image_url_;' |
||||||
| 99 | . 'pp_cancel_url_;pp_get_addr_;pp_curr_code_array;don_amount_1;' |
||||||
| 100 | . 'don_amount_2;don_amount_3;don_amount_4;don_amount_5;' |
||||||
| 101 | . 'don_amount_6;don_amount_7;don_amt_checked_;pp_item_num_;' |
||||||
| 102 | . 'don_top_img_width_;don_top_img_height_;don_sub_img_width_;' |
||||||
| 103 | . 'don_sub_img_height_;don_text_rawtext;don_name_prompt_;' |
||||||
| 104 | . 'don_name_yes_;don_name_no_;don_forceadd_;ipn_dbg_lvl_;ipn_log_entries_;' |
||||||
| 105 | . 'assign_group_;assign_rank_'; |
||||||
| 106 | |||||||
| 107 | $table = $xoopsDB->prefix('donations_config'); |
||||||
| 108 | $sql0 = "INSERT INTO `{$table}` (`name`, `subtype`, `value`, `text`) " . "VALUES ('%1\$s', '%2\$s', '%3\$s', '%4\$s')"; |
||||||
| 109 | |||||||
| 110 | $sql = "DELETE FROM {$table}"; |
||||||
| 111 | $xoopsDB->queryF($sql); |
||||||
| 112 | //echo "{$sql}<br>"; |
||||||
| 113 | $t = explode(';', $lstName); |
||||||
| 114 | |||||||
| 115 | for ($h = 0, $hMax = count($t); $h < $hMax; ++$h) { |
||||||
| 116 | //echo "<hr>{$t[$h]}<br>"; |
||||||
| 117 | $tc = explode('_', $t[$h]); |
||||||
| 118 | //echo "<hr>{$t[$h]}-".count($tc)."-".count($tn)."<br>"; |
||||||
| 119 | |||||||
| 120 | //$tc = array_shift($tc); |
||||||
| 121 | $subType = $tc[count($tc) - 1]; |
||||||
| 122 | |||||||
| 123 | $cstV = $prefixV . $t[$h]; |
||||||
| 124 | $cstT = $prefixT . $t[$h]; |
||||||
| 125 | |||||||
| 126 | //$tc = array_shift($tc); |
||||||
| 127 | $tn = array_pop($tc); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 128 | $tn = $tc; |
||||||
| 129 | $name = implode('_', $tn); |
||||||
| 130 | //echo "{$t[$h]}-".count($tc)."-".count($tn)."-{$tc[0]}-{$tn[0]}-{$name}<br>"; |
||||||
| 131 | |||||||
| 132 | $value = constant($cstV); |
||||||
| 133 | $text = constant($cstT); |
||||||
| 134 | $text = str_replace("'", "\'", $text); |
||||||
| 135 | $text = html_entity_decode($text); |
||||||
| 136 | $text = str_replace('<br>', "\r\n", $text); |
||||||
| 137 | $text = str_replace('<br>', "\r\n", $text); |
||||||
| 138 | |||||||
| 139 | $sql = sprintf($sql0, $name, $subType, $value, $text); |
||||||
| 140 | // echo "{$sql}<br>"; |
||||||
| 141 | $xoopsDB->queryF($sql); |
||||||
| 142 | } |
||||||
| 143 | } |
||||||
| 144 | |||||||
| 145 | eval('function xoops_module_install_' . $moduleDirName . '(\XoopsModule $module=NULL) |
||||||
|
0 ignored issues
–
show
|
|||||||
| 146 | { |
||||||
| 147 | return xoops_module_install_xyp_base($module); |
||||||
| 148 | } |
||||||
| 149 | '); |
||||||
| 150 | |||||||
| 151 | /************************************************************************ |
||||||
| 152 | * |
||||||
| 153 | * http://localhost/xoops2018a/modules/xdonations/include/installscript.php?op=update_lg |
||||||
| 154 | * http://localhost/xoops2018a/modules/xdonations/include/installscript.php?op=update_lg |
||||||
| 155 | * https://www.paypal.com/fr_FR/FR/i/btn/btn_donate_LG.gif |
||||||
| 156 | ************************************************************************/ |
||||||
| 157 | |||||||
| 158 | $op = \Xmf\Request::getString('op', '', 'GET'); |
||||||
|
0 ignored issues
–
show
The type
Xmf\Request was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 159 | |||||||
| 160 | switch ($op) { |
||||||
| 161 | case 'update_lg': |
||||||
| 162 | update_lg(); |
||||||
| 163 | break; |
||||||
| 164 | default: |
||||||
| 165 | break; |
||||||
| 166 | } |
||||||
| 167 |