function decline_lend_requests($option, $bids) { global $database, $booklibrary_configuration; $datas = array(); if (is_array($bids[0])) { $bids = $bids[0]; } foreach ($bids as $bid) { $lend_request = new mosBookLibrary_lend_request($database); if (!version_compare(JVERSION, '3.5', 'lt')) { $a = $bid[0]; $bid = $a; } $lend_request->load($bid); $tmp = $lend_request->decline(); if ($tmp != null) { echo "<script> alert('" . addslashes($tmp) . "'); window.history.go(-1); </script>\n"; exit; } $datas[] = array('email' => $lend_request->user_email, 'name' => $lend_request->user_name, 'id' => $lend_request->fk_bookid); } if ($booklibrary_configuration['lend_answer']) { sendMailLendRequest($datas, _BOOKLIBRARY_LENDREQUEST_EMAIL_ACCEPTED); } mosRedirect("index.php?option={$option}&task=lend_requests"); }
function decline_rent_requests_cb($option, $vids) { PHP_booklibrary::addTitleAndMetaTags(); global $database, $booklibrary_configuration, $Itemid; $datas = array(); foreach ($vids as $vid) { $rent_request = new mosBookLibrary_lend_request($database); $rent_request->load($vid); $tmp = $rent_request->decline(); if ($tmp != null) { echo "<script> alert('" . $tmp . "'); window.history.go(-1); </script>\n"; exit; } foreach ($datas as $c => $data) { if ($rent_request->user_email == $data['email']) { $datas[$c]['ids'][] = $rent_request->fk_bookid; continue 2; } } $datas[] = array('email' => $rent_request->user_email, 'name' => $rent_request->user_name, 'id' => $rent_request->fk_bookid); } if ($booklibrary_configuration['lend_answer']) { PHP_booklibrary::sendMailRentRequestCB($datas, _BOOKLIBRARY_LENDREQUEST_EMAIL_DECLINED); } if ($option == 'com_booklibrary') { mosRedirect("index.php?option={$option}&task=show_my_books&&layout=mybooks&Itemid=" . $Itemid); } else { mosRedirect("index.php?option={$option}&task=view_user_books&tab=getmybooksTab&is_show_data=1&Itemid=" . $Itemid); } }