Beispiel #1
0
function accept_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->accept();
        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");
}
Beispiel #2
0
 function accept_rent_requests_cb($option, $bids)
 {
     PHP_booklibrary::addTitleAndMetaTags();
     global $database, $booklibrary_configuration, $Itemid;
     $datas = array();
     foreach ($bids as $vid) {
         $rent_request = new mosBookLibrary_lend_request($database);
         $rent_request->load($vid);
         //echo $rent_request->load($vid);exit;
         $tmp = $rent_request->accept();
         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_ACCEPTED);
     }
     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);
     }
 }