Skip to content

Commit daa94d7

Browse files
author
Francis Gonzales
committed
rename variables
1 parent 9f4876c commit daa94d7

File tree

15 files changed

+344
-550
lines changed

15 files changed

+344
-550
lines changed

plugin/buy_courses/js/funciones.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ $(document).ready(function () {
2626
});
2727
});
2828

29-
$(".guardar").click(function () {
30-
var vvisible = $(this).parent().parent().prev().prev().children().attr("checked");
31-
var vprice = $(this).parent().parent().prev().children().attr("value");
32-
var courseid = $(this).parent().parent().attr("id");
33-
$.post("function.php", {tab: "save_mod", id: courseid, visible: vvisible, price: vprice},
29+
$(".save").click(function () {
30+
var visible = $(this).parent().parent().prev().prev().children().attr("checked");
31+
var price = $(this).parent().parent().prev().children().attr("value");
32+
var id_course = $(this).attr('id');
33+
$.post("function.php", {tab: "save_mod", id_course: id_course, visible: visible, price: price},
3434
function (data) {
3535
if (data.status == "false") {
36-
alert("Error database");
36+
alert("Database Error");
3737
} else {
38-
$("#course" + data.id).children().attr("style", "display:''");
39-
$("#course" + data.id).children().next().attr("style", "display:none");
40-
$("#course" + data.id).parent().removeClass("fmod")
41-
$("#course" + data.id).parent().children().each(function () {
38+
$("#course" + data.id_course).children().attr("style", "display:''");
39+
$("#course" + data.id_course).children().next().attr("style", "display:none");
40+
$("#course" + data.id_course).parent().removeClass("fmod")
41+
$("#course" + data.id_course).parent().children().each(function () {
4242
$(this).removeClass("btop");
4343
});
4444
}

plugin/buy_courses/resources/plugin.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,8 @@ select#lsessions, select#lcourses, select#lexercises, select#status {
7272

7373
.height5 {
7474
height: 5px;
75+
}
76+
77+
.margin-left-fifty{
78+
margin-left: 50px !important;
7579
}

plugin/buy_courses/src/ajax.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
2-
require_once '../../../main/inc/global.inc.php';
3-
require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
2+
3+
require_once '../config.php';
44
require_once api_get_path(LIBRARY_PATH) . 'mail.lib.inc.php';
5-
require_once '../lib/buy_course_plugin.class.php';
65

76
$language_file = array('course_description');
87

98
// Get the name of the database course.
109
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
1110

12-
$course_info = api_get_course_info($_GET['code']);
11+
$code = Database::escape_string($_GET['code']);
12+
$course_info = api_get_course_info($code);
1313
echo Display::tag('h2', $course_info['name']);
1414
echo '<br />';
1515

plugin/buy_courses/src/expresscheckout.php

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,44 @@
11
<?php
22

3-
require_once("paypalfunctions.php");
4-
// ==================================
5-
// PayPal Express Checkout Module
6-
// ==================================
7-
8-
//'------------------------------------
9-
//' The paymentAmount is the total value of
10-
//' the shopping cart, that was set
11-
//' earlier in a session variable
12-
//' by the shopping cart page
13-
//'------------------------------------
3+
require_once 'paypalfunctions.php';
4+
/**
5+
* PayPal Express Checkout Module
6+
*
7+
* The paymentAmount is the total value of
8+
* the shopping cart, that was set
9+
* earlier in a session variable
10+
* by the shopping cart page
11+
*/
1412
$paymentAmount = $_SESSION["Payment_Amount"];
1513

16-
//'------------------------------------
17-
//' The currencyCodeType and paymentType
18-
//' are set to the selections made on the Integration Assistant
19-
//'------------------------------------
14+
/**
15+
* The currencyCodeType and paymentType
16+
* are set to the selections made on the Integration Assistant
17+
*/
2018
$currencyCodeType = "EUR";
2119
$paymentType = "Sale";
2220

23-
//'------------------------------------
24-
//' The returnURL is the location where buyers return to when a
25-
//' payment has been succesfully authorized.
26-
//'
27-
//' This is set to the value entered on the Integration Assistant
28-
//'------------------------------------
21+
/**
22+
* The returnURL is the location where buyers return to when a
23+
* payment has been succesfully authorized.
24+
* This is set to the value entered on the Integration Assistant
25+
*/
2926
$returnURL = "http://www.nosolored.me/pluging/paypal/confirm.php";
3027

31-
//'------------------------------------
32-
//' The cancelURL is the location buyers are sent to when they hit the
33-
//' cancel button during authorization of payment during the PayPal flow
34-
//'
35-
//' This is set to the value entered on the Integration Assistant
36-
//'------------------------------------
28+
29+
/**
30+
* The cancelURL is the location buyers are sent to when they hit the
31+
* cancel button during authorization of payment during the PayPal flow
32+
*
33+
* This is set to the value entered on the Integration Assistant
34+
*/
3735
$cancelURL = "http://www.nosolored.me/pluging/paypal/error.php";
3836

39-
//'------------------------------------
40-
//' Calls the SetExpressCheckout API call
41-
//'
42-
//' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php,
43-
//' it is included at the top of this file.
44-
//'-------------------------------------------------
37+
/**
38+
* Calls the SetExpressCheckout API call
39+
* The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php,
40+
* it is included at the top of this file.
41+
*/
4542
$resArray = CallShortcutExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL);
4643
$ack = strtoupper($resArray["ACK"]);
4744
if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {

plugin/buy_courses/src/function.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
require_once '../../../main/inc/global.inc.php';
3-
require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
2+
3+
require_once '../config.php';
44
require_once api_get_path(LIBRARY_PATH) . 'mail.lib.inc.php';
5-
require_once 'buy_course_plugin.class.php';
65
require_once api_get_path(LIBRARY_PATH) . 'course.lib.php';
76

87
$tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE);
@@ -144,7 +143,7 @@
144143
$content .= '<div class="btn-toolbar right">';
145144
$content .= '<a class="ajax btn btn-primary" title="" href="' . $server . 'main/inc/ajax/course_home.ajax.php?a=show_course_information&code=' . $course['code'] . '">' . get_lang('Description') . '</a>&nbsp;';
146145
if ($course['enrolled'] != "YES") {
147-
$content .= '<a class="btn btn-success" title="" href="' . $server . 'plugin/buy_courses/process.php?code=' . $course['id'] . '">' . $buy_name . '</a>';
146+
$content .= '<a class="btn btn-success" title="" href="' . $server . 'plugin/buy_courses/src/process.php?code=' . $course['id'] . '">' . $buy_name . '</a>';
148147
}
149148
$content .= '</div>';
150149
$content .= '</div>';
@@ -224,23 +223,23 @@
224223
}
225224

226225
if ($_REQUEST['tab'] == 'save_mod') {
227-
$_REQUEST['id'] = intval($_REQUEST['id']);
228-
$id = substr($_REQUEST['id'], 5);
226+
$_REQUEST['id'] = Database::escape_string($_REQUEST['id']);
227+
$idCourse = intval($_REQUEST['id_course']);
229228
$visible = ($_REQUEST['visible'] == "checked") ? 1 : 0;
230-
$price = mysql_real_escape_string($_REQUEST['price']);
229+
$price = Database::escape_string($_REQUEST['price']);
231230
$obj = $_REQUEST['obj'];
232231

233232
$sql = "UPDATE $tableBuyCourse
234233
SET visible = " . $visible . ",
235234
price = '" . $price . "'
236-
WHERE id_course = '" . $id . "';";
235+
WHERE id_course = '" . $idCourse . "';";
237236

238237
$res = Database::query($sql);
239238
if (!res) {
240239
$content = $plugin->get_lang('ProblemToSaveTheMessage') . Database::error();
241240
echo json_encode(array("status" => "false", "content" => $content));
242241
} else {
243-
echo json_encode(array("status" => "true", "id" => $id));
242+
echo json_encode(array("status" => "true", "id_course" => $idCourse));
244243
}
245244
}
246245

0 commit comments

Comments
 (0)