| Conditions | 13 |
| Paths | 192 |
| Total Lines | 335 |
| Code Lines | 186 |
| Lines | 15 |
| Ratio | 4.48 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 261 | function setConfig() |
||
| 262 | { |
||
| 263 | global $tr_config, $xoopsModule, $modversion, $xoopsDB; |
||
| 264 | //------------------------------------------------------------------------ |
||
| 265 | $indexAdmin = new ModuleAdmin(); |
||
| 266 | echo $indexAdmin->addNavigation('donations.php?op=Config'); |
||
| 267 | ?> |
||
| 268 | <script Language="JavaScript"> |
||
| 269 | function isEmailAddr(email) { |
||
| 270 | var result = false; |
||
| 271 | var theStr = new String(email); |
||
| 272 | var index = theStr.indexOf("@"); |
||
| 273 | if (index > 0) { |
||
| 274 | var pindex = theStr.indexOf(".", index); |
||
| 275 | if ((pindex > index + 1) && (theStr.length > pindex + 1)) |
||
| 276 | result = true; |
||
| 277 | } |
||
| 278 | return result; |
||
| 279 | } |
||
| 280 | |||
| 281 | function validRequired(formField, fieldLabel, message) { |
||
| 282 | var result = true; |
||
| 283 | |||
| 284 | if (formField.value == "") { |
||
| 285 | alert(message.replace("%1\$s", field)); |
||
| 286 | |||
| 287 | formField.focus(); |
||
| 288 | result = false; |
||
| 289 | } |
||
| 290 | |||
| 291 | return result; |
||
| 292 | } |
||
| 293 | |||
| 294 | function allDigits(str) { |
||
| 295 | return inValidCharSet(str, "0123456789"); |
||
| 296 | } |
||
| 297 | |||
| 298 | function inValidCharSet(str, charset) { |
||
| 299 | var result = true; |
||
| 300 | |||
| 301 | // Note: doesn't use regular expressions to avoid early Mac browser bugs |
||
| 302 | for (var i = 0; i < str.length; i++) |
||
| 303 | if (charset.indexOf(str.substr(i, 1)) < 0) { |
||
| 304 | result = false; |
||
| 305 | break; |
||
| 306 | } |
||
| 307 | |||
| 308 | return result; |
||
| 309 | } |
||
| 310 | |||
| 311 | function validInt(formField, fieldLabel, required, message) { |
||
| 312 | var result = true; |
||
| 313 | |||
| 314 | if (required && !validRequired(formField, fieldLabel, message)) |
||
| 315 | result = false; |
||
| 316 | |||
| 317 | if (result) { |
||
| 318 | // var num = parseInt(formField.value,10); |
||
| 319 | if (!allDigits(formField.value)) { |
||
| 320 | if (required) { |
||
| 321 | //alert('Please enter a number for the "' + fieldLabel +'" field.'); |
||
| 322 | alert(message.replace("%1\$s", fieldLabel)); |
||
| 323 | formField.focus(); |
||
| 324 | result = false; |
||
| 325 | } |
||
| 326 | elseif(formField.value == "") |
||
| 327 | { |
||
| 328 | return true; |
||
| 329 | } |
||
| 330 | else |
||
| 331 | { |
||
| 332 | //alert('Please enter a number or a blank for the "' + fieldLabel +'" field.'); |
||
| 333 | alert(message.replace("%1\$s", fieldLabel)); |
||
| 334 | formField.focus(); |
||
| 335 | result = false; |
||
| 336 | } |
||
| 337 | } |
||
| 338 | } |
||
| 339 | |||
| 340 | return result; |
||
| 341 | } |
||
| 342 | |||
| 343 | |||
| 344 | function validateURL(formField, value, secure) { |
||
| 345 | |||
| 346 | var match = /https/i.test(value); |
||
| 347 | |||
| 348 | if (value != "" && !/^http/i.test(value)) { |
||
| 349 | alert('The URL must start with http://'); |
||
| 350 | formField.focus(); |
||
| 351 | |||
| 352 | return false; |
||
| 353 | } |
||
| 354 | |||
| 355 | if (secure && value != "" && !/^https/i.test(value)) { |
||
| 356 | // alert('This should reside on a HTTPS server. Users will be warned about viewing secure and non-secure data on the same page'); |
||
| 357 | return confirm('This URL does not begin with https://\nThis image should reside on an HTTPS server.\nIf you use this URL, users will receive a warning\nabout viewing secure and non-secure data on the same page.\n\n Are you sure you want to continue?'); |
||
| 358 | } |
||
| 359 | |||
| 360 | return true; |
||
| 361 | } |
||
| 362 | |||
| 363 | |||
| 364 | function checkCancelledURL() { |
||
| 365 | if (document.tr_configs.var_pp_image_url.value == "") |
||
| 366 | alert('There is no URL for a Cancelled payment. If you do not enter\na URL for cancelled payments PayPal will also use\nthis URL for cancelled payments.'); |
||
| 367 | |||
| 368 | return true; |
||
| 369 | } |
||
| 370 | </script> |
||
| 371 | <?php |
||
| 372 | //------------------------------------------------------------------------------- |
||
| 373 | echo "<form name=\"tr_configs\" action=\"donations.php\" method=\"post\">\n" . "<input type=\"hidden\" name=\"op\" value=\"updateConfig\" />\n"; |
||
| 374 | echo "<table style=\"border-width: 1px; width: 90%; text-align: center;\"><tr>\n"; |
||
| 375 | echo "<td style=\"text-align: center; font-weight: bold;\" class=\"title\">\n"; |
||
| 376 | echo '<h3>' . _AD_DON_CONFIG_MODULE . "</h3>\n"; |
||
| 377 | echo "<table style=\"border-width: 1px; text-align: center;\">\n"; |
||
| 378 | |||
| 379 | ShowTextBox('don_button_top', "<span style=\"font-weight: bold;\">" . _AD_DON_IMG_BUTTON_TOP . '</span>', '', '70', 'onChange="return validateURL(this,this.value);"'); |
||
| 380 | ShowImgXYBox('don_top_img_width', 'don_top_img_height', "<span style=\"font-weight: bold;\">" . _AD_DON_IMAGE_SIZE . '</span>', '4', "onChange='return validInt(this,\"" . _AD_DON_IMAGE_SIZE . "\",0,\"" . _AD_DON_ALERTE_INPUT_NUMBER . "\");'"); |
||
| 381 | ShowTextBox('don_button_submit', "<span style=\"font-weight: bold;\">" . _AD_DON_IMG_BUTTON_URL . '</span>', '', '70', 'onChange="return validateURL(this,this.value);"'); |
||
| 382 | ShowImgXYBox('don_sub_img_width', 'don_sub_img_height', "<span style=\"font-weight: bold;\">" . _AD_DON_IMAGE_SIZE . '</span>', '4', "onChange='return validInt(this,\"" . _AD_DON_IMAGE_SIZE . "\",0,\"" . _AD_DON_ALERTE_INPUT_NUMBER . "\");'"); |
||
| 383 | //"onChange='return validInt(this,"._AD_DON_IMAGE_SIZE.")'" |
||
| 384 | ShowTextBox('don_name_prompt', "<span style=\"font-weight: bold;\">" . _AD_DON_USERNAME_REQUEST . '</span>', '', '70', ''); |
||
| 385 | ShowTextBox('don_name_yes', "<span style=\"font-weight: bold;\">" . _AD_DON_USERNAME_REQUEST_YES . '</span>', '', '50', ''); |
||
| 386 | ShowTextBox('don_name_no', "<span style=\"font-weight: bold;\">" . _AD_DON_USERNAME_REQUEST_NO . '</span>', '', '50', ''); |
||
| 387 | |||
| 388 | $desc = 'This is where you can appeal to your' . 'users and your community for donations.' . 'Suggestion: Explain why you need donations,' . 'what you do with the money and how you' . 'manage it. Make them comfortable that' . 'they are not throwing their money away.'; |
||
| 389 | |||
| 390 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('donations_config') . " WHERE name = 'don_text'"; |
||
| 391 | $Recordset = $xoopsDB->query($sql); |
||
| 392 | $row = $xoopsDB->fetchArray($Recordset); |
||
| 393 | $donText = $row['text']; |
||
| 394 | echo "<tr>\n" . " <td title=\"{$desc}\" style=\"text-align: right; font-weight: bold;\">" . _AD_DON_INTRODUCE_TEXT . "</td>\n" . " <td title=\"{$desc}\" style=\"text-align: left;\">" . "<textarea name=\"var_don_text-rawtext-txt\" cols=\"100\" rows=\"20\">{$donText}</textarea></td>\n"; |
||
| 395 | echo "</tr>\n"; |
||
| 396 | |||
| 397 | // ShowTextBox('don_amt_checked', '<span style=\'font-weight: bold;\'>'._AD_DON_AMOUNT_DEFAULT.'</span>', '', '4', "onChange=\"return validInt(this,'"._AD_DON_AMOUNT_DEFAULT."',1,'"._AD_DON_ALERTE_INPUT_NUMBER."');\""); |
||
| 398 | |||
| 399 | echo "</table>\n"; |
||
| 400 | echo "<br />\n"; |
||
| 401 | |||
| 402 | $query_Recordset1 = 'SELECT * FROM ' . $xoopsDB->prefix('donations_config') . " WHERE name = 'don_amount' ORDER BY subtype"; |
||
| 403 | $Recordset1 = $xoopsDB->query($query_Recordset1); |
||
| 404 | $row_Recordset1 = $xoopsDB->fetchArray($Recordset1); |
||
| 405 | $totalRows_Recordset1 = $xoopsDB->getRowsNum($Recordset1); |
||
| 406 | $desc = htmlentities($row_Recordset1['text']); |
||
| 407 | |||
| 408 | echo "<table style=\"border-width: 1px; width: 100px; text-align: center;\">\n"; |
||
| 409 | echo " <tr><td style=\"text-align: center; width: 100%; font-weight: bold;\" colspan=\"8\">" . _AD_DON_SUGGESTED_AMOUNT . "<br /></td></tr>\n"; |
||
| 410 | $row1 = " <tr><td title=\"{$desc}\" style=\"text-align: center;\"></td>\n"; |
||
| 411 | $row2 = " <tr><td title=\"{$desc}\" style=\"text-align: center; font-weight: bold;\">" . _AD_DON_AMOUNT . "</td>\n"; |
||
| 412 | do { |
||
| 413 | $row1 .= " <td title=\"{$desc}\" style=\"text-align: center;\">{$row_Recordset1['subtype']}</td>\n"; |
||
| 414 | $row2 .= " <td title=\"{$desc}\" style=\"text-align: center;\"><input size=\"4\" name=\"var_don_amount-{$row_Recordset1['subtype']}\" type=\"text\" value=\"{$row_Recordset1['value']}\" onChange=\"return validInt(this,'" . _AD_DON_SUGGESTED_AMOUNT . " #{$row_Recordset1['subtype']}',1,'" . _AD_DON_ALERTE_INPUT_NUMBER . "');\" /></td>\n"; |
||
| 415 | } while (false != ($row_Recordset1 = $xoopsDB->fetchArray($Recordset1))); |
||
| 416 | |||
| 417 | $row1 .= "</tr>\n"; |
||
| 418 | $row2 .= "</tr>\n"; |
||
| 419 | echo "{$row1} {$row2}\n"; |
||
| 420 | |||
| 421 | // display default option |
||
| 422 | $query_cfg = 'SELECT * FROM ' . $xoopsDB->prefix('donations_config') . " WHERE name = 'don_amt_checked' LIMIT 1"; |
||
| 423 | $cfgResult = $xoopsDB->query($query_cfg); |
||
| 424 | $amt = $xoopsDB->fetchArray($cfgResult); |
||
| 425 | $amt_checked = (int)$amt['value']; |
||
| 426 | echo '<tr><td>' . _AD_DON_DEFAULT . "</td>\n"; |
||
| 427 | for ($i = 1; $i < 8; ++$i) { |
||
| 428 | $checked = ($i == $amt_checked) ? ' checked' : ''; |
||
| 429 | echo "<td><input type=\"radio\" name=\"var_don_amt_checked\"{$checked} value=\"{$i}\"></td>\n"; |
||
| 430 | } |
||
| 431 | echo "</tr>\n"; |
||
| 432 | echo "</table>\n"; |
||
| 433 | |||
| 434 | echo "</td></tr>\n"; |
||
| 435 | echo "<tr><td style=\"text-align: center; width: 100%;\"><br /><input type=\"submit\" value=\"" . _AD_DON_SUBMIT . "\" /></td></tr>"; |
||
| 436 | echo "</table><br /><br />\n"; |
||
| 437 | echo $indexAdmin->addNavigation('donations.php?op=Config'); |
||
| 438 | echo "<table style=\"border-width: 1px; width: 90%; text-align: center;\"><tr>\n"; |
||
| 439 | echo "<td class=\"title\" style=\"font-weight: bold; text-align: center;\"><h3>" . _AD_DON_CONFIG_PAYPAL_HEADER . "</h3><br />\n"; |
||
| 440 | echo "<table style=\"border-width: 1px; text-align: center;\">\n"; |
||
| 441 | |||
| 442 | $rsql = 'SELECT rank_id, rank_title FROM ' . $xoopsDB->prefix('ranks') . ''; |
||
| 443 | $rresult = $xoopsDB->query($rsql); |
||
| 444 | $r_array = array(); |
||
| 445 | while (false != ($r_row = $xoopsDB->fetchRow($rresult))) { |
||
| 446 | $r_array[] = $r_row; |
||
| 447 | } |
||
| 448 | ShowDropBox('paypal_url', '<span style=\'font-weight: bold;\'>' . _AD_DON_IPN_URL . '</span>'); |
||
| 449 | ShowTextBox('receiver_email', '<span style=\'font-weight: bold;\'>' . _AD_DON_IPN_EMAIL_RECEIVER . '</span>', '', '40', ''); |
||
| 450 | ShowTextBox('ty_url', '<span style=\'font-weight: bold;\'>' . _AD_DON_IPN_URL_SUCCESS . '</span>', '', '80', 'onChange="checkCancelledURL(); return validateURL(this,this.value);"'); |
||
| 451 | ShowTextBox('pp_cancel_url', '<span style=\'font-weight: bold;\'>' . _AD_DON_IPN_URL_CANCELED . '</span>', '', '80', 'onChange="return validateURL(this,this.value);"'); |
||
| 452 | ShowTextBox('pp_itemname', '<span style=\'font-weight: bold;\'>' . _AD_DON_PP_ITEM_NAME . '</span>', '', '20', ''); |
||
| 453 | ShowTextBox('pp_item_num', '<span style=\'font-weight: bold;\'>' . _AD_DON_PP_ITEM_NUMBER . '</span>', '', '20', ''); |
||
| 454 | ShowTextBox('pp_image_url', '<span style=\'font-weight: bold;\'>' . _AD_DON_PP_IMG . '</span>', '', '60', ''); |
||
| 455 | ShowYNBox('pp_get_addr', '<span style=\'font-weight: bold;\'>' . _AD_DON_PP_ASK_CP_ADRESS . '</span>'); |
||
| 456 | ShowDropBox('pp_curr_code', '<span style=\'font-weight: bold;\'>' . _AD_DON_PP_MONEY . '</span>'); |
||
| 457 | $gsql = 'SELECT groupid, name FROM ' . $xoopsDB->prefix('groups') . ' WHERE groupid>3'; |
||
| 458 | $gresult = $xoopsDB->query($gsql); |
||
| 459 | $g_array = array(); |
||
| 460 | while (false != ($g_row = $xoopsDB->fetchRow($gresult))) { |
||
| 461 | $g_array[] = $g_row; |
||
| 462 | } |
||
| 463 | ShowArrayDropBox('assign_group', '<span style=\'font-weight: bold;\'>' . _AD_DON_PP_GROUP . '</span>', $g_array); |
||
| 464 | $rsql = 'SELECT rank_id, rank_title FROM ' . $xoopsDB->prefix('ranks') . ''; |
||
| 465 | $rresult = $xoopsDB->query($rsql); |
||
| 466 | $r_array = array(); |
||
| 467 | while (false != ($r_row = $xoopsDB->fetchRow($rresult))) { |
||
| 468 | $r_array[] = $r_row; |
||
| 469 | } |
||
| 470 | ShowArrayDropBox('assign_rank', '<span style=\'font-weight: bold;\'>' . _AD_DON_PP_RANK . '</span>', $r_array); |
||
| 471 | ShowYNBox('don_forceadd', '<span style=\'font-weight: bold;\'>' . _AD_DON_ADD_ANYWAY . '</span>'); |
||
| 472 | |||
| 473 | echo "</table><br />\n"; |
||
| 474 | |||
| 475 | echo "<table style=\"border-width: 1px; width: 100px; text-align: center;\">\n"; |
||
| 476 | echo " <tr><td style=\"text-align: center; width: 100%; font-weight: bold;\" colspan=\"2\">" . _AD_DON_IPN_LOGGING . "<br /></td></tr>\n"; |
||
| 477 | echo " <tr>\n" . " <td style=\"text-align: right; font-weight: bold;\">" . _AD_DON_IPN_LOGGING_LEVEL . "</td>\n" . " <td style=\"text-align: left;\">\n" . " <select size=\"1\" name=\"var_ipn_dbg_lvl\">\n"; |
||
| 478 | echo ' <option '; |
||
| 479 | if (0 == $tr_config['ipn_dbg_lvl']) { |
||
| 480 | echo 'selected '; |
||
| 481 | } |
||
| 482 | echo "value=\"0\">" . _AD_DON_LOG_OFF . "</option>\n"; |
||
| 483 | echo ' <option '; |
||
| 484 | if ($tr_config['ipn_dbg_lvl'] == 1) { |
||
| 485 | echo 'selected '; |
||
| 486 | } |
||
| 487 | echo "value=\"1\">" . _AD_DON_LOG_ONLY_ERRORS . "</option>\n"; |
||
| 488 | echo ' <option '; |
||
| 489 | if ($tr_config['ipn_dbg_lvl'] == 2) { |
||
| 490 | echo 'selected '; |
||
| 491 | } |
||
| 492 | echo "value=\"2\">" . _AD_DON_LOG_EVERYTHING . "</option>\n"; |
||
| 493 | echo " </select>\n" . " </td>\n" . " </tr>\n"; |
||
| 494 | |||
| 495 | ShowTextBox('ipn_log_entries', '<nobr><span style=\'font-weight: bold;\'>' . _AD_DON_LOG_ENTRY . '</span></nobr>', '', '4', ''); |
||
| 496 | |||
| 497 | $desc = 'This box shows the link to the IPN recorder. |
||
| 498 | This link must be pasted EXACTLY as it is |
||
| 499 | into your PayPal IPN profile. You can click |
||
| 500 | on the "test" link to the right to verify |
||
| 501 | that the IPN recorder is functioning correctly.'; |
||
| 502 | $desc = htmlentities($desc); |
||
| 503 | echo "<tr>\n" . " <td title =\"$desc\" style=\"text-align: right; font-weight: bold;\">" . _AD_DON_IPN_LINK . "</td>\n" . " <td title =\"$desc\" style=\"text-align: center;\"> " . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/ipnppd.php \n" . " <br /><a href=\"" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/ipnppd.php?dbg=1\" target=\"_blank\"><span style=\"font-weight: bold; font-style: italic;\"><img src=\"../assets/images/admin/info.png\" style=\"height: 16px; width: 16px;\" alt=\"\"> " . _AD_DON_TEST_IPN . "</span></a>\n" . " </td>\n" . "</tr>\n"; |
||
| 504 | echo "</table><br />\n"; |
||
| 505 | echo "</td></tr>\n"; |
||
| 506 | echo "<tr><td style=\"text-align: center; width: 100%;\"><input type=\"submit\" value=\"" . _AD_DON_SUBMIT . "\" />\n"; |
||
| 507 | echo '</td></tr></table><br /><br />'; |
||
| 508 | |||
| 509 | //Goal Preferences |
||
| 510 | //=============================== |
||
| 511 | echo $indexAdmin->addNavigation('donations.php?op=Config'); |
||
| 512 | echo "<table style=\"border-width: 1px; width: 90%; text-align: center;\">\n" . " <tr>\n"; |
||
| 513 | echo " <td style=\"text-align: center; font-weight: bold;\" class=\"title\">\n" . ' <h3>' . _AD_DON_GOAL_PREFERENCES . "</h3>\n"; |
||
| 514 | echo " <table style=\"border-width: 1px; text-align: center;\">\n" . " <tr><td style=\"text-align: center;\">\n"; |
||
| 515 | echo " <table style=\"border-width: 1px; text-align: center;\">\n"; |
||
| 516 | ShowDropBox('use_goal', '<span style=\'font-weight: bold;\'>' . _AD_DON_GOAL_TYPE . '.</span>'); |
||
| 517 | echo " </table>\n"; |
||
| 518 | |||
| 519 | $query_Recordset1 = 'SELECT * FROM ' . $xoopsDB->prefix('donations_config') . " WHERE name = 'week_goal' AND subtype<>'Default'"; |
||
| 520 | $Recordset1 = $xoopsDB->query($query_Recordset1); |
||
| 521 | $row_Recordset1 = $xoopsDB->fetchArray($Recordset1); |
||
| 522 | $totalRows_Recordset1 = $xoopsDB->getRowsNum($Recordset1); |
||
| 523 | $desc = htmlentities($row_Recordset1['text']); |
||
| 524 | |||
| 525 | echo " <table style=\"border-width: 1px; width: 100px; text-align: center;\">\n" . " <tr><td style=\"text-align: center; width: 100%; font-weight: bold;\" colspan=\"5\">" . _AD_DON_GOAL_HEBDO . "<br /></td></tr>\n"; |
||
| 526 | $row1 = " <tr>\n" . " <td style=\"text-align: center; font-weight: bold;\">" . _AD_DON_WEEK . "</td>\n"; |
||
| 527 | $row2 = " <tr>\n" . " <td style=\"text-align: center; font-weight: bold;\">" . _AD_DON_GOAL . "</td>\n"; |
||
| 528 | //------------------------------------------------------------- |
||
| 529 | $shortMonth = explode('|', _AD_DON_SHORT_MONTH); |
||
| 530 | $ordinaux = explode('|', _AD_DON_NUMBER_ORDINAUX); |
||
| 531 | //------------------------------------------------------------- |
||
| 532 | $h = 0; |
||
| 533 | View Code Duplication | do { |
|
| 534 | $ord = $ordinaux[$h++]; |
||
| 535 | $row1 .= " <td title=\"{$desc}\" style=\"text-align: center;\">{$ord}</td>\n"; |
||
| 536 | $row2 .= " <td title=\"{$desc}\" style=\"text-align: center;\"><input size=\"4\" name=\"var_week_goal-$row_Recordset1[subtype]\" type=\"text\" value=\"$row_Recordset1[value]\" onChange=\"return validInt(this,'$row_Recordset1[subtype] " . _AD_DON_GOAL_DONATION . "',1,'" . _AD_DON_ALERTE_INPUT_NUMBER . "');\" /></td>\n"; |
||
| 537 | } while (false != ($row_Recordset1 = $xoopsDB->fetchArray($Recordset1))); |
||
| 538 | $row1 .= " </tr>\n"; |
||
| 539 | $row2 .= " </tr>\n"; |
||
| 540 | echo "{$row1} {$row2}"; |
||
| 541 | |||
| 542 | echo "</table>\n"; |
||
| 543 | |||
| 544 | $query_Recordset1 = 'SELECT * FROM ' . $xoopsDB->prefix('donations_config') . " WHERE name = 'month_goal' AND subtype<>'Default'"; |
||
| 545 | $Recordset1 = $xoopsDB->query($query_Recordset1); |
||
| 546 | $row_Recordset1 = $xoopsDB->fetchArray($Recordset1); |
||
| 547 | $totalRows_Recordset1 = $xoopsDB->getRowsNum($Recordset1); |
||
| 548 | $desc = htmlentities($row_Recordset1['text']); |
||
| 549 | |||
| 550 | $h = 0; |
||
| 551 | echo "<table style=\"border-width: 1px; width: 100px; text-align: center;\">\n"; |
||
| 552 | echo " <tr><td style=\"text-align: center; width: 100%; font-weight: bold;\" colspan=\"13\">" . _AD_DON_GOAL_MENSUEL . "</td></tr><br />\n"; |
||
| 553 | $row1 = " <tr>\n" . " <td style=\"text-align: center; font-weight: bold;\">" . _AD_DON_MONTH . "</td>\n"; |
||
| 554 | $row2 = " <tr>\n" . " <td style=\"text-align: center; font-weight: bold;\">" . _AD_DON_GOAL . "</td>\n"; |
||
| 555 | View Code Duplication | do { |
|
| 556 | $month = $shortMonth[$h++]; |
||
| 557 | $row1 .= " <td title=\"{$desc}\" style=\"text-align: center;\">{$month}</td>\n"; |
||
| 558 | $row2 .= " <td title=\"{$desc}\" style=\"text-align: center;\"><input size=\"4\" name=\"var_month_goal-$row_Recordset1[subtype]\" type=\"text\" value=\"$row_Recordset1[value]\" onChange=\"return validInt(this,'$row_Recordset1[subtype] " . _AD_DON_GOAL_DONATION . "',1,'" . _AD_DON_ALERTE_INPUT_NUMBER . "');\" /></td>\n"; |
||
| 559 | } while (false != ($row_Recordset1 = $xoopsDB->fetchArray($Recordset1))); |
||
| 560 | $row1 .= " </tr>\n"; |
||
| 561 | $row2 .= " </tr>\n"; |
||
| 562 | echo "{$row1}{$row2}"; |
||
| 563 | |||
| 564 | echo "</table>\n"; |
||
| 565 | echo "<table style=\"border-width: 1px; width: 100px; text-align: center;\">\n"; |
||
| 566 | ShowTextBox('swing_day', '<span style=\'font-weight: bold;\'>' . _AD_DON_SWING_DAY . '</span>', '175', '4', "onChange='return validInt(this,\"" . _AD_DON_SWING_DAY . "\",1,\"" . _AD_DON_ALERTE_INPUT_NUMBER . "\");'"); |
||
| 567 | echo "</table>\n"; |
||
| 568 | |||
| 569 | $query_Recordset1 = 'SELECT * FROM ' . $xoopsDB->prefix('donations_config') . " WHERE name = 'quarter_goal' AND subtype<>'Default'"; |
||
| 570 | $Recordset1 = $xoopsDB->query($query_Recordset1); |
||
| 571 | $row_Recordset1 = $xoopsDB->fetchArray($Recordset1); |
||
| 572 | $totalRows_Recordset1 = $xoopsDB->getRowsNum($Recordset1); |
||
| 573 | $desc = htmlentities($row_Recordset1['text']); |
||
| 574 | |||
| 575 | echo "<table style=\"border-width: 1px; width: 100px; text-align: center;\">\n"; |
||
| 576 | echo " <tr><td style=\"text-align: center; width: 100%; font-weight: bold;\" colspan=\"5\">" . _AD_DON_QUARTER . "<br /></td></tr>\n"; |
||
| 577 | $row1 = " <tr><td style=\"text-align: center; font-weight: bold;\">" . _AD_DON_QUARTER . "</td>\n"; |
||
| 578 | $row2 = " <tr><td style=\"text-align: center; font-weight: bold;\">" . _AD_DON_GOAL . "</td>\n"; |
||
| 579 | $h = 0; |
||
| 580 | View Code Duplication | do { |
|
| 581 | $ord = $ordinaux[$h++]; |
||
| 582 | $row1 .= " <td title='{$desc}' style='text-align: center;'>{$ord}</td>\n"; |
||
| 583 | $row2 .= " <td title='{$desc}' style='text-align: center;'><input size=\"4\" name=\"var_quarter_goal-$row_Recordset1[subtype]\" type=\"text\" value=\"$row_Recordset1[value]\" onChange=\"return validInt(this,'$row_Recordset1[subtype] " . _AD_DON_GOAL_DONATION . "',1,'" . _AD_DON_ALERTE_INPUT_NUMBER . "');\" /></td>\n"; |
||
| 584 | } while (false != ($row_Recordset1 = $xoopsDB->fetchArray($Recordset1))); |
||
| 585 | $row1 .= " </tr>\n"; |
||
| 586 | $row2 .= " </tr>\n"; |
||
| 587 | echo "{$row1} {$row2}"; |
||
| 588 | |||
| 589 | echo "</table><br />\n"; |
||
| 590 | echo "</td></tr>\n"; |
||
| 591 | echo "<tr><td style=\"text-align: center; width: 100%;\"><input type=\"submit\" value=\"" . _AD_DON_SUBMIT . "\"></td></tr>\n"; |
||
| 592 | echo "</table><br/>\n"; |
||
| 593 | echo "</td></tr></table>\n"; |
||
| 594 | echo "</form>\n"; |
||
| 595 | } |
||
| 596 | |||
| 816 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.