/** * Asks the author (through e-mail) for additional information about the given course request. * @param int/string $id The database primary id of the given request. * @return bool Returns TRUE on success or FALSE on failure. */ public static function ask_for_additional_info($id) { $id = (int) $id; // Retrieve request's data $course_request_info = self::get_course_request_info($id); if (!is_array($course_request_info)) { return false; } $user_id = intval($course_request_info['user_id']); if ($user_id <= 0) { return false; } $user_info = api_get_user_info($user_id); if (!is_array($user_info)) { return false; } $code = $course_request_info['code']; $info = intval($course_request_info['info']); // Error is to be returned on a repeated attempt for asking additional information. if (!empty($info)) { return false; } // E-mail notification. // E-mail language: The platform language seems to be the best choice. //$email_language = $course_language; //$email_language = api_get_interface_language(); $email_language = api_get_setting('platformLanguage'); $email_subject = sprintf(get_lang('CourseRequestAskInfoEmailSubject', null, $email_language), '[' . api_get_setting('platform.site_name') . ']', $code); $email_body = get_lang('Dear', null, $email_language) . ' '; $email_body .= api_get_person_name($user_info['firstname'], $user_info['lastname'], null, null, $email_language) . ",\n\n"; $email_body .= sprintf(get_lang('CourseRequestAskInfoEmailText', null, $email_language), $code) . "\n"; $email_body .= "\n" . get_lang('Formula', null, $email_language) . "\n"; $email_body .= api_get_person_name(api_get_setting('platform.administrator_name'), api_get_setting('platform.administrator_surname'), null, null, $email_language) . "\n"; $email_body .= get_lang('Manager', null, $email_language) . ' ' . api_get_setting('platform.site_name') . "\n"; $email_body .= get_lang('Phone', null, $email_language) . ': ' . api_get_setting('administratorTelephone') . "\n"; $email_body .= get_lang('Email', null, $email_language) . ': ' . api_get_setting('emailAdministrator', null, $email_language) . "\n"; $email_body .= "\n" . get_lang('CourseRequestLegalNote', null, $email_language) . "\n"; $sender_name = api_get_person_name(api_get_setting('platform.administrator_name'), api_get_setting('platform.administrator_surname'), null, PERSON_NAME_EMAIL_ADDRESS); $sender_email = api_get_setting('platform.administrator_email'); $recipient_name = api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS); $recipient_email = $user_info['mail']; $extra_headers = 'Bcc: ' . $sender_email; $result = @api_mail($recipient_name, $recipient_email, $email_subject, $email_body, $sender_name, $sender_email); if (!$result) { return false; } // Marking the fact that additional information about the request has been asked. $sql = "UPDATE " . Database::get_main_table(TABLE_MAIN_COURSE_REQUEST) . " SET info = 1 WHERE id = " . $id; $result = Database::query($sql) !== false; return $result; }
$portal_url = api_get_path(WEB_PUBLIC_PATH); if ($_configuration['multiple_access_urls']) { $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $url = api_get_access_url($access_url_id); $portal_url = $url['url']; } } if ($courseRegSucceed) { $emailbody = get_lang('Dear') . " " . stripslashes(api_get_person_name($firstname_form, $lastname_form)) . ",\n" . get_lang('OneResp') . " {$currentCourseName} " . get_lang('RegYou') . " " . api_get_setting('platform.site_name') . " " . get_lang('WithTheFollowingSettings') . "\n\n" . get_lang('Username') . " : {$username_form}\n" . get_lang('Pass') . ": {$password_form}\n" . get_lang('Address') . " " . api_get_setting('platform.site_name') . " " . get_lang('Is') . ": " . $portal_url . "\n" . get_lang('Problem') . "\n" . get_lang('Formula') . ",\n" . api_get_person_name(api_get_setting('platform.administrator_name'), api_get_setting('platform.administrator_surname')) . "\n" . get_lang('Manager') . " " . api_get_setting('platform.site_name') . " \nT. " . api_get_setting('administratorTelephone') . "\n" . get_lang('Email') . ": " . api_get_setting('platform.administrator_email') . "\n"; $message = get_lang('TheU') . " " . stripslashes(api_get_person_name($firstname_form, $lastname_form)) . " " . get_lang('AddedToCourse') . "<a href=\"user.php\">" . get_lang('BackUser') . "</a>\n"; } else { $emailbody = get_lang('Dear') . " " . api_get_person_name($firstname_form, $lastname_form) . ",\n " . get_lang('YouAreReg') . " " . api_get_setting('platform.site_name') . " " . get_lang('WithTheFollowingSettings') . "\n\n" . get_lang('Username') . " : {$username_form}\n" . get_lang('Pass') . ": {$password_form}\n" . get_lang('Address') . " " . api_get_setting('platform.site_name') . " " . get_lang('Is') . ": " . $portal_url . "\n" . get_lang('Problem') . "\n" . get_lang('Formula') . ",\n" . api_get_person_name(api_get_setting('platform.administrator_name'), api_get_setting('platform.administrator_surname')) . "\n" . get_lang('Manager') . " " . api_get_setting('platform.site_name') . " \nT. " . api_get_setting('administratorTelephone') . "\n" . get_lang('Email') . ": " . api_get_setting('platform.administrator_email') . "\n"; $message = stripslashes(api_get_person_name($firstname_form, $lastname_form)) . " " . get_lang('AddedU'); } @api_mail($recipient_name, $email_form, $emailsubject, $emailbody, $sender_name, $email_admin); /* * remove <form> variables to prevent any pre-filled fields */ unset($lastname_form, $firstname_form, $username_form, $password_form, $email_form, $admin_form, $tutor_form); } // end if ($platformRegSucceed) //else //{ // $message = get_lang('UserAlreadyRegistered'); //} } // end if register request $interbreadcrumb[] = array("url" => "user.php", "name" => get_lang('ToolUser')); $nameTools = get_lang('AddAU'); Display::display_header($nameTools, "User");
/** * Sends email according to an event * * @param string $event_name the name of the event that was triggered * @param array $event_data what to put in the mail * * Possible key : * - $event_data["about_user"] (= $user_id) * - $event_data["prior_lang"] * * Warning : * - $event_data["send_to"] MUST BE an array */ public static function send_mail($event_name, $event_data) { /** * Global explanation : * 1. we get information about the user that fired the event (in $event_data["about_user"]) * 2. we send mail to people that are in the $event_data["send_to"] * 2b. if a language was specified, we use that one to send the mail, else we get the user's language, if there isn't any, we get the english one * 3. we do the same with the people associated to the event through the admin panel */ global $event_config; // common variable for every mail sent $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); $email_admin = api_get_setting('emailAdministrator'); // basic keys $event_data["sitename"] = api_get_setting('siteName'); $event_data["administrator_name"] = api_get_setting('administratorName'); $event_data["administrator_surname"] = api_get_setting('administratorSurname'); $event_data["administrator_phone"] = api_get_setting('administratorTelephone'); $event_data["administrator_email"] = api_get_setting('emailAdministrator'); $event_data["portal"] = api_get_path(WEB_PATH); // Fill the array's cells with info regarding the user that fired the event // (for the keys in the template) if (isset($event_data["about_user"])) { $about_user = api_get_user_info($event_data["about_user"]); $event_data["firstname"] = $about_user["firstname"]; $event_data["lastname"] = $about_user["lastname"]; $event_data["username"] = $about_user["username"]; $event_data["usermail"] = $about_user["mail"]; $event_data["language"] = $about_user["language"]; $event_data["user_id"] = $about_user["user_id"]; } // First, we send the mail to people we put in the $event_data["send_to"] if ($event_data["send_to"] != null) { // the users we precised need to receive the mail foreach ($event_data["send_to"] as $id) { // for every member put in the array // get user's info (to know where to send) $user_info = api_get_user_info($id); // get the language the email will be in if ($event_data["prior_lang"] != null) { // if $lang is not null, we use that lang $language = $event_data["prior_lang"]; } else { // else we use the user's language $sql = 'SELECT language FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' u WHERE u.user_id = "' . $id . '" '; $language = Database::store_result(Database::query($sql), 'ASSOC'); $language = $language[0]["language"]; } // we get the message in the correct language (or in english if doesn't exist) $result = self::getMessage($event_name, $language); $message = ""; $subject = ""; self::getCorrectMessage($message, $subject, $language, $result); // replace the keycodes used in the message self::formatMessage($message, $subject, $event_config, $event_name, $event_data); // sending email $recipient_name = api_get_person_name($user_info['firstname'], $user_info['lastname']); // checks if there's a file we need to join to the mail if (isset($values["certificate_pdf_file"])) { $message = str_replace("\n", "<br />", $message); @api_mail_html($recipient_name, $user_info["mail"], $subject, $message, $sender_name, $email_admin, null, array($values['certificate_pdf_file'])); } else { @api_mail_html($recipient_name, $user_info["mail"], $subject, $message, $sender_name, $email_admin); } // If the mail only need to be send once (we know that thanks to the events.conf), we log it in the table if ($event_config[$event_name]["sending_mail_once"]) { $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' (user_from, user_to, event_type_name) VALUES (' . $event_data["user_id"] . ', ' . $id . ' ,"' . Database::escape_string($event_name) . '"); '; Database::query($sql); } } } // Second, we send to people linked to the event // So, we get everyone $sql = 'SELECT u.user_id, u.language, u.email, u.firstname, u.lastname FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER) . ' ue INNER JOIN ' . Database::get_main_table(TABLE_MAIN_USER) . ' u ON u.user_id = ue.user_id WHERE event_type_name = "' . $event_name . '"'; $result = Database::store_result(Database::query($sql), 'ASSOC'); foreach ($result as $key => $value) { // for each of the linked users // we get the language if ($event_data["prior_lang"] != null) { // if $lang is not null, we use that lang $language = $event_data["prior_lang"]; } else { // else we get the user's lang $sql = 'SELECT language FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' where user_id = ' . $value["user_id"] . ' '; $result = Database::store_result(Database::query($sql), 'ASSOC'); $language = $result[0]["language"]; } // we get the message in the correct language (or in english if doesn't exist) $result = self::getMessage($event_name, $language); $message = ""; $subject = ""; self::getCorrectMessage($message, $subject, $language, $result); // replace the keycodes used in the message self::formatMessage($message, $subject, $event_config, $event_name, $event_data); // we send the mail $recipient_name = api_get_person_name($value['firstname'], $value['lastname']); @api_mail($recipient_name, $value["email"], $subject, $message, $sender_name, $email_admin); // If the mail only need to be send once (we know that thanks to the events.conf, we log it in the table if ($event_config[$event_name]["sending_mail_once"]) { $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' (user_from, user_to, event_type_name) VALUES (' . $event_data["user_id"] . ', ' . $value["user_id"] . ' , "' . Database::escape_string($event_name) . '"); '; Database::query($sql); } } }
/** * Send an email to tutor after the auth-suscription of a student in your course * @author Carlos Vargas <*****@*****.**>, Dokeos Latino * @param int $user_id the id of the user * @param string $course_code the course code * @param string $send_to_tutor_also * @return string we return the message that is displayed when the action is succesfull */ public static function email_to_tutor($user_id, $course_code, $send_to_tutor_also = false) { if ($user_id != strval(intval($user_id))) { return false; } $course_code = Database::escape_string($course_code); $student = Database::fetch_array(Database::query("SELECT * FROM " . Database::get_main_table(TABLE_MAIN_USER) . "\n WHERE user_id='" . $user_id . "'")); $courseInfo = api_get_course_info($course_code); $name_course = $courseInfo['title']; $sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " WHERE c_id = '" . $courseInfo['real_id'] . "'"; // TODO: Ivan: This is a mistake, please, have a look at it. Intention here is diffcult to be guessed. //if ($send_to_tutor_also = true) // Proposed change: if ($send_to_tutor_also) { // $sql .= " AND tutor_id=1"; } else { $sql .= " AND status=1"; } $result = Database::query($sql); while ($row = Database::fetch_array($result)) { $tutor = Database::fetch_array(Database::query("SELECT * FROM " . Database::get_main_table(TABLE_MAIN_USER) . "\n WHERE user_id='" . $row['user_id'] . "'")); $emailto = $tutor['email']; $emailsubject = get_lang('NewUserInTheCourse') . ': ' . $name_course; $emailbody = get_lang('Dear') . ': ' . api_get_person_name($tutor['firstname'], $tutor['lastname']) . "\n"; $emailbody .= get_lang('MessageNewUserInTheCourse') . ': ' . $name_course . "\n"; $emailbody .= get_lang('UserName') . ': ' . $student['username'] . "\n"; if (api_is_western_name_order()) { $emailbody .= get_lang('FirstName') . ': ' . $student['firstname'] . "\n"; $emailbody .= get_lang('LastName') . ': ' . $student['lastname'] . "\n"; } else { $emailbody .= get_lang('LastName') . ': ' . $student['lastname'] . "\n"; $emailbody .= get_lang('FirstName') . ': ' . $student['firstname'] . "\n"; } $emailbody .= get_lang('Email') . ': ' . $student['email'] . "\n\n"; $recipient_name = api_get_person_name($tutor['firstname'], $tutor['lastname'], null, PERSON_NAME_EMAIL_ADDRESS); $sender_name = api_get_person_name(api_get_setting('platform.administrator_name'), api_get_setting('platform.administrator_surname'), null, PERSON_NAME_EMAIL_ADDRESS); $email_admin = api_get_setting('platform.administrator_email'); @api_mail($recipient_name, $emailto, $emailsubject, $emailbody, $sender_name, $email_admin); } }
/** * Sends an email to the students of a course when a homework is created * * @param string course_id * * @author Guillaume Viguier <*****@*****.**> * @author Julio Montoya <*****@*****.**> Adding session support - 2011 */ function send_email_on_homework_creation($course_id) { // Get the students of the course $session_id = api_get_session_id(); if (empty($session_id)) { $students = CourseManager::get_student_list_from_course_code($course_id); } else { $students = CourseManager::get_student_list_from_course_code($course_id, true, $session_id); } $emailsubject = '[' . api_get_setting('platform.site_name') . '] ' . get_lang('HomeworkCreated'); $currentUser = api_get_user_info(api_get_user_id()); if (!empty($students)) { foreach ($students as $student) { $user_info = api_get_user_info($student["user_id"]); if (!empty($user_info["mail"])) { $name_user = api_get_person_name($user_info["firstname"], $user_info["lastname"], null, PERSON_NAME_EMAIL_ADDRESS); $emailbody = get_lang('Dear') . " " . $name_user . ",\n\n"; $emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse') . " " . $course_id . ". " . "\n\n" . get_lang('PleaseCheckHomeworkPage'); $emailbody .= "\n\n" . api_get_person_name($currentUser["firstname"], $currentUser["lastname"]); @api_mail($name_user, $user_info["mail"], $emailsubject, $emailbody, api_get_person_name($currentUser["firstname"], $currentUser["lastname"], null, PERSON_NAME_EMAIL_ADDRESS), $currentUser["mail"]); } } } }
/** * @return array|null|string */ function store_add_dropbox() { $_course = api_get_course_info(); $_user = api_get_user_info(); $dropbox_cnf = getDropboxConf(); // Validating the form data // there are no recipients selected if (!isset($_POST['recipients']) || count($_POST['recipients']) <= 0) { return get_lang('YouMustSelectAtLeastOneDestinee'); } else { // Check if all the recipients are valid $thisIsAMailing = false; $thisIsJustUpload = false; foreach ($_POST['recipients'] as $rec) { if ($rec == 'mailing') { $thisIsAMailing = true; } elseif ($rec == 'upload') { $thisIsJustUpload = true; } elseif (strpos($rec, 'user_') === 0 && !isCourseMember(substr($rec, strlen('user_')))) { return get_lang('InvalideUserDetected'); } elseif (strpos($rec, 'group_') !== 0 && strpos($rec, 'user_') !== 0) { return get_lang('InvalideGroupDetected'); } } } // we are doing a mailing but an additional recipient is selected if ($thisIsAMailing && count($_POST['recipients']) != 1) { return get_lang('MailingSelectNoOther'); } // we are doing a just upload but an additional recipient is selected. // note: why can't this be valid? It is like sending a document to yourself AND to a different person (I do this quite often with my e-mails) if ($thisIsJustUpload && count($_POST['recipients']) != 1) { return get_lang('MailingJustUploadSelectNoOther'); } if (empty($_FILES['file']['name'])) { $error = true; return get_lang('NoFileSpecified'); } // are we overwriting a previous file or sending a new one $dropbox_overwrite = false; if (isset($_POST['cb_overwrite']) && $_POST['cb_overwrite']) { $dropbox_overwrite = true; } // doing the upload $dropbox_filename = $_FILES['file']['name']; $dropbox_filesize = $_FILES['file']['size']; $dropbox_filetype = $_FILES['file']['type']; $dropbox_filetmpname = $_FILES['file']['tmp_name']; // check if the filesize does not exceed the allowed size. if ($dropbox_filesize <= 0 || $dropbox_filesize > $dropbox_cnf['maxFilesize']) { return get_lang('DropboxFileTooBig'); // TODO: The "too big" message does not fit in the case of uploading zero-sized file. } // check if the file is actually uploaded if (!is_uploaded_file($dropbox_filetmpname)) { // check user fraud : no clean error msg. return get_lang('TheFileIsNotUploaded'); } $upload_ok = FileManager::process_uploaded_file($_FILES['file'], true); if (!$upload_ok) { return null; } // Try to add an extension to the file if it hasn't got one $dropbox_filename = FileManager::add_ext_on_mime($dropbox_filename, $dropbox_filetype); // Replace dangerous characters $dropbox_filename = api_replace_dangerous_char($dropbox_filename); // Transform any .php file in .phps fo security $dropbox_filename = FileManager::php2phps($dropbox_filename); //filter extension if (!FileManager::filter_extension($dropbox_filename)) { return get_lang('UplUnableToSaveFileFilteredExtension'); } // set title $dropbox_title = $dropbox_filename; // set author if (!isset($_POST['authors'])) { $_POST['authors'] = getUserNameFromId($_user['user_id']); } // note: I think we could better migrate everything from here on to separate functions: store_new_dropbox, store_new_mailing, store_just_upload if ($dropbox_overwrite) { $dropbox_person = new Dropbox_Person($_user['user_id'], api_is_course_admin(), api_is_course_tutor()); foreach ($dropbox_person->sentWork as $w) { if ($w->title == $dropbox_filename) { if ($w->recipients[0]['id'] > dropbox_cnf('mailingIdBase') xor $thisIsAMailing) { return get_lang('MailingNonMailingError'); } if ($w->recipients[0]['id'] == $_user['user_id'] xor $thisIsJustUpload) { return get_lang('MailingJustUploadSelectNoOther'); } $dropbox_filename = $w->filename; $found = true; // note: do we still need this? break; } } } else { // rename file to login_filename_uniqueId format $dropbox_filename = getLoginFromId($_user['user_id']) . "_" . $dropbox_filename . "_" . uniqid(''); } // creating the array that contains all the users who will receive the file $new_work_recipients = array(); foreach ($_POST['recipients'] as $rec) { if (strpos($rec, 'user_') === 0) { $new_work_recipients[] = substr($rec, strlen('user_')); } elseif (strpos($rec, 'group_') === 0) { $userList = GroupManager::get_subscribed_users(substr($rec, strlen('group_'))); foreach ($userList as $usr) { if (!in_array($usr['user_id'], $new_work_recipients) && $usr['user_id'] != $_user['user_id']) { $new_work_recipients[] = $usr['user_id']; } } } } @move_uploaded_file($dropbox_filetmpname, dropbox_cnf('sysPath') . '/' . $dropbox_filename); $b_send_mail = api_get_course_setting('email_alert_on_new_doc_dropbox'); if ($b_send_mail) { foreach ($new_work_recipients as $recipient_id) { $recipent_temp = UserManager::get_user_info_by_id($recipient_id); @api_mail(api_get_person_name($recipent_temp['firstname'] . ' ' . $recipent_temp['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $recipent_temp['email'], get_lang('NewDropboxFileUploaded'), get_lang('NewDropboxFileUploadedContent') . ' ' . api_get_path(WEB_CODE_PATH) . 'dropbox/index.php?cidReq=' . $_course['sysCode'] . "\n\n" . api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS) . "\n" . get_lang('Email') . " : " . $_user['mail'], api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), $_user['mail']); } } new Dropbox_SentWork($_user['user_id'], $dropbox_title, $_POST['description'], strip_tags($_POST['authors']), $dropbox_filename, $dropbox_filesize, $new_work_recipients); Security::clear_token(); return get_lang('FileUploadSucces'); }
$sql = "UPDATE {$user_table} SET active='" . $status . "' WHERE user_id='" . $user_id . "'"; $result = Database::query($sql); //Send and email if account is active if ($status == 1) { $user_info = api_get_user_info($user_id); $recipient_name = api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS); $emailsubject = '[' . api_get_setting('siteName') . '] ' . get_lang('YourReg') . ' ' . api_get_setting('siteName'); $email_admin = api_get_setting('emailAdministrator'); $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); $emailbody = get_lang('Dear') . " " . stripslashes($recipient_name) . ",\n\n"; $emailbody .= sprintf(get_lang('YourAccountOnXHasJustBeenApprovedByOneOfOurAdministrators'), api_get_setting('siteName')) . "\n"; $emailbody .= sprintf(get_lang('YouCanNowLoginAtXUsingTheLoginAndThePasswordYouHaveProvided'), api_get_path(WEB_PATH)) . ",\n\n"; $emailbody .= get_lang('HaveFun') . "\n\n"; //$emailbody.=get_lang('Problem'). "\n\n". get_lang('SignatureFormula'); $emailbody .= api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname')) . "\n" . get_lang('Manager') . " " . api_get_setting('siteName') . "\nT. " . api_get_setting('administratorTelephone') . "\n" . get_lang('Email') . " : " . api_get_setting('emailAdministrator'); $additionalParameters = array('smsType' => ClockworksmsPlugin::ACCOUNT_APPROVED_CONNECT, 'userId' => $user_id); $result = api_mail($recipient_name, $user_info['mail'], $emailsubject, $emailbody, $sender_name, $email_admin, '', $additionalParameters); event_system(LOG_USER_ENABLE, LOG_USER_ID, $user_id); } else { event_system(LOG_USER_DISABLE, LOG_USER_ID, $user_id); } echo $status; } } else { echo '-1'; } break; default: echo ''; } exit;
$email = $_SESSION['bc_user']['mail']; } else { $name = $_SESSION['bc_user']['firstname'] . ' ' . $_SESSION['bc_user']['lastname']; $email = $_SESSION['bc_user']['email']; } $message = $plugin->get_lang('bc_message'); $message = str_replace("{{name}}", $name, $message); $_SESSION['bc_codetext'] === 'THIS_IS_A_SESSION' ? $message = str_replace("{{session}}", sessionInfo($_SESSION['bc_code'])['name'], $message) : $message = str_replace("{{course}}", courseInfo($_SESSION['bc_code'])['title'], $message); $message = str_replace("{{".$parameterName."}}", $title, $message); $message = str_replace("{{reference}}", $reference, $message); $message .= $text; api_mail($name, $email, $asunto, $message); // Return to course list header('Location:list.php'); } $currencyType = $_POST['currency_type']; $_SESSION['bc_currency_type'] = $currencyType; $server = $_POST['server']; if ($_POST['payment_type'] == "PayPal") { $sql = "SELECT * FROM $tableBuyCoursePaypal WHERE id='1';"; $res = Database::query($sql); $row = Database::fetch_assoc($res); $pruebas = ($row['sandbox'] == "YES") ? true: false; $paypalUsername = $row['username'];