├── CHANGELOG
├── LICENSE
├── LICENSE.txt
├── README.md
├── attachment.php
├── cache
└── index.html
├── data
└── index.html
├── details.php
├── inc
├── HTTP
│ └── WebDAV
│ │ ├── Server.php
│ │ ├── Server
│ │ └── Filesystem.php
│ │ └── Tools
│ │ ├── _parse_lockinfo.php
│ │ ├── _parse_propfind.php
│ │ └── _parse_proppatch.php
├── PEAR.php
├── PEAR
│ ├── Autoloader.php
│ ├── Builder.php
│ ├── Command.php
│ ├── Command
│ │ ├── Auth.php
│ │ ├── Build.php
│ │ ├── Common.php
│ │ ├── Config.php
│ │ ├── Install.php
│ │ ├── Mirror.php
│ │ ├── Package.php
│ │ ├── Registry.php
│ │ └── Remote.php
│ ├── Common.php
│ ├── Config.php
│ ├── Dependency.php
│ ├── Downloader.php
│ ├── ErrorStack.php
│ ├── Exception.php
│ ├── Frontend
│ │ └── CLI.php
│ ├── Installer.php
│ ├── Packager.php
│ ├── Registry.php
│ ├── Remote.php
│ └── RunTest.php
├── System.php
├── css.css
├── header.php
├── include.php
└── libZotero.php
├── index.php
├── settings.php
└── webdav_server.php
/CHANGELOG:
--------------------------------------------------------------------------------
1 | 2013-05-29
2 | - Add support for storing attachments outside the phpZoteroWebDAV directory
3 |
4 | 2012-11-23
5 | - Add support for browsing by Collection
6 |
7 | 2012-11-04
8 | - Replace phpZotero library with proper official libZotero client
9 | - Add support for nginx and PHP as CGI
10 | - Add support for viewing web snapshots over HTTPS
11 |
12 | 2012-02-17 version 2.0m4
13 | - removed reference to unused (and thus missing) PEAR module
14 |
15 | 2011-11-28 version 2.0m3
16 | - attachment view was broken for attchments with linkMode=0 (i.e. most) since 2.0m3 - fixed
17 |
18 | 2011-11-23 version 2.0m2
19 | - added setting for timezone for servers that complain about it
20 | - detail view now observes the linkMode information, e.g. we now differentiate between stored websnapshots and web links
21 |
22 | 2011-11-03 version 2.0m1
23 | - added automatic delayed (5s) redirect to confidently identified web snapshot main page
24 |
25 | 2011-11-02 version 2.0
26 | first release of phpZoteroWebDAV 2.0. Major Changes since version 1.0
27 | - library view using Zotero Server API
28 | - attachment view from WebDAV data directory via server side cache
29 | - web snapshot view from WebDAV data directory via server side cache
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | phpZoteroWebDAV
2 | ===============
3 |
4 | Store your Zotero attachments on your own site, even on shared hosting.
5 |
6 | Features
7 | --------
8 |
9 | - Sync library attachment to any webhosting space that supports PHP (including freely available ones).
10 | This means your attachment data is never stored on computers (clients or servers) that you do not control yourself.
11 | - Access your Zotero library on your own webspace through the zotero.org server API, including sorting, detail view, custom number of items per page etc
12 | - Browse your Zotero collections from any web browser
13 | - View your synced attachments (incl. web snapshots) from any web browser without having to use zotero.org's storage server
14 | - Enjoy complete security with support for HTTPS connections
15 |
16 | Installation and Configuration Instructions
17 | -------------------------------------------
18 | http://blog.holz.ca/2011/11/phpzoterowebdav-installation/
19 | http://blog.holz.ca/2011/10/proudly-presenting/
20 |
21 |
22 | License
23 | -------
24 |
25 | phpZoteroWebDAV was originally written by Christian Holz and is licensed under the AGPLv3 license.
26 | Significant updates have been made by:
27 | * fishburn (Real name unknown - https://github.com/fishburn)
28 | * David Dean
29 |
30 | phpZoteroWebDAV includes the following third party components:
31 | - The WebDAV server PEAR module written by Hartmut Holzgraefe as well as the PEAR base module, both licensed under the PHP license (http://www.php.net/license/3_01.txt)
32 | - The libZotero class for zotero API connection, released under an unknown open source license (https://github.com/fcheslack/libZotero)
33 | - The zotero.org css style sheet, apparently released under the AGPLv3 license (http://www.gnu.org/licenses/agpl.html))
34 |
35 |
--------------------------------------------------------------------------------
/attachment.php:
--------------------------------------------------------------------------------
1 |
\n";
37 | $scriptpath = realpath(substr($_SERVER['SCRIPT_FILENAME'],0,strrpos($_SERVER['SCRIPT_FILENAME'],"/")));
38 | if ($scriptpath == substr( get_real_path( $cache_dir ), 0, strlen($scriptpath) ) ) {
39 | $cacheURL = ( isset( $_SERVER['HTTPS'] ) ? 'https' : 'http' ) . '://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'],0,strrpos($_SERVER['PHP_SELF'],"/")) . substr($abs_output,strlen($scriptpath));
40 | } else {
41 | $cacheURL = $cache_base_URL;
42 | }
43 | if(strlen($cacheURL)>0) {
44 | $html_output .= "However, the websnap shot has been written to the cache directory and can be accessed there.
\n";
45 | $webfilename=findwebfile($abs_output);
46 | if (strlen($webfilename)>0) {
47 | $html_output .= "Click here to access the file that looks most like the main file for the websnapshot (or wait 5 seconds to be redirected there).
\n";
48 | $html_output .= "If that doens't work, check out the entire websnapshot folder and look for the main file yourself.";
49 | $html_output = "\n
\n\n\n\n" . $html_output . "\n";
50 | } else {
51 | $html_output .= "I didn't find a file that looks most like the main file for the websnapshot, ";
52 | $html_output .= "so you might want to check out the entire websnapshot folder and look for the main file yourself.";
53 | $html_output = "\n\n\n\n" . $html_output . "\n";
54 | }
55 | } else {
56 | $html_output .= "However, if you use a cache directory which is located in the same directory as this script ";
57 | $html_output .= "($scriptpath) or you provide the base URL to whichever cache directory in the settings.php, ";
58 | $html_output .= "you would be able to use the workaround provided by this script.";
59 | $html_output = "\n\n\n\n" . $html_output . "\n";
60 | }
61 |
62 | if( empty( $cache_base_URL ) ) {
63 |
64 | $output = file_get_contents($abs_output . '/' . $webfilename);
65 |
66 | // Add a as a hack to include CSS files
67 | if( preg_match('/\)/i', $output, $matches, PREG_OFFSET_CAPTURE ) ) {
68 |
69 | $head_start = $matches[0][1];
70 | $head_end = $matches[2][1];
71 | $output = substr( $output, 0, $head_end + 1 ) . '' . substr( $output, $head_end + 1 );
72 | echo $output;
73 |
74 | }
75 |
76 | } else {
77 |
78 | echo $html_output;
79 |
80 | }
81 |
82 | } else {
83 | header("Content-type: " . $mimeType);
84 | header("Content-Disposition: filename=\"" . pathinfo($result, PATHINFO_BASENAME) . "\"");
85 | readfile($result);
86 | }
87 | } else {
88 | echo("AN ERROR HAS OCCURRED! - " . $result);
89 | }
90 |
91 | //purge old files from the cache again if $cache_age=0 (ie immediate deletion of cache files)
92 | if (($cache_age==0) && (strlen($cacheURL)==0)) { // do not purge immediately if web accessible websnapshot has been un zipped
93 | purge_cache( get_real_path( $cache_dir ), -1);
94 | }
95 | ?>
96 |
--------------------------------------------------------------------------------
/cache/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | nothing to display
4 |
5 |
6 |
--------------------------------------------------------------------------------
/data/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | nothing to display
4 |
5 |
6 |
--------------------------------------------------------------------------------
/details.php:
--------------------------------------------------------------------------------
1 | setCacheTtl( $apc_cache_ttl );
11 |
12 | //purge old files from the cache
13 | purge_cache( get_real_path( $cache_dir ), $cache_age);
14 |
15 | // reading item details from API
16 | $item = $zotero->fetchItem( $itemkey );
17 |
18 | // displaying content of main item
19 | ?>
20 |
21 | Item Details
22 |
23 | apiObject as $field_name => $field ) :
25 |
26 | // Apply any field-specific formatting
27 | switch( $field_name ) {
28 | case 'itemType':
29 | $field_formatted = un_camel( $field );
30 | break;
31 | case 'tags':
32 | $field_formatted = implode( ', ', array_map( create_function( '$val', 'return $val["tag"];' ), $field ) );
33 | break;
34 | case 'creators':
35 | $field_formatted = implode('
', array_map( create_function( '$val', 'return un_camel($val["creatorType"]) . ": " . $val["firstName"] . " " . $val["lastName"];' ), $field ) );
36 | break;
37 | default:
38 | $field_formatted = $field;
39 | }
40 |
41 | ?>
42 |
43 | |
44 | |
45 |
46 |
47 |
48 |
49 | Attachments (numChildren ?>)
50 |
51 | fetchItemChildren($item);
54 |
55 | if( $child_items ) {
56 | ?>
57 |
58 |
59 |
60 | apiObject['title'] ?> |
61 |
62 | apiObject as $field_name => $field ) :
64 |
65 | // Apply any field-specific formatting
66 | switch( $field_name ) {
67 | case 'tags':
68 | $field_formatted = implode( ', ', array_map( create_function( '$val', 'return $val["tag"];' ), $field ) );
69 | break;
70 | default:
71 | $field_formatted = $field;
72 | }
73 |
74 | ?>
75 |
76 | |
77 | |
78 |
79 |
80 |
81 | Link |
82 | apiObject['linkMode'], array( 'linked_file', 'linked_url' ) ) ) { ?>
83 | apiObject['url'] ?> |
84 |
85 | Access the Attachment as stored on the WebDAV server |
86 |
87 |
88 |
89 |
90 |
97 |
98 |