Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sucs-site
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
George Henry Woolley
sucs-site
Commits
7333c1d6
Commit
7333c1d6
authored
15 years ago
by
Thomas Lake
Browse files
Options
Downloads
Patches
Plain Diff
Change libraryadmin to use isbndb
parent
2d9390ba
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/libraryadmin.php
+9
-12
9 additions, 12 deletions
components/libraryadmin.php
with
9 additions
and
12 deletions
components/libraryadmin.php
+
9
−
12
View file @
7333c1d6
...
...
@@ -2,20 +2,16 @@
// you gotta be this high to enter
$permission
=
"librarian"
;
//include ISBN validation library
require_once
(
'../lib/Validate/ISPN.php'
);
$error
=
array
();
function
fetch_
amazon
_data
(
$isbn
)
{
function
fetch_
isbndb
_data
(
$isbn
)
{
$url1
=
"http://webservices.amazon.co.uk/onca/xml?Service=AWSECommerceService"
;
$url1
.
=
"&AWSAccessKeyId=02NDPFGZ9A35HRBQ9NG2"
;
$url1
.
=
"&Operation=ItemLookup&IdType=ISBN&SearchIndex=Books&ItemId="
;
$url2
=
"&ResponseGroup=Medium,Offers"
;
$url1
=
"http://isbndb.com/api/books.xml?access_key=I6AH5WJI&index1=isbn&value1="
;
return
file_get_contents
(
$url1
.
$isbn
.
$url2
);
return
file_get_contents
(
$url1
.
$isbn
);
}
function
valid_isbn
(
$isbn
)
{
...
...
@@ -31,13 +27,14 @@ if ($session->groups[$permission]) {
$isbn
=
str_replace
(
array
(
'ISBN'
,
'-'
,
' '
,
"
\t
"
,
"
\n
"
),
''
,
$isbn
);
if
(
valid_isbn
(
$isbn
))
{
$xmlresult
=
fetch_
amazon
_data
(
$isbn
);
$xmlresult
=
fetch_
isbndb
_data
(
$isbn
);
$simple_xml
=
simplexml_load_string
(
$xmlresult
);
$book
[
'isbn'
]
=
$isbn
;
$book
[
'title'
]
=
$simple_xml
->
Items
->
Item
->
ItemAttributes
->
Title
;
$book
[
'author'
]
=
$simple_xml
->
Items
->
Item
->
ItemAttributes
->
Author
;
$book
[
'publisher'
]
=
$simple_xml
->
Items
->
Item
->
ItemAttributes
->
Publisher
;
$book
[
'image_url'
]
=
$simple_xml
->
Items
->
Item
->
MediumImage
->
URL
;
$book
[
'title'
]
=
$simple_xml
->
BookList
->
BookData
->
Title
;
$book
[
'author'
]
=
$simple_xml
->
BookList
->
BookData
->
AuthorsText
;
if
(
substr
(
trim
(
$book
[
'author'
]),
-
1
)
==
','
)
{
$book
[
'author'
]
=
substr
(
trim
(
$book
[
'author'
]),
0
,
-
1
);}
$book
[
'publisher'
]
=
$simple_xml
->
BookList
->
BookData
->
PublisherText
;
$book
[
'image_url'
]
=
""
;
$smarty
->
assign
(
"book"
,
$book
);
}
else
{
// invalid isbn entered
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment