static function fetchAmazonInfosForBookRest($book, $amazon_version = '2011-08-01') { global $booklibrary_configuration, $my, $acl; //****************************** Added by OrdaSoft ********************************** $param_ws = mosBooklibraryWS::getWsParamById($book->informationFrom); if ($param_ws == "COM") { $endpoint = "http://ecs.amazonaws.com/onca/xml"; } else { if ($param_ws == "UK") { $endpoint = "http://ecs.amazonaws.co.uk/onca/xml"; } else { if ($param_ws == "CA") { $endpoint = "http://ecs.amazonaws.ca/onca/xml"; } else { if ($param_ws == "DE") { $endpoint = "http://ecs.amazonaws.de/onca/xml"; } else { if ($param_ws == "JP") { $endpoint = "http://ecs.amazonaws.jp/onca/xml"; } else { if ($param_ws == "FR") { $endpoint = "http://ecs.amazonaws.fr/onca/xml"; } else { if ($param_ws == "ES") { $endpoint = "http://webservices.amazon.es/onca/xml"; } else { if ($param_ws == "IT") { $endpoint = "http://webservices.amazon.it/onca/xml"; } else { if ($param_ws == "CN") { $endpoint = "http://webservices.amazon.cn/onca/xml"; } else { if ($param_ws == "IN") { $endpoint = "http://webservices.amazon.in/onca/xml"; } else { if ($param_ws == "BR") { $endpoint = "http://webservices.amazon.com.br/onca/xml"; } else { if ($param_ws == "US") { $endpoint = "http://webservices.amazon.com/onca/xml"; } } } } } } } } } } } } if ($booklibrary_configuration['ws']['amazon']['secret_key'] == "") { $secret_key = "ooTVCJy06UNXeMujmlyso9Wj4VD1flgEPsCx5HYY"; } else { $secret_key = $booklibrary_configuration['ws']['amazon']['secret_key']; } $request = "{$endpoint}?" . "Service=AWSECommerceService" . "&Operation=ItemLookup" . "&Condition=All" . "&Version={$amazon_version}" . "&AWSAccessKeyId=" . $booklibrary_configuration['ws']['amazon']['devtag'] . "&AssociateTag=" . $booklibrary_configuration['ws']['amazon']['tag'] . "&SearchIndex=Books" . "&ResponseGroup=Large" . "&IdType=ISBN" . "&ItemId={$book->isbn}"; // Get a nice array of elements to work with $uri_elements = parse_url($request); // Grab our request elements $request = $uri_elements['query']; // Throw them into an array parse_str($request, $parameters); // Add the new required paramters $parameters['Timestamp'] = gmdate("Y-m-d\\TH:i:s\\Z"); $parameters['Version'] = $amazon_version; // The new authentication requirements need the keys to be sorted ksort($parameters); // Create our new request foreach ($parameters as $parameter => $value) { // We need to be sure we properly encode the value of our parameter $parameter = str_replace("%7E", "~", rawurlencode($parameter)); $value = str_replace("%7E", "~", rawurlencode($value)); $request_array[] = $parameter . '=' . $value; } // Put our & symbol at the beginning of each of our request variables and put it in a string $new_request = implode('&', $request_array); // Create our signature string $signature_string = "GET\n{$uri_elements['host']}\n{$uri_elements['path']}\n{$new_request}"; if (function_exists("hash_hmac")) { $signature = urlencode(base64_encode(hash_hmac('sha256', $signature_string, $secret_key, true))); } elseif (function_exists("mhash")) { $signature = urlencode(base64_encode(mhash(MHASH_SHA256, $signature_string, $secret_key))); } // Create our signature using hash_hmac // new request $request = "http://{$uri_elements['host']}{$uri_elements['path']}?{$new_request}&Signature={$signature}"; // Load the call and capture the document returned by the Shopping API // if((int)ini_get('allow_url_fopen')==1) // $result = simplexml_load_file($request); // else // { // $retVal = "Error: variable 'allow_url_fopen' in php.ini set 'Off'. Fetch information require this variable On"; // return $retVal; // } $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $request); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0'); // grab URL and pass it to the browser $result = curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); $result = simplexml_load_string($result); //echo '<pre>';var_dump($result); echo '</pre>';exit; //Errors test -- 1 if (array_key_exists('Errors', $result->OperationRequest)) { $retVal = "faultcode: {$result->OperationRequest->Errors->Error->Code}, faultstring: {$result->OperationRequest->Errors->Error->Message}"; return $retVal; } //Errors test -- 2 if (array_key_exists('Errors', $result->Items->Request)) { $retVal = "faultcode: {$result->Items->Request->Errors->Error->Code}, faultstring: {$result->Items->Request->Errors->Error->Message}"; return $retVal; } //Body -- Output in joomla form //ProductName $book->title = (string) $result->Items->Item->ItemAttributes->Title; //ImageUrlMedium $book->imageURL = (string) $result->Items->Item->MediumImage->URL; //URL $book->URL = (string) $result->Items->Item->DetailPageURL; //Number Of Pages $book->numberOfPages = (int) $result->Items->Item->ItemAttributes->NumberOfPages; //Manufacturer if (array_key_exists('Manufacturer', $result->Items->Item->ItemAttributes)) { $book->manufacturer = (string) $result->Items->Item->ItemAttributes->Manufacturer; } //Author $i = 0; $book->authors = ""; foreach ($result->Items->Item->ItemAttributes->Author as $item) { if ($i > 0) { $book->authors .= ', '; } $book->authors .= $item; $i++; } //Rating // if (array_key_exists('CustomerReviews', $result->Items->Item)) { // $book->rating = (string)($result->Items->Item->CustomerReviews->AverageRating * 2); // } //PublicationDate if (array_key_exists('PublicationDate', $result->Items->Item->ItemAttributes)) { $book->release_Date = (string) $result->Items->Item->ItemAttributes->PublicationDate; } //ReleaseDate if (array_key_exists('ReleaseDate', $result->Items->Item->ItemAttributes)) { $book->release_Date = (string) $result->Items->Item->ItemAttributes->ReleaseDate; } //Edition if (array_key_exists('Edition', $result->Items->Item->ItemAttributes)) { $book->edition = (string) $result->Items->Item->ItemAttributes->Edition; } //Price no partner if (array_key_exists('Offer', $result->Items->Item->Offers) && array_key_exists('FormattedPrice', $result->Items->Item->Offers->Offer->OfferListing->Price)) { $book->price = substr_replace((string) $result->Items->Item->Offers->Offer->OfferListing->Price->Amount, '.', -2, 0); $book->priceunit = (string) $result->Items->Item->Offers->Offer->OfferListing->Price->CurrencyCode; $mas = $book->price; //$mas = ereg_replace("\xC2\xA3", "GBP ", $mas); //for funt //$mas = ereg_replace("\xEF\xBF\xA5", "JPY", $mas); //for ena $book->price = $mas; } else { $book->price = "Does not exist anymore!"; } //echo '<pre>';var_dump($book);echo '</pre>';exit; //************************ begin add for Book Description ********************* if ($booklibrary_configuration['merge_description']['use']) { if (checkAccessBL($booklibrary_configuration['merge_description']['registrationlevel'], 'RECURSE', userGID_BL($my->id), $acl)) { $book->comment = $book->comment . "<br /><p></p> "; } else { $book->comment = ""; } } else { $book->comment = ""; } if ($result->Items->Item->EditorialReviews->EditorialReview) { foreach ($result->Items->Item->EditorialReviews->EditorialReview as $item) { $book->comment .= "<strong>" . $item->Source . "</strong><br />"; $book->comment .= $item->Content . "<br />"; } } //************************ end add for Book Description ************************ return $book; }
} } } else { $query = "SELECT * FROM #__booklibrary_lend_request AS b WHERE b.status=0"; } $db->setQuery($query); $current_user_rent_request_array = $db->loadObjectList(); $check_for_show_rent_request = 0; if (isset($current_user_rent_request_array)) { foreach ($current_user_rent_request_array as $temp) { $check_for_show_rent_request = 1; } } if ($booklibrary_configuration['cb_rent']['show']) { $params->def('show_rent', 1); $i = checkAccessBL($booklibrary_configuration['cb_rent']['registrationlevel'], 'NORECURSE', userGID_BL($my->id), $acl); if ($i) { $params->def('show_rent_registrationlevel', 1); } /* if($params->get('show_rent')) { if($params->get('show_rent_registrationlevel')) { if($check_for_show_rent_request!=0) { echo" <span class='books_button'><a class='my_btn my_btn-primary' href='". JRoute::_('index.php?option=com_booklibrary&task=rent_requests_cb_books&is_show_data=1') . "'>" . _BOOKLIBRARY_LEND_REQUESTS ."</a></span>" ; } } } */
static function showRequestRentBooksCB($option, $rent_requests, &$pageNav, $params) { global $my, $mosConfig_live_site, $mainframe, $Itemid, $booklibrary_configuration; $session = JFactory::getSession(); $acl = JFactory::getACL(); $arr = $session->get("array", "default"); $doc = JFactory::getDocument(); $doc->addScript($mosConfig_live_site . '/components/com_booklibrary/includes/functions.js'); $doc->addStyleSheet($mosConfig_live_site . '/components/com_booklibrary/includes/custom.css'); $doc->addStyleSheet($mosConfig_live_site . '/components/com_booklibrary/includes/booklibrary.css'); $doc->addStyleSheet($mosConfig_live_site . '/components/com_booklibrary/includes/custom.css'); // for 1.6 if ($option == 'com_booklibrary') { $user = JFactory::getuser(); $db = JFactory::getDBO(); $query = "SELECT * FROM #__booklibrary_lend_request AS b WHERE b.status=0"; $db->setQuery($query); $current_user_rent_request_array = $db->loadObjectList(); $check_for_show_rent_request = 0; if (isset($current_user_rent_request_array)) { $check_for_show_rent_request = 1; } if ($booklibrary_configuration['cb_mybook']['show'] == '1' && checkAccessBL($booklibrary_configuration['cb_mybook']['registrationlevel'], 'NORECURSE', userGID_BL($my->id), $acl)) { echo "<span class='books_button'><a class='my_btn my_btn-primary' href='" . JRoute::_('index.php?option=' . $option . '&task=show_my_books&layout=mybooks') . "'>" . _BOOKLIBRARY_LABEL_CBBOOKS_TT . "</a></span>"; } if ($booklibrary_configuration['cb_edit']['show'] == '1' && checkAccessBL($booklibrary_configuration['cb_mybook']['registrationlevel'], 'NORECURSE', userGID_BL($my->id), $acl)) { echo " <span class='books_button'><a class='my_btn my_btn-primary' href='" . JRoute::_('index.php?option=' . $option . '&task=showmybooks&layout=mybooks') . "'>" . _BOOKLIBRARY_LABEL_CBEDIT . "</a></span>"; } if ($booklibrary_configuration['cb_history']['show']) { $params->def('show_history', 1); $i = checkAccessBL($booklibrary_configuration['cb_history']['registrationlevel'], 'NORECURSE', userGID_BL($my->id), $acl); if ($i) { $params->def('show_history_registrationlevel', 1); } if ($params->get('show_history')) { if ($params->get('show_history_registrationlevel')) { if ($check_for_show_rent_request != 0) { echo " <span class='books_button'>\n\t\t\t\t\t\t\t\t\t\t<a class='my_btn my_btn-primary' href='" . JRoute::_('index.php?option=com_booklibrary&task=rent_history_books&name=' . $user->name . '&user='******'&is_show_data=1') . "'>" . _BOOKLIBRARY_MY_LEND_HISTORY . "</a></span>"; } //echo "<div style=\" border:1px solid black; padding: 10px; text-align:center; \">you dont have rent_history_lable</div>"; } } } if ($booklibrary_configuration['cb_rent']['show']) { $params->def('show_rent', 1); $i = checkAccessBL($booklibrary_configuration['cb_rent']['registrationlevel'], 'NORECURSE', userGID_BL($my->id), $acl); if ($i) { $params->def('show_rent_registrationlevel', 1); } if ($params->get('show_rent')) { if ($params->get('show_rent_registrationlevel')) { if ($check_for_show_rent_request != 0) { echo " <span class='books_button'><a class='my_btn my_btn-primary' href='" . JRoute::_('index.php?option=' . $option . '&task=rent_requests_cb_books&is_show_data=1') . "'>" . _BOOKLIBRARY_LEND_REQUESTS . "</a></span>"; } } } } ?> <style type="text/css"> .row0 {background-color:#F9F9F9;} </style><br/><br/><br/> <?php } ?> <script> function vm_buttonClickCB() { document.getElementById('adminFormTaskInput').value = 'decline_rent_requests_cb_book'; document.getElementById('adminForm').submit(); } </script> <script type="text/javascript"> function checkAll(all) { var c = document.getElementsByName('bid[]'); for(var i=0;i<c.length;i++) {if(all.checked!=true) {c[i].checked=false;} else {c[i].checked=true;} } } function buttonClick(button) {if(button.name=='addbook') {submitform('add_book_fe');return;} var c = document.getElementsByName('bid[]'); for(var i=0;i<c.length;i++) {if(c[i].checked) {var checkedbooks = true;break;} } if(!checkedbooks){ alert("<?php echo _BOOKLIBRARY_ERROR_DEL; ?> ");return;} if(button.name=='delete'){ resultat = confirm("<?php echo _BOOKLIBRARY_LABEL_EBOOK_DELETE; ?> "); if (resultat) { submitform('delete');} return;} if(button.name=='unpublish'){ submitform('unpublish');return;} if(button.name=='publish'){ submitform('publish');return;} } function submitform(submit){ var button=document.getElementsByName('submitbutton'); button[0].value=submit;document.forms["adminForm1"].submit(); } </script> <form class="bl_all_categories_show_my_book_lend_requests_form" action="index.php" method="get" name="adminForm" id="adminForm"> <table cellpadding="4" cellspacing="0" border="0" width="100%" class="bl_all_categories_show_my_book_lend_requests my_table my_table-bordered basictable my_table-hover"> <tr> <th align = "center" width="5%"> <input type="checkbox" name="toggle" value="" onClick="checkAll(this<?php //echo count($rent_requests); ?> );" /> </th> <th align = "center" width="5%">#</th> <th align = "center" class="title" width="10%" nowrap="nowrap"> <?php echo _BOOKLIBRARY_ORDER_LEND_FROM; ?> </th> <th align = "center" class="title" width="10%" nowrap="nowrap"> <?php echo _BOOKLIBRARY_ORDER_LEND_UNTIL; ?> </th> <th align = "center" class="title" width="5%" nowrap="nowrap"> <?php echo _BOOKLIBRARY_LABEL_BOOKID; ?> </th> <th align = "center" class="title" width="70%" nowrap="nowrap"> <?php echo _BOOKLIBRARY_LABEL_TITLE; ?> </th> <th align = "center" class="title" width="15%" nowrap="nowrap"> <?php echo _BOOKLIBRARY_LABEL_LEND_USER; ?> </th> <th align = "center" class="title" width="10%" nowrap="nowrap"> <?php echo _BOOKLIBRARY_LABEL_LEND_EMAIL; ?> </th> <th align = "center" class="title" width="20%" nowrap="nowrap"> <?php echo _BOOKLIBRARY_LABEL_LEND_ADRES; ?> </th> </tr> <?php for ($i = 0, $n = count($rent_requests); $i < $n; $i++) { $row = $rent_requests[$i]; ?> <tr class="row<?php echo $i % 2; ?> "> <td width="20" align="center"><?php echo mosHTML::idBox($i, $row->id, 0, 'bid'); ?> </td> <td align = "center"><?php echo $row->id; ?> </td> <td align = "center"><?php echo $row->lend_from; ?> </td> <td align = "center"><?php echo $row->lend_until; ?> </td> <td align = "center"><?php $data = JFactory::getDBO(); $query = "SELECT bookid FROM #__booklibrary where id = " . $row->fk_bookid . " "; $data->setQuery($query); $bookid = $data->loadObjectList(); echo $bookid[0]->bookid; ?> </td> <td align = "center"><?php echo $row->title; ?> </td> <td align = "center"><?php echo $row->user_name; ?> </td> <td align = "center"> <a href='mailto:"<?php echo $row->user_email; ?> '><?php echo $row->user_email; ?> </a> </td> <td align= "center"><?php echo $row->user_mailing; ?> </td> </tr> <?php } ?> <tr class="for_paginator"> <td colspan = "9" align="center" id="pagenavig"> <?php $paginations = $arr; if ($paginations && $pageNav->total > $pageNav->limit) { echo $pageNav->getPagesLinks(); } ?> </td> </tr> </table> <?php if ($option == 'com_booklibrary') { ?> <input type="hidden" name="option" value="com_booklibrary" /> <?php } else { ?> <input type="hidden" name="option" value="com_comprofiler" /> <input type="hidden" name="tab" value="getmybooksTab" /><?php } ?> <input type="hidden" name="is_show_data" value="1" /> <input type="hidden" id="adminFormTaskInput" name="task" value="accept_rent_requests_cb_book" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input class="my_btn my_btn-success" type="submit" name="submitButton" value="accept request"/> <input class="my_btn my_btn-danger" type="button" name="declineButton" value="decline request" onclick="vm_buttonClickCB()"/> </form> <?php }
static function ownersList($option) { global $database, $my, $Itemid, $mainframe, $booklibrary_configuration, $acl, $mosConfig_list_limit, $limit, $limitstart; PHP_booklibrary::addTitleAndMetaTags(); $symbol = mosGetParam($_REQUEST, 'letindex', ''); $symbol_str = ''; if ($symbol) { $symbol_str = " AND (LOWER(u.name) LIKE '{$symbol}%' ) "; } //getting groups of user $s = getWhereUsergroupsString("c"); // $menu = new JTableMenu( $database ); // $menu->load( $Itemid ); // $params = new mosParameters( $menu->params ); if (version_compare(JVERSION, '3.0', 'ge')) { $menu = new JTableMenu($database); $menu->load($Itemid); $params = new JRegistry(); $params->loadString($menu->params); } else { $menu = new mosMenu($database); $menu->load($Itemid); $params = new mosParameters($menu->params); } $database->setQuery("SELECT id FROM #__menu WHERE link='index.php?option=com_booklibrary'"); if ($database->loadResult() != $Itemid) { $params->def('wrongitemid', '1'); } $params->def('header', _BOOKLIBRARY_LABEL_TITLE_OWNERSLIST); if (!$params->get('wrongitemid')) { $pathway = sefRelToAbs('index.php?option=' . $option . '&task=owners_list&Itemid=' . $Itemid); $pathway_name = _BOOKLIBRARY_LABEL_TITLE_OWNERSLIST; $mainframe->appendPathWay($pathway_name, $pathway); } if (checkAccessBL($booklibrary_configuration['ownerslist']['registrationlevel'], 'NORECURSE', userGID_BL($my->id), $acl) && $booklibrary_configuration['ownerslist']['show']) { $params->def('ownerslist_show', 1); } $db = JFactory::getDBO(); $query = "SELECT COUNT(DISTINCT u.email)\n \nFROM #__booklibrary AS bl\n \nLEFT JOIN #__booklibrary_categories AS mc ON mc.bookid=bl.id\n \nLEFT JOIN #__booklibrary_main_categories AS c ON c.id=mc.catid\n \nLEFT JOIN #__users AS u ON bl.owneremail=u.email\n \nWHERE bl.published=1 AND bl.approved=1 AND c.published=1\n AND ({$s}) {$symbol_str};\n "; $database->setQuery($query); $total = $database->loadResult(); $pageNav = new JPagination($total, $limitstart, $limit); // for J 1.6 $query = "SELECT u.name, COUNT(DISTINCT mc.bookid) AS books\n \nFROM #__booklibrary AS bl\n \nLEFT JOIN #__booklibrary_categories AS mc ON mc.bookid=bl.id\n \nLEFT JOIN #__booklibrary_main_categories AS c ON c.id=mc.catid\n \nLEFT JOIN #__users AS u ON bl.owneremail=u.email\n \nWHERE bl.published=1 AND bl.approved=1 AND c.published=1 AND bl.owneremail!=''\n AND ({$s}) {$symbol_str}\n \nGROUP BY u.name\n \nORDER BY u.name\n \nLIMIT {$pageNav->limitstart},{$pageNav->limit};"; $database->setQuery($query); $ownerslist = $database->loadObjectList(); if (!empty($ownerslist[0]->books) && !isset($ownerslist[0]->name)) { $ownerslist[0]->name = 'anonymous'; } $query = "SELECT DISTINCT UPPER(SUBSTRING(u.name, 1,1)) AS symb \n \nFROM #__booklibrary AS bl\n \nLEFT JOIN #__booklibrary_categories AS mc ON mc.bookid=bl.id\n \nLEFT JOIN #__booklibrary_main_categories AS c ON c.id=mc.catid\n \nLEFT JOIN #__users AS u ON bl.owneremail=u.email\n \nWHERE bl.published=1 AND bl.approved=1 AND c.published=1 AND bl.owneremail!=''\n AND ({$s})\n \nORDER BY u.name ;"; $database->setQuery($query); $symb = $database->loadObjectList(); if (count($symb) > 0) { $symb_list_str = '<div style="display:inline; margin-left:auto;margin-right:auto;">'; foreach ($symb as $symbol) { $symb_list_str .= '<span style="padding:5px; ">' . '<a href="index.php?option=' . $option . '&task=owners_list' . '&letindex=' . $symbol->symb . '&Itemid=' . $Itemid . '">' . $symbol->symb . '</a></span>'; } $symb_list_str .= "</div>"; $params->def('symb_list_str', $symb_list_str); } $params->def('ownerlist01', "{loadposition com_booklibrary_owner_list_01}"); $params->def('ownerlist02', "{loadposition com_booklibrary_owner_list_02}"); $params->def('ownerlist03', "{loadposition com_booklibrary_owner_list_03}"); //print_r($ownerslist); HTML_booklibrary::showOwnersList($params, $ownerslist, $pageNav); }
positions_bl($params->get('allcategories07')); ?> <table class="basictable bl_bl_all_categories_some_intresting_table_with_button" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%"> </td> <td width="50%"> <?php mosHTML::BackButton($params, $hide_js); ?> </td> </tr> </table> </form> <!-- Add item Begin --> <?php global $booklibrary_configuration; if ($booklibrary_configuration['addbook_button']['show'] == 1 && $booklibrary_configuration['addbook_button']['allow']['categories'] == -2 && checkAccessBL($GLOBALS['add_book_button'], 'RECURSE', userGID_BL($my->id), $acl)) { ?> <?php } positions_bl($params->get('singlecategory10')); ?> <div style="text-align: center;"><a href="http://ordasoft.com" style="font-size: 10px;">Powered by OrdaSoft!</a></div>