From 4e0c1576475390faa2f1fb4c4dc2902a953f440e Mon Sep 17 00:00:00 2001
From: Cash Costello
';
+ foreach($not_uploaded as $im_name){
+ $error .= ' [' . $im_name . '] ';
+ }
+ $error .= ' ' . elgg_echo("image:notimage");
+ register_error($error);
+ } //end of upload check
+
+ if (count($uploaded_images)>0) {
+ forward($CONFIG->wwwroot . 'mod/tidypics/edit_multi.php?files=' . implode('-', $uploaded_images)); //forward to multi-image edit page
+ } else {
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //upload failed, so forward to previous page
+ }
+
+?>
\ No newline at end of file
diff --git a/contributions.txt b/contributions.txt
new file mode 100644
index 000000000..ff014654c
--- /dev/null
+++ b/contributions.txt
@@ -0,0 +1,170 @@
+Elgg community and users:
+
+ The original author of Tidypics has not been active in the Elgg community lately. Therefore, I took on the task of improving his plug-in and maintaining a log of all changes in this file. If you contribute to this plug-in, please record your changes here and release them under a GPL license.
+
+Best regards,
+
+Gabriel Monge-Franco (gabrielinux)
+http://gabriel.mongefranco.com
+
+
+------------------------------------------------------------------------
+Version 1.08.2 Change List
+Release Date: 02/13/2008
+Contributors:
+ * Gabriel Monge-Franco (http://gabriel.mongefranco.com)
+------------------------------------------------------------------------
+BEGIN VERSION 1.08.2 CHANGES
+------------------------------------------------------------------------
+* Fixed bug introduced in v1.08.1 that broke the picture upload (thanks to Karsten Schulze).
+* Fixed empty variables in several files that were supposed to send the user back to the previous page, but didn't.
+* Cleaned up change log (contributions.txt).
+* Finally fixed the Polish language file!!! Yay!! :)
+
+* TODO: Work around large image (high resolution) limit when creating thumbnails (an Elgg limitation... can probably be fixed by using PHP GD functions directly or ImageMagic if available)
+ - The problem is with get_resized_image_from_existing_file(). Submitted a ticket to the Elgg tracking bug system.
+ - Edit actions/upload.php when done. There is a dirty hack in place for now that needs to be removed once the above bug is fixed.
+* TODO: disable public by default (input/accessRead.php) -- add setting to admin page that lets the site admin decide whether pictures can be public or not.
+* TODO: allow group members to add pictures to group photo albums
+* TODO: implement photo anotations
+* TODO: look into replacing individual image views with lightbox2 or jQuery lightbox album views.
+* TODO: create a new widget to show pictures (in slideshow) in a user's profile.
+* TODO: add settings for group albums so that the group owner can select the number of albums to show.
+* TODO: implement a way to move pictures from one album to another (should be pretty easy).
+* TODO: add an "Add Photos" option to the user widget similar to the one in the group widget.
+* TODO: implement automagic file resizing to meet the admin's maximum resolution and file size.
+
+* OF NOTE: It is currently not possible to allow group members to edit an album created by another group member. This is a bug with group permissions and it will probably not be fixed until [at least] Elgg v1.5 comes out.
+------------------------------------------------------------------------
+END VERSION 1.08.2 CHANGES
+------------------------------------------------------------------------
+
+
+------------------------------------------------------------------------
+Version 1.08.1 Change List
+Release Date: 02/13/2008
+Contributors:
+ * Gabriel Monge-Franco (http://gabriel.mongefranco.com)
+ * LKLaRose (http://community.elgg.org/pg/profile/lauren)
+ * Webgalli (http://community.elgg.org/pg/profile/webgalli)
+ * Karsten Schulze (http://ks.frinx.eu)
+ * Cash (http://community.elgg.org/pg/profile/costelloc)
+------------------------------------------------------------------------
+BEGIN VERSION 1.08.1 CHANGES
+------------------------------------------------------------------------
+* Fixed bug introduced in v1.08 that caused fake files to be created during thumbnail creation (thanks to Karsten Schulze).
+* Reverted to old directory structure that saves pictures to /image/ALBUMGUID/picGUID (v1.08 saved to /image/ALBUMGUID__picGUID, thus keeping everything in one folder).
+* Album directory is now deleted when the album is deleted (along with every picture inside of the album).
+* Reverted thumbnail and small thumbnail to use picture cropping instead of scaling, so that sites that already use Tidypics can keep a consisting look and feel.
+* Completed River integration by moving album and image directories to an "object" sub-directory (thanks to LKLaRose).
+* Added status messages/graphics to give the user some feedback.
+* Fixed bug in profile widget whereby the selected number of albums had no effect (thanks to @Webgalli and @cheltenham).
+* Fixed bug introduced in v1.06 that prevented anonymous users from viewing a user's album (thanks to Karsten Schulze).
+* Fixed more language file bugs (thanks to Karsten Schulze).
+* Administrators can now set a file size limit from the plugin configuration (it has to be in Kilobytes).
+
+* JUST PLAIN WEIRD: Fixed Polish language file (thanks to @Vazco, Ian Medlock and Brett Profitt) and saved as UTF8 without BOM. However, it still doesn't work. Can somebody try saving it on a Polish box for me? :)
+
+* TODO: fix Polish language file -- it seems to break the whole Elgg site! Maybe it needs to use HTML codes in place of international characters?
+* TODO: Work around large image (high resolution) limit when creating thumbnails (an Elgg limitation... can probably be fixed by using PHP GD functions directly or ImageMagic if available)
+ - The problem is with get_resized_image_from_existing_file(). Submitted a ticket to the Elgg tracking bug system.
+ - Edit actions/upload.php when done. There is a dirty hack in place for now that needs to be removed once the above bug is fixed.
+* TODO: disable public by default (input/accessRead.php) -- add setting to admin page that lets the site admin decide whether pictures can be public or not.
+* TODO: allow group members to add pictures to group photo albums
+* TODO: implement photo anotations
+* TODO: look into replacing individual image views with lightbox2 or jQuery lightbox album views.
+* TODO: create a new widget to show pictures (in slideshow) in a user's profile.
+* TODO: add settings for group albums so that the group owner can select the number of albums to show.
+* TODO: implement a way to move pictures from one album to another (should be pretty easy).
+
+* OF NOTE: It is currently not possible to allow group members to edit an album created by another group member. This is a bug with group permissions and it will probably not be fixed until [at least] Elgg v1.5 comes out.
+------------------------------------------------------------------------
+END VERSION 1.08.1 CHANGES
+------------------------------------------------------------------------
+
+
+------------------------------------------------------------------------
+Version 1.08 Change List
+Release Date: 02/08/2008
+Contributors:
+ * Gabriel Monge-Franco (http://gabriel.mongefranco.com)
+------------------------------------------------------------------------
+BEGIN VERSION 1.08 CHANGES
+------------------------------------------------------------------------
+* Merged most (safe) changes made by other contributors in v1.07.
+ - Did not include SWFuploader or JQuery due to the number of bugs reported.
+* Changed ugly "new album" picture into something better looking.
+* Fixed bug whereby image objects were deleted from the database, but they physical files remained on the server.
+ - Since deleting directories was not possible without the use of unsafe file operations, albums no longer create new directories. Instead, all pictures are saved as /image/ALBUMGUID__picturename.
+* Fixed some bugs in the English, Spanish and German language files and added missing error messages.
+* Thumbnails now display the default error image (same as new album) when the requested image cannot be found.
+* Fixed a bug in the multi-edit form that did not allow image titles to be saved.
+* Removed some customizations made to edit.php action in v1.07 since they removed the ability to add titles to images.
+* Fixed bug introduced in v1.07 that prevented images from being set as album covers.
+* Fixed miscellaneous bugs in group albums widget.
+* Removed jQuery for now since it was making the albums too slow. In the future, we should look into replacing individual image views with lightbox2 or jQuery lightbox album views.
+
+
+* TODO: fix Polish language file -- it seems to break the whole Elgg site! Maybe it needs to use HTML codes in place of international characters?
+* TODO: Work around 0.9MB source file size limit when creating thumbnails (an Elgg limitation... can probably be fixed by using PHP GD functions directly)
+ - The problem is with get_resized_image_from_existing_file(). Submitted a ticket to the Elgg tracking bug system.
+ - Edit actions/upload.php when done. There is a dirty hack in place for now that needs to be removed once the above bug is fixed.
+* TODO: disable public by default (input/accessRead.php) -- add setting to admin page that lets the site admin decide whether pictures can be public or not.
+* TODO: allow group members to add pictures to group photo albums
+* TODO: implement photo anotations
+* TODO: look into replacing individual image views with lightbox2 or jQuery lightbox album views.
+
+* OF NOTE: It is currently not possible to allow group members to edit an album created by another group member. This is a bug with group permissions and it will probably not be fixed until [at least] Elgg v1.5 comes out.
+------------------------------------------------------------------------
+END VERSION 1.08 CHANGES
+------------------------------------------------------------------------
+
+
+------------------------------------------------------------------------
+Version 1.07 Change List
+Release Date: 02/03/2008
+Contributors:
+ * vazco (http://community.elgg.org/pg/profile/vazco)
+ * simophin (http://community.elgg.org/pg/profile/simophin)
+------------------------------------------------------------------------
+BEGIN VERSION 1.07 CHANGES
+------------------------------------------------------------------------
+* About 10 missing translations added
+* Translated to polish
+* When no album is present, user can add a new album straight from the widget if he has the required rights
+* Added some missing
+* Changed some to getFilename(), but would it be safe to execute shell commands directly???
+------------------------------------------------------------------------
+END VERSION 1.06 CHANGES
+------------------------------------------------------------------------
+
diff --git a/edit.php b/edit.php
new file mode 100644
index 000000000..2c202e402
--- /dev/null
+++ b/edit.php
@@ -0,0 +1,46 @@
+canEdit())
+ forward();
+
+ $subtype = $file->getSubtype();
+
+ if($subtype == 'album'){
+ if($container = $file->container_guid)
+ set_page_owner($container);
+
+ $area2 .= elgg_view_title($title = elgg_echo('album:edit'));
+ }
+ elseif($subtype == 'image'){
+ if($container = get_entity($file->container_guid)->container_guid)
+ set_page_owner($container);
+
+ $area2 .= elgg_view_title($title = elgg_echo('image:edit'));
+ }
+ else{
+ forward();
+ }
+
+ $area2 .= elgg_view("tidypics/forms/edit",array('entity' => $file, 'subtype' => $subtype));
+ $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+ page_draw(elgg_echo("edit"), $body);
+
+
+?>
\ No newline at end of file
diff --git a/edit_multi.php b/edit_multi.php
new file mode 100644
index 000000000..2fdc85e42
--- /dev/null
+++ b/edit_multi.php
@@ -0,0 +1,33 @@
+canEdit()){
+ array_push($new_file_array, $file_guid);
+ }
+ if(!$album_guid) $album_guid = $entity->container_guid;
+
+ }
+ }
+
+ $area2 .= elgg_view_title($title = elgg_echo('image:edit'));
+ $area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid));
+ $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+ page_draw(elgg_echo("edit"), $body);
+?>
\ No newline at end of file
diff --git a/friends.php b/friends.php
new file mode 100644
index 000000000..61ed52380
--- /dev/null
+++ b/friends.php
@@ -0,0 +1,43 @@
+username);
+ }
+ }
+
+ if (is_null(page_owner_entity()->name) || page_owner_entity()->name == '') {
+ $friendname = get_input('username');
+ } else {
+ $friendname = page_owner_entity()->name;
+ };
+
+ if(isloggedin() && (page_owner() == $_SESSION['guid'])) {
+ $area2 = elgg_view_title($title = elgg_echo('album:yours:friends'));
+ } else {
+ $area2 = elgg_view_title($title = sprintf(elgg_echo('album:friends'), "$friendname"));
+ }
+
+ set_context('search');
+ set_input('search_viewtype', 'gallery');
+ $area2 .= list_user_friends_objects(page_owner(), 'album');
+
+ set_context('photos');
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ // Finally draw the page
+ page_draw(sprintf(elgg_echo("album:friends"),$_SESSION['user']->name), $body);
+?>
\ No newline at end of file
diff --git a/graphics/Thumbs.db b/graphics/Thumbs.db
new file mode 100644
index 000000000..46eac31d3
Binary files /dev/null and b/graphics/Thumbs.db differ
diff --git a/graphics/arrow_next.gif b/graphics/arrow_next.gif
new file mode 100644
index 000000000..6b3d8f829
Binary files /dev/null and b/graphics/arrow_next.gif differ
diff --git a/graphics/arrow_previous.gif b/graphics/arrow_previous.gif
new file mode 100644
index 000000000..e7ded54eb
Binary files /dev/null and b/graphics/arrow_previous.gif differ
diff --git a/graphics/bl.gif b/graphics/bl.gif
new file mode 100644
index 000000000..735fcb582
Binary files /dev/null and b/graphics/bl.gif differ
diff --git a/graphics/br.gif b/graphics/br.gif
new file mode 100644
index 000000000..90cdccdcb
Binary files /dev/null and b/graphics/br.gif differ
diff --git a/graphics/btnClose.gif b/graphics/btnClose.gif
new file mode 100644
index 000000000..b8ab4638d
Binary files /dev/null and b/graphics/btnClose.gif differ
diff --git a/graphics/btnContract.gif b/graphics/btnContract.gif
new file mode 100644
index 000000000..9be301039
Binary files /dev/null and b/graphics/btnContract.gif differ
diff --git a/graphics/btnExpand.gif b/graphics/btnExpand.gif
new file mode 100644
index 000000000..72a8471b3
Binary files /dev/null and b/graphics/btnExpand.gif differ
diff --git a/graphics/btnNext.gif b/graphics/btnNext.gif
new file mode 100644
index 000000000..467f23246
Binary files /dev/null and b/graphics/btnNext.gif differ
diff --git a/graphics/btnPrevious.gif b/graphics/btnPrevious.gif
new file mode 100644
index 000000000..298c1e99c
Binary files /dev/null and b/graphics/btnPrevious.gif differ
diff --git a/graphics/icons/Thumbs.db b/graphics/icons/Thumbs.db
new file mode 100644
index 000000000..fb5d56ed3
Binary files /dev/null and b/graphics/icons/Thumbs.db differ
diff --git a/graphics/icons/album.gif b/graphics/icons/album.gif
new file mode 100644
index 000000000..73ce91356
Binary files /dev/null and b/graphics/icons/album.gif differ
diff --git a/graphics/icons/general.jpg b/graphics/icons/general.jpg
new file mode 100644
index 000000000..23494eff2
Binary files /dev/null and b/graphics/icons/general.jpg differ
diff --git a/graphics/icons/general.png b/graphics/icons/general.png
new file mode 100644
index 000000000..267ae010c
Binary files /dev/null and b/graphics/icons/general.png differ
diff --git a/graphics/icons/river_icon_album.gif b/graphics/icons/river_icon_album.gif
new file mode 100644
index 000000000..e1bbfedaa
Binary files /dev/null and b/graphics/icons/river_icon_album.gif differ
diff --git a/graphics/icons/river_icon_image.gif b/graphics/icons/river_icon_image.gif
new file mode 100644
index 000000000..6f8bfd6af
Binary files /dev/null and b/graphics/icons/river_icon_image.gif differ
diff --git a/graphics/img_error.jpg b/graphics/img_error.jpg
new file mode 100644
index 000000000..e3aad2aed
Binary files /dev/null and b/graphics/img_error.jpg differ
diff --git a/graphics/loader.gif b/graphics/loader.gif
new file mode 100644
index 000000000..7ac990cf0
Binary files /dev/null and b/graphics/loader.gif differ
diff --git a/graphics/tl.gif b/graphics/tl.gif
new file mode 100644
index 000000000..ff93dadcc
Binary files /dev/null and b/graphics/tl.gif differ
diff --git a/graphics/tr.gif b/graphics/tr.gif
new file mode 100644
index 000000000..8dc197272
Binary files /dev/null and b/graphics/tr.gif differ
diff --git a/graphics/ttl.gif b/graphics/ttl.gif
new file mode 100644
index 000000000..8e44c0374
Binary files /dev/null and b/graphics/ttl.gif differ
diff --git a/graphics/ttp.gif b/graphics/ttp.gif
new file mode 100644
index 000000000..36f7211c4
Binary files /dev/null and b/graphics/ttp.gif differ
diff --git a/graphics/ttr.gif b/graphics/ttr.gif
new file mode 100644
index 000000000..66d06941e
Binary files /dev/null and b/graphics/ttr.gif differ
diff --git a/index.php b/index.php
new file mode 100644
index 000000000..00b09d14b
--- /dev/null
+++ b/index.php
@@ -0,0 +1,45 @@
+username) || empty($owner->username)) {
+ //if not logged in, see world pictures instead
+ if (!isloggedin()) forward('pg/photos/world');
+ forward('pg/photos/owned/' . $_SESSION['user']->username);
+ }
+
+ //set the title
+ $area2 = elgg_view_title($title = sprintf(elgg_echo('album:user'), "$owner->name"));
+
+ //allow new album creation
+ if(can_write_to_container($_SESSION['guid'], page_owner())){
+ $area2 .= 'username.'">'.elgg_echo('album:create').'
';
+ }
+
+ // Get objects
+ set_context('search');
+ set_input('search_viewtype', 'gallery');
+ $area2 .= list_entities("object","album",page_owner(),10);
+
+ set_context('photos');
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ // Finally draw the page
+ page_draw(sprintf(elgg_echo("album:user"),page_owner_entity()->name), $body);
+?>
\ No newline at end of file
diff --git a/languages/de.php b/languages/de.php
new file mode 100644
index 000000000..2d668f72f
--- /dev/null
+++ b/languages/de.php
@@ -0,0 +1,114 @@
+ "Bild",
+ 'images' => "Bilder",
+ 'caption' => "Untertitel",
+ 'photos' => "Photos",
+ 'images:upload' => "Bilder hochladen",
+ 'album' => "Fotoalbum",
+ 'albums' => "Fotoalben",
+ 'album:yours' => "Deine Fotoalben",
+ 'album:yours:friends' => "Fotoalben von Freunden",
+ 'album:user' => "Fotoalben von %s",
+ 'album:friends' => "Fotoalben von Freunden von %s",
+ 'album:all' => "Alle Fotoalben",
+ 'album:group' => "Alben der Gruppe",
+ 'item:object:image' => "Photos",
+ 'item:object:album' => "Alben",
+ 'tidypics:settings:maxfilesize' => "Maximale Dateigre in den Kilobytes (KB):",
+
+ //actions
+
+ 'album:create' => "Neues Album",
+ 'album:add' => "Fotoalbum hinzufügen",
+ 'album:addpix' => "Fotos hinzufügen",
+ 'album:edit' => "Album bearbeiten",
+ 'album:delete' => "Album löschen",
+
+ 'image:edit' => "Bild bearbeiten",
+ 'image:delete' => "Bild löschen",
+ 'image:download' => "Download Bild",
+
+ //forms
+
+ 'album:title' => "Titel",
+ 'album:desc' => "Beschreibung",
+ 'album:tags' => "Stichwörter",
+ 'album:cover' => "Albumcover erstellen?",
+ 'album:cover:yes' => "Ja",
+ 'image:access:note' => "(Zugriffsberechtigung wird vom Album übernommen)",
+
+ //views
+
+ 'image:total' => "Bilder im Album:",
+ 'image:by' => "Bild hinzugefügt von",
+ 'album:by' => "Album erstellt von:",
+ 'album:created:on' => "Verursacht",
+ 'image:none' => "Noch keine Bilder hinzugefügt.",
+ 'image:back' => "Zurück",
+ 'image:next' => "Weiter",
+
+ //widgets
+
+ 'album:widget' => "Fotoalben",
+ 'album:more' => "Alle Alben ansehen",
+ 'album:widget:description' => "Zeige Deine neuesten Fotoalben",
+ 'album:display:number' => "Anzahl der Alben, die angezeigt werden sollen",
+ 'album:num_albums' => "Anzahl der anzuzeigenden Alben",
+
+ // river
+
+ //images
+ 'image:river:created' => "%s hat hochgeladen:",
+ 'image:river:item' => "ein Bild",
+ 'image:river:annotate' => "%s kommentierte",
+
+ //albums
+ 'album:river:created' => "%s erstellte",
+ 'album:river:item' => "ein Album",
+ 'album:river:annotate' => "%s kommentierte",
+
+ // Status messages
+
+ 'image:saved' => "Dein Bild wurde gespeichert.",
+ 'images:saved' => "Alle Bilder wurden gespeichert.",
+ 'image:deleted' => "Dein Bild wurde gelöscht.",
+ 'image:delete:confirm' => "Willst Du das Bild wirklich löschen?",
+
+ 'images:edited' => "Dein Bild wurde aktualisiert.",
+ 'album:edited' => "Dein Album wurde aktualisiert.",
+ 'album:saved' => "Dein Album wurde gespeichert.",
+ 'album:deleted' => "Dein Album wurde gelöscht.",
+ 'album:delete:confirm' => "Willst Du das Album wirklich löschen?",
+ 'album:created' => "Ihr neues Album ist hergestellt worden.",
+ 'tidypics:status:processing' => "Warten Sie bitte, whrend wir verarbeiten Ihre Abbildung....",
+
+ //Error messages
+
+ 'image:none' => "Kein Bilder gefunden.",
+ 'image:uploadfailed' => "Dateien konnten nicht hochgeladen werden:",
+ 'image:deletefailed' => "Bild konnte nicht gelöscht werden.",
+ 'image:downloadfailed' => "Dieses Bild ist nicht diesmal vorhanden.",
+
+ 'image:notimage' => 'Wir akzeptieren nur jpeg, gif, und png Dateien der erlaubten Dateigre an.',
+ 'images:notedited' => 'Nicht alle Bilder konnten hochgeladen werden',
+
+ 'album:none' => "Keine Alben gefunden.",
+ 'album:uploadfailed' => "Sorry; Dein Album konnte nicht gespeichert werden.",
+ 'album:deletefailed' => "Dein Album konnte nicht gelöscht werden.",
+ 'album:blank' => "Geben Sie diesem Album einen Titel und eine Beschreibung bitte."
+ );
+
+ add_translation("de",$german);
+?>
diff --git a/languages/en.php b/languages/en.php
new file mode 100644
index 000000000..2316a9e2f
--- /dev/null
+++ b/languages/en.php
@@ -0,0 +1,115 @@
+ "Image",
+ 'images' => "Images",
+ 'caption' => "Caption",
+ 'photos' => "Photos",
+ 'images:upload' => "Upload Images",
+ 'album' => "Photo Album",
+ 'albums' => "Photo Albums",
+ 'album:yours' => "Your photo albums",
+ 'album:yours:friends' => "Your friends' photo albums",
+ 'album:user' => "%s's photo albums",
+ 'album:friends' => "%s's friends' photo albums",
+ 'album:all' => "All site photo albums",
+ 'album:group' => "Group albums",
+ 'item:object:image' => "Photos",
+ 'item:object:album' => "Albums",
+ 'tidypics:settings:maxfilesize' => "Maximum file size in kilo bytes (KB):",
+
+ //actions
+
+ 'album:create' => "New Album",
+ 'album:add' => "Add Photo Album",
+ 'album:addpix' => "Add photos",
+ 'album:edit' => "Edit album",
+ 'album:delete' => "Delete album",
+
+ 'image:edit' => "Edit image",
+ 'image:delete' => "Delete image",
+ 'image:download' => "Download image",
+
+ //forms
+
+ 'album:title' => "Title",
+ 'album:desc' => "Description",
+ 'album:tags' => "Tags",
+ 'album:cover' => "Make image album cover?",
+ 'album:cover:yes' => "Yes",
+ 'image:access:note' => "(view access is inherited from the album)",
+
+ //views
+
+ 'image:total' => "Images in album:",
+ 'image:by' => "Image added by",
+ 'album:by' => "Album created by",
+ 'album:created:on' => "Created",
+ 'image:none' => "No images have been added yet.",
+ 'image:back' => "Back",
+ 'image:next' => "Next",
+
+ //widgets
+
+ 'album:widget' => "Photo Albums",
+ 'album:more' => "View all albums",
+ 'album:widget:description' => "Showcase your latest photo albums",
+ 'album:display:number' => "Number of albums to display",
+ 'album:num_albums' => "Number of albums to display",
+
+ // river
+
+ //images
+ 'image:river:created' => "%s uploaded",
+ 'image:river:item' => "an image",
+ 'image:river:annotate' => "%s commented on",
+
+ //albums
+ 'album:river:created' => "%s created",
+ 'album:river:item' => "an album",
+ 'album:river:annotate' => "%s commented on",
+
+ // Status messages
+
+ 'image:saved' => "Your image was successfully saved.",
+ 'images:saved' => "All images were successfully saved.",
+ 'image:deleted' => "Your image was successfully deleted.",
+ 'image:delete:confirm' => "Are you sure you want to delete this image?",
+
+ 'images:edited' => "Your images were successfully updated.",
+ 'album:edited' => "Your album was successfully updated.",
+ 'album:saved' => "Your album was successfully saved.",
+ 'album:deleted' => "Your album was successfully deleted.",
+ 'album:delete:confirm' => "Are you sure you want to delete this album?",
+ 'album:created' => "Your new album has been created.",
+ 'tidypics:status:processing' => "Please wait while we process your picture....",
+
+ //Error messages
+
+ 'image:none' => "We could not find any images at the moment.",
+ 'image:uploadfailed' => "Files not uploaded:",
+ 'image:deletefailed' => "Your image could not be deleted at this time.",
+ 'image:downloadfailed' => "Sorry; this image is not available at this time.",
+
+ 'image:notimage' => "We only accept jpeg, gif, or png images of the allowed file size.",
+ 'images:notedited' => "Not all images were successfully updated",
+
+ 'album:none' => "We could not find any albums at the moment.",
+ 'album:uploadfailed' => "Sorry; we could not save your album.",
+ 'album:deletefailed' => "Your album could not be deleted at this time.",
+ 'album:blank' => "Please give this album a title and description."
+ );
+
+ add_translation("en",$english);
+?>
\ No newline at end of file
diff --git a/languages/es.php b/languages/es.php
new file mode 100644
index 000000000..babb87068
--- /dev/null
+++ b/languages/es.php
@@ -0,0 +1,115 @@
+ "Imagen",
+ 'images' => "Imágenes",
+ 'caption' => "Leyenda",
+ 'photos' => "Fotos",
+ 'images:upload' => "Subir Imágenes",
+ 'album' => "Állbum de Fotos",
+ 'albums' => "Álbums de Fotos",
+ 'album:yours' => "Tus álbums de fotos",
+ 'album:yours:friends' => "Álbums de tus amigos",
+ 'album:user' => "Állbums de %s",
+ 'album:friends' => "Albums de los amigos de %s",
+ 'album:all' => "Todos los álbums",
+ 'album:group' => "Állbums del grupo",
+ 'item:object:image' => "Fotos",
+ 'item:object:album' => "Állbums",
+ 'tidypics:settings:maxfilesize' => "Tamaño máximo en kilo bytes (KB):",
+
+ //actions
+
+ 'album:create' => "Nuevo álbum",
+ 'album:add' => "Añadir álbum de fotos",
+ 'album:addpix' => "Añadir fotos",
+ 'album:edit' => "Modificar álbum",
+ 'album:delete' => "Eliminar álbum",
+
+ 'image:edit' => "Modificar imagen",
+ 'image:delete' => "Eliminar imagen",
+ 'image:download' => "Descargar imagen",
+
+ //forms
+
+ 'album:title' => "Título",
+ 'album:desc' => "Descripción",
+ 'album:tags' => "Etiquetas",
+ 'album:cover' => "¿Hacer portada del álbum?",
+ 'album:cover:yes' => "Si",
+ 'image:access:note' => "(los permisos de acceso se heredan del álbum)",
+
+ //views
+
+ 'image:total' => "Imágenes en el álbum:",
+ 'image:by' => "Imagen añadida por",
+ 'album:by' => "Album creado por",
+ 'album:created:on' => "Creado",
+ 'image:none' => "Todavía no se han añadido imágenes.",
+ 'image:back' => "Anterior",
+ 'image:next' => "Siguiente",
+
+ //widgets
+
+ 'album:widget' => "Albums de Fotos",
+ 'album:more' => "Ver todos los albums",
+ 'album:widget:description' => "Muestra tus álbums de fotos más recientes",
+ 'album:display:number' => "Número de albums a mostrar",
+ 'album:num_albums' => "Número de albums a mostrar",
+
+ // river
+
+ //images
+ 'image:river:created' => "%s subió",
+ 'image:river:item' => "una imagen",
+ 'image:river:annotate' => "%s comentó en",
+
+ //albums
+ 'album:river:created' => "%s creó",
+ 'album:river:item' => "un album",
+ 'album:river:annotate' => "%s comentó en",
+
+ // Status messages
+
+ 'image:saved' => "Tu imagen ha sido guardada.",
+ 'images:saved' => "Todas tus imágenes han sido guardadas.",
+ 'image:deleted' => "Tu imagen ha sido borrada.",
+ 'image:delete:confirm' => "¿Deseas borrar esta imagen?",
+
+ 'images:edited' => "Tus imágenes han sido actualizadas.",
+ 'album:edited' => "Tu álbum ha sido actualizado.",
+ 'album:saved' => "Tu álbum ha sido guardado.",
+ 'album:deleted' => "Tu álbum ha sido borrado con éxito.",
+ 'album:delete:confirm' => "¿Deseas borrar este álbum?",
+ 'album:created' => "Tu nuevo álbum ha sido creado.",
+ 'tidypics:status:processing' => "Por favor espera mientras procesamos tu imagen....",
+
+ //Error messages
+
+ 'image:none' => "No ha sido psible encontrar ninguna imagen en este momento.",
+ 'image:uploadfailed' => "Algunos ficheros no se pudieron subir:",
+ 'image:deletefailed' => "Tu imagen no ha podido ser borrada en este momento.",
+ 'image:downloadfailed' => "Esta imagen no se encuentra disponible en este momento.",
+
+ 'image:notimage' => "Sólo se aceptan imágenes jpeg, gif, o png del tamaño permitido.",
+ 'images:notedited' => "No se pudieron actualizar todas las imágenes.",
+
+ 'album:none' => "Actualmente no hay ningún álbum de fotos.",
+ 'album:uploadfailed' => "No se ha podido guardar el álbum.",
+ 'album:deletefailed' => "En este momento no se ha podido borrar el álbum.",
+ 'album:blank' => "Por favor entra un título y descripción para tu nuevo álbum."
+ );
+
+ add_translation("es",$spanish);
+?>
\ No newline at end of file
diff --git a/languages/pl.php b/languages/pl.php
new file mode 100644
index 000000000..047b17220
--- /dev/null
+++ b/languages/pl.php
@@ -0,0 +1,115 @@
+ "Obrazek",
+ 'images' => "Obrazki",
+ 'caption' => "Opis",
+ 'photos' => "Zdjęcia",
+ 'images:upload' => "Dodaj obrazki",
+ 'album' => "Album zdjęciowy",
+ 'albums' => "Albumy zdjęciowe",
+ 'album:yours' => "Twoje albumy",
+ 'album:yours:friends' => "Albumy twoich znajomych",
+ 'album:user' => "Albumy użytkownika %s",
+ 'album:friends' => "Albumy przyjaciół użytkownika %s",
+ 'album:all' => "Wszystkie publiczne albumy",
+ 'album:group' => "Albumy rejsu",
+ 'item:object:image' => "Zdjęcia",
+ 'item:object:album' => "Albumy",
+ 'tidypics:settings:maxfilesize' => "Maximum file size in kilo bytes (KB):",
+
+ //actions
+
+ 'album:create' => "Nowy album",
+ 'album:add' => "Dodaj album zdjęciowy",
+ 'album:addpix' => "Dodaj zdjęcia",
+ 'album:edit' => "Edytuj album",
+ 'album:delete' => "Skasuj album",
+
+ 'image:edit' => "Edytuj obrazek",
+ 'image:delete' => "Skasuj obrazek",
+ 'image:download' => "Pobierz obrazek",
+
+ //forms
+
+ 'album:title' => "Tytuł albumu",
+ 'album:desc' => "Opis (widoczny tylko dla twórcy)",
+ 'album:tags' => "Tagi",
+ 'album:cover' => "Ustaw jako okładkę albumu?",
+ 'album:cover:yes' => "Tak",
+ 'image:access:note' => "(prawa dostępu pobierane są z ustawień albumu)",
+
+ //views
+
+ 'image:total' => "Obrazki w albumie:",
+ 'image:by' => "Obrazek dodany przez",
+ 'album:by' => "Album stworzony przez",
+ 'album:created:on' => "Stworzono",
+ 'image:none' => "Nie dodano jeszcze żadnych obrazków.",
+ 'image:back' => "Poprzednia",
+ 'image:next' => "Kolejna",
+
+ //widgets
+
+ 'album:widget' => "Albumy zdjęciowe",
+ 'album:more' => "Pokaż wszystkie albumy",
+ 'album:widget:description' => "Pokazuje twoje ostatnie albumy zdjęciowe",
+ 'album:display:number' => "Liczba wyświetlanych albumów",
+ 'album:num_albums' => "Liczba wyświetlanych albumów",
+
+ // river
+
+ //images
+ 'image:river:created' => "wgrano %s",
+ 'image:river:item' => "obrazek",
+ 'image:river:annotate' => "%s skomentował",
+
+ //albums
+ 'album:river:created' => "Stworzono %s",
+ 'album:river:item' => "album",
+ 'album:river:annotate' => "%s skomentował",
+
+ // Status messages
+
+ 'image:saved' => "Twój obrazek został pomyślnie zapisany.",
+ 'images:saved' => "Wszystkie obrazki zostały pomyślnie zapisane.",
+ 'image:deleted' => "Twój obrazek został pomyślnie skasowany.",
+ 'image:delete:confirm' => "Czy jesteś pewien że chcesz skasować ten obrazek?",
+
+ 'images:edited' => "Twoje obrazki zostały pomyślnie zapisane.",
+ 'album:edited' => "Twój album został pomyślnie zapisany.",
+ 'album:saved' => "Twój album został pomyślnie zapisany.",
+ 'album:deleted' => "Twój album został skasowany.",
+ 'album:delete:confirm' => "Na pewno chcesz skasować ten album?",
+ 'album:created' => "Stworzono nowy album.",
+ 'tidypics:status:processing' => "Please wait while we process your picture....",
+
+ //Error messages
+
+ 'image:none' => "Jeszcze nie dodano żadnych obrazków.",
+ 'image:uploadfailed' => "Pliki nie zapisane:",
+ 'image:deletefailed' => "Nie udało się skasować obrazka.",
+ 'image:downloadfailed' => "Nie udało się ściągnąć albumu.",
+
+ 'image:notimage' => "Akceptowane formaty to tylko: jpeg, gif i png, and the allowed file size.",
+ 'images:notedited' => "Nie wszystkie obrazki zostały zapisane",
+
+ 'album:none' => "Jeszcze nie dodano żadnych albumów.",
+ 'album:uploadfailed' => "Nie udało się zapisać twojego albumu.",
+ 'album:deletefailed' => "Nie udało się usunąć twojego albumu.",
+ 'album:blank' => "Please give this albumu a tytuł and opis."
+ );
+
+ add_translation("pl",$polish);
+?>
\ No newline at end of file
diff --git a/manifest.xml b/manifest.xml
new file mode 100644
index 000000000..1dfd9b7a7
--- /dev/null
+++ b/manifest.xml
@@ -0,0 +1,9 @@
+
+'. $album_entity->title. '
';
+
+ $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album ) );
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2, $area3);
+
+ page_draw($title, $body);
+?>
\ No newline at end of file
diff --git a/view.php b/view.php
new file mode 100644
index 000000000..e0121baae
--- /dev/null
+++ b/view.php
@@ -0,0 +1,62 @@
+container_guid)->container_guid;
+
+ if ($top_container) {
+ set_page_owner($top_container);
+ } else {
+ set_page_owner($entity->owner_guid);
+ }
+
+ // Set the body to be the full view of the entity, and the title to be its title
+ $area2 = elgg_view_entity($entity,true);
+ if ($shell) {
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area1 . $area2);
+ } else {
+ $body = $area2;
+ }
+
+ } else {
+ $body = elgg_echo('notfound');
+ }
+
+ // Display the page
+ if ($shell) {
+ page_draw("", $body);
+ } else {
+ header("Content-type: text/html; charset=UTF-8");
+ echo $body;
+ }
+
+?>
\ No newline at end of file
diff --git a/views/default/input/accessRead.php b/views/default/input/accessRead.php
new file mode 100644
index 000000000..81392b19f
--- /dev/null
+++ b/views/default/input/accessRead.php
@@ -0,0 +1,61 @@
+ 0)
+ {
+
+ /* my hacks (pay no attention please =D )
+ //allow showing of group for write access
+ if($vars['group_write']) $vars['options'] = trigger_plugin_hook('access:collections:write','user',array('user_id' => $_SESSION['guid'], 'site_id' => 0),$vars['options']);
+ */
+
+ //developer check - to check the value being sent initially
+ //echo 'given value: '.$vars['value'].'
';
+
+ //if no value currently set - specify default
+ if (empty($vars['value']) && $vars['value'] != '0')
+ $vars['value'] = 2;
+
+
+ foreach($vars['options'] as $key => $option) {
+ if ($key == $vars['value']) {
+?>
+
+ class="">
+
+
\ No newline at end of file
diff --git a/views/default/input/cover_checkbox.php b/views/default/input/cover_checkbox.php
new file mode 100644
index 000000000..48c7d51cc
--- /dev/null
+++ b/views/default/input/cover_checkbox.php
@@ -0,0 +1,45 @@
+ $option) {
+
+ if ($option != $vars['value']) {
+ $selected = "";
+ } else {
+ $selected = "checked = \"checked\"";
+ }
+
+ $labelint = (int) $label;
+ if ("{$label}" == "{$labelint}") {
+ $label = $option;
+ }
+
+ $disabled = "";
+ if ($vars['disabled']) $disabled = ' disabled="yes" ';
+ echo "
";
+ }
+
+?>
\ No newline at end of file
diff --git a/views/default/input/multi_radio.php b/views/default/input/multi_radio.php
new file mode 100644
index 000000000..11f4c13b8
--- /dev/null
+++ b/views/default/input/multi_radio.php
@@ -0,0 +1,42 @@
+ $option) {
+
+ if ($vars['set'] != $vars['value']) {
+ $selected = "";
+ } else {
+ $selected = "checked = \"checked\"";
+ }
+
+ $labelint = (int) $label;
+ if ("{$label}" == "{$labelint}") {
+ $label = $option;
+ }
+
+ $disabled = "";
+ if ($vars['disabled']) $disabled = ' disabled="yes" ';
+ echo "
";
+ }
+
+?>
\ No newline at end of file
diff --git a/views/default/object/album.php b/views/default/object/album.php
new file mode 100644
index 000000000..b95d55eed
--- /dev/null
+++ b/views/default/object/album.php
@@ -0,0 +1,137 @@
+getGUID();
+ $tags = $file->tags;
+ $title = $file->title;
+ $desc = $file->description;
+ $owner = $vars['entity']->getOwnerEntity();
+ $friendlytime = friendly_time($vars['entity']->time_created);
+ $mime = $file->mimetype;
+
+ if (get_context() == "search") {
+
+ if (get_input('search_viewtype') == "gallery") {
+ //default gallery view for album listing @ /photos/owned/
+
+ //get album cover if one was set
+ if($file->cover)
+ $album_cover = '';
+ else
+ $album_cover = '
';
+
+ ?>
+
+
+ name;?>
+ getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")";
+ ?>
+
+
+ + + 'params[maxfilesize]', 'value' => $maxfilesize)); ?> +
\ No newline at end of file diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php new file mode 100644 index 000000000..f9f5b09e6 --- /dev/null +++ b/views/default/tidypics/css.php @@ -0,0 +1,128 @@ + + /* --- independent view for image/album SHARED --- */ + +#tidypics_title{ + font-size:1.2em; + font-weight:bold; +} +#tidypics_desc{ + padding:0 20px; + font-style:italic; +} +#tidypics_info{ + padding:20px; + line-height:1.5em; +} + +#tidypics_controls{ + text-align:center; + margin-bottom:10px; +} + +#tidypics_controls a{ + margin:10px; +} + + /* independent album view only */ + +.album_images{ + float:left; + width:160px; + height:160px; + margin:4px; + padding:5px; + border:1px solid #ccc; + text-align:center; +} + + /* independent image view only */ + +#image_full{ + text-align:center; + margin:10px; +} +#image_full img{ + padding:5px; + border:1px solid #ccc; + margin:7px 0; +} + +/* --- albums gallery view --- */ + +.album_cover{ + padding:2px; + border:1px solid #ccc; + margin:8px 0; +} + + +/* ------ album WIDGET VIEW ------ */ + +#album_widget_container{ + text-align:center; +} + +.album_widget_single_item{ + +} +.album_widget_title{ + +} +.album_widget_timestamp { + color:#666666; + margin:0; +} +.collapsable_box #album_widget_layout { + margin:0; +} + +/* --------- image upload/edit forms ------------ */ + +#image_upload_list li{ + margin:3px 0; +} +.edit_image_container{ + padding:5px; + margin:5px 0; + overflow:auto; +} +.edit_images{ + float:right; + width:160px; + height:160px; + margin:4px; + padding:5px; + border:1px solid #ccc; + text-align:center; +} +.image_info{ + float:left; + width:60%; +} +.image_info label{ + font-size:1em; +} +.edit_image{ + float:right; + border:1px solid #ccc; + width:153px; + height:153px; +} + +/* --------- tidypics river items ------------ */ + +.river_image_create { + background: url(mod/tidypics/graphics/icons/river_icon_image.gif) no-repeat left -1px; +} +.river_album_create { + background: url(mod/tidypics/graphics/icons/river_icon_album.gif) no-repeat left -1px; +} + +.pagination { + clear:both !important; +} + \ No newline at end of file diff --git a/views/default/tidypics/forms/edit.php b/views/default/tidypics/forms/edit.php new file mode 100644 index 000000000..efe4aa508 --- /dev/null +++ b/views/default/tidypics/forms/edit.php @@ -0,0 +1,115 @@ +title); + $action = "tidypics/editalbum"; + $title = $vars['entity']->title; + $body = $vars['entity']->description; + $tags = $vars['entity']->tags; + $access_id = $vars['entity']->access_id; + $subtype = $vars['subtype']; + + // if nothing is sent, create new, but only new albums are sent here + // new images are sent to upload.php + } else { + $title = elgg_echo("album:add"); + $action = "tidypics/addalbum"; + $tags = ""; + $title = ""; + $description = ""; + } + + // in case we have some cached details + if (isset($vars['albumtitle'])) { + $title = $vars['albumtitle']; + $body = $vars['albumbody']; + $tags = $vars['albumtags']; + } + + $container_guid = get_input('container_guid'); + if (!$container_guid) $container_guid = page_owner(); + +?> + \ No newline at end of file diff --git a/views/default/tidypics/forms/edit_multi.php b/views/default/tidypics/forms/edit_multi.php new file mode 100644 index 000000000..252a660bd --- /dev/null +++ b/views/default/tidypics/forms/edit_multi.php @@ -0,0 +1,44 @@ + + \ No newline at end of file diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php new file mode 100644 index 000000000..35768f64c --- /dev/null +++ b/views/default/tidypics/forms/upload.php @@ -0,0 +1,79 @@ +access_id; + if (get_plugin_setting('maxfilesize','tidypics')) { + if (((int) get_plugin_setting('maxfilesize','tidypics')) < 1 || ((int) get_plugin_setting('maxfilesize','tidypics')) > 1048576) { + $maxfilesize = 10240; //if file size is less than 1KB or greater than 1GB, default to 10MB + } else { + $maxfilesize = (int) get_plugin_setting('maxfilesize','tidypics'); + } + } else { + $maxfilesize = 10240; //if the file size limit is not set, default to 10MB + } + +?> + + \ No newline at end of file diff --git a/views/default/tidypics/groupprofile_albums.php b/views/default/tidypics/groupprofile_albums.php new file mode 100644 index 000000000..ea11006fa --- /dev/null +++ b/views/default/tidypics/groupprofile_albums.php @@ -0,0 +1,60 @@ +num_display; + //if no number has been set, default to 5 + if (!$number) + $number = 5; + + $owner = page_owner_entity(); + $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false); + + echo ''.elgg_echo("album:none").'
'; + if ($owner && ($owner->canWriteToContainer($_SESSION['user']))){ + echo 'username.'>'.elgg_echo("album:add").''; + echo '+ : + + num_display == '') $vars['entity']->num_display = 5; + ?> + +
\ No newline at end of file diff --git a/views/default/widgets/album_view/view.php b/views/default/widgets/album_view/view.php new file mode 100644 index 000000000..347332971 --- /dev/null +++ b/views/default/widgets/album_view/view.php @@ -0,0 +1,53 @@ +num_display; + //if no number has been set, default to 5 + if (!$number) + $number = 5; + + $owner = page_owner_entity(); + $owner_albums = get_entities("object", "album", page_owner(), "", $number, 0, false); + + if ($owner_albums) { + echo ''.elgg_echo("album:none").'
'; + + //check if owner has write rights. If so, let him edit the album + $container_guid = get_input('container_guid', $_SESSION['user']->getGUID()); + + if ($owner->username == get_entity($container_guid)->username){ + echo 'username.'>'.elgg_echo("album:create").'
'; + } + + } +?> \ No newline at end of file diff --git a/views/rss/object/file.php b/views/rss/object/file.php new file mode 100644 index 000000000..3bd84d076 --- /dev/null +++ b/views/rss/object/file.php @@ -0,0 +1,30 @@ +title; + if (empty($title)) { + $title = substr($vars['entity']->description,0,32); + if (strlen($vars['entity']->description) > 32) + $title .= " ..."; + } + +?> + +'.elgg_echo("album:none").'
'; + echo '' . elgg_echo("album:none") . '
'; - //check if owner has write rights. If so, let him edit the album - $container_guid = get_input('container_guid', $_SESSION['user']->getGUID()); - - if ($owner->username == get_entity($container_guid)->username){ + if (get_loggedin_userid() == page_owner()) { echo ''; } } -?> \ No newline at end of file +?> +- - 'access_id','value' => $access_id)); ?> -
- '; } - echo elgg_echo('image:access:note'); ?> diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php index be87c8697..8cc9af897 100644 --- a/views/default/tidypics/forms/upload.php +++ b/views/default/tidypics/forms/upload.php @@ -57,9 +57,6 @@ function showhide(layer_ref) { - - 'access_id','value' => $access_id)); ?> -
Date: Fri, 27 Mar 2009 12:00:43 +0000
Subject: can now enable/disable photo albums for groups
---
languages/en.php | 2 +-
start.php | 9 ++++++---
views/default/tidypics/groupprofile_albums.php | 4 ++++
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/languages/en.php b/languages/en.php
index 90c2c8b5a..0ba223a8c 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -20,7 +20,7 @@
'item:object:image' => "Photos",
'item:object:album' => "Albums",
'tidypics:settings:maxfilesize' => "Maximum file size in kilo bytes (KB):",
-
+ 'tidypics:enablephotos' => 'Enable Group Photo Albums',
'tidypics:editprops' => 'Edit Image Properties',
//actions
diff --git a/start.php b/start.php
index a0162319c..660e20de5 100644
--- a/start.php
+++ b/start.php
@@ -40,6 +40,7 @@
register_entity_type('object','image');
register_entity_type('object','album');
+ add_group_tool_option('photos',elgg_echo('tidypics:enablephotos'),true);
}
/**
@@ -94,9 +95,11 @@
}
if (isloggedin() && ($page_owner instanceof ElggGroup)) {
- add_submenu_item(sprintf(elgg_echo("album:user"),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username,
- 'photo_albums');
+ if ($page_owner->photos_enable != "no") {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username,
+ 'photo_albums');
+ }
}
}
diff --git a/views/default/tidypics/groupprofile_albums.php b/views/default/tidypics/groupprofile_albums.php
index ea11006fa..ff63a38d1 100644
--- a/views/default/tidypics/groupprofile_albums.php
+++ b/views/default/tidypics/groupprofile_albums.php
@@ -1,4 +1,7 @@
photos_enable != 'no') {
+
//the number of files to display
$number = (int) $vars['entity']->num_display;
//if no number has been set, default to 5
@@ -57,4 +60,5 @@
}
//close group_albums_widget div
echo "";
+}
?>
\ No newline at end of file
--
cgit v1.2.3
From d17f91a236cd3008aa888736db894b1e898e91d5 Mon Sep 17 00:00:00 2001
From: alfalive '.elgg_echo("album:none").' '.elgg_echo("album:none").'
';
-
+ echo '';
+ if ($access_id)
+ echo '';
?>
" onclick="showhide('tidypics_loader');" />
';
echo elgg_view("input/text", array("internalname" => "title[$key]", "value" => $title,)) . "\n";
echo ' ' . elgg_echo('tidypics:settings:image_lib');
+ $form_body = ' ' . elgg_echo('tidypics:settings:image_lib') . ': ';
$form_body .= elgg_view('input/pulldown', array(
'internalname' => 'params[image_lib]',
'options_values' => $img_lib_options,
--
cgit v1.2.3
From f0bb034d7b84190a0984e99a9dca56c9a7f0344d Mon Sep 17 00:00:00 2001
From: Cash Costello
- "tidypicsdesc","value" => $body,)); ?>
+ "tidypicsbody","value" => $body,)); ?>
' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . " " . elgg_echo('tidypics:settings:watermark') . "
-Tidypics tries to calculate the maximum size of an image that your server will support. If it
-guesses incorrectly and someone uploads a photo that is too large, the script may crash when
-resizing the image if you are using GD. The easiest way to test this is to set display_errors
-to 1 in your .htaccess file and upload large images. If this causes a problem, a php memory error
-should display on the screen. You can increased your php memory limit (see the docs directory).
-A better option is to use ImageMagick if your server supports it (again see the docs directory).
-
-If it is not a memory issue, you should see some other error appear. Once you have fixed the error,
-change display_error back to 0.
-
-If you see question mark images when you look at your albums, this means the resizing of the images
-failed. This could be due to the memory limits as described above. There are other causes. Tidypics
-tries to detect these problems and write the cause to the error log. You should check your server
-error log right after an upload that results in a question mark for these error messages. The messages
-will begin with "Tidypics warning:". It is possible if you have turned off php warnings that you will
-not see these warnings.
-
-Another possible cause is using ImageMagick when your server does not support it or specifying
-the wrong path to the ImageMagick executables.
+
+Tidypics tries to calculate the maximum size of an image that your server will support. If it
+guesses incorrectly and someone uploads a photo that is too large, the script may crash when
+resizing the image if you are using GD. The easiest way to test this is to set display_errors
+to 1 in your .htaccess file and upload large images. If this causes a problem, a php memory error
+should display on the screen. You can increased your php memory limit (see the docs directory).
+A better option is to use ImageMagick if your server supports it (again see the docs directory).
+
+If it is not a memory issue, you should see some other error appear. Once you have fixed the error,
+change display_error back to 0.
+
+If you see question mark images when you look at your albums, this means the resizing of the images
+failed. This could be due to the memory limits as described above. There are other causes. Tidypics
+tries to detect these problems and write the cause to the error log. You should check your server
+error log right after an upload that results in a question mark for these error messages. The messages
+will begin with "Tidypics warning:". It is possible if you have turned off php warnings that you will
+not see these warnings.
+
+Another possible cause is using ImageMagick when your server does not support it or specifying
+the wrong path to the ImageMagick executables.
-An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping.
-There are three image library options with Tidypics: PHP extension GD,
-ImageMagick called via a system call, and the PHP extension
-imagick. GD is the most common of the three on hosted servers but suffers
-from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the
-PHP extension), we recommend that you use that.
-
-To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can check our
-server analysis page to find out the
-configuration of your server. Next, you need to determine the path to ImageMagick on your server. Your hosting service should
-be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of
-ImageMagick installed on your server.
-
-
-
-Upgrade
+
+Upgrade
-
+
-This page allows you to create thumbnails for images when the thumbnail creation failed during upload.
-You may experience problems with thumbnail creation if your image library in not configured properly or
-if there is not enough memory for the GD library to load and resize an image. If your users have
-experienced problems with thumbnail creation and you have modified your setup, you can try to redo the
-thumbnails. Find the unique identifier of the photo (it is the number near the end of the url when viewing
-a photo) and enter it below.
-
-:
-
-
- ' . elgg_echo('tidypics:settings:image_lib') . ': ';
- $form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[image_lib]',
- 'options_values' => $img_lib_options,
- 'value' => $image_lib
- ));
- $form_body .= ' " . elgg_echo('tidypics:settings:im_path') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . " " . elgg_echo('tidypics:settings:watermark') . " " . elgg_echo('tidypics:settings:maxfilesize') . " " . elgg_echo('tidypics:settings:quota') . " ' . elgg_echo('tidypics:settings:img_river_view');
- $form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[img_river_view]',
- 'options_values' => array(
- 'all' => 'all',
- '1' => '1',
- 'none' => 'none',
- ),
- 'value' => $img_river_view
- ));
- $form_body .= ' ' . elgg_echo('tidypics:settings:album_river_view');
- $form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[album_river_view]',
- 'options_values' => array(
- 'cover' => 'cover',
- 'set' => 'set',
- ),
- 'value' => $album_river_view
- ));
- $form_body .= ' " . elgg_echo('tidypics:settings:largesize') . " " . elgg_echo('tidypics:settings:smallsize') . " " . elgg_echo('tidypics:settings:thumbsize') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . " ' . elgg_echo('tidypics:settings:image_lib') . ': ';
+ $form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[image_lib]',
+ 'options_values' => $img_lib_options,
+ 'value' => $image_lib
+ ));
+ $form_body .= ' " . elgg_echo('tidypics:settings:im_path') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . " " . elgg_echo('tidypics:settings:watermark') . " " . elgg_echo('tidypics:settings:maxfilesize') . " " . elgg_echo('tidypics:settings:quota') . " ' . elgg_echo('tidypics:settings:img_river_view');
+ $form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[img_river_view]',
+ 'options_values' => array(
+ 'all' => 'all',
+ '1' => '1',
+ 'none' => 'none',
+ ),
+ 'value' => $img_river_view
+ ));
+ $form_body .= ' ' . elgg_echo('tidypics:settings:album_river_view');
+ $form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[album_river_view]',
+ 'options_values' => array(
+ 'cover' => 'cover',
+ 'set' => 'set',
+ ),
+ 'value' => $album_river_view
+ ));
+ $form_body .= ' " . elgg_echo('tidypics:settings:largesize') . " " . elgg_echo('tidypics:settings:smallsize') . " " . elgg_echo('tidypics:settings:thumbsize') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "
-num_display == '') $vars['entity']->num_display = 5;
-
-?>
-
+
+num_display == '') $vars['entity']->num_display = 5;
+
+?>
+
-num_display == '') $vars['entity']->num_display = 6;
-
-?>
-
+
+num_display == '') $vars['entity']->num_display = 6;
+
+?>
+
+
+
--
cgit v1.2.3
From 0ccf8f23e31eb946b907da9e1d9365ce45831d15 Mon Sep 17 00:00:00 2001
From: Cash Costello ' . elgg_echo('tidypics:settings:image_lib') . ': ';
+ $form_body .= ' ' . elgg_echo('tidypics:settings:image_lib') . ': ';
$form_body .= elgg_view('input/pulldown', array(
'internalname' => 'params[image_lib]',
'options_values' => $img_lib_options,
@@ -45,6 +46,7 @@
}
// Tagging
+ $form_body .= ' ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . " ' . elgg_echo('tidypics:settings:img_river_view');
@@ -115,6 +118,8 @@
$form_body .= ' " . elgg_echo('tidypics:settings:largesize') . " " . elgg_echo('tidypics:settings:smallsize') . "' . elgg_echo('albums') . '
';
if ($owner_albums) {
@@ -50,11 +50,11 @@ if ($vars['entity']->photos_enable != 'no') {
echo "';
+ $album_cover = '
';
else
- $album_cover = '
';
+ $album_cover = '
';
?>
';
if ($next) echo '';
diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php
index 3c935e8c5..44590b676 100644
--- a/views/default/tidypics/css.php
+++ b/views/default/tidypics/css.php
@@ -3,145 +3,130 @@
* tidypics CSS extender
*/
?>
- /* --- independent view for image/album SHARED --- */
-
-#tidypics_title{
- font-size:1.2em;
- font-weight:bold;
-}
-#tidypics_desc{
- padding:0 20px;
- font-style:italic;
-}
-#tidypics_info{
- padding:20px;
- line-height:1.5em;
+/* ---- tidypics object views ---- */
+
+#tidypics_desc {
+padding:0 20px;
+font-style:italic;
}
-#tidypics_controls{
- text-align:center;
- margin-bottom:10px;
+#tidypics_info {
+padding:20px;
}
-#tidypics_controls a{
- margin:10px;
+#tidypics_controls {
+text-align:center;
+margin-bottom:10px;
}
-#group_albums_widget {
--webkit-border-radius: 8px;
--moz-border-radius: 8px;
-background:white none repeat scroll 0 0;
-margin:0 0 20px;
-padding:0 0 5px;
+#tidypics_controls a {
+margin:10px;
}
.tidypics_download a {
- font: 12px/100% Arial, Helvetica, sans-serif;
- font-weight: bold;
- color: white;
- background:#4690d6;
- border:none;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- width: auto;
- height: 25px;
- padding: 3px 6px 3px 6px;
- margin:10px 0 10px 0;
- cursor: pointer;
+font:12px/100% Arial, Helvetica, sans-serif;
+font-weight:bold;
+color:white;
+background:#4690d6;
+border:none;
+-webkit-border-radius: 5px;
+-moz-border-radius: 5px;
+width:auto;
+height:25px;
+padding:3px 6px 3px 6px;
+margin:10px 0 10px 0;
+cursor:pointer;
}
+
.tidypics_download a:hover {
- background: black;
- color:white;
- text-decoration: none;
+background:black;
+color:white;
+text-decoration:none;
}
-
- /* independent album view only */
-
-.album_images{
- float:left;
- width:160px;
- height:160px;
- margin:4px;
- padding:5px;
- border:1px solid #cccccc;
- text-align:center;
+.tidypics_album_images {
+float:left;
+width:153px;
+height:153px;
+margin:3px;
+padding:4px;
+border:1px solid #dedede;
+text-align:center;
}
- /* independent image view only */
-
-#image_full{
- text-align:center;
- margin:10px;
-}
-#image_full img{
- padding:5px;
- border:1px solid #cccccc;
- margin:7px 0;
+#tidypics_image_full {
+text-align:center;
+margin:10px;
}
-/* --- albums gallery view --- */
-
-.album_cover{
- padding:2px;
- border:1px solid #cccccc;
- margin:8px 0;
+#tidypics_image_full img {
+padding:5px;
+border:1px solid #dedede;
+margin:7px 0;
}
+.tidypics_album_cover {
+padding:2px;
+border:1px solid #dedede;
+margin:8px 0;
+}
-/* ------ album WIDGET VIEW ------ */
-
-#album_widget_container{
- text-align:center;
+.tidypics_album_widget_single_item {
+margin-bottom:8px;
}
-.album_widget_single_item{
+/* ------ tidypics widget view ------ */
+#tidypics_album_widget_container {
+text-align:center;
}
-.album_widget_title{
-}
-.album_widget_timestamp {
- color:#666666;
- margin:0;
-}
-.collapsable_box #album_widget_layout {
- margin:0;
+.tidypics_album_widget_timestamp {
+color:#333333;
}
/* --------- image upload/edit forms ------------ */
-#image_upload_list li{
- margin:3px 0;
+#tidpics_image_upload_list li {
+margin:3px 0;
}
-.edit_image_container{
- padding:5px;
- margin:5px 0;
- overflow:auto;
+
+.tidypics_edit_image_container {
+padding:5px;
+margin:5px 0;
+overflow:auto;
}
-.edit_images{
- float:right;
- width:160px;
- height:160px;
- margin:4px;
- padding:5px;
- border:1px solid #cccccc;
- text-align:center;
+
+.tidypics_edit_images {
+float:right;
+width:160px;
+height:160px;
+margin:4px;
+padding:5px;
+border:1px solid #dedede;
+text-align:center;
}
-.image_info{
- float:left;
- width:60%;
+
+.tidypics_image_info {
+float:left;
+width:60%;
}
-.image_info label{
- font-size:1em;
+
+.tidypics_image_info label {
+font-size:1em;
}
-.edit_image{
- float:right;
- border:1px solid #cccccc;
- width:153px;
- height:153px;
+
+/* ---- tidypics group css ----- */
+
+#group_albums_widget {
+-webkit-border-radius: 8px;
+-moz-border-radius: 8px;
+background:white none repeat scroll 0 0;
+margin:0 0 20px;
+padding:0 0 5px;
}
+
/* --------- tidypics river items ------------ */
.river_image_create {
@@ -158,9 +143,4 @@ padding:0 0 5px;
}
.river_object_album_comment {
background: url(_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px;
-}
-
-.pagination {
- clear:both !important;
-}
-
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/views/default/tidypics/forms/edit_multi.php b/views/default/tidypics/forms/edit_multi.php
index 354600798..24755e9cf 100644
--- a/views/default/tidypics/forms/edit_multi.php
+++ b/views/default/tidypics/forms/edit_multi.php
@@ -19,9 +19,9 @@
$container_guid = $entity->container_guid;
if($no_cover && !$cover) $cover = $guid;
- echo '
';
- echo '
';
+ echo '
-
+
' . elgg_view("input/file",array('internalname' => "upload_$x")) . "\n";
diff --git a/views/default/tidypics/groupprofile_albums.php b/views/default/tidypics/groupprofile_albums.php
index d975f5f99..de61b0845 100644
--- a/views/default/tidypics/groupprofile_albums.php
+++ b/views/default/tidypics/groupprofile_albums.php
@@ -15,19 +15,19 @@ if ($vars['entity']->photos_enable != 'no') {
echo '
' . elgg_echo('albums') . '
';
if ($owner_albums) {
- echo '';
+ $album_cover = '
';
else
- $album_cover = '
';
+ $album_cover = '
';
?>
-
@@ -214,6 +214,7 @@ if ($photo_tags) {
var coordinates = "";
var user_id = 0;
+ var tagging = 0;
// add to DOM as soon as ready
$(document).ready(function () {
@@ -324,38 +325,52 @@ if ($photo_tags) {
function startTagging()
{
- if ( $('#tagging_instructions').is(':hidden') )
+ if (tagging != 0)
{
- $('#tagging_instructions').show();
-
- $('#tidypics_image').hover(
- function(){
- $('.tidypics_tag').hide();
- },
- function(){
- $('.tidypics_tag').hide();
- }
+ stopTagging();
+ return;
+ }
+
+ tagging = 1;
+
+ $('#tag_control').text("Stop Tagging");
+
+ showTagInstruct();
+
+
+ $('#tidypics_image').hover(
+ function(){
+ $('.tidypics_tag').hide();
+ },
+ function(){
+ $('.tidypics_tag').hide();
+ }
);
- $('img#tidypics_image').imgAreaSelect( {
- borderWidth: 2,
- borderColor1: 'white',
- borderColor2: 'white',
- disable: false,
- hide: false,
- onSelectEnd: showTagMenu,
- onSelectStart: hideTagMenu
- }
- );
- }
+ $('img#tidypics_image').imgAreaSelect( {
+ borderWidth: 2,
+ borderColor1: 'white',
+ borderColor2: 'white',
+ disable: false,
+ hide: false,
+ onSelectEnd: showTagMenu,
+ onSelectStart: hideTagMenu
+ }
+ );
}
function stopTagging()
{
- $('#tagging_instructions').hide();
- $('#tag_menu').hide();
+ tagging = 0;
+
+ hideTagInstruct();
+ hideTagMenu();
+
+ $('#tag_control').text("Tag this photo");
+
$('img#tidypics_image').imgAreaSelect( {hide: true, disable: true} );
+ // restart tag hovering
$('#tidypics_image').hover(
function(){
$('.tidypics_tag').show();
@@ -392,9 +407,28 @@ if ($photo_tags) {
function hideTagMenu()
{
$('#tag_menu').hide();
- coordinates = "";
}
+ function showTagInstruct()
+ {
+ offsetY = -60;
+
+ imgOffset = $('#tidypics_image').offset();
+ imgWidth = $('#tidypics_image').width();
+
+ top = imgOffset.top + offsetY;
+ left = imgOffset.left;
+
+ $('#tagging_instructions').show().css({
+ "top": top + "px",
+ "left": left + "px"
+ });
+ }
+
+ function hideTagInstruct()
+ {
+ $('#tagging_instructions').hide();
+ }
function addTag()
{
diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php
index f9f57ceab..00fbb38de 100644
--- a/views/default/tidypics/css.php
+++ b/views/default/tidypics/css.php
@@ -182,19 +182,15 @@ padding:0 0 5px;
/* ----------- tagging ---------------- */
#tagging_instructions {
-background:#FFFBE2 none repeat scroll 0 0;
-border:1px solid #FFE222;
-margin:10px;
+background:#FFFBE2;
+border:1px solid #FFE222;
padding:10px;
+height:30px;
+width:400px;
display:none;
-}
-
-#cont-image {
-margin:0px auto;
-background:white none repeat scroll 0 0;
-border:1px solid #DDDDDD;
-padding:10px;
-overflow:hidden;
+overflow:hidden;
+position:absolute;
+z-index:10000;
}
#tag_menu {
@@ -203,29 +199,24 @@ width:200px;
position:absolute;
z-index:10000;
display:none;
-background:#fff;
+background:#ffffff;
padding:5px;
font-size:12px;
text-align:left;
}
-
.tidypics_tag {
- display: none;
- background: url(spacer.gif);
- border: 2px solid rgb(255, 255, 255);
- overflow: hidden;
- position: absolute;
- z-index: 0;
- cursor: text;
+display:none;
+border:2px solid #ffffff;
+overflow:hidden;
+position:absolute;
+z-index:0;
}
.tidypics_tag_text {
- display: none;
- background: url(spacer.gif);
- border: 2px solid rgb(255, 255, 255);
- overflow: hidden;
- position: absolute;
- z-index: 0;
- cursor: text;
+display:none;
+border:2px solid #ffffff;
+overflow:hidden;
+position:absolute;
+z-index:0;
}
--
cgit v1.2.3
From 36c4e40fee8f698fde36b6e083290c8d877f456e Mon Sep 17 00:00:00 2001
From: Cash Costello
@@ -207,6 +202,15 @@ if ($photo_tags) {
?>
+
+
+
diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php
index 00fbb38de..0d4c6b046 100644
--- a/views/default/tidypics/css.php
+++ b/views/default/tidypics/css.php
@@ -219,4 +219,4 @@ border:2px solid #ffffff;
overflow:hidden;
position:absolute;
z-index:0;
-}
+}
\ No newline at end of file
--
cgit v1.2.3
From 9081cb8734afab7b31e6f30739fe11c747789450 Mon Sep 17 00:00:00 2001
From: Cash Costello
@@ -201,7 +201,7 @@ if ($photo_tags) {
$content .= "";
- $content .= "";
+ $content .= "";
echo elgg_view('input/form', array('internalid' => 'quicksearch', 'internalname' => 'form-phototagging', 'class' => 'quicksearch', 'action' => "{$vars['url']}action/tidypics/addtag", 'body' => $content));
--
cgit v1.2.3
From ba7c75f865065caa6910578e0ca9bab6937ca293 Mon Sep 17 00:00:00 2001
From: Cash Costello
-
-
-
+
+
-
-
-
-
- wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" border="0" class="tidypics_album_cover" alt="thumbnail"/>' . "
';
-
+
echo elgg_view_listing($icon, $info);
}
+
/***************************************************************
*
* front page view
*
****************************************************************/
} else if (get_context() == "front") {
+ // the front page view is a clikcable thumbnail of the image
?>
-
+
+
+
guid) {
- $the_viewer = $viewer->guid;
- } else {
- $the_viewer = 0;
- }
-
- // only non-owner views count
- if ($owner->guid != $view->owner_guid)
- create_annotation($image_guid, "tp_view", "1", "integer", $the_viewer, ACCESS_PUBLIC);
- $views_a = get_annotations($image_guid, "object", "image", "tp_view", "", 0, 9999);
- $views = count($views_a);
-
- $my_views = 0;
- $owner_views = 0;
- $diff_viewers = array();
- // echo "
"; var_dump($owner); echo "
";
- foreach($views_a as $view) {
- if($view->owner_guid == $the_viewer && $the_viewer != 0) $my_views++;
- if($owner->guid == $view->owner_guid) $owner_views++;
- //count how many different people have viewed it
- if($owner->guid != $view->owner_guid) $diff_viewers[$view->owner_guid] = 1;
- }
- //remove the owner's views from the total count (prevents artificially inflated view counts)
- $views = $views - $owner_views;
- }
// Build back and next links
$back = '';
@@ -143,11 +117,19 @@
'; // content wrapper
diff --git a/views/default/tidypics/tagging.php b/views/default/tidypics/tagging.php
index 7062d942a..1d307df08 100644
--- a/views/default/tidypics/tagging.php
+++ b/views/default/tidypics/tagging.php
@@ -36,7 +36,7 @@
";
$form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "Elgg requires the GD extension to be loaded
-
--
cgit v1.2.3
From 30362f5fabb71e6f0f5a7b6b9b733be11dac73e2 Mon Sep 17 00:00:00 2001
From: Cash Costello ImageMagick PHP
+ IMagick PHP extension
";
+ $image_link = $vars['url'] . "action/tidypics/download?file_guid=" . $image_guid . "&view=inline&__elgg_token={$token}&__elgg_ts={$ts}";
+ }
+ // does any plugin want to override the link
+ $image_link = trigger_plugin_hook('tp_image_link', 'image', $image, $image_link);
+ // add link if set
+ if ($image_link) {
+ echo "
";
} else {
+ // no link for this image
echo "
";
}
- ?>
+ ?>
wwwroot}mod/tidypics/thumbnail.php?file_guid={$guid}&size=large\" alt=\"{$title}\" />";
-
-?>
+getFilename();
+ $container_guid = $image->container_guid;
+ if (!$filename || !$container_guid) {
+ echo "Error retrieving information about the image";
+ return;
+ }
+
+ $title = $image->title;
+ $prefix = "image/" . $container_guid . "/";
+ $filestorename = substr($filename, strlen($prefix));
+
+ $image_lib = get_plugin_setting('image_lib', 'tidypics');
+ if (!$image_lib)
+ $image_lib = "GD";
+
+ if ($image_lib == 'ImageMagick') { // ImageMagick command line
+
+ if (tp_create_im_cmdline_thumbnails($image, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING);
+ echo "Failed to create thumbnails";
+ }
+
+ } else if ($image_lib == 'ImageMagickPHP') { // imagick PHP extension
+
+ if (tp_create_imagick_thumbnails($image, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING);
+ echo "Failed to create thumbnails";
+ }
+
+ } else {
+
+ if (tp_create_gd_thumbnails($image, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING);
+ echo "Failed to create thumbnails";
+ }
+
+ } // end of image library selector
+
+ echo "
wwwroot}mod/tidypics/thumbnail.php?file_guid={$guid}&size=large\" alt=\"{$title}\" />";
+
+?>
diff --git a/actions/delete.php b/actions/delete.php
index 1a518af9e..5506c2303 100644
--- a/actions/delete.php
+++ b/actions/delete.php
@@ -1,121 +1,121 @@
-canEdit()) { // user doesn't have permissions
- register_error(elgg_echo("file:deletefailed"));
- forward($forward_url);
- }
-
- $subtype = $entity->getSubtype();
- $container = get_entity($entity->container_guid);
-
- if ($subtype != 'image' && $subtype != 'album') { // how did we even get here?
- register_error(elgg_echo("file:deletefailed"));
- forward($forward_url);
- }
-
- $owner_guid = 0; // group or user
- if ($subtype == 'image') { //deleting an image
- $album = get_entity($entity->container_guid);
- $owner_guid = $album->container_guid;
- $forward_url = $container->getURL(); //forward back to album after deleting pictures
- $images = array($entity);
- // plugins can register to be told when a Tidypics image has been deleted
- trigger_elgg_event('delete', 'tp_image', $entity);
- } else { //deleting an album
- $owner_guid = $entity->container_guid;
- $forward_url = 'pg/photos/owned/' . $container->username;
- //get all the images from this album as long as less than 999 images
- $images = get_entities("object", "image", $guid, '', 999);
- // plugins can register to be told when a Tidypics album has been deleted
- trigger_elgg_event('delete', 'tp_album', $entity);
- }
-
- // make sure we decrease the repo size for the size quota
- $image_repo_size_md = get_metadata_byname($owner_guid, "image_repo_size");
- $image_repo_size = (int)$image_repo_size_md->value;
-
- //loop through all images and delete them
- foreach($images as $im) {
- $thumbnail = $im->thumbnail;
- $smallthumb = $im->smallthumb;
- $largethumb = $im->largethumb;
-
- if ($thumbnail) { //delete standard thumbnail image
- $delfile = new ElggFile();
- $delfile->owner_guid = $im->getOwner();
- $delfile->setFilename($thumbnail);
- $delfile->delete();
- }
- if ($smallthumb) { //delete small thumbnail image
- $delfile = new ElggFile();
- $delfile->owner_guid = $im->getOwner();
- $delfile->setFilename($smallthumb);
- $delfile->delete();
- }
- if ($largethumb) { //delete large thumbnail image
- $delfile = new ElggFile();
- $delfile->owner_guid = $im->getOwner();
- $delfile->setFilename($largethumb);
- $delfile->delete();
- }
- if ($im) { //delete actual image file
- $delfile = new ElggFile($im->getGUID());
- $delfile->owner_guid = $im->getOwner();
- //$delfile->setFilename($im->originalfilename);
- $image_repo_size -= $delfile->size();
-
- if (!$delfile->delete()) {
- if ($subtype=='image') register_error(elgg_echo("file:deletefailed")); //unable to delete object
- } else {
- if ($subtype=='image') system_message(elgg_echo("file:deleted")); //successfully deleted object
- }
- } //end delete actual image file
- } //end looping through each image to delete it
-
- //now that all images have been deleted, delete the album
- if ($subtype == 'album') {
- //delete the album's directory manually; first create a temp file to get the directory path
- $tmpfile = new ElggFile();
- $tmpfile->setFilename('image/' . $guid . '/._tmp_del_tidypics_album_');
- $tmpfile->subtype = 'image';
- $tmpfile->container_guid = $guid;
- $tmpfile->open("write");
- $tmpfile->write('');
- $tmpfile->close();
- $tmpfile->save();
- $albumdir = eregi_replace('/._tmp_del_tidypics_album_', '', $tmpfile->getFilenameOnFilestore());
- $tmpfile->delete();
- if (is_dir($albumdir))
- rmdir($albumdir);
-
- //delete object from database
- if (!$entity->delete()) {
- register_error(elgg_echo("file:deletefailed")); //unable to delete object
- } else {
- system_message(elgg_echo("file:deleted")); //successfully deleted object
- }
- } //end of delete album
-
- create_metadata($owner_guid, "image_repo_size", $image_repo_size, 'integer', $owner_guid);
-
- forward($forward_url);
-
+canEdit()) { // user doesn't have permissions
+ register_error(elgg_echo("file:deletefailed"));
+ forward($forward_url);
+ }
+
+ $subtype = $entity->getSubtype();
+ $container = get_entity($entity->container_guid);
+
+ if ($subtype != 'image' && $subtype != 'album') { // how did we even get here?
+ register_error(elgg_echo("file:deletefailed"));
+ forward($forward_url);
+ }
+
+ $owner_guid = 0; // group or user
+ if ($subtype == 'image') { //deleting an image
+ $album = get_entity($entity->container_guid);
+ $owner_guid = $album->container_guid;
+ $forward_url = $container->getURL(); //forward back to album after deleting pictures
+ $images = array($entity);
+ // plugins can register to be told when a Tidypics image has been deleted
+ trigger_elgg_event('delete', 'tp_image', $entity);
+ } else { //deleting an album
+ $owner_guid = $entity->container_guid;
+ $forward_url = 'pg/photos/owned/' . $container->username;
+ //get all the images from this album as long as less than 999 images
+ $images = get_entities("object", "image", $guid, '', 999);
+ // plugins can register to be told when a Tidypics album has been deleted
+ trigger_elgg_event('delete', 'tp_album', $entity);
+ }
+
+ // make sure we decrease the repo size for the size quota
+ $image_repo_size_md = get_metadata_byname($owner_guid, "image_repo_size");
+ $image_repo_size = (int)$image_repo_size_md->value;
+
+ //loop through all images and delete them
+ foreach($images as $im) {
+ $thumbnail = $im->thumbnail;
+ $smallthumb = $im->smallthumb;
+ $largethumb = $im->largethumb;
+
+ if ($thumbnail) { //delete standard thumbnail image
+ $delfile = new ElggFile();
+ $delfile->owner_guid = $im->getOwner();
+ $delfile->setFilename($thumbnail);
+ $delfile->delete();
+ }
+ if ($smallthumb) { //delete small thumbnail image
+ $delfile = new ElggFile();
+ $delfile->owner_guid = $im->getOwner();
+ $delfile->setFilename($smallthumb);
+ $delfile->delete();
+ }
+ if ($largethumb) { //delete large thumbnail image
+ $delfile = new ElggFile();
+ $delfile->owner_guid = $im->getOwner();
+ $delfile->setFilename($largethumb);
+ $delfile->delete();
+ }
+ if ($im) { //delete actual image file
+ $delfile = new ElggFile($im->getGUID());
+ $delfile->owner_guid = $im->getOwner();
+ //$delfile->setFilename($im->originalfilename);
+ $image_repo_size -= $delfile->size();
+
+ if (!$delfile->delete()) {
+ if ($subtype=='image') register_error(elgg_echo("file:deletefailed")); //unable to delete object
+ } else {
+ if ($subtype=='image') system_message(elgg_echo("file:deleted")); //successfully deleted object
+ }
+ } //end delete actual image file
+ } //end looping through each image to delete it
+
+ //now that all images have been deleted, delete the album
+ if ($subtype == 'album') {
+ //delete the album's directory manually; first create a temp file to get the directory path
+ $tmpfile = new ElggFile();
+ $tmpfile->setFilename('image/' . $guid . '/._tmp_del_tidypics_album_');
+ $tmpfile->subtype = 'image';
+ $tmpfile->container_guid = $guid;
+ $tmpfile->open("write");
+ $tmpfile->write('');
+ $tmpfile->close();
+ $tmpfile->save();
+ $albumdir = eregi_replace('/._tmp_del_tidypics_album_', '', $tmpfile->getFilenameOnFilestore());
+ $tmpfile->delete();
+ if (is_dir($albumdir))
+ rmdir($albumdir);
+
+ //delete object from database
+ if (!$entity->delete()) {
+ register_error(elgg_echo("file:deletefailed")); //unable to delete object
+ } else {
+ system_message(elgg_echo("file:deleted")); //successfully deleted object
+ }
+ } //end of delete album
+
+ create_metadata($owner_guid, "image_repo_size", $image_repo_size, 'integer', $owner_guid);
+
+ forward($forward_url);
+
?>
\ No newline at end of file
diff --git a/actions/deletetag.php b/actions/deletetag.php
index 3a76f6e99..becf1fedb 100644
--- a/actions/deletetag.php
+++ b/actions/deletetag.php
@@ -1,57 +1,57 @@
- $value) {
- // delete normal tag if it exists
- if (is_array($image->tags)) {
- $index = array_search($value, $image->tags);
- if ($index !== false) {
- $tagarray = $image->tags;
- unset($tagarray[$index]);
- $image->clearMetadata('tags');
- $image->tags = $tagarray;
- }
- } else {
- if ($value === $image->tags) {
- $image->clearMetadata('tags');
- }
- }
-
- // delete relationship if this tag is a user
- $annotation = get_annotation($id);
- $photo_tag = unserialize($annotation->value);
- if ($photo_tag->type == 'user') {
- remove_entity_relationship($photo_tag->value, 'phototag', $image_guid);
- }
-
- // delete the photo tag annotation
- delete_annotation($id);
- }
-
- system_message(elgg_echo("tidypics:deletetag:success"));
-
- forward($_SERVER['HTTP_REFERER']);
-
-?>
+ $value) {
+ // delete normal tag if it exists
+ if (is_array($image->tags)) {
+ $index = array_search($value, $image->tags);
+ if ($index !== false) {
+ $tagarray = $image->tags;
+ unset($tagarray[$index]);
+ $image->clearMetadata('tags');
+ $image->tags = $tagarray;
+ }
+ } else {
+ if ($value === $image->tags) {
+ $image->clearMetadata('tags');
+ }
+ }
+
+ // delete relationship if this tag is a user
+ $annotation = get_annotation($id);
+ $photo_tag = unserialize($annotation->value);
+ if ($photo_tag->type == 'user') {
+ remove_entity_relationship($photo_tag->value, 'phototag', $image_guid);
+ }
+
+ // delete the photo tag annotation
+ delete_annotation($id);
+ }
+
+ system_message(elgg_echo("tidypics:deletetag:success"));
+
+ forward($_SERVER['HTTP_REFERER']);
+
+?>
diff --git a/actions/edit.php b/actions/edit.php
index 91c465828..cdf9420b2 100644
--- a/actions/edit.php
+++ b/actions/edit.php
@@ -1,81 +1,81 @@
-canEdit()) {
- forward();
- }
-
- // Get owning user/group
- $owner = get_entity($entity->getOwner());
-
- // change access only if access is different from current
- if ($subtype == 'album' && $entity->access_id != $access) {
- $entity->access_id = $access;
-
- //get images from album and update access on image entities
- $images = get_entities("object","image", $guid, '', 999, '', false);
- foreach ($images as $im) {
- $im->access_id = $access;
- $im->save();
- }
- }
-
-
- // Set its title and description appropriately
- $entity->title = $title;
- $entity->description = $body;
-
- // Before we can set metadata, we need to save the entity
- if (!$entity->save()) {
- register_error(elgg_echo("album:error"));
- $entity->delete();
- forward($_SERVER['HTTP_REFERER']); //failed, so forward to previous page
- }
-
- // Now let's add tags
- $tagarray = string_to_tag_array($tags);
- $entity->clearMetadata('tags');
- if (is_array($tagarray)) {
- $entity->tags = $tagarray;
- }
-
- //if cover meta is sent from image save as metadata
- if ($subtype == 'image' && $cover == elgg_echo('album:cover')) {
- $album = get_entity($container_guid);
- $album->cover = $entity->guid;
- }
-
- // Success message
- if ($subtype == 'album') {
- system_message(elgg_echo("album:edited"));
- // plugins can register to be told when a Tidypics album has been updated
- trigger_elgg_event('update', 'tp_album', $entity);
- } else {
- system_message(elgg_echo('images:edited'));
- // plugins can register to be told when a Tidypics image has been updated
- trigger_elgg_event('update', 'tp_image', $entity);
- }
-
- forward($entity->getURL());
-?>
+canEdit()) {
+ forward();
+ }
+
+ // Get owning user/group
+ $owner = get_entity($entity->getOwner());
+
+ // change access only if access is different from current
+ if ($subtype == 'album' && $entity->access_id != $access) {
+ $entity->access_id = $access;
+
+ //get images from album and update access on image entities
+ $images = get_entities("object","image", $guid, '', 999, '', false);
+ foreach ($images as $im) {
+ $im->access_id = $access;
+ $im->save();
+ }
+ }
+
+
+ // Set its title and description appropriately
+ $entity->title = $title;
+ $entity->description = $body;
+
+ // Before we can set metadata, we need to save the entity
+ if (!$entity->save()) {
+ register_error(elgg_echo("album:error"));
+ $entity->delete();
+ forward($_SERVER['HTTP_REFERER']); //failed, so forward to previous page
+ }
+
+ // Now let's add tags
+ $tagarray = string_to_tag_array($tags);
+ $entity->clearMetadata('tags');
+ if (is_array($tagarray)) {
+ $entity->tags = $tagarray;
+ }
+
+ //if cover meta is sent from image save as metadata
+ if ($subtype == 'image' && $cover == elgg_echo('album:cover')) {
+ $album = get_entity($container_guid);
+ $album->cover = $entity->guid;
+ }
+
+ // Success message
+ if ($subtype == 'album') {
+ system_message(elgg_echo("album:edited"));
+ // plugins can register to be told when a Tidypics album has been updated
+ trigger_elgg_event('update', 'tp_album', $entity);
+ } else {
+ system_message(elgg_echo('images:edited'));
+ // plugins can register to be told when a Tidypics image has been updated
+ trigger_elgg_event('update', 'tp_image', $entity);
+ }
+
+ forward($entity->getURL());
+?>
diff --git a/actions/edit_multi.php b/actions/edit_multi.php
index 92252b6dd..c7099e6db 100644
--- a/actions/edit_multi.php
+++ b/actions/edit_multi.php
@@ -1,66 +1,66 @@
- $im) {
- $image = get_entity($im);
-
- if ($image->canEdit()) {
-
- // Convert string of tags into a preformatted array
- $tagarray = string_to_tag_array($tags_array[$key]);
-
- //set title appropriately
- if ($title_array[$key])
- $image->title = $title_array[$key];
- else
- $image->title = substr($image->originalfilename, 0, strrpos($image->originalfilename, '.'));
-
- //set description appropriately
- $image->description = $caption_array[$key];
-
- // Before we can set metadata, we need to save the image
- if (!$image->save()) {
- array_push($not_updated, $image->guid);
- }
-
- // Now let's add tags. We can pass an array directly to the object property! Easy.
- $image->clearMetadata('tags');
- if (is_array($tagarray)) {
- $image->tags = $tagarray;
- }
-
- //if cover meta is sent from image save as metadata
- if ($cover == $im) {
- $album_entity->cover = $im;
- }
- }
- }
-
- // Success message
- if (count($not_updated) > 0) {
- register_error(elgg_echo("images:notedited"));
- } else {
- system_message(elgg_echo("images:edited"));
- }
-
- // Forward to the main album page
- forward($album_entity->getURL());
-
+ $im) {
+ $image = get_entity($im);
+
+ if ($image->canEdit()) {
+
+ // Convert string of tags into a preformatted array
+ $tagarray = string_to_tag_array($tags_array[$key]);
+
+ //set title appropriately
+ if ($title_array[$key])
+ $image->title = $title_array[$key];
+ else
+ $image->title = substr($image->originalfilename, 0, strrpos($image->originalfilename, '.'));
+
+ //set description appropriately
+ $image->description = $caption_array[$key];
+
+ // Before we can set metadata, we need to save the image
+ if (!$image->save()) {
+ array_push($not_updated, $image->guid);
+ }
+
+ // Now let's add tags. We can pass an array directly to the object property! Easy.
+ $image->clearMetadata('tags');
+ if (is_array($tagarray)) {
+ $image->tags = $tagarray;
+ }
+
+ //if cover meta is sent from image save as metadata
+ if ($cover == $im) {
+ $album_entity->cover = $im;
+ }
+ }
+ }
+
+ // Success message
+ if (count($not_updated) > 0) {
+ register_error(elgg_echo("images:notedited"));
+ } else {
+ system_message(elgg_echo("images:edited"));
+ }
+
+ // Forward to the main album page
+ forward($album_entity->getURL());
+
?>
\ No newline at end of file
diff --git a/actions/imtest.php b/actions/imtest.php
index 8d5171785..cbe15a1c1 100644
--- a/actions/imtest.php
+++ b/actions/imtest.php
@@ -1,19 +1,19 @@
-
+
diff --git a/actions/settings.php b/actions/settings.php
index 6b115b049..e16e7960e 100644
--- a/actions/settings.php
+++ b/actions/settings.php
@@ -1,70 +1,70 @@
- $v) {
- if (!set_plugin_setting($k, $v, 'tidypics')) {
- register_error(sprintf(elgg_echo('plugins:settings:save:fail'), 'tidypics'));
- forward($_SERVER['HTTP_REFERER']);
- }
- }
-
- // check boxes
- if (is_array(get_input('download_link'))) // this can be done due to way Elgg uses checkboxes
- set_plugin_setting('download_link', 'enabled', 'tidypics');
- else
- set_plugin_setting('download_link', 'disabled', 'tidypics');
-
- if (is_array(get_input('tagging')))
- set_plugin_setting('tagging', 'enabled', 'tidypics');
- else
- set_plugin_setting('tagging', 'disabled', 'tidypics');
-
- if (is_array(get_input('photo_ratings')))
- set_plugin_setting('photo_ratings', 'enabled', 'tidypics');
- else
- set_plugin_setting('photo_ratings', 'disabled', 'tidypics');
-
- if (is_array(get_input('exif')))
- set_plugin_setting('exif', 'enabled', 'tidypics');
- else
- set_plugin_setting('exif', 'disabled', 'tidypics');
-
- if (is_array(get_input('view_count')))
- set_plugin_setting('view_count', 'enabled', 'tidypics');
- else
- set_plugin_setting('view_count', 'disabled', 'tidypics');
-
- if (is_array(get_input('grp_perm_override')))
- set_plugin_setting('grp_perm_override', 'enabled', 'tidypics');
- else
- set_plugin_setting('grp_perm_override', 'disabled', 'tidypics');
-
-
- // image sizes
- $image_sizes = array();
- $image_sizes['large_image_width'] = get_input('large_thumb_width');
- $image_sizes['large_image_height'] = get_input('large_thumb_height');
- $image_sizes['small_image_width'] = get_input('small_thumb_width');
- $image_sizes['small_image_height'] = get_input('small_thumb_height');
- $image_sizes['thumb_image_width'] = get_input('thumb_width');
- $image_sizes['thumb_image_height'] = get_input('thumb_height');
- set_plugin_setting('image_sizes', serialize($image_sizes), 'tidypics');
-
-
-
- system_message(elgg_echo('tidypics:settings:save:ok'));
-
- forward($_SERVER['HTTP_REFERER']);
-?>
+ $v) {
+ if (!set_plugin_setting($k, $v, 'tidypics')) {
+ register_error(sprintf(elgg_echo('plugins:settings:save:fail'), 'tidypics'));
+ forward($_SERVER['HTTP_REFERER']);
+ }
+ }
+
+ // check boxes
+ if (is_array(get_input('download_link'))) // this can be done due to way Elgg uses checkboxes
+ set_plugin_setting('download_link', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('download_link', 'disabled', 'tidypics');
+
+ if (is_array(get_input('tagging')))
+ set_plugin_setting('tagging', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('tagging', 'disabled', 'tidypics');
+
+ if (is_array(get_input('photo_ratings')))
+ set_plugin_setting('photo_ratings', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('photo_ratings', 'disabled', 'tidypics');
+
+ if (is_array(get_input('exif')))
+ set_plugin_setting('exif', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('exif', 'disabled', 'tidypics');
+
+ if (is_array(get_input('view_count')))
+ set_plugin_setting('view_count', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('view_count', 'disabled', 'tidypics');
+
+ if (is_array(get_input('grp_perm_override')))
+ set_plugin_setting('grp_perm_override', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('grp_perm_override', 'disabled', 'tidypics');
+
+
+ // image sizes
+ $image_sizes = array();
+ $image_sizes['large_image_width'] = get_input('large_thumb_width');
+ $image_sizes['large_image_height'] = get_input('large_thumb_height');
+ $image_sizes['small_image_width'] = get_input('small_thumb_width');
+ $image_sizes['small_image_height'] = get_input('small_thumb_height');
+ $image_sizes['thumb_image_width'] = get_input('thumb_width');
+ $image_sizes['thumb_image_height'] = get_input('thumb_height');
+ set_plugin_setting('image_sizes', serialize($image_sizes), 'tidypics');
+
+
+
+ system_message(elgg_echo('tidypics:settings:save:ok'));
+
+ forward($_SERVER['HTTP_REFERER']);
+?>
diff --git a/actions/upload.php b/actions/upload.php
index 3aa739414..0913ed937 100644
--- a/actions/upload.php
+++ b/actions/upload.php
@@ -1,255 +1,255 @@
-getGUID();
-
- $album = get_entity($container_guid);
-
- $maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
- if (!$maxfilesize)
- $maxfilesize = 5; // default to 5 MB if not set
- $maxfilesize = 1024 * 1024 * $maxfilesize; // convert to bytes from MBs
-
- $quota = get_plugin_setting('quota','tidypics');
- $quota = 1024 * 1024 * $quota;
- $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
- $image_repo_size = (int)$image_repo_size_md->value;
-
- $image_lib = get_plugin_setting('image_lib', 'tidypics');
- if (!$image_lib)
- $image_lib = "GD";
-
- // post limit exceeded
- if (count($_FILES) == 0) {
- trigger_error('Tidypics warning: user exceeded post limit on image upload', E_USER_WARNING);
- register_error(elgg_echo('tidypics:exceedpostlimit'));
- forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
- }
-
- // test to make sure at least 1 image was selected by user
- $num_images = 0;
- foreach($_FILES as $key => $sent_file) {
- if (!empty($sent_file['name']))
- $num_images++;
- }
- if ($num_images == 0) {
- // have user try again
- register_error(elgg_echo('tidypics:noimages'));
- forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
- }
-
- $uploaded_images = array();
- $not_uploaded = array();
- $error_msgs = array();
-
- $img_river_view = get_plugin_setting('img_river_view', 'tidypics');
-
- $accepted_formats = array(
- 'image/jpeg',
- 'image/png',
- 'image/gif',
- 'image/pjpeg',
- 'image/x-png',
- );
-
-
- foreach($_FILES as $key => $sent_file) {
-
- // skip empty entries
- if (empty($sent_file['name']))
- continue;
-
- $name = $sent_file['name'];
- $mime = $sent_file['type'];
-
- if ($sent_file['error']) {
- array_push($not_uploaded, $sent_file['name']);
- if ($sent_file['error'] == 1) {
- trigger_error('Tidypics warning: image exceed server php upload limit', E_USER_WARNING);
- array_push($error_msgs, elgg_echo('tidypics:image_mem'));
- }
- else {
- array_push($error_msgs, elgg_echo('tidypics:unk_error'));
- }
- continue;
- }
-
- //make sure file is an image
- if (!in_array($mime, $accepted_formats)) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:not_image'));
- continue;
- }
-
- // check quota
- if ($quota) {
- if ($image_repo_size + $sent_file['size'] > $quota) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:exceed_quota'));
- continue;
- }
- }
-
- // make sure file does not exceed memory limit
- if ($sent_file['size'] > $maxfilesize) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:image_mem'));
- continue;
- }
-
- // make sure the in memory image size does not exceed memory available - GD only
- $imginfo = getimagesize($sent_file['tmp_name']);
- $mem_avail = ini_get('memory_limit');
- $mem_avail = rtrim($mem_avail, 'M');
- $mem_avail = $mem_avail * 1024 * 1024;
- if ($image_lib == 'GD') {
- $mem_required = ceil(5.35 * $imginfo[0] * $imginfo[1]);
-
- $mem_used = memory_get_usage();
-
- $mem_avail = $mem_avail - $mem_used - 2097152; // 2 MB buffer
- if ($mem_required > $mem_avail) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:image_pixels'));
- trigger_error('Tidypics warning: image memory size too large for resizing so rejecting', E_USER_WARNING);
- continue;
- }
- } else if ($image_lib == 'ImageMagickPHP') {
- // haven't been able to determine a limit like there is for GD
- }
-
- //this will save to users folder in /image/ and organize by photo album
- $prefix = "image/" . $container_guid . "/";
- $file = new ElggFile();
- $filestorename = strtolower(time().$name);
- $file->setFilename($prefix.$filestorename);
- $file->setMimeType($mime);
- $file->originalfilename = $name;
- $file->subtype="image";
- $file->simpletype="image";
- $file->access_id = $access_id;
- if ($container_guid) {
- $file->container_guid = $container_guid;
- }
- $file->open("write");
- $file->write(get_uploaded_file($key));
- $file->close();
- $result = $file->save();
-
- if (!$result) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:save_error'));
- continue;
- }
-
- //get and store the exif data
- td_get_exif($file);
-
-
- // resize photos to create thumbnails
- if ($image_lib == 'ImageMagick') { // ImageMagick command line
-
- if (tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING);
- }
-
- } else if ($image_lib == 'ImageMagickPHP') { // imagick php extension
-
- if (tp_create_imagick_thumbnails($file, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING);
- }
-
- } else {
-
- if (tp_create_gd_thumbnails($file, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING);
- }
-
- } // end of image library selector
-
- //keep one file handy so we can add a notice to the river if single image option selected
- if(!$file_for_river) {
- $file_for_river = $file;
- }
-
- array_push($uploaded_images, $file->guid);
-
- // update user/group size for checking quota
- $image_repo_size += $sent_file['size'];
-
- // plugins can register to be told when a new image has been uploaded
- trigger_elgg_event('upload', 'tp_image', $file);
-
- // successful upload so check if this is a new album and throw river event/notification if so
- if ($album->new_album == TP_NEW_ALBUM) {
- $album->new_album = TP_OLD_ALBUM;
-
- // we throw the notification manually here so users are not told about the new album until there
- // is at least a few photos in it
- object_notifications('create', 'object', $album);
-
- if (function_exists('add_to_river'))
- add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid);
- }
-
- if ($img_river_view == "all") {
- add_to_river('river/object/image/create', 'create', $file->getObjectOwnerGUID(), $file->getGUID());
- }
- unset($file); // may not be needed but there seems to be a memory leak
-
- } //end of for loop
-
- if (count($not_uploaded) > 0) {
- if (count($uploaded_images) > 0)
- $error = sprintf(elgg_echo("tidypics:partialuploadfailure"), count($not_uploaded), count($not_uploaded) + count($uploaded_images)) . '
';
- else
- $error = elgg_echo("tidypics:completeuploadfailure") . '
';
-
- $num_failures = count($not_uploaded);
- for ($i = 0; $i < $num_failures; $i++) {
- $error .= "{$not_uploaded[$i]}: {$error_msgs[$i]}
";
- }
- register_error($error);
-
- if (count($uploaded_images) == 0)
- forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //upload failed, so forward to previous page
- else {
- // some images did upload so we fall through
- }
- } else {
- system_message(elgg_echo('tidypics:upl_success'));
- }
-
-
- if (count($uploaded_images) && $img_river_view == "1") {
- if (function_exists('add_to_river')) {
- add_to_river('river/object/image/create', 'create', $file_for_river->getObjectOwnerGUID(), $file_for_river->getGUID());
- }
- }
-
- // update image repo size
- create_metadata($album->container_guid, "image_repo_size", $image_repo_size, 'integer', $album->container_guid);
-
- // plugins can register to be told when a Tidypics album has had images added
- trigger_elgg_event('upload', 'tp_album', $album);
-
-
- //forward to multi-image edit page
- forward($CONFIG->wwwroot . 'mod/tidypics/pages/edit_multiple.php?files=' . implode('-', $uploaded_images));
-
-?>
+getGUID();
+
+ $album = get_entity($container_guid);
+
+ $maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
+ if (!$maxfilesize)
+ $maxfilesize = 5; // default to 5 MB if not set
+ $maxfilesize = 1024 * 1024 * $maxfilesize; // convert to bytes from MBs
+
+ $quota = get_plugin_setting('quota','tidypics');
+ $quota = 1024 * 1024 * $quota;
+ $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
+ $image_repo_size = (int)$image_repo_size_md->value;
+
+ $image_lib = get_plugin_setting('image_lib', 'tidypics');
+ if (!$image_lib)
+ $image_lib = "GD";
+
+ // post limit exceeded
+ if (count($_FILES) == 0) {
+ trigger_error('Tidypics warning: user exceeded post limit on image upload', E_USER_WARNING);
+ register_error(elgg_echo('tidypics:exceedpostlimit'));
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
+ }
+
+ // test to make sure at least 1 image was selected by user
+ $num_images = 0;
+ foreach($_FILES as $key => $sent_file) {
+ if (!empty($sent_file['name']))
+ $num_images++;
+ }
+ if ($num_images == 0) {
+ // have user try again
+ register_error(elgg_echo('tidypics:noimages'));
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
+ }
+
+ $uploaded_images = array();
+ $not_uploaded = array();
+ $error_msgs = array();
+
+ $img_river_view = get_plugin_setting('img_river_view', 'tidypics');
+
+ $accepted_formats = array(
+ 'image/jpeg',
+ 'image/png',
+ 'image/gif',
+ 'image/pjpeg',
+ 'image/x-png',
+ );
+
+
+ foreach($_FILES as $key => $sent_file) {
+
+ // skip empty entries
+ if (empty($sent_file['name']))
+ continue;
+
+ $name = $sent_file['name'];
+ $mime = $sent_file['type'];
+
+ if ($sent_file['error']) {
+ array_push($not_uploaded, $sent_file['name']);
+ if ($sent_file['error'] == 1) {
+ trigger_error('Tidypics warning: image exceed server php upload limit', E_USER_WARNING);
+ array_push($error_msgs, elgg_echo('tidypics:image_mem'));
+ }
+ else {
+ array_push($error_msgs, elgg_echo('tidypics:unk_error'));
+ }
+ continue;
+ }
+
+ //make sure file is an image
+ if (!in_array($mime, $accepted_formats)) {
+ array_push($not_uploaded, $sent_file['name']);
+ array_push($error_msgs, elgg_echo('tidypics:not_image'));
+ continue;
+ }
+
+ // check quota
+ if ($quota) {
+ if ($image_repo_size + $sent_file['size'] > $quota) {
+ array_push($not_uploaded, $sent_file['name']);
+ array_push($error_msgs, elgg_echo('tidypics:exceed_quota'));
+ continue;
+ }
+ }
+
+ // make sure file does not exceed memory limit
+ if ($sent_file['size'] > $maxfilesize) {
+ array_push($not_uploaded, $sent_file['name']);
+ array_push($error_msgs, elgg_echo('tidypics:image_mem'));
+ continue;
+ }
+
+ // make sure the in memory image size does not exceed memory available - GD only
+ $imginfo = getimagesize($sent_file['tmp_name']);
+ $mem_avail = ini_get('memory_limit');
+ $mem_avail = rtrim($mem_avail, 'M');
+ $mem_avail = $mem_avail * 1024 * 1024;
+ if ($image_lib == 'GD') {
+ $mem_required = ceil(5.35 * $imginfo[0] * $imginfo[1]);
+
+ $mem_used = memory_get_usage();
+
+ $mem_avail = $mem_avail - $mem_used - 2097152; // 2 MB buffer
+ if ($mem_required > $mem_avail) {
+ array_push($not_uploaded, $sent_file['name']);
+ array_push($error_msgs, elgg_echo('tidypics:image_pixels'));
+ trigger_error('Tidypics warning: image memory size too large for resizing so rejecting', E_USER_WARNING);
+ continue;
+ }
+ } else if ($image_lib == 'ImageMagickPHP') {
+ // haven't been able to determine a limit like there is for GD
+ }
+
+ //this will save to users folder in /image/ and organize by photo album
+ $prefix = "image/" . $container_guid . "/";
+ $file = new ElggFile();
+ $filestorename = strtolower(time().$name);
+ $file->setFilename($prefix.$filestorename);
+ $file->setMimeType($mime);
+ $file->originalfilename = $name;
+ $file->subtype="image";
+ $file->simpletype="image";
+ $file->access_id = $access_id;
+ if ($container_guid) {
+ $file->container_guid = $container_guid;
+ }
+ $file->open("write");
+ $file->write(get_uploaded_file($key));
+ $file->close();
+ $result = $file->save();
+
+ if (!$result) {
+ array_push($not_uploaded, $sent_file['name']);
+ array_push($error_msgs, elgg_echo('tidypics:save_error'));
+ continue;
+ }
+
+ //get and store the exif data
+ td_get_exif($file);
+
+
+ // resize photos to create thumbnails
+ if ($image_lib == 'ImageMagick') { // ImageMagick command line
+
+ if (tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING);
+ }
+
+ } else if ($image_lib == 'ImageMagickPHP') { // imagick php extension
+
+ if (tp_create_imagick_thumbnails($file, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING);
+ }
+
+ } else {
+
+ if (tp_create_gd_thumbnails($file, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING);
+ }
+
+ } // end of image library selector
+
+ //keep one file handy so we can add a notice to the river if single image option selected
+ if(!$file_for_river) {
+ $file_for_river = $file;
+ }
+
+ array_push($uploaded_images, $file->guid);
+
+ // update user/group size for checking quota
+ $image_repo_size += $sent_file['size'];
+
+ // plugins can register to be told when a new image has been uploaded
+ trigger_elgg_event('upload', 'tp_image', $file);
+
+ // successful upload so check if this is a new album and throw river event/notification if so
+ if ($album->new_album == TP_NEW_ALBUM) {
+ $album->new_album = TP_OLD_ALBUM;
+
+ // we throw the notification manually here so users are not told about the new album until there
+ // is at least a few photos in it
+ object_notifications('create', 'object', $album);
+
+ if (function_exists('add_to_river'))
+ add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid);
+ }
+
+ if ($img_river_view == "all") {
+ add_to_river('river/object/image/create', 'create', $file->getObjectOwnerGUID(), $file->getGUID());
+ }
+ unset($file); // may not be needed but there seems to be a memory leak
+
+ } //end of for loop
+
+ if (count($not_uploaded) > 0) {
+ if (count($uploaded_images) > 0)
+ $error = sprintf(elgg_echo("tidypics:partialuploadfailure"), count($not_uploaded), count($not_uploaded) + count($uploaded_images)) . '
';
+ else
+ $error = elgg_echo("tidypics:completeuploadfailure") . '
';
+
+ $num_failures = count($not_uploaded);
+ for ($i = 0; $i < $num_failures; $i++) {
+ $error .= "{$not_uploaded[$i]}: {$error_msgs[$i]}
";
+ }
+ register_error($error);
+
+ if (count($uploaded_images) == 0)
+ forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //upload failed, so forward to previous page
+ else {
+ // some images did upload so we fall through
+ }
+ } else {
+ system_message(elgg_echo('tidypics:upl_success'));
+ }
+
+
+ if (count($uploaded_images) && $img_river_view == "1") {
+ if (function_exists('add_to_river')) {
+ add_to_river('river/object/image/create', 'create', $file_for_river->getObjectOwnerGUID(), $file_for_river->getGUID());
+ }
+ }
+
+ // update image repo size
+ create_metadata($album->container_guid, "image_repo_size", $image_repo_size, 'integer', $album->container_guid);
+
+ // plugins can register to be told when a Tidypics album has had images added
+ trigger_elgg_event('upload', 'tp_album', $album);
+
+
+ //forward to multi-image edit page
+ forward($CONFIG->wwwroot . 'mod/tidypics/pages/edit_multiple.php?files=' . implode('-', $uploaded_images));
+
+?>
diff --git a/languages/en.php b/languages/en.php
index 87c431f75..7fa5f2e73 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -1,221 +1,221 @@
- "untitled",
-
- // Menu items and titles
-
- 'image' => "Image",
- 'images' => "Images",
- 'caption' => "Caption",
- 'photos' => "Photos",
- 'images:upload' => "Upload Images",
- 'images:multiupload' => "Flash Multi Upload Tool",
- 'images:multiupload:todo' => "Choose one or more files for upload.",
- 'album' => "Photo Album",
- 'albums' => "Photo Albums",
- 'album:slideshow' => "View slideshow",
- 'album:yours' => "Your photo albums",
- 'album:yours:friends' => "Your friends' photo albums",
- 'album:user' => "%s's photo albums",
- 'album:friends' => "%s's friends' photo albums",
- 'album:all' => "All site photo albums",
- 'album:group' => "Group albums",
- 'item:object:image' => "Photos",
- 'item:object:album' => "Albums",
- 'tidypics:uploading:images' => "Please wait. Uploading images.",
- 'tidypics:enablephotos' => 'Enable group photo albums',
- 'tidypics:editprops' => 'Edit Image Properties',
- 'tidypics:mostcommented' => 'Most commented images',
- 'tidypics:mostcommentedthismonth' => 'Most commented this month',
- 'tidypics:mostcommentedtoday' => 'Most commented today',
- 'tidypics:mostviewed' => 'Most viewed images',
- 'tidypics:mostvieweddashboard' => 'Most viewed dashboard',
- 'tidypics:mostviewedthisyear' => 'Most viewed this year',
- 'tidypics:mostviewedthismonth' => 'Most viewed this month',
- 'tidypics:mostviewedlastmonth' => 'Most viewed last month',
- 'tidypics:mostviewedtoday' => 'Most viewed today',
- 'tidypics:recentlyviewed' => 'Recently viewed images',
- 'tidypics:recentlycommented' => 'Recently commented images',
- 'tidypics:mostrecent' => 'Most recent images',
- 'tidypics:yourmostviewed' => 'Your most viewed images',
- 'tidypics:yourmostrecent' => 'Your most recent images',
- 'tidypics:friendmostviewed' => "%s's most viewed images",
- 'tidypics:friendmostrecent' => "%s's most recent images",
- 'tidypics:highestrated' => "Highest rated images",
- 'tidypics:views' => "Views: %s",
- 'tidypics:viewsbyowner' => "by %s users (not including you)",
- 'tidypics:viewsbyothers' => "(%s by you)",
- 'tidypics:administration' => 'Tidypics Administration',
- 'tidypics:stats' => 'Stats',
- 'flickr:setup' => 'Flickr Setup',
- 'flickr:usernamesetup' => 'Please enter your Flickr username here:',
- 'flickr:selectalbum' => 'Select album to import photos into',
- 'flickr:albumdesc' => 'Album to import photos to:',
- 'flickr:importmanager' => 'Photoset Import Manager',
- 'flickr:desc' => 'Click on the set you wish to import into this site.
Copies of the photos will be made and stored on this site where they can be viewed and commented on.',
- 'flickr:intro' => 'Flickr Integration allows you to import photos from your flickr account into this Elgg site. By entering your username and choosing an album to import into, you can begin the process.
When you have saved your username and album selection, click on the ' . elgg_echo( 'flickr:menuimport' ) . ' link to the left to select which Flickr set you would like to import photos from.',
- 'flickr:menusetup' => 'Flickr Setup',
- 'flickr:menuimport' => 'Import Flickr Photos',
-
- //settings
- 'tidypics:settings' => 'Settings',
- 'tidypics:admin:instructions' => 'These are the core Tidypics settings. Change them for your setup and then click save.',
- 'tidypics:settings:image_lib' => "Image Library",
- 'tidypics:settings:thumbnail' => "Thumbnail Creation",
- 'tidypics:settings:help' => "Help",
- 'tidypics:settings:download_link' => "Show download link",
- 'tidypics:settings:tagging' => "Enable photo tagging",
- 'tidypics:settings:photo_ratings' => "Enable photo ratings (requires rate plugin of Miguel Montes or compatible)",
- 'tidypics:settings:exif' => "Show EXIF data",
- 'tidypics:settings:view_count' => "View counter",
- 'tidypics:settings:grp_perm_override' => "Allow group members full access to group albums",
- 'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):",
- 'tidypics:settings:quota' => "User/Group Quota (MB) - 0 equals no quota",
- 'tidypics:settings:watermark' => "Enter text to appear in the watermark - not for production sites yet",
- 'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands (with trailing slash)",
- 'tidypics:settings:img_river_view' => "How many entries in river for each batch of uploaded images",
- 'tidypics:settings:album_river_view' => "Show the album cover or a set of photos for new album",
- 'tidypics:settings:largesize' => "Primary image size",
- 'tidypics:settings:smallsize' => "Album view image size",
- 'tidypics:settings:thumbsize' => "Thumbnail image size",
- 'tidypics:settings:im_id' => "Image ID",
-
- //actions
-
- 'album:create' => "Create new album",
- 'album:add' => "Add Photo Album",
- 'album:addpix' => "Add photos to album",
- 'album:edit' => "Edit album",
- 'album:delete' => "Delete album",
-
- 'image:edit' => "Edit image",
- 'image:delete' => "Delete image",
- 'image:download' => "Download image",
-
- //forms
-
- 'album:title' => "Title",
- 'album:desc' => "Description",
- 'album:tags' => "Tags",
- 'album:cover' => "Make image album cover?",
- 'tidypics:quota' => "Quota usage:",
-
- //views
-
- 'image:total' => "Images in album:",
- 'image:by' => "Image added by",
- 'album:by' => "Album created by",
- 'album:created:on' => "Created",
- 'image:none' => "No images have been added yet.",
- 'image:back' => "Previous",
- 'image:next' => "Next",
-
- // tagging
- 'tidypics:taginstruct' => 'Select area that you want to tag',
- 'tidypics:deltag_title' => 'Select tags to delete',
- 'tidypics:finish_tagging' => 'Stop tagging',
- 'tidypics:tagthisphoto' => 'Tag this photo',
- 'tidypics:deletetag' => 'Delete a photo tag',
- 'tidypics:actiontag' => 'Tag',
- 'tidypics:actiondelete' => 'Delete',
- 'tidypics:actioncancel' => 'Cancel',
- 'tidypics:inthisphoto' => 'In this photo',
- 'tidypics:usertag' => "Photos tagged with user %s",
- 'tidypics:phototagging:success' => 'Photo tag was successfully added',
- 'tidypics:phototagging:error' => 'Unexpected error occurred during tagging',
- 'tidypics:deletetag:success' => 'Selected tags were successfully deleted',
-
- 'tidypics:tag:subject' => "You have been tagged in a photo",
- 'tidypics:tag:body' => "You have been tagged in the photo %s by %s.
-
-The photo can be viewed here: %s",
-
-
- //rss
- 'tidypics:posted' => 'posted a photo:',
-
- //widgets
-
- 'tidypics:widget:albums' => "Photo Albums",
- 'tidypics:widget:album_descr' => "Showcase your photo albums",
- 'tidypics:widget:num_albums' => "Number of albums to display",
- 'tidypics:widget:latest' => "Latest Photos",
- 'tidypics:widget:latest_descr' => "Display your latest photos",
- 'tidypics:widget:num_latest' => "Number of images to display",
- 'album:more' => "View all albums",
-
- // river
-
- //images
- 'image:river:created' => "%s added the photo %s to album %s",
- 'image:river:item' => "an photo",
- 'image:river:annotate' => "a comment on the photo",
- 'image:river:tagged' => "was tagged in the photo",
-
- //albums
- 'album:river:created' => "%s created a new photo album",
- 'album:river:group' => "in the group",
- 'album:river:item' => "an album",
- 'album:river:annotate' => "a comment on the photo album",
-
- // notifications
- 'tidypics:newalbum' => 'New photo album',
-
-
- // Status messages
-
- 'tidypics:upl_success' => "Your images uploaded successfully.",
- 'image:saved' => "Your image was successfully saved.",
- 'images:saved' => "All images were successfully saved.",
- 'image:deleted' => "Your image was successfully deleted.",
- 'image:delete:confirm' => "Are you sure you want to delete this image?",
-
- 'images:edited' => "Your images were successfully updated.",
- 'album:edited' => "Your album was successfully updated.",
- 'album:saved' => "Your album was successfully saved.",
- 'album:deleted' => "Your album was successfully deleted.",
- 'album:delete:confirm' => "Are you sure you want to delete this album?",
- 'album:created' => "Your new album has been created.",
- 'tidypics:settings:save:ok' => 'Successfully saved the Tidypics plugin settings',
-
- 'tidypics:upgrade:success' => 'Upgrade of Tidypics a success',
-
- 'flickr:enterusername' => 'You must enter a username',
- 'flickr:savedusername' => 'Successfully saved username of %s',
- 'flickr:saveduserid' => 'Successfully saved userid of %s',
- 'flickr:savedalbum' => 'Album saved - %s',
-
- //Error messages
-
- 'tidypics:partialuploadfailure' => "There were errors uploading some of the images (%s of %s images).",
- 'tidypics:completeuploadfailure' => "Upload of images failed.",
- 'tidypics:exceedpostlimit' => "Too many large images - try to upload fewer or smaller images.",
- 'tidypics:noimages' => "No images were selected.",
- 'tidypics:image_mem' => "Image is too large - too many bytes",
- 'tidypics:image_pixels' => "Image has too many pixels",
- 'tidypics:unk_error' => "Unknown upload error",
- 'tidypics:save_error' => "Unknown error saving the image on server",
- 'tidypics:not_image' => "This is not a recognized image type",
- 'image:deletefailed' => "Your image could not be deleted at this time.",
- 'image:downloadfailed' => "Sorry; this image is not available at this time.",
- 'tidypics:nosettings' => "Admin of this site has not set photo album settings.",
- 'tidypics:exceed_quota' => "You have exceeded the quota set by the administrator",
- 'images:notedited' => "Not all images were successfully updated",
-
- 'album:none' => "No albums have been created yet.",
- 'album:uploadfailed' => "Sorry; we could not save your album.",
- 'album:deletefailed' => "Your album could not be deleted at this time.",
- 'album:blank' => "Please give this album a title and description.",
-
- 'tidypics:upgrade:failed' => "The upgrade of Tidypics failed",
-
- 'flickr:errorusername' => 'Username %s not found on Flickr',
- 'flickr:errorusername2' => 'You must enter a username',
- 'flickr:errorimageimport' => 'This image has already been imported',
- 'flickr:errornoalbum' => "No album selected. Please choose and save an album: %s"
- );
-
- add_translation("en",$english);
+ "untitled",
+
+ // Menu items and titles
+
+ 'image' => "Image",
+ 'images' => "Images",
+ 'caption' => "Caption",
+ 'photos' => "Photos",
+ 'images:upload' => "Upload Images",
+ 'images:multiupload' => "Flash Multi Upload Tool",
+ 'images:multiupload:todo' => "Choose one or more files for upload.",
+ 'album' => "Photo Album",
+ 'albums' => "Photo Albums",
+ 'album:slideshow' => "View slideshow",
+ 'album:yours' => "Your photo albums",
+ 'album:yours:friends' => "Your friends' photo albums",
+ 'album:user' => "%s's photo albums",
+ 'album:friends' => "%s's friends' photo albums",
+ 'album:all' => "All site photo albums",
+ 'album:group' => "Group albums",
+ 'item:object:image' => "Photos",
+ 'item:object:album' => "Albums",
+ 'tidypics:uploading:images' => "Please wait. Uploading images.",
+ 'tidypics:enablephotos' => 'Enable group photo albums',
+ 'tidypics:editprops' => 'Edit Image Properties',
+ 'tidypics:mostcommented' => 'Most commented images',
+ 'tidypics:mostcommentedthismonth' => 'Most commented this month',
+ 'tidypics:mostcommentedtoday' => 'Most commented today',
+ 'tidypics:mostviewed' => 'Most viewed images',
+ 'tidypics:mostvieweddashboard' => 'Most viewed dashboard',
+ 'tidypics:mostviewedthisyear' => 'Most viewed this year',
+ 'tidypics:mostviewedthismonth' => 'Most viewed this month',
+ 'tidypics:mostviewedlastmonth' => 'Most viewed last month',
+ 'tidypics:mostviewedtoday' => 'Most viewed today',
+ 'tidypics:recentlyviewed' => 'Recently viewed images',
+ 'tidypics:recentlycommented' => 'Recently commented images',
+ 'tidypics:mostrecent' => 'Most recent images',
+ 'tidypics:yourmostviewed' => 'Your most viewed images',
+ 'tidypics:yourmostrecent' => 'Your most recent images',
+ 'tidypics:friendmostviewed' => "%s's most viewed images",
+ 'tidypics:friendmostrecent' => "%s's most recent images",
+ 'tidypics:highestrated' => "Highest rated images",
+ 'tidypics:views' => "Views: %s",
+ 'tidypics:viewsbyowner' => "by %s users (not including you)",
+ 'tidypics:viewsbyothers' => "(%s by you)",
+ 'tidypics:administration' => 'Tidypics Administration',
+ 'tidypics:stats' => 'Stats',
+ 'flickr:setup' => 'Flickr Setup',
+ 'flickr:usernamesetup' => 'Please enter your Flickr username here:',
+ 'flickr:selectalbum' => 'Select album to import photos into',
+ 'flickr:albumdesc' => 'Album to import photos to:',
+ 'flickr:importmanager' => 'Photoset Import Manager',
+ 'flickr:desc' => 'Click on the set you wish to import into this site.
Copies of the photos will be made and stored on this site where they can be viewed and commented on.',
+ 'flickr:intro' => 'Flickr Integration allows you to import photos from your flickr account into this Elgg site. By entering your username and choosing an album to import into, you can begin the process.
When you have saved your username and album selection, click on the ' . elgg_echo( 'flickr:menuimport' ) . ' link to the left to select which Flickr set you would like to import photos from.',
+ 'flickr:menusetup' => 'Flickr Setup',
+ 'flickr:menuimport' => 'Import Flickr Photos',
+
+ //settings
+ 'tidypics:settings' => 'Settings',
+ 'tidypics:admin:instructions' => 'These are the core Tidypics settings. Change them for your setup and then click save.',
+ 'tidypics:settings:image_lib' => "Image Library",
+ 'tidypics:settings:thumbnail' => "Thumbnail Creation",
+ 'tidypics:settings:help' => "Help",
+ 'tidypics:settings:download_link' => "Show download link",
+ 'tidypics:settings:tagging' => "Enable photo tagging",
+ 'tidypics:settings:photo_ratings' => "Enable photo ratings (requires rate plugin of Miguel Montes or compatible)",
+ 'tidypics:settings:exif' => "Show EXIF data",
+ 'tidypics:settings:view_count' => "View counter",
+ 'tidypics:settings:grp_perm_override' => "Allow group members full access to group albums",
+ 'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):",
+ 'tidypics:settings:quota' => "User/Group Quota (MB) - 0 equals no quota",
+ 'tidypics:settings:watermark' => "Enter text to appear in the watermark - not for production sites yet",
+ 'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands (with trailing slash)",
+ 'tidypics:settings:img_river_view' => "How many entries in river for each batch of uploaded images",
+ 'tidypics:settings:album_river_view' => "Show the album cover or a set of photos for new album",
+ 'tidypics:settings:largesize' => "Primary image size",
+ 'tidypics:settings:smallsize' => "Album view image size",
+ 'tidypics:settings:thumbsize' => "Thumbnail image size",
+ 'tidypics:settings:im_id' => "Image ID",
+
+ //actions
+
+ 'album:create' => "Create new album",
+ 'album:add' => "Add Photo Album",
+ 'album:addpix' => "Add photos to album",
+ 'album:edit' => "Edit album",
+ 'album:delete' => "Delete album",
+
+ 'image:edit' => "Edit image",
+ 'image:delete' => "Delete image",
+ 'image:download' => "Download image",
+
+ //forms
+
+ 'album:title' => "Title",
+ 'album:desc' => "Description",
+ 'album:tags' => "Tags",
+ 'album:cover' => "Make image album cover?",
+ 'tidypics:quota' => "Quota usage:",
+
+ //views
+
+ 'image:total' => "Images in album:",
+ 'image:by' => "Image added by",
+ 'album:by' => "Album created by",
+ 'album:created:on' => "Created",
+ 'image:none' => "No images have been added yet.",
+ 'image:back' => "Previous",
+ 'image:next' => "Next",
+
+ // tagging
+ 'tidypics:taginstruct' => 'Select area that you want to tag',
+ 'tidypics:deltag_title' => 'Select tags to delete',
+ 'tidypics:finish_tagging' => 'Stop tagging',
+ 'tidypics:tagthisphoto' => 'Tag this photo',
+ 'tidypics:deletetag' => 'Delete a photo tag',
+ 'tidypics:actiontag' => 'Tag',
+ 'tidypics:actiondelete' => 'Delete',
+ 'tidypics:actioncancel' => 'Cancel',
+ 'tidypics:inthisphoto' => 'In this photo',
+ 'tidypics:usertag' => "Photos tagged with user %s",
+ 'tidypics:phototagging:success' => 'Photo tag was successfully added',
+ 'tidypics:phototagging:error' => 'Unexpected error occurred during tagging',
+ 'tidypics:deletetag:success' => 'Selected tags were successfully deleted',
+
+ 'tidypics:tag:subject' => "You have been tagged in a photo",
+ 'tidypics:tag:body' => "You have been tagged in the photo %s by %s.
+
+The photo can be viewed here: %s",
+
+
+ //rss
+ 'tidypics:posted' => 'posted a photo:',
+
+ //widgets
+
+ 'tidypics:widget:albums' => "Photo Albums",
+ 'tidypics:widget:album_descr' => "Showcase your photo albums",
+ 'tidypics:widget:num_albums' => "Number of albums to display",
+ 'tidypics:widget:latest' => "Latest Photos",
+ 'tidypics:widget:latest_descr' => "Display your latest photos",
+ 'tidypics:widget:num_latest' => "Number of images to display",
+ 'album:more' => "View all albums",
+
+ // river
+
+ //images
+ 'image:river:created' => "%s added the photo %s to album %s",
+ 'image:river:item' => "an photo",
+ 'image:river:annotate' => "a comment on the photo",
+ 'image:river:tagged' => "was tagged in the photo",
+
+ //albums
+ 'album:river:created' => "%s created a new photo album",
+ 'album:river:group' => "in the group",
+ 'album:river:item' => "an album",
+ 'album:river:annotate' => "a comment on the photo album",
+
+ // notifications
+ 'tidypics:newalbum' => 'New photo album',
+
+
+ // Status messages
+
+ 'tidypics:upl_success' => "Your images uploaded successfully.",
+ 'image:saved' => "Your image was successfully saved.",
+ 'images:saved' => "All images were successfully saved.",
+ 'image:deleted' => "Your image was successfully deleted.",
+ 'image:delete:confirm' => "Are you sure you want to delete this image?",
+
+ 'images:edited' => "Your images were successfully updated.",
+ 'album:edited' => "Your album was successfully updated.",
+ 'album:saved' => "Your album was successfully saved.",
+ 'album:deleted' => "Your album was successfully deleted.",
+ 'album:delete:confirm' => "Are you sure you want to delete this album?",
+ 'album:created' => "Your new album has been created.",
+ 'tidypics:settings:save:ok' => 'Successfully saved the Tidypics plugin settings',
+
+ 'tidypics:upgrade:success' => 'Upgrade of Tidypics a success',
+
+ 'flickr:enterusername' => 'You must enter a username',
+ 'flickr:savedusername' => 'Successfully saved username of %s',
+ 'flickr:saveduserid' => 'Successfully saved userid of %s',
+ 'flickr:savedalbum' => 'Album saved - %s',
+
+ //Error messages
+
+ 'tidypics:partialuploadfailure' => "There were errors uploading some of the images (%s of %s images).",
+ 'tidypics:completeuploadfailure' => "Upload of images failed.",
+ 'tidypics:exceedpostlimit' => "Too many large images - try to upload fewer or smaller images.",
+ 'tidypics:noimages' => "No images were selected.",
+ 'tidypics:image_mem' => "Image is too large - too many bytes",
+ 'tidypics:image_pixels' => "Image has too many pixels",
+ 'tidypics:unk_error' => "Unknown upload error",
+ 'tidypics:save_error' => "Unknown error saving the image on server",
+ 'tidypics:not_image' => "This is not a recognized image type",
+ 'image:deletefailed' => "Your image could not be deleted at this time.",
+ 'image:downloadfailed' => "Sorry; this image is not available at this time.",
+ 'tidypics:nosettings' => "Admin of this site has not set photo album settings.",
+ 'tidypics:exceed_quota' => "You have exceeded the quota set by the administrator",
+ 'images:notedited' => "Not all images were successfully updated",
+
+ 'album:none' => "No albums have been created yet.",
+ 'album:uploadfailed' => "Sorry; we could not save your album.",
+ 'album:deletefailed' => "Your album could not be deleted at this time.",
+ 'album:blank' => "Please give this album a title and description.",
+
+ 'tidypics:upgrade:failed' => "The upgrade of Tidypics failed",
+
+ 'flickr:errorusername' => 'Username %s not found on Flickr',
+ 'flickr:errorusername2' => 'You must enter a username',
+ 'flickr:errorimageimport' => 'This image has already been imported',
+ 'flickr:errornoalbum' => "No album selected. Please choose and save an album: %s"
+ );
+
+ add_translation("en",$english);
?>
\ No newline at end of file
diff --git a/lib/resize.php b/lib/resize.php
index 7885a52df..c35eb09ea 100644
--- a/lib/resize.php
+++ b/lib/resize.php
@@ -1,547 +1,547 @@
-owner_guid = $file->owner_guid;
- $thumb->container_guid = $file->container_guid;
-
- // tiny thumbail
- $thumb->setFilename($prefix."thumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- false,
- $image_sizes['thumb_image_width'],
- $image_sizes['thumb_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->thumbnail = $prefix."thumb".$filestorename;
-
-
- // album thumbnail
- $thumb->setFilename($prefix."smallthumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- false,
- $image_sizes['small_image_width'],
- $image_sizes['small_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->smallthumb = $prefix."smallthumb".$filestorename;
-
-
- // main image
- $thumb->setFilename($prefix."largethumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- true,
- $image_sizes['large_image_width'],
- $image_sizes['large_image_height'],
- false);
- if (!$rtn_code)
- return false;
- $file->largethumb = $prefix."largethumb".$filestorename;
-
-
- unset($thumb);
-
- return true;
- }
-
- /**
- * Writes resized version of an already uploaded image - original from Elgg filestore.php
- * Saves it in the same format as uploaded
- *
- * @param string $input_name The name of the file on the disk
- * @param string $output_name The name of the file to be written
- * @param bool - watermark this image?
- * @param int $maxwidth The maximum width of the resized image
- * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
- * @return bool true on success or false on failure
- */
- function tp_gd_resize($input_name, $output_name, $watermark, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
-
- // Get the size information from the image
- $imgsizearray = getimagesize($input_name);
- if (!imgsizearray)
- return false;
-
- // Get width and height
- $width = $imgsizearray[0];
- $height = $imgsizearray[1];
- $newwidth = $width;
- $newheight = $height;
-
- // Square the image dimensions if we're wanting a square image
- if ($square) {
- if ($width < $height) {
- $height = $width;
- } else {
- $width = $height;
- }
-
- $newwidth = $width;
- $newheight = $height;
-
- }
-
- if ($width > $maxwidth) {
- $newheight = floor($height * ($maxwidth / $width));
- $newwidth = $maxwidth;
- }
- if ($newheight > $maxheight) {
- $newwidth = floor($newwidth * ($maxheight / $newheight));
- $newheight = $maxheight;
- }
-
- $accepted_formats = array(
- 'image/jpeg' => 'jpeg',
- 'image/pjpeg' => 'jpeg',
- 'image/png' => 'png',
- 'image/x-png' => 'png',
- 'image/gif' => 'gif'
- );
-
- // make sure the function is available
- $function = "imagecreatefrom" . $accepted_formats[$imgsizearray['mime']];
- if (!is_callable($function))
- return false;
-
-
- // load old image
- $oldimage = $function($input_name);
- if (!$oldimage)
- return false;
-
- // allocate the new image
- $newimage = imagecreatetruecolor($newwidth, $newheight);
- if (!$newimage)
- return false;
-
- // Crop the image if we need a square
- if ($square) {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = floor(($imgsizearray[0] - $width) / 2);
- $heightoffset = floor(($imgsizearray[1] - $height) / 2);
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = $width;
- }
- } else {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = 0;
- $heightoffset = 0;
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = ($y2 - $y1);
- }
- }
-
- if ($square) {
- $newheight = $maxheight;
- $newwidth = $maxwidth;
- }
-
- $rtn_code = imagecopyresampled($newimage, $oldimage, 0,0,$widthoffset,$heightoffset,$newwidth,$newheight,$width,$height);
- if (!rtn_code)
- return $rtn_code;
-
- if ($watermark)
- tp_gd_watermark($newimage);
-
- switch ($imgsizearray['mime']) {
- case 'image/jpeg':
- case 'image/pjpeg':
- $rtn_code = imagejpeg($newimage, $output_name, 85);
- break;
- case 'image/png':
- case 'image/x-png':
- $rtn_code = imagepng($newimage, $output_name);
- break;
- case 'image/gif':
- $rtn_code = imagegif($newimage, $output_name);
- break;
- }
-
- imagedestroy($newimage);
- imagedestroy($oldimage);
-
- return $rtn_code;
- }
-
-
- /**
- * Create thumbnails using PHP imagick extension
- *
- * @param ElggFile holds the image that was uploaded
- * @param string folder to store thumbnail in
- * @param string name of the thumbnail
- * @return bool true on success
- */
- function tp_create_imagick_thumbnails($file, $prefix, $filestorename)
- {
- $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
- if (!$image_sizes) {
- register_error(elgg_echo('tidypics:nosettings'));
- return false;
- }
- $image_sizes = unserialize($image_sizes);
-
- $thumb = new ElggFile();
- $thumb->owner_guid = $file->owner_guid;
- $thumb->container_guid = $file->container_guid;
-
- // tiny thumbnail
- $thumb->setFilename($prefix."thumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['thumb_image_width'],
- $image_sizes['thumb_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->thumbnail = $prefix."thumb".$filestorename;
-
-
- // album thumbnail
- $thumb->setFilename($prefix."smallthumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['small_image_width'],
- $image_sizes['small_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->smallthumb = $prefix."smallthumb".$filestorename;
-
-
- // main image
- $thumb->setFilename($prefix."largethumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['large_image_width'],
- $image_sizes['large_image_height'],
- false);
- if (!$rtn_code)
- return false;
- $file->largethumb = $prefix."largethumb".$filestorename;
-
- tp_imagick_watermark($thumbname);
-
- unset($thumb);
-
- return true;
- }
-
-
- /**
- * Resize using PHP imagick extension
- *
- * Writes resized version of an already uploaded image
- *
- *
- * @param string $input_name The name of the file input field on the submission form
- * @param string $output_name The name of the file to be written
- * @param int $maxwidth The maximum width of the resized image
- * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
- * @return bool true on success
- */
- function tp_imagick_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
-
- // Get the size information from the image
- $imgsizearray = getimagesize($input_name);
- if (!$imgsizearray)
- return false;
-
-
- // Get width and height
- $width = $imgsizearray[0];
- $height = $imgsizearray[1];
- $newwidth = $width;
- $newheight = $height;
-
- // initial guess at final dimensions for new image (doesn't check for squareness yet
- if ($newwidth > $maxwidth) {
- $newheight = floor($newheight * ($maxwidth / $newwidth));
- $newwidth = $maxwidth;
- }
- if ($newheight > $maxheight) {
- $newwidth = floor($newwidth * ($maxheight / $newheight));
- $newheight = $maxheight;
- }
-
- // Handle squareness for both original and new image
- if ($square) {
- if ($width < $height) {
- $height = $width;
- } else {
- $width = $height;
- }
-
- if ($maxheight == $maxwidth) {
- // if input arguments = square, no need to use above calculations (which can have round-off errors)
- $newwidth = $maxwidth;
- $newheight = $maxheight;
- } else {
- if ($newwidth < $newheight) {
- $newheight = $newwidth;
- } else {
- $newwidth = $newheight;
- }
- }
- }
-
-
- // Crop the original image - this needs to be checked over
- if ($square) {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $xoffset = floor(($imgsizearray[0] - $width) / 2);
- $yoffset = floor(($imgsizearray[1] - $height) / 2);
- } else { // assume we're being passed good croping coordinates
- $xoffset = $x1;
- $yoffset = $y1;
- $width = ($x2 - $x1);
- $height = $width;
- }
- } else {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $xoffset = 0;
- $yoffset = 0;
- } else {
- $xoffset = $x1;
- $yoffset = $y1;
- $width = ($x2 - $x1);
- $height = ($y2 - $y1);
- }
- }
-
-
- try {
- $img = new Imagick($input_name);
- } catch (ImagickException $e) {
- return false;
- }
-
- $img->cropImage($width, $height, $xoffset, $yoffset);
-
- // use the default IM filter (windowing filter), I think 1 means default blurring or number of lobes
- $img->resizeImage($newwidth, $newheight, imagick::FILTER_LANCZOS, 1);
- $img->setImagePage($newwidth, $newheight, 0, 0);
-
- if ($img->writeImage($output_name) != true) {
- $img->destroy();
- return false;
- }
-
- $img->destroy();
-
- return true;
- }
-
- /**
- * Create thumbnails using ImageMagick executables
- *
- * @param ElggFile holds the image that was uploaded
- * @param string folder to store thumbnail in
- * @param string name of the thumbnail
- * @return bool true on success
- */
- function tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename)
- {
- $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
- if (!$image_sizes) {
- register_error(elgg_echo('tidypics:nosettings'));
- return false;
- }
- $image_sizes = unserialize($image_sizes);
-
- $thumb = new ElggFile();
- $thumb->owner_guid = $file->owner_guid;
- $thumb->container_guid = $file->container_guid;
-
- // tiny thumbnail
- $thumb->setFilename($prefix."thumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['thumb_image_width'],
- $image_sizes['thumb_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->thumbnail = $prefix."thumb".$filestorename;
-
-
- // album thumbnail
- $thumb->setFilename($prefix."smallthumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['small_image_width'],
- $image_sizes['small_image_height'],
- true);
- if (!$rtn_code)
- return false;
- $file->smallthumb = $prefix."smallthumb".$filestorename;
-
-
- // main image
- $thumb->setFilename($prefix."largethumb".$filestorename);
- $thumbname = $thumb->getFilenameOnFilestore();
- $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
- $thumbname,
- $image_sizes['large_image_width'],
- $image_sizes['large_image_height'],
- false);
- if (!$rtn_code)
- return false;
- $file->largethumb = $prefix."largethumb".$filestorename;
-
-
- tp_im_cmdline_watermark($thumbname);
-
-
-
- unset($thumb);
-
- return true;
- }
-
- /*
- * Gets the jpeg contents of the resized version of an already uploaded image
- * (Returns false if the uploaded file was not an image)
- *
- * @param string $input_name The name of the file input field on the submission form
- * @param string $output_name The name of the file to be written
- * @param int $maxwidth The maximum width of the resized image
- * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
- * @return bool
- */
- function tp_im_cmdline_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
-
-
- // Get the size information from the image
- if ($imgsizearray = getimagesize($input_name)) {
-
- // Get width and height
- $width = $imgsizearray[0];
- $height = $imgsizearray[1];
- $newwidth = $width;
- $newheight = $height;
-
- // Square the image dimensions if we're wanting a square image
- if ($square) {
- if ($width < $height) {
- $height = $width;
- } else {
- $width = $height;
- }
-
- $newwidth = $width;
- $newheight = $height;
-
- }
-
- if ($width > $maxwidth) {
- $newheight = floor($height * ($maxwidth / $width));
- $newwidth = $maxwidth;
- }
- if ($newheight > $maxheight) {
- $newwidth = floor($newwidth * ($maxheight / $newheight));
- $newheight = $maxheight;
- }
-
- $accepted_formats = array(
- 'image/jpeg' => 'jpeg',
- 'image/pjpeg' => 'jpeg',
- 'image/png' => 'png',
- 'image/x-png' => 'png',
- 'image/gif' => 'gif'
- );
- // If it's a file we can manipulate ...
- if (array_key_exists($imgsizearray['mime'],$accepted_formats)) {
-
- // Crop the image if we need a square
- if ($square) {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = floor(($imgsizearray[0] - $width) / 2);
- $heightoffset = floor(($imgsizearray[1] - $height) / 2);
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = $width;
- }
- } else {
- if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
- $widthoffset = 0;
- $heightoffset = 0;
- } else {
- $widthoffset = $x1;
- $heightoffset = $y1;
- $width = ($x2 - $x1);
- $height = ($y2 - $y1);
- }
- }
-
- // Resize and return the image contents!
- if ($square) {
- $newheight = $maxheight;
- $newwidth = $maxwidth;
- }
- $im_path = get_plugin_setting('im_path', 'tidypics');
- if(!$im_path) {
- $im_path = "/usr/bin/";
- }
- if(substr($im_path, strlen($im_path)-1, 1) != "/") $im_path .= "/";
- $command = $im_path . "convert \"$input_name\" -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";
- exec($command);
- return true;
-
- }
- }
-
- return false;
- }
-
+owner_guid = $file->owner_guid;
+ $thumb->container_guid = $file->container_guid;
+
+ // tiny thumbail
+ $thumb->setFilename($prefix."thumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ false,
+ $image_sizes['thumb_image_width'],
+ $image_sizes['thumb_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->thumbnail = $prefix."thumb".$filestorename;
+
+
+ // album thumbnail
+ $thumb->setFilename($prefix."smallthumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ false,
+ $image_sizes['small_image_width'],
+ $image_sizes['small_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->smallthumb = $prefix."smallthumb".$filestorename;
+
+
+ // main image
+ $thumb->setFilename($prefix."largethumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_gd_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ true,
+ $image_sizes['large_image_width'],
+ $image_sizes['large_image_height'],
+ false);
+ if (!$rtn_code)
+ return false;
+ $file->largethumb = $prefix."largethumb".$filestorename;
+
+
+ unset($thumb);
+
+ return true;
+ }
+
+ /**
+ * Writes resized version of an already uploaded image - original from Elgg filestore.php
+ * Saves it in the same format as uploaded
+ *
+ * @param string $input_name The name of the file on the disk
+ * @param string $output_name The name of the file to be written
+ * @param bool - watermark this image?
+ * @param int $maxwidth The maximum width of the resized image
+ * @param int $maxheight The maximum height of the resized image
+ * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
+ * @return bool true on success or false on failure
+ */
+ function tp_gd_resize($input_name, $output_name, $watermark, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
+
+ // Get the size information from the image
+ $imgsizearray = getimagesize($input_name);
+ if (!imgsizearray)
+ return false;
+
+ // Get width and height
+ $width = $imgsizearray[0];
+ $height = $imgsizearray[1];
+ $newwidth = $width;
+ $newheight = $height;
+
+ // Square the image dimensions if we're wanting a square image
+ if ($square) {
+ if ($width < $height) {
+ $height = $width;
+ } else {
+ $width = $height;
+ }
+
+ $newwidth = $width;
+ $newheight = $height;
+
+ }
+
+ if ($width > $maxwidth) {
+ $newheight = floor($height * ($maxwidth / $width));
+ $newwidth = $maxwidth;
+ }
+ if ($newheight > $maxheight) {
+ $newwidth = floor($newwidth * ($maxheight / $newheight));
+ $newheight = $maxheight;
+ }
+
+ $accepted_formats = array(
+ 'image/jpeg' => 'jpeg',
+ 'image/pjpeg' => 'jpeg',
+ 'image/png' => 'png',
+ 'image/x-png' => 'png',
+ 'image/gif' => 'gif'
+ );
+
+ // make sure the function is available
+ $function = "imagecreatefrom" . $accepted_formats[$imgsizearray['mime']];
+ if (!is_callable($function))
+ return false;
+
+
+ // load old image
+ $oldimage = $function($input_name);
+ if (!$oldimage)
+ return false;
+
+ // allocate the new image
+ $newimage = imagecreatetruecolor($newwidth, $newheight);
+ if (!$newimage)
+ return false;
+
+ // Crop the image if we need a square
+ if ($square) {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $widthoffset = floor(($imgsizearray[0] - $width) / 2);
+ $heightoffset = floor(($imgsizearray[1] - $height) / 2);
+ } else {
+ $widthoffset = $x1;
+ $heightoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = $width;
+ }
+ } else {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $widthoffset = 0;
+ $heightoffset = 0;
+ } else {
+ $widthoffset = $x1;
+ $heightoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = ($y2 - $y1);
+ }
+ }
+
+ if ($square) {
+ $newheight = $maxheight;
+ $newwidth = $maxwidth;
+ }
+
+ $rtn_code = imagecopyresampled($newimage, $oldimage, 0,0,$widthoffset,$heightoffset,$newwidth,$newheight,$width,$height);
+ if (!rtn_code)
+ return $rtn_code;
+
+ if ($watermark)
+ tp_gd_watermark($newimage);
+
+ switch ($imgsizearray['mime']) {
+ case 'image/jpeg':
+ case 'image/pjpeg':
+ $rtn_code = imagejpeg($newimage, $output_name, 85);
+ break;
+ case 'image/png':
+ case 'image/x-png':
+ $rtn_code = imagepng($newimage, $output_name);
+ break;
+ case 'image/gif':
+ $rtn_code = imagegif($newimage, $output_name);
+ break;
+ }
+
+ imagedestroy($newimage);
+ imagedestroy($oldimage);
+
+ return $rtn_code;
+ }
+
+
+ /**
+ * Create thumbnails using PHP imagick extension
+ *
+ * @param ElggFile holds the image that was uploaded
+ * @param string folder to store thumbnail in
+ * @param string name of the thumbnail
+ * @return bool true on success
+ */
+ function tp_create_imagick_thumbnails($file, $prefix, $filestorename)
+ {
+ $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
+ if (!$image_sizes) {
+ register_error(elgg_echo('tidypics:nosettings'));
+ return false;
+ }
+ $image_sizes = unserialize($image_sizes);
+
+ $thumb = new ElggFile();
+ $thumb->owner_guid = $file->owner_guid;
+ $thumb->container_guid = $file->container_guid;
+
+ // tiny thumbnail
+ $thumb->setFilename($prefix."thumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['thumb_image_width'],
+ $image_sizes['thumb_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->thumbnail = $prefix."thumb".$filestorename;
+
+
+ // album thumbnail
+ $thumb->setFilename($prefix."smallthumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['small_image_width'],
+ $image_sizes['small_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->smallthumb = $prefix."smallthumb".$filestorename;
+
+
+ // main image
+ $thumb->setFilename($prefix."largethumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_imagick_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['large_image_width'],
+ $image_sizes['large_image_height'],
+ false);
+ if (!$rtn_code)
+ return false;
+ $file->largethumb = $prefix."largethumb".$filestorename;
+
+ tp_imagick_watermark($thumbname);
+
+ unset($thumb);
+
+ return true;
+ }
+
+
+ /**
+ * Resize using PHP imagick extension
+ *
+ * Writes resized version of an already uploaded image
+ *
+ *
+ * @param string $input_name The name of the file input field on the submission form
+ * @param string $output_name The name of the file to be written
+ * @param int $maxwidth The maximum width of the resized image
+ * @param int $maxheight The maximum height of the resized image
+ * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
+ * @return bool true on success
+ */
+ function tp_imagick_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
+
+ // Get the size information from the image
+ $imgsizearray = getimagesize($input_name);
+ if (!$imgsizearray)
+ return false;
+
+
+ // Get width and height
+ $width = $imgsizearray[0];
+ $height = $imgsizearray[1];
+ $newwidth = $width;
+ $newheight = $height;
+
+ // initial guess at final dimensions for new image (doesn't check for squareness yet
+ if ($newwidth > $maxwidth) {
+ $newheight = floor($newheight * ($maxwidth / $newwidth));
+ $newwidth = $maxwidth;
+ }
+ if ($newheight > $maxheight) {
+ $newwidth = floor($newwidth * ($maxheight / $newheight));
+ $newheight = $maxheight;
+ }
+
+ // Handle squareness for both original and new image
+ if ($square) {
+ if ($width < $height) {
+ $height = $width;
+ } else {
+ $width = $height;
+ }
+
+ if ($maxheight == $maxwidth) {
+ // if input arguments = square, no need to use above calculations (which can have round-off errors)
+ $newwidth = $maxwidth;
+ $newheight = $maxheight;
+ } else {
+ if ($newwidth < $newheight) {
+ $newheight = $newwidth;
+ } else {
+ $newwidth = $newheight;
+ }
+ }
+ }
+
+
+ // Crop the original image - this needs to be checked over
+ if ($square) {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $xoffset = floor(($imgsizearray[0] - $width) / 2);
+ $yoffset = floor(($imgsizearray[1] - $height) / 2);
+ } else { // assume we're being passed good croping coordinates
+ $xoffset = $x1;
+ $yoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = $width;
+ }
+ } else {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $xoffset = 0;
+ $yoffset = 0;
+ } else {
+ $xoffset = $x1;
+ $yoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = ($y2 - $y1);
+ }
+ }
+
+
+ try {
+ $img = new Imagick($input_name);
+ } catch (ImagickException $e) {
+ return false;
+ }
+
+ $img->cropImage($width, $height, $xoffset, $yoffset);
+
+ // use the default IM filter (windowing filter), I think 1 means default blurring or number of lobes
+ $img->resizeImage($newwidth, $newheight, imagick::FILTER_LANCZOS, 1);
+ $img->setImagePage($newwidth, $newheight, 0, 0);
+
+ if ($img->writeImage($output_name) != true) {
+ $img->destroy();
+ return false;
+ }
+
+ $img->destroy();
+
+ return true;
+ }
+
+ /**
+ * Create thumbnails using ImageMagick executables
+ *
+ * @param ElggFile holds the image that was uploaded
+ * @param string folder to store thumbnail in
+ * @param string name of the thumbnail
+ * @return bool true on success
+ */
+ function tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename)
+ {
+ $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
+ if (!$image_sizes) {
+ register_error(elgg_echo('tidypics:nosettings'));
+ return false;
+ }
+ $image_sizes = unserialize($image_sizes);
+
+ $thumb = new ElggFile();
+ $thumb->owner_guid = $file->owner_guid;
+ $thumb->container_guid = $file->container_guid;
+
+ // tiny thumbnail
+ $thumb->setFilename($prefix."thumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['thumb_image_width'],
+ $image_sizes['thumb_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->thumbnail = $prefix."thumb".$filestorename;
+
+
+ // album thumbnail
+ $thumb->setFilename($prefix."smallthumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['small_image_width'],
+ $image_sizes['small_image_height'],
+ true);
+ if (!$rtn_code)
+ return false;
+ $file->smallthumb = $prefix."smallthumb".$filestorename;
+
+
+ // main image
+ $thumb->setFilename($prefix."largethumb".$filestorename);
+ $thumbname = $thumb->getFilenameOnFilestore();
+ $rtn_code = tp_im_cmdline_resize( $file->getFilenameOnFilestore(),
+ $thumbname,
+ $image_sizes['large_image_width'],
+ $image_sizes['large_image_height'],
+ false);
+ if (!$rtn_code)
+ return false;
+ $file->largethumb = $prefix."largethumb".$filestorename;
+
+
+ tp_im_cmdline_watermark($thumbname);
+
+
+
+ unset($thumb);
+
+ return true;
+ }
+
+ /*
+ * Gets the jpeg contents of the resized version of an already uploaded image
+ * (Returns false if the uploaded file was not an image)
+ *
+ * @param string $input_name The name of the file input field on the submission form
+ * @param string $output_name The name of the file to be written
+ * @param int $maxwidth The maximum width of the resized image
+ * @param int $maxheight The maximum height of the resized image
+ * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
+ * @return bool
+ */
+ function tp_im_cmdline_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
+
+
+ // Get the size information from the image
+ if ($imgsizearray = getimagesize($input_name)) {
+
+ // Get width and height
+ $width = $imgsizearray[0];
+ $height = $imgsizearray[1];
+ $newwidth = $width;
+ $newheight = $height;
+
+ // Square the image dimensions if we're wanting a square image
+ if ($square) {
+ if ($width < $height) {
+ $height = $width;
+ } else {
+ $width = $height;
+ }
+
+ $newwidth = $width;
+ $newheight = $height;
+
+ }
+
+ if ($width > $maxwidth) {
+ $newheight = floor($height * ($maxwidth / $width));
+ $newwidth = $maxwidth;
+ }
+ if ($newheight > $maxheight) {
+ $newwidth = floor($newwidth * ($maxheight / $newheight));
+ $newheight = $maxheight;
+ }
+
+ $accepted_formats = array(
+ 'image/jpeg' => 'jpeg',
+ 'image/pjpeg' => 'jpeg',
+ 'image/png' => 'png',
+ 'image/x-png' => 'png',
+ 'image/gif' => 'gif'
+ );
+ // If it's a file we can manipulate ...
+ if (array_key_exists($imgsizearray['mime'],$accepted_formats)) {
+
+ // Crop the image if we need a square
+ if ($square) {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $widthoffset = floor(($imgsizearray[0] - $width) / 2);
+ $heightoffset = floor(($imgsizearray[1] - $height) / 2);
+ } else {
+ $widthoffset = $x1;
+ $heightoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = $width;
+ }
+ } else {
+ if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 ==0) {
+ $widthoffset = 0;
+ $heightoffset = 0;
+ } else {
+ $widthoffset = $x1;
+ $heightoffset = $y1;
+ $width = ($x2 - $x1);
+ $height = ($y2 - $y1);
+ }
+ }
+
+ // Resize and return the image contents!
+ if ($square) {
+ $newheight = $maxheight;
+ $newwidth = $maxwidth;
+ }
+ $im_path = get_plugin_setting('im_path', 'tidypics');
+ if(!$im_path) {
+ $im_path = "/usr/bin/";
+ }
+ if(substr($im_path, strlen($im_path)-1, 1) != "/") $im_path .= "/";
+ $command = $im_path . "convert \"$input_name\" -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";
+ exec($command);
+ return true;
+
+ }
+ }
+
+ return false;
+ }
+
?>
\ No newline at end of file
diff --git a/lib/tidypics.php b/lib/tidypics.php
index e24e4d77e..b0a8a70d2 100644
--- a/lib/tidypics.php
+++ b/lib/tidypics.php
@@ -1,299 +1,299 @@
-
-
-
-
-
- * Good luck
- */
- function tp_get_latest_photos($num_images, $owner_guid = 0)
- {
- $prev_context = set_context('front');
- $image_html = tp_list_entities('object', 'image', $owner_guid, $num_images, false, false, false);
- set_context($prev_context);
- return $image_html;
- }
-
-
- /**
- * Get image directory path
- *
- * Each album gets a subdirectory based on its container id
- *
- * @return string path to image directory
- */
- function tp_get_img_dir()
- {
- $file = new ElggFile();
- return $file->getFilenameOnFilestore() . 'image/';
- }
-
-
-
- /*********************************************************************
- * the functions below replace broken core functions or add functions
- * that could/should exist in the core
- */
-
- /**
- *
- */
- function tp_get_entities($type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null, $timelower = 0, $timeupper = 0)
- {
- global $CONFIG;
-
- if ($subtype === false || $subtype === null || $subtype === 0)
- return false;
-
- if ($order_by == "") $order_by = "time_created desc";
- $order_by = sanitise_string($order_by);
- $limit = (int)$limit;
- $offset = (int)$offset;
- $site_guid = (int) $site_guid;
- $timelower = (int) $timelower;
- $timeupper = (int) $timeupper;
- if ($site_guid == 0)
- $site_guid = $CONFIG->site_guid;
-
- $where = array();
-
- if (is_array($subtype)) {
- $tempwhere = "";
- if (sizeof($subtype))
- foreach($subtype as $typekey => $subtypearray) {
- foreach($subtypearray as $subtypeval) {
- $typekey = sanitise_string($typekey);
- if (!empty($subtypeval)) {
- if (!$subtypeval = (int) get_subtype_id($typekey, $subtypeval))
- return false;
- } else {
- // @todo: Setting subtype to 0 when $subtype = '' returns entities with
- // no subtype. This is different to the non-array behavior
- // but may be required in some cases.
- $subtypeval = 0;
- }
- if (!empty($tempwhere)) $tempwhere .= " or ";
- $tempwhere .= "(type = '{$typekey}' and subtype = {$subtypeval})";
- }
- }
- if (!empty($tempwhere)) $where[] = "({$tempwhere})";
-
- } else {
-
- $type = sanitise_string($type);
- if ($subtype !== "" AND !$subtype = get_subtype_id($type, $subtype))
- return false;
-
- if ($type != "")
- $where[] = "type='$type'";
- if ($subtype!=="")
- $where[] = "subtype=$subtype";
- }
-
- if ($owner_guid != "") {
- if (!is_array($owner_guid)) {
- $owner_array = array($owner_guid);
- $owner_guid = (int) $owner_guid;
- $where[] = "owner_guid = '$owner_guid'";
- } else if (sizeof($owner_guid) > 0) {
- $owner_array = array_map('sanitise_int', $owner_guid);
- // Cast every element to the owner_guid array to int
- $owner_guid = array_map("sanitise_int", $owner_guid);
- $owner_guid = implode(",",$owner_guid);
- $where[] = "owner_guid in ({$owner_guid})";
- }
- }
- if ($site_guid > 0)
- $where[] = "site_guid = {$site_guid}";
-
- if (!is_null($container_guid)) {
- if (is_array($container_guid)) {
- foreach($container_guid as $key => $val) $container_guid[$key] = (int) $val;
- $where[] = "container_guid in (" . implode(",",$container_guid) . ")";
- } else {
- $container_guid = (int) $container_guid;
- $where[] = "container_guid = {$container_guid}";
- }
- }
- if ($timelower)
- $where[] = "time_created >= {$timelower}";
- if ($timeupper)
- $where[] = "time_created <= {$timeupper}";
-
- if (!$count) {
- $query = "SELECT * from {$CONFIG->dbprefix}entities where ";
- } else {
- $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where ";
- }
- foreach ($where as $w)
- $query .= " $w and ";
- $query .= get_access_sql_suffix(); // Add access controls
- if (!$count) {
- $query .= " order by $order_by";
- if ($limit) $query .= " limit $offset, $limit"; // Add order and limit
- $dt = get_data($query, "entity_row_to_elggstar");
- return $dt;
- } else {
- $total = get_data_row($query);
- return $total->total;
- }
- }
-
- function tp_list_entities($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $pagination = true) {
-
- $offset = (int) get_input('offset');
- $count = tp_get_entities($type, $subtype, $owner_guid, "", $limit, $offset, true);
- $entities = tp_get_entities($type, $subtype, $owner_guid, "", $limit, $offset);
-
- return tp_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $pagination);
- }
-
- function tp_view_entity_list($entities, $count, $offset, $limit, $fullview = true, $viewtypetoggle = false, $pagination = true) {
- $context = get_context();
-
- $html = elgg_view('tidypics/gallery',array(
- 'entities' => $entities,
- 'count' => $count,
- 'offset' => $offset,
- 'limit' => $limit,
- 'baseurl' => $_SERVER['REQUEST_URI'],
- 'fullview' => $fullview,
- 'context' => $context,
- 'viewtypetoggle' => $viewtypetoggle,
- 'viewtype' => get_input('search_viewtype','list'),
- 'pagination' => $pagination
- ));
-
- return $html;
- }
-
- function tp_get_entities_from_annotations_calculate_x($sum = "sum", $entity_type = "", $entity_subtype = "", $name = "", $mdname = '', $mdvalue = '', $owner_guid = 0, $limit = 10, $offset = 0, $orderdir = 'desc', $count = false)
- {
- global $CONFIG;
-
- $sum = sanitise_string($sum);
- $entity_type = sanitise_string($entity_type);
- $entity_subtype = get_subtype_id($entity_type, $entity_subtype);
- $name = get_metastring_id($name);
- $limit = (int) $limit;
- $offset = (int) $offset;
- $owner_guid = (int) $owner_guid;
- if (!empty($mdname) && !empty($mdvalue)) {
- $meta_n = get_metastring_id($mdname);
- $meta_v = get_metastring_id($mdvalue);
- }
-
- if (empty($name)) return 0;
-
- $where = array();
-
- if ($entity_type!="")
- $where[] = "e.type='$entity_type'";
- if ($owner_guid > 0)
- $where[] = "e.owner_guid = $owner_guid";
- if ($entity_subtype)
- $where[] = "e.subtype=$entity_subtype";
- if ($name!="")
- $where[] = "a.name_id='$name'";
-
- if (!empty($mdname) && !empty($mdvalue)) {
- if ($mdname!="")
- $where[] = "m.name_id='$meta_n'";
- if ($mdvalue!="")
- $where[] = "m.value_id='$meta_v'";
- }
-
- if ($sum != "count")
- $where[] = "a.value_type='integer'"; // Limit on integer types
-
- if (!$count) {
- $query = "SELECT distinct e.*, $sum(ms.string) as sum ";
- } else {
- $query = "SELECT count(distinct e.guid) as num, $sum(ms.string) as sum ";
- }
- $query .= " from {$CONFIG->dbprefix}entities e JOIN {$CONFIG->dbprefix}annotations a on a.entity_guid = e.guid JOIN {$CONFIG->dbprefix}metastrings ms on a.value_id=ms.id ";
-
- if (!empty($mdname) && !empty($mdvalue)) {
- $query .= " JOIN {$CONFIG->dbprefix}metadata m on m.entity_guid = e.guid ";
- }
-
- $query .= " WHERE ";
- foreach ($where as $w)
- $query .= " $w and ";
- $query .= get_access_sql_suffix("a"); // now add access
- $query .= ' and ' . get_access_sql_suffix("e"); // now add access
- if (!$count) $query .= ' group by e.guid';
-
- if (!$count) {
- $query .= ' order by sum ' . $orderdir;
- $query .= ' limit ' . $offset . ' , ' . $limit;
- return get_data($query, "entity_row_to_elggstar");
- } else {
- if ($row = get_data_row($query)) {
- return $row->num;
- }
- }
- return false;
- }
-
- /**
- * Is page owner a group - convenience function
- *
- * @return true/false
- */
- function tp_is_group_page() {
-
- if ($group = page_owner_entity()) {
- if ($group instanceof ElggGroup)
- return true;
- }
-
- return false;
- }
-
-
- /**
- * Is the request from a known browser
- *
- * @return true/false
- */
- function tp_is_person()
- {
- $known = array('msie', 'mozilla', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko');
-
- $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
-
- foreach ($known as $browser)
- {
- if (strpos($agent, $browser) !== false) {
- return true;
- }
- }
-
- return false;
- }
+
+
+
+
+
+ * Good luck
+ */
+ function tp_get_latest_photos($num_images, $owner_guid = 0)
+ {
+ $prev_context = set_context('front');
+ $image_html = tp_list_entities('object', 'image', $owner_guid, $num_images, false, false, false);
+ set_context($prev_context);
+ return $image_html;
+ }
+
+
+ /**
+ * Get image directory path
+ *
+ * Each album gets a subdirectory based on its container id
+ *
+ * @return string path to image directory
+ */
+ function tp_get_img_dir()
+ {
+ $file = new ElggFile();
+ return $file->getFilenameOnFilestore() . 'image/';
+ }
+
+
+
+ /*********************************************************************
+ * the functions below replace broken core functions or add functions
+ * that could/should exist in the core
+ */
+
+ /**
+ *
+ */
+ function tp_get_entities($type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null, $timelower = 0, $timeupper = 0)
+ {
+ global $CONFIG;
+
+ if ($subtype === false || $subtype === null || $subtype === 0)
+ return false;
+
+ if ($order_by == "") $order_by = "time_created desc";
+ $order_by = sanitise_string($order_by);
+ $limit = (int)$limit;
+ $offset = (int)$offset;
+ $site_guid = (int) $site_guid;
+ $timelower = (int) $timelower;
+ $timeupper = (int) $timeupper;
+ if ($site_guid == 0)
+ $site_guid = $CONFIG->site_guid;
+
+ $where = array();
+
+ if (is_array($subtype)) {
+ $tempwhere = "";
+ if (sizeof($subtype))
+ foreach($subtype as $typekey => $subtypearray) {
+ foreach($subtypearray as $subtypeval) {
+ $typekey = sanitise_string($typekey);
+ if (!empty($subtypeval)) {
+ if (!$subtypeval = (int) get_subtype_id($typekey, $subtypeval))
+ return false;
+ } else {
+ // @todo: Setting subtype to 0 when $subtype = '' returns entities with
+ // no subtype. This is different to the non-array behavior
+ // but may be required in some cases.
+ $subtypeval = 0;
+ }
+ if (!empty($tempwhere)) $tempwhere .= " or ";
+ $tempwhere .= "(type = '{$typekey}' and subtype = {$subtypeval})";
+ }
+ }
+ if (!empty($tempwhere)) $where[] = "({$tempwhere})";
+
+ } else {
+
+ $type = sanitise_string($type);
+ if ($subtype !== "" AND !$subtype = get_subtype_id($type, $subtype))
+ return false;
+
+ if ($type != "")
+ $where[] = "type='$type'";
+ if ($subtype!=="")
+ $where[] = "subtype=$subtype";
+ }
+
+ if ($owner_guid != "") {
+ if (!is_array($owner_guid)) {
+ $owner_array = array($owner_guid);
+ $owner_guid = (int) $owner_guid;
+ $where[] = "owner_guid = '$owner_guid'";
+ } else if (sizeof($owner_guid) > 0) {
+ $owner_array = array_map('sanitise_int', $owner_guid);
+ // Cast every element to the owner_guid array to int
+ $owner_guid = array_map("sanitise_int", $owner_guid);
+ $owner_guid = implode(",",$owner_guid);
+ $where[] = "owner_guid in ({$owner_guid})";
+ }
+ }
+ if ($site_guid > 0)
+ $where[] = "site_guid = {$site_guid}";
+
+ if (!is_null($container_guid)) {
+ if (is_array($container_guid)) {
+ foreach($container_guid as $key => $val) $container_guid[$key] = (int) $val;
+ $where[] = "container_guid in (" . implode(",",$container_guid) . ")";
+ } else {
+ $container_guid = (int) $container_guid;
+ $where[] = "container_guid = {$container_guid}";
+ }
+ }
+ if ($timelower)
+ $where[] = "time_created >= {$timelower}";
+ if ($timeupper)
+ $where[] = "time_created <= {$timeupper}";
+
+ if (!$count) {
+ $query = "SELECT * from {$CONFIG->dbprefix}entities where ";
+ } else {
+ $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where ";
+ }
+ foreach ($where as $w)
+ $query .= " $w and ";
+ $query .= get_access_sql_suffix(); // Add access controls
+ if (!$count) {
+ $query .= " order by $order_by";
+ if ($limit) $query .= " limit $offset, $limit"; // Add order and limit
+ $dt = get_data($query, "entity_row_to_elggstar");
+ return $dt;
+ } else {
+ $total = get_data_row($query);
+ return $total->total;
+ }
+ }
+
+ function tp_list_entities($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $pagination = true) {
+
+ $offset = (int) get_input('offset');
+ $count = tp_get_entities($type, $subtype, $owner_guid, "", $limit, $offset, true);
+ $entities = tp_get_entities($type, $subtype, $owner_guid, "", $limit, $offset);
+
+ return tp_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $pagination);
+ }
+
+ function tp_view_entity_list($entities, $count, $offset, $limit, $fullview = true, $viewtypetoggle = false, $pagination = true) {
+ $context = get_context();
+
+ $html = elgg_view('tidypics/gallery',array(
+ 'entities' => $entities,
+ 'count' => $count,
+ 'offset' => $offset,
+ 'limit' => $limit,
+ 'baseurl' => $_SERVER['REQUEST_URI'],
+ 'fullview' => $fullview,
+ 'context' => $context,
+ 'viewtypetoggle' => $viewtypetoggle,
+ 'viewtype' => get_input('search_viewtype','list'),
+ 'pagination' => $pagination
+ ));
+
+ return $html;
+ }
+
+ function tp_get_entities_from_annotations_calculate_x($sum = "sum", $entity_type = "", $entity_subtype = "", $name = "", $mdname = '', $mdvalue = '', $owner_guid = 0, $limit = 10, $offset = 0, $orderdir = 'desc', $count = false)
+ {
+ global $CONFIG;
+
+ $sum = sanitise_string($sum);
+ $entity_type = sanitise_string($entity_type);
+ $entity_subtype = get_subtype_id($entity_type, $entity_subtype);
+ $name = get_metastring_id($name);
+ $limit = (int) $limit;
+ $offset = (int) $offset;
+ $owner_guid = (int) $owner_guid;
+ if (!empty($mdname) && !empty($mdvalue)) {
+ $meta_n = get_metastring_id($mdname);
+ $meta_v = get_metastring_id($mdvalue);
+ }
+
+ if (empty($name)) return 0;
+
+ $where = array();
+
+ if ($entity_type!="")
+ $where[] = "e.type='$entity_type'";
+ if ($owner_guid > 0)
+ $where[] = "e.owner_guid = $owner_guid";
+ if ($entity_subtype)
+ $where[] = "e.subtype=$entity_subtype";
+ if ($name!="")
+ $where[] = "a.name_id='$name'";
+
+ if (!empty($mdname) && !empty($mdvalue)) {
+ if ($mdname!="")
+ $where[] = "m.name_id='$meta_n'";
+ if ($mdvalue!="")
+ $where[] = "m.value_id='$meta_v'";
+ }
+
+ if ($sum != "count")
+ $where[] = "a.value_type='integer'"; // Limit on integer types
+
+ if (!$count) {
+ $query = "SELECT distinct e.*, $sum(ms.string) as sum ";
+ } else {
+ $query = "SELECT count(distinct e.guid) as num, $sum(ms.string) as sum ";
+ }
+ $query .= " from {$CONFIG->dbprefix}entities e JOIN {$CONFIG->dbprefix}annotations a on a.entity_guid = e.guid JOIN {$CONFIG->dbprefix}metastrings ms on a.value_id=ms.id ";
+
+ if (!empty($mdname) && !empty($mdvalue)) {
+ $query .= " JOIN {$CONFIG->dbprefix}metadata m on m.entity_guid = e.guid ";
+ }
+
+ $query .= " WHERE ";
+ foreach ($where as $w)
+ $query .= " $w and ";
+ $query .= get_access_sql_suffix("a"); // now add access
+ $query .= ' and ' . get_access_sql_suffix("e"); // now add access
+ if (!$count) $query .= ' group by e.guid';
+
+ if (!$count) {
+ $query .= ' order by sum ' . $orderdir;
+ $query .= ' limit ' . $offset . ' , ' . $limit;
+ return get_data($query, "entity_row_to_elggstar");
+ } else {
+ if ($row = get_data_row($query)) {
+ return $row->num;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Is page owner a group - convenience function
+ *
+ * @return true/false
+ */
+ function tp_is_group_page() {
+
+ if ($group = page_owner_entity()) {
+ if ($group instanceof ElggGroup)
+ return true;
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Is the request from a known browser
+ *
+ * @return true/false
+ */
+ function tp_is_person()
+ {
+ $known = array('msie', 'mozilla', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko');
+
+ $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
+
+ foreach ($known as $browser)
+ {
+ if (strpos($agent, $browser) !== false) {
+ return true;
+ }
+ }
+
+ return false;
+ }
?>
\ No newline at end of file
diff --git a/pages/admin.php b/pages/admin.php
index 0668ac324..33d44b6c4 100644
--- a/pages/admin.php
+++ b/pages/admin.php
@@ -1,24 +1,24 @@
- $tab));
-
- page_draw(elgg_echo('tidypics:administration'), elgg_view_layout("two_column_left_sidebar", '', $body));
-
+ $tab));
+
+ page_draw(elgg_echo('tidypics:administration'), elgg_view_layout("two_column_left_sidebar", '', $body));
+
?>
\ No newline at end of file
diff --git a/pages/download.php b/pages/download.php
index f5530cebc..e4ad2e855 100644
--- a/pages/download.php
+++ b/pages/download.php
@@ -1,52 +1,52 @@
-originalfilename;
- $mime = $file->mimetype;
-
- header("Content-Type: $mime");
- if ($type == "inline")
- header("Content-Disposition: inline; filename=\"$filename\"");
- else
- header("Content-Disposition: attachment; filename=\"$filename\"");
-
-
- $readfile = new ElggFile($file_guid);
- $readfile->owner_guid = $file->owner_guid;
-
- $contents = $readfile->grabFile();
-
- if (empty($contents)) {
- echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/image_error_large.png" );
- } else {
-
- // expires every 60 days
- $expires = 60 * 60*60*24;
-
- header("Content-Length: " . strlen($contents));
- header("Cache-Control: public", true);
- header("Pragma: public", true);
- header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
-
-
- echo $contents;
- }
-
- exit;
- }
- else
- register_error(elgg_echo("image:downloadfailed"));
-
+originalfilename;
+ $mime = $file->mimetype;
+
+ header("Content-Type: $mime");
+ if ($type == "inline")
+ header("Content-Disposition: inline; filename=\"$filename\"");
+ else
+ header("Content-Disposition: attachment; filename=\"$filename\"");
+
+
+ $readfile = new ElggFile($file_guid);
+ $readfile->owner_guid = $file->owner_guid;
+
+ $contents = $readfile->grabFile();
+
+ if (empty($contents)) {
+ echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/image_error_large.png" );
+ } else {
+
+ // expires every 60 days
+ $expires = 60 * 60*60*24;
+
+ header("Content-Length: " . strlen($contents));
+ header("Cache-Control: public", true);
+ header("Pragma: public", true);
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
+
+
+ echo $contents;
+ }
+
+ exit;
+ }
+ else
+ register_error(elgg_echo("image:downloadfailed"));
+
?>
\ No newline at end of file
diff --git a/pages/edit.php b/pages/edit.php
index 3f13abae9..abf1a0fdd 100644
--- a/pages/edit.php
+++ b/pages/edit.php
@@ -1,51 +1,51 @@
-canEdit())
- forward();
-
- $subtype = $entity->getSubtype();
-
- if ($subtype == 'album') {
- $title = elgg_echo('album:edit');
-
- if ($container = $entity->container_guid)
- set_page_owner($container);
-
- } else if ($subtype == 'image') {
- $title = elgg_echo('image:edit');
-
- if ($container = get_entity($entity->container_guid)->container_guid)
- set_page_owner($container);
-
- } else {
- forward();
- }
-
- $page_owner = page_owner_entity();
- if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
- }
-
-
- $area2 .= elgg_view_title($title);
- $area2 .= elgg_view('tidypics/forms/edit', array('entity' => $entity, 'subtype' => $subtype));
- $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
-
- page_draw($title, $body);
+canEdit())
+ forward();
+
+ $subtype = $entity->getSubtype();
+
+ if ($subtype == 'album') {
+ $title = elgg_echo('album:edit');
+
+ if ($container = $entity->container_guid)
+ set_page_owner($container);
+
+ } else if ($subtype == 'image') {
+ $title = elgg_echo('image:edit');
+
+ if ($container = get_entity($entity->container_guid)->container_guid)
+ set_page_owner($container);
+
+ } else {
+ forward();
+ }
+
+ $page_owner = page_owner_entity();
+ if ($page_owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+
+ $area2 .= elgg_view_title($title);
+ $area2 .= elgg_view('tidypics/forms/edit', array('entity' => $entity, 'subtype' => $subtype));
+ $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+
+ page_draw($title, $body);
?>
\ No newline at end of file
diff --git a/pages/edit_multiple.php b/pages/edit_multiple.php
index 0c9295054..49b7dd6f3 100644
--- a/pages/edit_multiple.php
+++ b/pages/edit_multiple.php
@@ -1,47 +1,47 @@
-owner_guid);
- $album = get_entity($photo->container_guid);
- if ($album) {
- $owner_guid = $album->container_guid;
- if ($owner_guid)
- set_page_owner($owner_guid);
- }
-
- foreach ($file_array_sent as $file_guid) {
- if ($entity = get_entity($file_guid)) {
- if ($entity->canEdit()){
- array_push($new_file_array, $file_guid);
- }
- if (!$album_guid)
- $album_guid = $entity->container_guid;
-
- }
- }
-
- $title = elgg_echo('tidypics:editprops');
- $area2 .= elgg_view_title($title);
- $area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid));
- $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
- page_draw($title, $body);
-?>
+owner_guid);
+ $album = get_entity($photo->container_guid);
+ if ($album) {
+ $owner_guid = $album->container_guid;
+ if ($owner_guid)
+ set_page_owner($owner_guid);
+ }
+
+ foreach ($file_array_sent as $file_guid) {
+ if ($entity = get_entity($file_guid)) {
+ if ($entity->canEdit()){
+ array_push($new_file_array, $file_guid);
+ }
+ if (!$album_guid)
+ $album_guid = $entity->container_guid;
+
+ }
+ }
+
+ $title = elgg_echo('tidypics:editprops');
+ $area2 .= elgg_view_title($title);
+ $area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid));
+ $body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+ page_draw($title, $body);
+?>
diff --git a/pages/friends.php b/pages/friends.php
index 8ac1e21d0..e35adce04 100644
--- a/pages/friends.php
+++ b/pages/friends.php
@@ -1,38 +1,38 @@
-guid == get_loggedin_userid())
- $title = elgg_echo('album:yours:friends');
- else
- $title = sprintf(elgg_echo('album:friends'), $user->name);
-
- $area2 = elgg_view_title($title);
-
- // get html for viewing list of photo albums
- set_context('search');
- set_input('search_viewtype', 'gallery'); // need to force gallery view
- $area2 .= list_user_friends_objects($user->guid, 'album', 10, true, false);
-
-
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($title, $body);
+guid == get_loggedin_userid())
+ $title = elgg_echo('album:yours:friends');
+ else
+ $title = sprintf(elgg_echo('album:friends'), $user->name);
+
+ $area2 = elgg_view_title($title);
+
+ // get html for viewing list of photo albums
+ set_context('search');
+ set_input('search_viewtype', 'gallery'); // need to force gallery view
+ $area2 .= list_user_friends_objects($user->guid, 'album', 10, true, false);
+
+
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($title, $body);
?>
\ No newline at end of file
diff --git a/pages/newalbum.php b/pages/newalbum.php
index 006c61b54..fda886d52 100644
--- a/pages/newalbum.php
+++ b/pages/newalbum.php
@@ -1,32 +1,32 @@
-name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
- }
-
- $area2 = elgg_view_title(elgg_echo('album:add'));
- $area2 .= elgg_view("tidypics/forms/edit");
-
- // Display page
- page_draw(elgg_echo('album:add'),elgg_view_layout("two_column_left_sidebar", $area1, $area2, $area3 ));
-
+name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+ $area2 = elgg_view_title(elgg_echo('album:add'));
+ $area2 .= elgg_view("tidypics/forms/edit");
+
+ // Display page
+ page_draw(elgg_echo('album:add'),elgg_view_layout("two_column_left_sidebar", $area1, $area2, $area3 ));
+
?>
\ No newline at end of file
diff --git a/pages/ownedalbums.php b/pages/ownedalbums.php
index c3dc54d24..f43c2c5eb 100644
--- a/pages/ownedalbums.php
+++ b/pages/ownedalbums.php
@@ -1,51 +1,51 @@
-username) || empty($owner->username)) {
- forward('pg/photos/world');
- }
-
-
- // setup group menu for album index
- if ($owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
- if (can_write_to_container(0, $owner->guid)) {
- add_submenu_item( elgg_echo('album:create'),
- $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
- 'tidypics');
- }
- }
-
- //set the title
- $title = sprintf(elgg_echo('album:user'), $owner->name);
- $area2 = elgg_view_title($title);
-
- // Get objects
- set_context('search');
- set_input('search_viewtype', 'gallery');
- if ($owner instanceof ElggGroup)
- $area2 .= list_entities("object", "album", $owner->guid, 12, false);
- else
- $area2 .= list_entities("object", "album", $owner->guid, 12, false);
-
- set_context('photos');
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- // Finally draw the page
- page_draw($title, $body);
+username) || empty($owner->username)) {
+ forward('pg/photos/world');
+ }
+
+
+ // setup group menu for album index
+ if ($owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
+ if (can_write_to_container(0, $owner->guid)) {
+ add_submenu_item( elgg_echo('album:create'),
+ $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
+ 'tidypics');
+ }
+ }
+
+ //set the title
+ $title = sprintf(elgg_echo('album:user'), $owner->name);
+ $area2 = elgg_view_title($title);
+
+ // Get objects
+ set_context('search');
+ set_input('search_viewtype', 'gallery');
+ if ($owner instanceof ElggGroup)
+ $area2 .= list_entities("object", "album", $owner->guid, 12, false);
+ else
+ $area2 .= list_entities("object", "album", $owner->guid, 12, false);
+
+ set_context('photos');
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ // Finally draw the page
+ page_draw($title, $body);
?>
\ No newline at end of file
diff --git a/pages/tagged.php b/pages/tagged.php
index fb07b392c..b5a879809 100644
--- a/pages/tagged.php
+++ b/pages/tagged.php
@@ -1,50 +1,50 @@
-name);
- else
- $title = "User does not exist";
-
-
-
- // create main column
- $body = elgg_view_title($title);
-
- set_context('search');
- set_input('search_viewtype', 'gallery'); // need to force gallery view
- $body .= list_entities_from_relationship('phototag', $guid, false, 'object', 'image', 0, 10, false);
-
- // Set up submenus
- if (isloggedin()) {
- add_submenu_item( elgg_echo("album:yours"),
- $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username,
- 'tidypics-b' );
- }
- add_submenu_item( elgg_echo('album:all'),
- $CONFIG->wwwroot . "pg/photos/world/",
- 'tidypics-z');
- add_submenu_item( elgg_echo('tidypics:mostrecent'),
- $CONFIG->wwwroot . 'pg/photos/mostrecent',
- 'tidypics-z');
-
-
-
- $body = elgg_view_layout('two_column_left_sidebar','',$body);
-
-
- page_draw($title,$body);
-
+name);
+ else
+ $title = "User does not exist";
+
+
+
+ // create main column
+ $body = elgg_view_title($title);
+
+ set_context('search');
+ set_input('search_viewtype', 'gallery'); // need to force gallery view
+ $body .= list_entities_from_relationship('phototag', $guid, false, 'object', 'image', 0, 10, false);
+
+ // Set up submenus
+ if (isloggedin()) {
+ add_submenu_item( elgg_echo("album:yours"),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username,
+ 'tidypics-b' );
+ }
+ add_submenu_item( elgg_echo('album:all'),
+ $CONFIG->wwwroot . "pg/photos/world/",
+ 'tidypics-z');
+ add_submenu_item( elgg_echo('tidypics:mostrecent'),
+ $CONFIG->wwwroot . 'pg/photos/mostrecent',
+ 'tidypics-z');
+
+
+
+ $body = elgg_view_layout('two_column_left_sidebar','',$body);
+
+
+ page_draw($title,$body);
+
?>
\ No newline at end of file
diff --git a/pages/upload.php b/pages/upload.php
index 3550d5620..84d237287 100644
--- a/pages/upload.php
+++ b/pages/upload.php
@@ -1,42 +1,42 @@
-canEdit()) {
- // throw warning and forward to previous page
- forward($_SERVER['HTTP_REFERER']);
- }
-
- // set page owner based on container (user or group)
- $container = $album->container_guid;
- set_page_owner($container);
-
- $page_owner = page_owner_entity();
- if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
- }
-
- set_context('photos');
- $title = elgg_echo('album:addpix') . ': ' . $album->title;
- $area2 .= elgg_view_title($title);
-
- $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album_guid ) );
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($title, $body);
+canEdit()) {
+ // throw warning and forward to previous page
+ forward($_SERVER['HTTP_REFERER']);
+ }
+
+ // set page owner based on container (user or group)
+ $container = $album->container_guid;
+ set_page_owner($container);
+
+ $page_owner = page_owner_entity();
+ if ($page_owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+ set_context('photos');
+ $title = elgg_echo('album:addpix') . ': ' . $album->title;
+ $area2 .= elgg_view_title($title);
+
+ $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album_guid ) );
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($title, $body);
?>
\ No newline at end of file
diff --git a/pages/viewalbum.php b/pages/viewalbum.php
index 402c2d7e6..9ebc31fae 100644
--- a/pages/viewalbum.php
+++ b/pages/viewalbum.php
@@ -1,68 +1,68 @@
-container_guid)
- set_page_owner($album->container_guid);
- else
- set_page_owner($album->owner_guid);
-
- $owner = page_owner_entity();
-
- // setup group menu
- if ($owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
- }
-
- // allow other plugins to override the slideshow
- $slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', $album, null);
- if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
- }
-
- if (can_write_to_container(0, $album->container_guid)) {
- if ($owner instanceof ElggGroup) {
- add_submenu_item( elgg_echo('album:create'),
- $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
- 'photos');
- }
- add_submenu_item( elgg_echo('album:addpix'),
- $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid,
- 'photos');
- add_submenu_item( elgg_echo('album:edit'),
- $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid,
- 'photos');
- $ts = time();
- $token = generate_action_token($ts);
- add_submenu_item( elgg_echo('album:delete'),
- $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $album_guid . '&__elgg_token=' . $token . '&__elgg_ts=' . $ts,
- 'photos',
- true);
- }
-
- // create body
- $area2 = elgg_view_entity($album, true);
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($album->title, $body);
+container_guid)
+ set_page_owner($album->container_guid);
+ else
+ set_page_owner($album->owner_guid);
+
+ $owner = page_owner_entity();
+
+ // setup group menu
+ if ($owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
+ }
+
+ // allow other plugins to override the slideshow
+ $slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', $album, null);
+ if ($slideshow_link) {
+ add_submenu_item(elgg_echo('album:slideshow'),
+ $slideshow_link,
+ 'photos' );
+ }
+
+ if (can_write_to_container(0, $album->container_guid)) {
+ if ($owner instanceof ElggGroup) {
+ add_submenu_item( elgg_echo('album:create'),
+ $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
+ 'photos');
+ }
+ add_submenu_item( elgg_echo('album:addpix'),
+ $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid,
+ 'photos');
+ add_submenu_item( elgg_echo('album:edit'),
+ $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid,
+ 'photos');
+ $ts = time();
+ $token = generate_action_token($ts);
+ add_submenu_item( elgg_echo('album:delete'),
+ $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $album_guid . '&__elgg_token=' . $token . '&__elgg_ts=' . $ts,
+ 'photos',
+ true);
+ }
+
+ // create body
+ $area2 = elgg_view_entity($album, true);
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($album->title, $body);
?>
\ No newline at end of file
diff --git a/pages/viewimage.php b/pages/viewimage.php
index 5f23fc685..025c1ad3b 100644
--- a/pages/viewimage.php
+++ b/pages/viewimage.php
@@ -1,58 +1,58 @@
-owner_guid);
- $album = get_entity($photo->container_guid);
- if ($album) {
- $owner_guid = $album->container_guid;
- if ($owner_guid)
- set_page_owner($owner_guid);
- }
-
-
- $page_owner = page_owner_entity();
- if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
- }
-
- if (can_write_to_container(0, $album->container_guid)) {
- add_submenu_item( elgg_echo('image:edit'),
- $CONFIG->wwwroot . 'pg/photos/edit/' . $photo_guid,
- 'photos');
- $ts = time();
- $token = generate_action_token($ts);
- add_submenu_item( elgg_echo('image:delete'),
- $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $photo_guid . '&__elgg_token=' . $token . '&__elgg_ts=' . $ts,
- 'photos',
- true);
- }
-
-
- $title = $photo->title;
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view_entity($photo, true);
-
- $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
- page_draw($title, $body);
+owner_guid);
+ $album = get_entity($photo->container_guid);
+ if ($album) {
+ $owner_guid = $album->container_guid;
+ if ($owner_guid)
+ set_page_owner($owner_guid);
+ }
+
+
+ $page_owner = page_owner_entity();
+ if ($page_owner instanceof ElggGroup) {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+
+ if (can_write_to_container(0, $album->container_guid)) {
+ add_submenu_item( elgg_echo('image:edit'),
+ $CONFIG->wwwroot . 'pg/photos/edit/' . $photo_guid,
+ 'photos');
+ $ts = time();
+ $token = generate_action_token($ts);
+ add_submenu_item( elgg_echo('image:delete'),
+ $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $photo_guid . '&__elgg_token=' . $token . '&__elgg_ts=' . $ts,
+ 'photos',
+ true);
+ }
+
+
+ $title = $photo->title;
+ $area2 = elgg_view_title($title);
+ $area2 .= elgg_view_entity($photo, true);
+
+ $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+
+ page_draw($title, $body);
?>
\ No newline at end of file
diff --git a/pages/world.php b/pages/world.php
index 2683abc1d..9488f2620 100644
--- a/pages/world.php
+++ b/pages/world.php
@@ -1,31 +1,31 @@
-
\ No newline at end of file
diff --git a/start.php b/start.php
index f56669c1f..472bf4881 100644
--- a/start.php
+++ b/start.php
@@ -1,437 +1,437 @@
-wwwroot . "pg/photos/owned/" . $_SESSION['user']->username);
- }
-
- // Extend CSS
- extend_view('css', 'tidypics/css');
-
- // Extend hover-over and profile menu
- extend_view('profile/menu/links','tidypics/hover_menu');
-
- //group view ** psuedo widget view for group pages**
- extend_view('groups/right_column','tidypics/groupprofile_albums');
-
- // rss extensions
- extend_view('extensions/xmlns', 'extensions/tidypics/xmlns');
- extend_view('extensions/channel', 'extensions/tidypics/channel');
-
- // Register a page handler, so we can have nice URLs
- register_page_handler('photos','tidypics_page_handler');
-
- // Add a new tidypics widget
- add_widget_type('album_view', elgg_echo("tidypics:widget:albums"), elgg_echo("tidypics:widget:album_descr"), 'profile');
- add_widget_type('latest_photos', elgg_echo("tidypics:widget:latest"), elgg_echo("tidypics:widget:latest_descr"), 'profile');
-
- // Register a URL handler for files
- register_entity_url_handler('tidypics_image_url', 'object', 'image');
- register_entity_url_handler('tidypics_album_url', 'object', 'album');
-
- // add the class files for image and album
- add_subtype("object", "image", "TidypicsImage");
- add_subtype("object", "album", "TidypicsAlbum");
-
- // Register entity type
- register_entity_type('object','image');
- register_entity_type('object','album');
-
- if (function_exists('add_group_tool_option'))
- add_group_tool_option('photos',elgg_echo('tidypics:enablephotos'),true);
-
- if (get_plugin_setting('grp_perm_override', 'tidypics') != "disabled")
- register_plugin_hook('permissions_check', 'object', 'tidypics_permission_override');
-
- // Register for notifications
- if (is_callable('register_notification_object')) {
- register_notification_object('object', 'album', elgg_echo('tidypics:newalbum'));
-
- register_plugin_hook('notify:entity:message', 'object', 'tidypics_notify_message');
- }
-
- // slideshow plugin hook
- register_plugin_hook('tp_slideshow', 'album', 'tidypics_slideshow');
- }
-
- /**
- * Sets up sidebar menus for tidypics. Triggered on pagesetup.
- */
- function tidypics_submenus() {
-
- global $CONFIG;
-
- $page_owner = page_owner_entity();
-
- if ($page_owner instanceof ElggGroup) {
- if (get_context() == "groups") {
- if ($page_owner->photos_enable != "no") {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
- }
- }
- }
- // context is only set to photos on individual pages, not on group pages
- else if (get_context() == "photos") {
-
- $view_count = get_plugin_setting('view_count', 'tidypics');
-
- // owner gets "your albumn", "your friends albums", "your most viewed", "your most recent"
- if (get_loggedin_userid() && get_loggedin_userid() == $page_owner->guid) {
-
- add_submenu_item( elgg_echo('album:create'),
- $CONFIG->wwwroot . "pg/photos/new/{$page_owner->username}/",
- 'tidypics-a' );
-
- add_submenu_item( elgg_echo("album:yours"),
- $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
- 'tidypics-a' );
-
- add_submenu_item( elgg_echo('album:yours:friends'),
- $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
- 'tidypics-a');
-
- if ($view_count != 'disabled') {
- add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
- $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
- 'tidypics-a');
- }
-
- add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
- $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
- 'tidypics-a');
- } else if (isloggedin()) {
-
- $user = get_loggedin_user();
-
- // logged in not owner gets "page owners albums", "page owner's friends albums", "page owner's most viewed", "page owner's most recent"
- // and then "your albums", "your most viewed", "your most recent"
- add_submenu_item( elgg_echo("album:yours"),
- $CONFIG->wwwroot . "pg/photos/owned/{$user->username}/",
- 'tidypics-b' );
-
- if ($view_count != 'disabled') {
- add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
- $CONFIG->wwwroot . "pg/photos/mostviewed/{$user->username}/",
- 'tidypics-b');
- }
-
- add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
- $CONFIG->wwwroot . "pg/photos/mostrecent/{$user->username}/",
- 'tidypics-b');
-
- if($page_owner->name) { // check to make sure the owner set their display name
- add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
- 'tidypics-a' );
- add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
- 'tidypics-a');
-
- if ($view_count != 'disabled') {
- add_submenu_item( sprintf(elgg_echo('tidypics:friendmostviewed'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
- 'tidypics-a');
- }
-
- add_submenu_item( sprintf(elgg_echo('tidypics:friendmostrecent'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
- 'tidypics-a');
- }
- } else if ($page_owner->guid) {
- // non logged in user gets "page owners albums", "page owner's friends albums"
- add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
- 'tidypics-a' );
- add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
- 'tidypics-a');
- }
-
- // everyone gets world albums, most recent, most viewed, most recently viewed, recently commented
- add_submenu_item( elgg_echo('album:all'),
- $CONFIG->wwwroot . "pg/photos/world/",
- 'tidypics-z');
- add_submenu_item( elgg_echo('tidypics:mostrecent'),
- $CONFIG->wwwroot . 'pg/photos/mostrecent/',
- 'tidypics-z');
-
- if ($view_count != 'disabled') {
- add_submenu_item( elgg_echo('tidypics:mostviewed'),
- $CONFIG->wwwroot . 'pg/photos/mostviewed/',
- 'tidypics-z');
- add_submenu_item( elgg_echo('tidypics:recentlyviewed'),
- $CONFIG->wwwroot . 'pg/photos/recentlyviewed/',
- 'tidypics-z');
- }
- add_submenu_item( elgg_echo('tidypics:recentlycommented'),
- $CONFIG->wwwroot . 'pg/photos/recentlycommented/',
- 'tidypics-z');
- add_submenu_item( 'Flickr Integration',
- $CONFIG->wwwroot . 'mod/tidypics/pages/flickr/setup.php',
- 'tidypics-z');
-
- }
-
- }
-
- /**
- * Sets up tidypics admin menu. Triggered on pagesetup.
- */
- function tidypics_adminmenu()
- {
- global $CONFIG;
- if (get_context() == 'admin' && isadminloggedin()) {
- add_submenu_item(elgg_echo('tidypics:administration'), $CONFIG->url . "mod/tidypics/pages/admin.php");
- }
- }
-
- /**
- * Sets up submenus for tidypics most viewed pages
- */
- function tidypics_mostviewed_submenus() {
-
- global $CONFIG;
-
- add_submenu_item(elgg_echo('tidypics:mostvieweddashboard'), $CONFIG->url . "mod/tidypics/mostvieweddashboard.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedthisyear'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthisyear.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthismonth.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedlastmonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimageslastmonth.php");
- add_submenu_item(elgg_echo('tidypics:mostviewedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagestoday.php");
- add_submenu_item(elgg_echo('tidypics:mostcommented'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimages.php");
- add_submenu_item(elgg_echo('tidypics:mostcommentedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagesthismonth.php");
- add_submenu_item(elgg_echo('tidypics:mostcommentedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagestoday.php");
- add_submenu_item(elgg_echo('tidypics:recentlycommented'), $CONFIG->wwwroot . 'pg/photos/recentlycommented/');
- }
-
- /**
- * tidypics page handler
- *
- * @param array $page Array of page elements, forwarded by the page handling mechanism
- */
- function tidypics_page_handler($page) {
-
- global $CONFIG;
-
- if (isset($page[0]))
- {
- switch($page[0])
- {
- case "owned": //view list of albums owned by container
- if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/ownedalbums.php");
- break;
-
- case "view": //view an image individually
- if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/viewimage.php");
- break;
-
- case "album": //view an album individually
- if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/viewalbum.php");
- break;
-
- case "new": //create new album
- if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/newalbum.php");
- break;
-
- case "upload": //upload images to album
- if (isset($page[1])) set_input('container_guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/upload.php");
- break;
-
- case "edit": //edit image or album
- if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/edit.php");
- break;
-
- case "friends": // albums of friends
- if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/friends.php");
- break;
-
- case "world": // all site albums
- include($CONFIG->pluginspath . "tidypics/pages/world.php");
- break;
-
- case "download": // download an image
- if (isset($page[1])) set_input('file_guid', $page[1]);
- if (isset($page[2])) set_input('type', $page[2]);
- include($CONFIG->pluginspath . "tidypics/pages/download.php");
- break;
-
- case "tagged": // all photos tagged with user
- if (isset($page[1])) set_input('guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/tagged.php");
- break;
-
- case "mostviewed": // images with the most views
- if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/lists/mostviewedimages.php");
- break;
-
- case "mostrecent": // images uploaded most recently
- if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/lists/mostrecentimages.php");
- break;
-
- case "recentlyviewed": // images most recently viewed
- include($CONFIG->pluginspath . "tidypics/pages/lists/recentlyviewed.php");
- break;
-
- case "recentlycommented": // images with the most recent comments
- include($CONFIG->pluginspath . "tidypics/pages/lists/recentlycommented.php");
- break;
-
- case "highestrated": // images with the highest average rating
- include($CONFIG->pluginspath . "tidypics/pages/lists/highestrated.php");
- break;
-
- case "flickr":
- if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/pages/flickr/setup.php");
- break;
- }
- }
- else
- {
- // going to all site albums if something goes wrong with the page handler
- include($CONFIG->pluginspath . "tidypics/pages/world.php");
- }
-
- }
-
- /**
- * Override permissions for group albums and images
- *
- */
- function tidypics_permission_override($hook, $entity_type, $returnvalue, $params)
- {
- $entity = $params['entity'];
- $user = $params['user'];
-
- if ($entity->subtype == get_subtype_id('object', 'album')) {
- // test that the user can edit the container
- return can_write_to_container(0, $entity->container_guid);
- }
-
- if ($entity->subtype == get_subtype_id('object', 'image')) {
- // test that the user can edit the container
- return can_write_to_container(0, $entity->container_guid);
- }
- }
-
-
- /**
- * Notification message handler
- */
- function tidypics_notify_message($hook, $entity_type, $returnvalue, $params)
- {
- $entity = $params['entity'];
- $to_entity = $params['to_entity'];
- $method = $params['method'];
- if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'album'))
- {
- // block notification message when the album doesn't have any photos
- if ($entity->new_album == TP_NEW_ALBUM)
- return false;
-
- $descr = $entity->description;
- $title = $entity->title;
- $owner = $entity->getOwnerEntity();
- return sprintf(elgg_echo('album:river:created'), $owner->name) . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
- }
- return null;
- }
-
- /**
- * Populates the ->getUrl() method for file objects
- * Registered in the init function
- *
- * @param ElggEntity $entity album/image entity
- * @return string File URL
- */
- function tidypics_image_url($entity) {
- global $CONFIG;
- $title = $entity->title;
- $title = friendly_title($title);
- return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title;
- }
-
- function tidypics_album_url($entity) {
- global $CONFIG;
- $title = $entity->title;
- $title = friendly_title($title);
- return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title;
- }
-
-
- /**
- * Catch the plugin hook and add the default album slideshow
- *
- * @param $hook - 'tidypics:slideshow'
- * @param $entity_type - 'album'
- * @param $returnvalue - if set, return because another plugin has used the hook
- * @param $params - album entity
- * @return unknown_type
- */
- function tidypics_slideshow($hook, $entity_type, $returnvalue, $params) {
-
- if ($returnvalue !== null) {
- // someone has already added a slideshow or requested that the slideshow is not used
- return $returnvalue;
- }
-
- $slideshow_link = 'javascript:PicLensLite.start({maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})';
-
- // add the slideshow javascript to the header
- extend_view('metatags', 'js/slideshow');
-
- return $slideshow_link;
- }
-
- function tp_mostrecentimages($max = 8, $pagination = true) {
- return list_entities("object", "image", 0, $max, false, false, $pagination);
- }
-
-
- // Make sure tidypics_init is called on initialisation
- register_elgg_event_handler('init','system','tidypics_init');
- register_elgg_event_handler('pagesetup','system','tidypics_submenus');
- register_elgg_event_handler('pagesetup','system','tidypics_adminmenu');
-
- // Register actions
- register_action("tidypics/settings", false, $CONFIG->pluginspath . "tidypics/actions/settings.php");
- register_action("tidypics/upload", false, $CONFIG->pluginspath . "tidypics/actions/upload.php");
- register_action("tidypics/addalbum", false, $CONFIG->pluginspath. "tidypics/actions/addalbum.php");
- register_action("tidypics/edit", false, $CONFIG->pluginspath. "tidypics/actions/edit.php");
- register_action("tidypics/delete", false, $CONFIG->pluginspath. "tidypics/actions/delete.php");
- register_action("tidypics/edit_multi", false, $CONFIG->pluginspath. "tidypics/actions/edit_multi.php");
- register_action("tidypics/addtag", true, $CONFIG->pluginspath . "tidypics/actions/addtag.php");
- register_action("tidypics/deletetag", true, $CONFIG->pluginspath . "tidypics/actions/deletetag.php");
- register_action("tidypics/flickrSetup", true, $CONFIG->pluginspath . "tidypics/actions/flickrSetup.php");
-
+wwwroot . "pg/photos/owned/" . $_SESSION['user']->username);
+ }
+
+ // Extend CSS
+ extend_view('css', 'tidypics/css');
+
+ // Extend hover-over and profile menu
+ extend_view('profile/menu/links','tidypics/hover_menu');
+
+ //group view ** psuedo widget view for group pages**
+ extend_view('groups/right_column','tidypics/groupprofile_albums');
+
+ // rss extensions
+ extend_view('extensions/xmlns', 'extensions/tidypics/xmlns');
+ extend_view('extensions/channel', 'extensions/tidypics/channel');
+
+ // Register a page handler, so we can have nice URLs
+ register_page_handler('photos','tidypics_page_handler');
+
+ // Add a new tidypics widget
+ add_widget_type('album_view', elgg_echo("tidypics:widget:albums"), elgg_echo("tidypics:widget:album_descr"), 'profile');
+ add_widget_type('latest_photos', elgg_echo("tidypics:widget:latest"), elgg_echo("tidypics:widget:latest_descr"), 'profile');
+
+ // Register a URL handler for files
+ register_entity_url_handler('tidypics_image_url', 'object', 'image');
+ register_entity_url_handler('tidypics_album_url', 'object', 'album');
+
+ // add the class files for image and album
+ add_subtype("object", "image", "TidypicsImage");
+ add_subtype("object", "album", "TidypicsAlbum");
+
+ // Register entity type
+ register_entity_type('object','image');
+ register_entity_type('object','album');
+
+ if (function_exists('add_group_tool_option'))
+ add_group_tool_option('photos',elgg_echo('tidypics:enablephotos'),true);
+
+ if (get_plugin_setting('grp_perm_override', 'tidypics') != "disabled")
+ register_plugin_hook('permissions_check', 'object', 'tidypics_permission_override');
+
+ // Register for notifications
+ if (is_callable('register_notification_object')) {
+ register_notification_object('object', 'album', elgg_echo('tidypics:newalbum'));
+
+ register_plugin_hook('notify:entity:message', 'object', 'tidypics_notify_message');
+ }
+
+ // slideshow plugin hook
+ register_plugin_hook('tp_slideshow', 'album', 'tidypics_slideshow');
+ }
+
+ /**
+ * Sets up sidebar menus for tidypics. Triggered on pagesetup.
+ */
+ function tidypics_submenus() {
+
+ global $CONFIG;
+
+ $page_owner = page_owner_entity();
+
+ if ($page_owner instanceof ElggGroup) {
+ if (get_context() == "groups") {
+ if ($page_owner->photos_enable != "no") {
+ add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
+ }
+ }
+ }
+ // context is only set to photos on individual pages, not on group pages
+ else if (get_context() == "photos") {
+
+ $view_count = get_plugin_setting('view_count', 'tidypics');
+
+ // owner gets "your albumn", "your friends albums", "your most viewed", "your most recent"
+ if (get_loggedin_userid() && get_loggedin_userid() == $page_owner->guid) {
+
+ add_submenu_item( elgg_echo('album:create'),
+ $CONFIG->wwwroot . "pg/photos/new/{$page_owner->username}/",
+ 'tidypics-a' );
+
+ add_submenu_item( elgg_echo("album:yours"),
+ $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
+ 'tidypics-a' );
+
+ add_submenu_item( elgg_echo('album:yours:friends'),
+ $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
+ 'tidypics-a');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
+ $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+
+ add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
+ $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
+ 'tidypics-a');
+ } else if (isloggedin()) {
+
+ $user = get_loggedin_user();
+
+ // logged in not owner gets "page owners albums", "page owner's friends albums", "page owner's most viewed", "page owner's most recent"
+ // and then "your albums", "your most viewed", "your most recent"
+ add_submenu_item( elgg_echo("album:yours"),
+ $CONFIG->wwwroot . "pg/photos/owned/{$user->username}/",
+ 'tidypics-b' );
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
+ $CONFIG->wwwroot . "pg/photos/mostviewed/{$user->username}/",
+ 'tidypics-b');
+ }
+
+ add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
+ $CONFIG->wwwroot . "pg/photos/mostrecent/{$user->username}/",
+ 'tidypics-b');
+
+ if($page_owner->name) { // check to make sure the owner set their display name
+ add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
+ 'tidypics-a' );
+ add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
+ 'tidypics-a');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( sprintf(elgg_echo('tidypics:friendmostviewed'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/mostviewed/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+
+ add_submenu_item( sprintf(elgg_echo('tidypics:friendmostrecent'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/mostrecent/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+ } else if ($page_owner->guid) {
+ // non logged in user gets "page owners albums", "page owner's friends albums"
+ add_submenu_item( sprintf(elgg_echo("album:user"), $page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/owned/{$page_owner->username}/",
+ 'tidypics-a' );
+ add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/friends/{$page_owner->username}/",
+ 'tidypics-a');
+ }
+
+ // everyone gets world albums, most recent, most viewed, most recently viewed, recently commented
+ add_submenu_item( elgg_echo('album:all'),
+ $CONFIG->wwwroot . "pg/photos/world/",
+ 'tidypics-z');
+ add_submenu_item( elgg_echo('tidypics:mostrecent'),
+ $CONFIG->wwwroot . 'pg/photos/mostrecent/',
+ 'tidypics-z');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:mostviewed'),
+ $CONFIG->wwwroot . 'pg/photos/mostviewed/',
+ 'tidypics-z');
+ add_submenu_item( elgg_echo('tidypics:recentlyviewed'),
+ $CONFIG->wwwroot . 'pg/photos/recentlyviewed/',
+ 'tidypics-z');
+ }
+ add_submenu_item( elgg_echo('tidypics:recentlycommented'),
+ $CONFIG->wwwroot . 'pg/photos/recentlycommented/',
+ 'tidypics-z');
+ add_submenu_item( 'Flickr Integration',
+ $CONFIG->wwwroot . 'mod/tidypics/pages/flickr/setup.php',
+ 'tidypics-z');
+
+ }
+
+ }
+
+ /**
+ * Sets up tidypics admin menu. Triggered on pagesetup.
+ */
+ function tidypics_adminmenu()
+ {
+ global $CONFIG;
+ if (get_context() == 'admin' && isadminloggedin()) {
+ add_submenu_item(elgg_echo('tidypics:administration'), $CONFIG->url . "mod/tidypics/pages/admin.php");
+ }
+ }
+
+ /**
+ * Sets up submenus for tidypics most viewed pages
+ */
+ function tidypics_mostviewed_submenus() {
+
+ global $CONFIG;
+
+ add_submenu_item(elgg_echo('tidypics:mostvieweddashboard'), $CONFIG->url . "mod/tidypics/mostvieweddashboard.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedthisyear'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthisyear.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagesthismonth.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedlastmonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimageslastmonth.php");
+ add_submenu_item(elgg_echo('tidypics:mostviewedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostviewedimagestoday.php");
+ add_submenu_item(elgg_echo('tidypics:mostcommented'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimages.php");
+ add_submenu_item(elgg_echo('tidypics:mostcommentedthismonth'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagesthismonth.php");
+ add_submenu_item(elgg_echo('tidypics:mostcommentedtoday'), $CONFIG->url . "mod/tidypics/pages/lists/mostcommentedimagestoday.php");
+ add_submenu_item(elgg_echo('tidypics:recentlycommented'), $CONFIG->wwwroot . 'pg/photos/recentlycommented/');
+ }
+
+ /**
+ * tidypics page handler
+ *
+ * @param array $page Array of page elements, forwarded by the page handling mechanism
+ */
+ function tidypics_page_handler($page) {
+
+ global $CONFIG;
+
+ if (isset($page[0]))
+ {
+ switch($page[0])
+ {
+ case "owned": //view list of albums owned by container
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/ownedalbums.php");
+ break;
+
+ case "view": //view an image individually
+ if (isset($page[1])) set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/viewimage.php");
+ break;
+
+ case "album": //view an album individually
+ if (isset($page[1])) set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/viewalbum.php");
+ break;
+
+ case "new": //create new album
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/newalbum.php");
+ break;
+
+ case "upload": //upload images to album
+ if (isset($page[1])) set_input('container_guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/upload.php");
+ break;
+
+ case "edit": //edit image or album
+ if (isset($page[1])) set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/edit.php");
+ break;
+
+ case "friends": // albums of friends
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/friends.php");
+ break;
+
+ case "world": // all site albums
+ include($CONFIG->pluginspath . "tidypics/pages/world.php");
+ break;
+
+ case "download": // download an image
+ if (isset($page[1])) set_input('file_guid', $page[1]);
+ if (isset($page[2])) set_input('type', $page[2]);
+ include($CONFIG->pluginspath . "tidypics/pages/download.php");
+ break;
+
+ case "tagged": // all photos tagged with user
+ if (isset($page[1])) set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/tagged.php");
+ break;
+
+ case "mostviewed": // images with the most views
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/lists/mostviewedimages.php");
+ break;
+
+ case "mostrecent": // images uploaded most recently
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/lists/mostrecentimages.php");
+ break;
+
+ case "recentlyviewed": // images most recently viewed
+ include($CONFIG->pluginspath . "tidypics/pages/lists/recentlyviewed.php");
+ break;
+
+ case "recentlycommented": // images with the most recent comments
+ include($CONFIG->pluginspath . "tidypics/pages/lists/recentlycommented.php");
+ break;
+
+ case "highestrated": // images with the highest average rating
+ include($CONFIG->pluginspath . "tidypics/pages/lists/highestrated.php");
+ break;
+
+ case "flickr":
+ if (isset($page[1])) set_input('username',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/pages/flickr/setup.php");
+ break;
+ }
+ }
+ else
+ {
+ // going to all site albums if something goes wrong with the page handler
+ include($CONFIG->pluginspath . "tidypics/pages/world.php");
+ }
+
+ }
+
+ /**
+ * Override permissions for group albums and images
+ *
+ */
+ function tidypics_permission_override($hook, $entity_type, $returnvalue, $params)
+ {
+ $entity = $params['entity'];
+ $user = $params['user'];
+
+ if ($entity->subtype == get_subtype_id('object', 'album')) {
+ // test that the user can edit the container
+ return can_write_to_container(0, $entity->container_guid);
+ }
+
+ if ($entity->subtype == get_subtype_id('object', 'image')) {
+ // test that the user can edit the container
+ return can_write_to_container(0, $entity->container_guid);
+ }
+ }
+
+
+ /**
+ * Notification message handler
+ */
+ function tidypics_notify_message($hook, $entity_type, $returnvalue, $params)
+ {
+ $entity = $params['entity'];
+ $to_entity = $params['to_entity'];
+ $method = $params['method'];
+ if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'album'))
+ {
+ // block notification message when the album doesn't have any photos
+ if ($entity->new_album == TP_NEW_ALBUM)
+ return false;
+
+ $descr = $entity->description;
+ $title = $entity->title;
+ $owner = $entity->getOwnerEntity();
+ return sprintf(elgg_echo('album:river:created'), $owner->name) . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+ }
+ return null;
+ }
+
+ /**
+ * Populates the ->getUrl() method for file objects
+ * Registered in the init function
+ *
+ * @param ElggEntity $entity album/image entity
+ * @return string File URL
+ */
+ function tidypics_image_url($entity) {
+ global $CONFIG;
+ $title = $entity->title;
+ $title = friendly_title($title);
+ return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title;
+ }
+
+ function tidypics_album_url($entity) {
+ global $CONFIG;
+ $title = $entity->title;
+ $title = friendly_title($title);
+ return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title;
+ }
+
+
+ /**
+ * Catch the plugin hook and add the default album slideshow
+ *
+ * @param $hook - 'tidypics:slideshow'
+ * @param $entity_type - 'album'
+ * @param $returnvalue - if set, return because another plugin has used the hook
+ * @param $params - album entity
+ * @return unknown_type
+ */
+ function tidypics_slideshow($hook, $entity_type, $returnvalue, $params) {
+
+ if ($returnvalue !== null) {
+ // someone has already added a slideshow or requested that the slideshow is not used
+ return $returnvalue;
+ }
+
+ $slideshow_link = 'javascript:PicLensLite.start({maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})';
+
+ // add the slideshow javascript to the header
+ extend_view('metatags', 'js/slideshow');
+
+ return $slideshow_link;
+ }
+
+ function tp_mostrecentimages($max = 8, $pagination = true) {
+ return list_entities("object", "image", 0, $max, false, false, $pagination);
+ }
+
+
+ // Make sure tidypics_init is called on initialisation
+ register_elgg_event_handler('init','system','tidypics_init');
+ register_elgg_event_handler('pagesetup','system','tidypics_submenus');
+ register_elgg_event_handler('pagesetup','system','tidypics_adminmenu');
+
+ // Register actions
+ register_action("tidypics/settings", false, $CONFIG->pluginspath . "tidypics/actions/settings.php");
+ register_action("tidypics/upload", false, $CONFIG->pluginspath . "tidypics/actions/upload.php");
+ register_action("tidypics/addalbum", false, $CONFIG->pluginspath. "tidypics/actions/addalbum.php");
+ register_action("tidypics/edit", false, $CONFIG->pluginspath. "tidypics/actions/edit.php");
+ register_action("tidypics/delete", false, $CONFIG->pluginspath. "tidypics/actions/delete.php");
+ register_action("tidypics/edit_multi", false, $CONFIG->pluginspath. "tidypics/actions/edit_multi.php");
+ register_action("tidypics/addtag", true, $CONFIG->pluginspath . "tidypics/actions/addtag.php");
+ register_action("tidypics/deletetag", true, $CONFIG->pluginspath . "tidypics/actions/deletetag.php");
+ register_action("tidypics/flickrSetup", true, $CONFIG->pluginspath . "tidypics/actions/flickrSetup.php");
+
?>
\ No newline at end of file
diff --git a/thumbnail.php b/thumbnail.php
index f310aee95..79d487210 100644
--- a/thumbnail.php
+++ b/thumbnail.php
@@ -1,78 +1,78 @@
-getSubtype() != "image")
- forward('mod/tidypics/graphics/' . $error_image);
-
- // Get filename
- if ($size == "thumb") {
- $thumbfile = $file->thumbnail;
- } else if ($size == "small") {
- $thumbfile = $file->smallthumb;
- } else {
- $thumbfile = $file->largethumb;
- }
-
- if (!$thumbfile)
- forward('mod/tidypics/graphics/' . $error_image);
-
- // create Elgg File object
- $readfile = new ElggFile();
- $readfile->owner_guid = $file->owner_guid;
- $readfile->setFilename($thumbfile);
- $contents = $readfile->grabFile();
-
- // send error image if file could not be read
- if (!$contents) {
- forward('mod/tidypics/graphics/' . $error_image);
- }
-
- // expires every 14 days
- $expires = 14 * 60*60*24;
-
- // overwrite header caused by php session code so images can be cached
- $mime = $file->getMimeType();
- header("Content-Type: $mime");
- header("Content-Length: " . strlen($contents));
- header("Cache-Control: public", true);
- header("Pragma: public", true);
- header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
-
- // Return the thumbnail and exit
- echo $contents;
- exit;
-?>
+getSubtype() != "image")
+ forward('mod/tidypics/graphics/' . $error_image);
+
+ // Get filename
+ if ($size == "thumb") {
+ $thumbfile = $file->thumbnail;
+ } else if ($size == "small") {
+ $thumbfile = $file->smallthumb;
+ } else {
+ $thumbfile = $file->largethumb;
+ }
+
+ if (!$thumbfile)
+ forward('mod/tidypics/graphics/' . $error_image);
+
+ // create Elgg File object
+ $readfile = new ElggFile();
+ $readfile->owner_guid = $file->owner_guid;
+ $readfile->setFilename($thumbfile);
+ $contents = $readfile->grabFile();
+
+ // send error image if file could not be read
+ if (!$contents) {
+ forward('mod/tidypics/graphics/' . $error_image);
+ }
+
+ // expires every 14 days
+ $expires = 14 * 60*60*24;
+
+ // overwrite header caused by php session code so images can be cached
+ $mime = $file->getMimeType();
+ header("Content-Type: $mime");
+ header("Content-Length: " . strlen($contents));
+ header("Cache-Control: public", true);
+ header("Pragma: public", true);
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
+
+ // Return the thumbnail and exit
+ echo $contents;
+ exit;
+?>
diff --git a/views/default/annotation/annotate.php b/views/default/annotation/annotate.php
index c0fb05d3a..8156a4bb4 100644
--- a/views/default/annotation/annotate.php
+++ b/views/default/annotation/annotate.php
@@ -1,21 +1,21 @@
-subject_guid);
- $object = get_entity($vars['item']->object_guid);
- $url = $object->getURL();
- $subtype = get_subtype_from_id($object->subtype);
- $title = $object->title;
- if (!$title)
- $title = elgg_echo('untitled');
-
- $url = "getURL()}\">{$performed_by->name}";
- $string = sprintf(elgg_echo("river:posted:generic"),$url) . " ";
- $string .= elgg_echo("{$subtype}:river:annotate") . " getURL() . "\">" . $title . "";
-
-?>
-
+subject_guid);
+ $object = get_entity($vars['item']->object_guid);
+ $url = $object->getURL();
+ $subtype = get_subtype_from_id($object->subtype);
+ $title = $object->title;
+ if (!$title)
+ $title = elgg_echo('untitled');
+
+ $url = "getURL()}\">{$performed_by->name}";
+ $string = sprintf(elgg_echo("river:posted:generic"),$url) . " ";
+ $string .= elgg_echo("{$subtype}:river:annotate") . " getURL() . "\">" . $title . "";
+
+?>
+
\ No newline at end of file
diff --git a/views/default/js/tagging.php b/views/default/js/tagging.php
index bd6890502..d8abda24c 100644
--- a/views/default/js/tagging.php
+++ b/views/default/js/tagging.php
@@ -1,303 +1,303 @@
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/views/default/river/object/album/create.php b/views/default/river/object/album/create.php
index a9b261566..20f9293d7 100644
--- a/views/default/river/object/album/create.php
+++ b/views/default/river/object/album/create.php
@@ -1,42 +1,42 @@
-subject_guid);
- $album = get_entity($vars['item']->object_guid);
-
- $group_album = ($album->owner_guid != $album->container_guid);
- if ($group_album) {
- $group = get_entity($album->container_guid);
- $group_name = $group->name;
- $group_link = $group->getURL();
- }
-
- $url = "getURL()}\">{$performed_by->name}";
- $string = sprintf(elgg_echo("album:river:created"),$url) . " ";
- $string .= "getURL() . "\">" . $album->title . "";
- if ($group_album)
- $string .= ' ' . elgg_echo('album:river:group') . ' ' . "{$group_name}";
-
- $album_river_view = get_plugin_setting('album_river_view', 'tidypics');
-
- if ($album_river_view == "cover") {
- if ($album->cover) {
- $string .= "wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/>' . "
wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> ';
- }
- }
-
- $string .= "
wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/>' . "
wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> ';
+ }
+ }
+
+ $string .= "
wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> ';
-*/
- $string .= "getURL() . "\">
wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> ';
- $string .= "
wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> ';
+*/
+ $string .= "getURL() . "\">
wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> ';
+ $string .= "
-White screen when uploading images
-Question mark images appear
-
+White screen when uploading images
+Question mark images appear
+
-Overview
-Testing ImageMagick Commandline
-
-
-
-
-
-
-Run Server Analysis
-
+
+Run Server Analysis
+
-Photos:
-Albums:
-Comments on photos:
-Comments on albums:
-Total views:
-
-Photo tags:
-
+dbprefix}entities where subtype={$img_type}";
+ $total = get_data_row($query);
+ $num_images = $total->total;
+
+ $img_type = get_subtype_id('object', 'album');
+ $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
+ $total = get_data_row($query);
+ $num_albums = $total->total;
+
+ $num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment');
+ $num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment');
+
+ $num_views = count_annotations(0, 'object', 'image', 'tp_view');
+
+ if (get_plugin_setting('tagging', 'tidypics') != "disabled")
+ $num_tags = count_annotations(0, 'object', 'image', 'phototag');
+?>
+
+Photos:
+Albums:
+Comments on photos:
+Comments on albums:
+Total views:
+
+Photo tags:
+
-Overview
-Thumbnail Creation
-';
- else
- $album_cover = '
';
-?>
-
-username) || empty($owner->username)) {
- echo ' ';
- } else {
- echo '';
- }
-
- }
-
- if (can_write_to_container(0, $owner->guid)) {
- echo '';
- }
-
-
- //close album_widget_container div
- echo "
';
+ else
+ $album_cover = '
';
+?>
+
+username) || empty($owner->username)) {
+ echo ' ';
+ } else {
+ echo '';
+ }
+
+ }
+
+ if (can_write_to_container(0, $owner->guid)) {
+ echo '';
+ }
+
+
+ //close album_widget_container div
+ echo "
';
- }
- echo '
';
+ }
+ echo '
Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.
";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "
";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "
";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "
";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "
";
- $form_body .= 'width: ';
- $form_body .= 'height:
";
- $form_body .= 'width: ';
- $form_body .= 'height:
";
- $form_body .= 'width: ';
- $form_body .= 'height:
Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.
";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "
";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "
";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "
";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "
";
+ $form_body .= 'width: ';
+ $form_body .= 'height:
";
+ $form_body .= 'width: ';
+ $form_body .= 'height:
";
+ $form_body .= 'width: ';
+ $form_body .= 'height: ' . elgg_echo('album:group') . '
';
- echo elgg_view('tidypics/albums', array('num_albums' => 5));
- echo '' . elgg_echo('album:group') . '
';
+ echo elgg_view('tidypics/albums', array('num_albums' => 5));
+ echo '
+
-
";
+ $image_html = "";
+ $image_html .= "
";
+ $image_html .= "";
} else {
- // no link for this image
- echo "
";
+ $image_html = "
";
}
+ // does any plugin want to override the link
+ $image_html = trigger_plugin_hook('tp_thumbnail_link', 'image', array('image' => $image), $image_html);
+ echo $image_html;
?>
';
+ $album_cover = '
';
else
$album_cover = '
';
?>
+
name;?>
Copies of the photos will be made and stored on this site where they can be viewed and commented on.',
- 'flickr:intro' => 'Flickr Integration allows you to import photos from your flickr account into this Elgg site. By entering your username and choosing an album to import into, you can begin the process.
When you have saved your username and album selection, click on the ' . elgg_echo( 'flickr:menuimport' ) . ' link to the left to select which Flickr set you would like to import photos from.',
+ 'flickr:intro' => 'Flickr Integration allows you to import photos from your flickr account into this Elgg site. By entering your username and choosing an album to import into, you can begin the process.
When you have saved your username and album selection, click on the Import Flickr Photos link to the left to select which Flickr set you would like to import photos from.',
'flickr:menusetup' => 'Flickr Setup',
'flickr:menuimport' => 'Import Flickr Photos',
@@ -219,4 +219,4 @@ The photo can be viewed here: %s",
);
add_translation("en",$english);
-?>
\ No newline at end of file
+?>
--
cgit v1.2.3
From 5fe18f0778902fa6c0541b99d988415ae921a4ca Mon Sep 17 00:00:00 2001
From: Cash Costello
+
+
+:
+
+
--
cgit v1.2.3
From bbaf1bfa96b7034929426e7e88dec0ac7d030b64 Mon Sep 17 00:00:00 2001
From: Cash Costello ' . elgg_echo('album:group') . '
';
+?>
+ guid; ?>">Group albums
+' . elgg_echo('album:group') . '';
echo elgg_view('tidypics/albums', array('num_albums' => 5));
echo '
- name;?>
+ name;?>
+
0) {
+ $counter = 0;
foreach($entities as $entity) {
+ if ($counter % $num_wide == 0) {
+ $html .= "";
+ }
$html .= elgg_view_entity($entity, $fullview);
+ $counter++;
}
}
--
cgit v1.2.3
From faeb704ed004777c57389f829519feeb2e235f11 Mon Sep 17 00:00:00 2001
From: Cash Costello
';
- else
- $error = elgg_echo("tidypics:completeuploadfailure") . '
';
-
- $num_failures = count($not_uploaded);
- for ($i = 0; $i < $num_failures; $i++) {
- $error .= "{$not_uploaded[$i]}: {$error_msgs[$i]}
";
+
+ } else if ($image_lib == 'ImageMagickPHP') { // imagick php extension
+
+ if (tp_create_imagick_thumbnails($file, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING);
}
- register_error($error);
-
- if (count($uploaded_images) == 0)
- forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //upload failed, so forward to previous page
- else {
- // some images did upload so we fall through
+
+ } else {
+
+ if (tp_create_gd_thumbnails($file, $prefix, $filestorename) != true) {
+ trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING);
}
+
+ } // end of image library selector
+
+ //keep one file handy so we can add a notice to the river if single image option selected
+ if (!$file_for_river) {
+ $file_for_river = $file;
+ }
+
+ array_push($uploaded_images, $file->guid);
+
+ // update user/group size for checking quota
+ $image_repo_size += $sent_file['size'];
+
+ // plugins can register to be told when a new image has been uploaded
+ trigger_elgg_event('upload', 'tp_image', $file);
+
+ // successful upload so check if this is a new album and throw river event/notification if so
+ if ($album->new_album == TP_NEW_ALBUM) {
+ $album->new_album = TP_OLD_ALBUM;
+
+ // we throw the notification manually here so users are not told about the new album until there
+ // is at least a few photos in it
+ object_notifications('create', 'object', $album);
+
+ add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid);
+ }
+
+ if ($img_river_view == "all") {
+ add_to_river('river/object/image/create', 'create', $file->getObjectOwnerGUID(), $file->getGUID());
+ }
+ unset($file); // may not be needed but there seems to be a memory leak
+
+} //end of for loop
+
+if (count($not_uploaded) > 0) {
+ if (count($uploaded_images) > 0) {
+ $error = sprintf(elgg_echo("tidypics:partialuploadfailure"), count($not_uploaded), count($not_uploaded) + count($uploaded_images)) . '
';
} else {
- system_message(elgg_echo('tidypics:upl_success'));
+ $error = elgg_echo("tidypics:completeuploadfailure") . '
';
}
-
- if (count($uploaded_images) && $img_river_view == "1") {
- if (function_exists('add_to_river')) {
- add_to_river('river/object/image/create', 'create', $file_for_river->getObjectOwnerGUID(), $file_for_river->getGUID());
- }
+ $num_failures = count($not_uploaded);
+ for ($i = 0; $i < $num_failures; $i++) {
+ $error .= "{$not_uploaded[$i]}: {$error_msgs[$i]}
";
+ }
+ register_error($error);
+
+ if (count($uploaded_images) == 0) {
+ //upload failed, so forward to previous page
+ forward($_SERVER['HTTP_REFERER']);
+ } else {
+ // some images did upload so we fall through
}
-
- // update image repo size
- create_metadata($album->container_guid, "image_repo_size", $image_repo_size, 'integer', $album->container_guid);
-
- // plugins can register to be told when a Tidypics album has had images added
- trigger_elgg_event('upload', 'tp_album', $album);
-
-
- //forward to multi-image edit page
- forward($CONFIG->wwwroot . 'mod/tidypics/pages/edit_multiple.php?files=' . implode('-', $uploaded_images));
-
-?>
+} else {
+ system_message(elgg_echo('tidypics:upl_success'));
+}
+
+
+if (count($uploaded_images) && $img_river_view == "1") {
+ add_to_river('river/object/image/create', 'create', $file_for_river->getObjectOwnerGUID(), $file_for_river->getGUID());
+}
+
+// update image repo size
+create_metadata($album->container_guid, "image_repo_size", $image_repo_size, 'integer', $album->container_guid);
+
+// plugins can register to be told when a Tidypics album has had images added
+trigger_elgg_event('upload', 'tp_album', $album);
+
+
+//forward to multi-image edit page
+forward($CONFIG->wwwroot . 'mod/tidypics/pages/edit_multiple.php?files=' . implode('-', $uploaded_images));
diff --git a/contributions.txt b/contributions.txt
index fac5edc6f..2e09ca1cf 100644
--- a/contributions.txt
+++ b/contributions.txt
@@ -7,7 +7,7 @@ Release Date: 05/01/2010
------------------------------------------------------------------------
BEGIN VERSION 1.6.8 CHANGES
------------------------------------------------------------------------
- * New language strings: tidypics:nophotosingroup
+ * New language strings: tidypics:nophotosingroup, tidypics:baduploadform
* Fixed bug in titles of albums RSS
* Added a new css element: tidypics_line_break
* Fixed layout of album covers due to long titles or other text
diff --git a/languages/en.php b/languages/en.php
index 7211ed9be..30cef2db4 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -191,6 +191,7 @@ The photo can be viewed here: %s",
//Error messages
+ 'tidypics:baduploadform' => "There was an error with the upload form",
'tidypics:partialuploadfailure' => "There were errors uploading some of the images (%s of %s images).",
'tidypics:completeuploadfailure' => "Upload of images failed.",
'tidypics:exceedpostlimit' => "Too many large images - try to upload fewer or smaller images.",
--
cgit v1.2.3
From ec7f055fd50b809ea50b7917b9c2e0cee5cd50d6 Mon Sep 17 00:00:00 2001
From: Cash Costello ' . elgg_echo('tidypics:settings:heading:img_lib') . '
';
$image_lib = $plugin->image_lib;
if (!$image_lib) $image_lib = 'GD';
- $form_body = '' . elgg_echo('tidypics:settings:heading:main') . '
';
$tagging = $plugin->tagging;
if(!$tagging) $tagging = "enabled";
$form_body .= '' . elgg_echo('tidypics:settings:heading:river') . '
';
$img_river_view = $plugin->img_river_view;
if (!$img_river_view) $img_river_view = '1';
$form_body .= '' . elgg_echo('tidypics:settings:heading:sizes') . '
';
+ $form_body .= "You must edit the css if you change the default sizes
";
$image_sizes = $plugin->image_sizes;
if(!$image_sizes) {
$image_sizes = array(); // set default values
@@ -127,15 +132,18 @@
$form_body .= "
";
$form_body .= 'width: ';
$form_body .= 'height:
";
- $form_body .= 'width: ';
- $form_body .= 'height:
" . elgg_echo('tidypics:settings:thumbsize') . "
";
- $form_body .= 'width: ';
- $form_body .= 'height:
' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "
"; -- cgit v1.2.3 From 76d0f767eb42cb2c4bf20b5db63c6722c64fa28c Mon Sep 17 00:00:00 2001 From: Cash Costello' . elgg_echo('tidypics:settings:image_lib') . ': ';
- $form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[image_lib]',
- 'options_values' => $img_lib_options,
- 'value' => $image_lib
- ));
- $form_body .= '
Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.
" . elgg_echo('tidypics:settings:im_path') . "
";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "
' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . "
"; @@ -87,6 +60,38 @@ $form_body .= "" . elgg_echo('tidypics:settings:quota') . "
";
$form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "
' . elgg_echo('tidypics:settings:image_lib') . ': ';
+ $form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[image_lib]',
+ 'options_values' => $img_lib_options,
+ 'value' => $image_lib
+ ));
+ $form_body .= '
Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.
" . elgg_echo('tidypics:settings:im_path') . "
";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "
Another possible cause is using ImageMagick when your server does not support it or specifying the wrong path to the ImageMagick executables. +
+If you are unable to settings, there are two possible causes. First, +Apache can be configured to block pages that use file paths as Tidypics +does when setting the location of the ImageMagick executable. In this case, +leave that field blank. Second, there is some bad code in the Izaps video +plugin that can prevent the settings from being saved. Try disabling that plugin.
\ No newline at end of file -- cgit v1.2.3 From 83c4591aad6e7598a35a8ee358ef562f132d78b8 Mon Sep 17 00:00:00 2001 From: Cash Costello"; var_dump( array($flickr_username, $return_url )); echo ""; - -?> \ No newline at end of file diff --git a/actions/imtest.php b/actions/imtest.php index cbe15a1c1..293a9b2e8 100644 --- a/actions/imtest.php +++ b/actions/imtest.php @@ -1,19 +1,18 @@ +/** + * Tidypics ImageMagick Location Test + * + * Called through ajax + */ + +$location = $_GET['location']; + +$command = $location . "convert -version"; + +$result = system($command, $return_val); + +if ($return_val == 0) { + echo $result; +} else { + echo "Unable to run ImageMagick. Please check the path."; +} diff --git a/actions/settings.php b/actions/settings.php index a4f102b89..2c529d950 100644 --- a/actions/settings.php +++ b/actions/settings.php @@ -1,72 +1,77 @@ $v) { - if (!set_plugin_setting($k, $v, 'tidypics')) { - register_error(sprintf(elgg_echo('plugins:settings:save:fail'), 'tidypics')); - forward($_SERVER['HTTP_REFERER']); - } +// Params array (text boxes and drop downs) +$params = get_input('params'); +$result = false; +foreach ($params as $k => $v) { + if (!set_plugin_setting($k, $v, 'tidypics')) { + register_error(sprintf(elgg_echo('plugins:settings:save:fail'), 'tidypics')); + forward($_SERVER['HTTP_REFERER']); } +} - // check boxes - if (is_array(get_input('download_link'))) // this can be done due to way Elgg uses checkboxes - set_plugin_setting('download_link', 'enabled', 'tidypics'); - else - set_plugin_setting('download_link', 'disabled', 'tidypics'); - - if (is_array(get_input('tagging'))) - set_plugin_setting('tagging', 'enabled', 'tidypics'); - else - set_plugin_setting('tagging', 'disabled', 'tidypics'); - - if (is_array(get_input('photo_ratings'))) - set_plugin_setting('photo_ratings', 'enabled', 'tidypics'); - else - set_plugin_setting('photo_ratings', 'disabled', 'tidypics'); - - if (is_array(get_input('exif'))) - set_plugin_setting('exif', 'enabled', 'tidypics'); - else - set_plugin_setting('exif', 'disabled', 'tidypics'); - - if (is_array(get_input('view_count'))) - set_plugin_setting('view_count', 'enabled', 'tidypics'); - else - set_plugin_setting('view_count', 'disabled', 'tidypics'); - - if (is_array(get_input('grp_perm_override'))) - set_plugin_setting('grp_perm_override', 'enabled', 'tidypics'); - else - set_plugin_setting('grp_perm_override', 'disabled', 'tidypics'); - - - // image sizes - $image_sizes = array(); - $image_sizes['large_image_width'] = get_input('large_thumb_width'); - $image_sizes['large_image_height'] = get_input('large_thumb_height'); - $image_sizes['small_image_width'] = get_input('small_thumb_width'); - //$image_sizes['small_image_height'] = get_input('small_thumb_height'); - $image_sizes['small_image_height'] = get_input('small_thumb_width'); - $image_sizes['thumb_image_width'] = get_input('thumb_width'); - //$image_sizes['thumb_image_height'] = get_input('thumb_height'); - $image_sizes['thumb_image_height'] = get_input('thumb_width'); - set_plugin_setting('image_sizes', serialize($image_sizes), 'tidypics'); - - - - system_message(elgg_echo('tidypics:settings:save:ok')); - - forward($_SERVER['HTTP_REFERER']); -?> +// check boxes +if (is_array(get_input('download_link'))) { // this can be done due to way Elgg uses checkboxes + set_plugin_setting('download_link', 'enabled', 'tidypics'); +} else { + set_plugin_setting('download_link', 'disabled', 'tidypics'); +} + +if (is_array(get_input('tagging'))) { + set_plugin_setting('tagging', 'enabled', 'tidypics'); +} else { + set_plugin_setting('tagging', 'disabled', 'tidypics'); +} + +if (is_array(get_input('photo_ratings'))) { + set_plugin_setting('photo_ratings', 'enabled', 'tidypics'); +} else { + set_plugin_setting('photo_ratings', 'disabled', 'tidypics'); +} + +if (is_array(get_input('exif'))) { + set_plugin_setting('exif', 'enabled', 'tidypics'); +} else { + set_plugin_setting('exif', 'disabled', 'tidypics'); +} + +if (is_array(get_input('view_count'))) { + set_plugin_setting('view_count', 'enabled', 'tidypics'); +} else { + set_plugin_setting('view_count', 'disabled', 'tidypics'); +} + +if (is_array(get_input('grp_perm_override'))) { + set_plugin_setting('grp_perm_override', 'enabled', 'tidypics'); +} else { + set_plugin_setting('grp_perm_override', 'disabled', 'tidypics'); +} + + +// image sizes +$image_sizes = array(); +$image_sizes['large_image_width'] = get_input('large_thumb_width'); +$image_sizes['large_image_height'] = get_input('large_thumb_height'); +$image_sizes['small_image_width'] = get_input('small_thumb_width'); +//$image_sizes['small_image_height'] = get_input('small_thumb_height'); +$image_sizes['small_image_height'] = get_input('small_thumb_width'); +$image_sizes['thumb_image_width'] = get_input('thumb_width'); +//$image_sizes['thumb_image_height'] = get_input('thumb_height'); +$image_sizes['thumb_image_height'] = get_input('thumb_width'); +set_plugin_setting('image_sizes', serialize($image_sizes), 'tidypics'); + + + +system_message(elgg_echo('tidypics:settings:save:ok')); + +forward($_SERVER['HTTP_REFERER']); diff --git a/actions/upgrade.php b/actions/upgrade.php index cb200380a..596b90a22 100644 --- a/actions/upgrade.php +++ b/actions/upgrade.php @@ -6,35 +6,34 @@ * *********************************************/ - include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"; - - admin_gatekeeper(); - - $result = true; - - // add image class - $id = get_subtype_id("object", "image"); - if ($id != 0) { - $table = $CONFIG->dbprefix . 'entity_subtypes'; - $result = update_data("UPDATE {$table} set class='TidypicsImage' where id={$id}"); - if (!result) { - register_error(elgg_echo('tidypics:upgrade:failed')); - forward($_SERVER['HTTP_REFERER']); - } +include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"; + +admin_gatekeeper(); + +$result = true; + +// add image class +$id = get_subtype_id("object", "image"); +if ($id != 0) { + $table = $CONFIG->dbprefix . 'entity_subtypes'; + $result = update_data("UPDATE {$table} set class='TidypicsImage' where id={$id}"); + if (!result) { + register_error(elgg_echo('tidypics:upgrade:failed')); + forward($_SERVER['HTTP_REFERER']); } +} - // add album class - $id = get_subtype_id("object", "album"); - if ($id != 0) { - $table = $CONFIG->dbprefix . 'entity_subtypes'; - $result = update_data("UPDATE {$table} set class='TidypicsAlbum' where id={$id}"); - if (!result) { - register_error(elgg_echo('tidypics:upgrade:failed')); - forward($_SERVER['HTTP_REFERER']); - } +// add album class +$id = get_subtype_id("object", "album"); +if ($id != 0) { + $table = $CONFIG->dbprefix . 'entity_subtypes'; + $result = update_data("UPDATE {$table} set class='TidypicsAlbum' where id={$id}"); + if (!result) { + register_error(elgg_echo('tidypics:upgrade:failed')); + forward($_SERVER['HTTP_REFERER']); } +} + +system_message(elgg_echo('tidypics:upgrade:success')); - system_message(elgg_echo('tidypics:upgrade:success')); - - forward($_SERVER['HTTP_REFERER']); -?> \ No newline at end of file +forward($_SERVER['HTTP_REFERER']); diff --git a/contributions.txt b/contributions.txt index 3cea54bd9..947f2b069 100644 --- a/contributions.txt +++ b/contributions.txt @@ -1,5 +1,17 @@ Changelog and contributors list +------------------------------------------------------------------------ +Version 1.6.9 Change List +Release Date: 07/25/2010 +------------------------------------------------------------------------ +BEGIN VERSION 1.6.9 CHANGES +------------------------------------------------------------------------ + * Fixed bug where old installs of Tidypics would not upgrade + * Fixed bug in activity river with link on image entry + * +------------------------------------------------------------------------ +END VERSION 1.6.9 CHANGES +------------------------------------------------------------------------ ------------------------------------------------------------------------ Version 1.6.8 Change List diff --git a/languages/en.php b/languages/en.php index 934c8ae5a..2ee3a6e5e 100644 --- a/languages/en.php +++ b/languages/en.php @@ -1,11 +1,10 @@ "untitled", // Menu items and titles - 'image' => "Image", 'images' => "Images", 'caption' => "Caption", @@ -225,7 +224,6 @@ The photo can be viewed here: %s", 'flickr:errorusername2' => 'You must enter a username', 'flickr:errorimageimport' => 'This image has already been imported', 'flickr:errornoalbum' => "No album selected. Please choose and save an album: %s" - ); +); - add_translation("en",$english); -?> +add_translation("en", $english); diff --git a/lib/flickr.php b/lib/flickr.php index effd186c4..7f91b0f01 100644 --- a/lib/flickr.php +++ b/lib/flickr.php @@ -4,5 +4,3 @@ function flickr_menu() { add_submenu_item( elgg_echo( 'flickr:menusetup' ), "/mod/tidypics/pages/flickr/setup.php"); add_submenu_item( elgg_echo( 'flickr:menuimport' ), "/mod/tidypics/pages/flickr/importPhotosets.php" ); } - -?> \ No newline at end of file diff --git a/manifest.xml b/manifest.xml index d630e9601..f19991546 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,10 +1,10 @@
"; - var_dump( $sql); -// var_dump( $result ); - echo ""; + if (count($entities) >= $max) { + break; } - $title = elgg_echo("tidypics:recentlycommented"); - $area2 = elgg_view_title($title); - - // grab the html to display the images - $images = tp_view_entity_list($entities, $max, 0, $max, false); - - // this view takes care of the title on the main column and the content wrapper - $area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $images,)); - if( empty( $area2 )) $area2 = $images; - - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - page_draw($title, $body); -?> \ No newline at end of file +} + +$user = get_loggedin_user(); +$title = elgg_echo("tidypics:recentlycommented"); +$area2 = elgg_view_title($title); + +// grab the html to display the images +$images = tp_view_entity_list($entities, $max, 0, $max, false); + +// this view takes care of the title on the main column and the content wrapper +$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $images,)); +if (empty($area2)) { + $area2 = $images; +} + +$body = elgg_view_layout('two_column_left_sidebar', '', $area2); +page_draw($title, $body); diff --git a/pages/lists/recentlyviewed.php b/pages/lists/recentlyviewed.php index 16ad474df..419576d8e 100644 --- a/pages/lists/recentlyviewed.php +++ b/pages/lists/recentlyviewed.php @@ -1,36 +1,36 @@ dbprefix; - $max_limit = 200; //get extra because you'll have multiple views per image in the result set - $max = 16; //controls how many actually show on screen - - //this works but is wildly inefficient - //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); - - $sql = "SELECT distinct ent.guid, ann1.time_created +// world view - set page owner to logged in user +if (isloggedin()) { + set_page_owner(get_loggedin_userid()); +} + +// allow other plugins to override the slideshow +$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array(), null); +if ($slideshow_link) { + add_submenu_item(elgg_echo('album:slideshow'), + $slideshow_link, + 'photos' ); +} + + +global $CONFIG; +$prefix = $CONFIG->dbprefix; +$max_limit = 200; //get extra because you'll have multiple views per image in the result set +$max = 16; //controls how many actually show on screen + +//this works but is wildly inefficient +//$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); + +$sql = "SELECT distinct ent.guid, ann1.time_created FROM " . $prefix . "entities ent INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id AND sub.subtype = 'image' @@ -39,27 +39,30 @@ AND ms.string = 'tp_view' ORDER BY ann1.id DESC LIMIT $max_limit"; - - $result = get_data($sql); - $entities = array(); - foreach($result as $entity) { - if(!$entities[$entity->guid]) { - $entities[$entity->guid] = get_entity($entity->guid); - } - if(count($entities) >= $max) break; +$result = get_data($sql); + +$entities = array(); +foreach ($result as $entity) { + if (!$entities[$entity->guid]) { + $entities[$entity->guid] = get_entity($entity->guid); + } + if (count($entities) >= $max) { + break; } - - $title = elgg_echo("tidypics:recentlyviewed"); - $area2 = elgg_view_title($title); - - // grab the html to display the images - $images = tp_view_entity_list($entities, $max, 0, $max, false); - - // this view takes care of the title on the main column and the content wrapper - $area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $images,)); - if( empty( $area2 )) $area2 = $images; - - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - page_draw($title, $body); -?> \ No newline at end of file +} + +$title = elgg_echo("tidypics:recentlyviewed"); +$area2 = elgg_view_title($title); + +// grab the html to display the images +$images = tp_view_entity_list($entities, $max, 0, $max, false); + +// this view takes care of the title on the main column and the content wrapper +$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $images,)); +if (empty($area2)) { + $area2 = $images; +} + +$body = elgg_view_layout('two_column_left_sidebar', '', $area2); +page_draw($title, $body); diff --git a/pages/newalbum.php b/pages/newalbum.php index fda886d52..535116237 100644 --- a/pages/newalbum.php +++ b/pages/newalbum.php @@ -1,32 +1,30 @@ name), - $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username); - } - - $area2 = elgg_view_title(elgg_echo('album:add')); - $area2 .= elgg_view("tidypics/forms/edit"); - - // Display page - page_draw(elgg_echo('album:add'),elgg_view_layout("two_column_left_sidebar", $area1, $area2, $area3 )); +// Load Elgg engine +include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"; -?> \ No newline at end of file +// must be logged in to create a new album +gatekeeper(); + +// Get the current page's owner +$page_owner = page_owner_entity(); +if ($page_owner === false || is_null($page_owner)) { + $page_owner = get_loggedin_user(); + set_page_owner($page_owner->guid); +} + +if ($page_owner instanceof ElggGroup) { + add_submenu_item(sprintf(elgg_echo('album:group'), $page_owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username); +} + +$area2 = elgg_view_title(elgg_echo('album:add')); +$area2 .= elgg_view("tidypics/forms/edit"); + +// Display page +page_draw(elgg_echo('album:add'),elgg_view_layout("two_column_left_sidebar", '', $area2)); diff --git a/pages/ownedalbums.php b/pages/ownedalbums.php index d22c6d44a..67583c65c 100644 --- a/pages/ownedalbums.php +++ b/pages/ownedalbums.php @@ -1,53 +1,55 @@ username) || empty($owner->username)) { - forward('pg/photos/world'); - } +/** + * tidypics photo gallery album listing page for a person/group + * + * Shows all the albums that belong to that person or group + */ + +include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"; + +// if this page belongs to a closed group, prevent anyone outside group from seeing +if (is_callable('group_gatekeeper')) { + group_gatekeeper(); +} + +//get the owner of the current page +$owner = page_owner_entity(); + + +//if page owner cannot be found, forward to world album list +if (is_null($owner->username) || empty($owner->username)) { + forward('pg/photos/world'); +} - - // setup group menu for album index - if ($owner instanceof ElggGroup) { - add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name), - $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username); - if (can_write_to_container(0, $owner->guid)) { - add_submenu_item( elgg_echo('album:create'), - $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username, - 'tidypics'); - } + +// setup group menu for album index +if ($owner instanceof ElggGroup) { + add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name), + $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username); + if (can_write_to_container(0, $owner->guid)) { + add_submenu_item( elgg_echo('album:create'), + $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username, + 'tidypics'); } - - //set the title - $title = sprintf(elgg_echo('album:user'), $owner->name); - $area2 = elgg_view_title($title); - - // Get objects - set_context('search'); - set_input('search_viewtype', 'gallery'); - if ($owner instanceof ElggGroup) - $content .= tp_list_entities("object", "album", 0, $owner->guid, 12, false); - else - $content .= tp_list_entities("object", "album", $owner->guid, $owner->guid, 12, false); - - $area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,)); - - set_context('photos'); - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - - // Finally draw the page - page_draw($title, $body); -?> \ No newline at end of file +} + +//set the title +$title = sprintf(elgg_echo('album:user'), $owner->name); +$area2 = elgg_view_title($title); + +// Get objects +set_context('search'); +set_input('search_viewtype', 'gallery'); +if ($owner instanceof ElggGroup) { + $content .= tp_list_entities("object", "album", 0, $owner->guid, 12, false); +} else { + $content .= tp_list_entities("object", "album", $owner->guid, $owner->guid, 12, false); +} + +$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,)); + +set_context('photos'); +$body = elgg_view_layout('two_column_left_sidebar', '', $area2); + +// Finally draw the page +page_draw($title, $body); \ No newline at end of file diff --git a/pages/server_analysis.php b/pages/server_analysis.php index ccffc1632..db3aed5f6 100644 --- a/pages/server_analysis.php +++ b/pages/server_analysis.php @@ -8,48 +8,49 @@ * ********************************************************************/ - include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"; +include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"; - global $CONFIG; +global $CONFIG; - admin_gatekeeper(); +admin_gatekeeper(); - set_context('admin'); +set_context('admin'); - $title = 'TidyPics Server Analysis'; +$title = 'TidyPics Server Analysis'; - function tp_readable_size($bytes) - { - if (strpos($bytes, 'M')) - return $bytes . 'B'; - - $size = $bytes / 1024; +function tp_readable_size($bytes) { + if (strpos($bytes, 'M')) { + return $bytes . 'B'; + } + + $size = $bytes / 1024; + if ($size < 1024) { + $size = number_format($size, 2); + $size .= ' KB'; + } else { + $size = $size / 1024; if ($size < 1024) { $size = number_format($size, 2); - $size .= ' KB'; + $size .= ' MB'; } else { $size = $size / 1024; - if($size < 1024) { - $size = number_format($size, 2); - $size .= ' MB'; - } else { - $size = $size / 1024; - $size = number_format($size, 2); - $size .= ' GB'; - } + $size = number_format($size, 2); + $size .= ' GB'; } - return $size; } + return $size; +} - $disablefunc = explode(',', ini_get('disable_functions')); - $exec_avail = "Disabled"; - if (is_callable('exec') && !in_array('exec',$disablefunc)) - $exec_avail = "Enabled"; +$disablefunc = explode(',', ini_get('disable_functions')); +$exec_avail = "Disabled"; +if (is_callable('exec') && !in_array('exec',$disablefunc)) { + $exec_avail = "Enabled"; +} - ob_start(); +ob_start(); - echo elgg_view_title($title); +echo elgg_view_title($title); ?>
Instructions here for uploading images using Ajax/Flash
- -Upload Files | -Clear Queue +Instructions here for uploading images using Ajax/Flash
+ +
';
+ if ($album) {
+ echo '';
}
if ($access_id) {
echo '';
--
cgit v1.2.3
From 9e0d8ea4aa08f6390c0f93f6466c2a101dffcbed Mon Sep 17 00:00:00 2001
From: Cash Costello Instructions here for uploading images using Ajax/Flash
- ' . elgg_echo('tidypics:settings:img_river_view');
$form_body .= elgg_view('input/pulldown', array(
'internalname' => 'params[img_river_view]',
'options_values' => array(
'all' => 'all',
- '1' => '1',
+ 'batch' => '1',
'none' => 'none',
),
'value' => $img_river_view
--
cgit v1.2.3
From 243e836190128b14e1c5aa53b6d01b6771b19d8c Mon Sep 17 00:00:00 2001
From: Cash Costello ";
$form_body .= elgg_echo( 'flickr:usernamesetup') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:uploader') => 'enabled'), 'internalname' => 'uploader', 'value' => $uploader )) . " " . elgg_echo('tidypics:settings:watermark') . " " . elgg_echo('tidypics:settings:im_path') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:uploader') => 'enabled'), 'internalname' => 'uploader', 'value' => $uploader )) . " " . elgg_echo('tidypics:settings:watermark') . " " . elgg_echo('tidypics:settings:maxfilesize') . " " . elgg_echo('tidypics:settings:quota') . " ' . elgg_echo('tidypics:settings:image_lib') . ': ';
+$form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[image_lib]',
+ 'options_values' => $img_lib_options,
+ 'value' => $image_lib
+));
+$form_body .= ' " . elgg_echo('tidypics:settings:im_path') . " ' . elgg_echo('tidypics:settings:img_river_view') . ': ';
+$form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[img_river_view]',
+ 'options_values' => array(
+ 'all' => 'all',
+ 'batch' => '1',
+ 'none' => 'none',
+ ),
+ 'value' => $img_river_view
+));
+$form_body .= ' ' . elgg_echo('tidypics:settings:album_river_view') . ': ';
+$form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[album_river_view]',
+ 'options_values' => array(
+ 'cover' => 'cover',
+ 'set' => 'set',
+ ),
+ 'value' => $album_river_view
+));
+$form_body .= ' " . elgg_echo('tidypics:settings:largesize') . " " . elgg_echo('tidypics:settings:smallsize') . " " . elgg_echo('tidypics:settings:thumbsize') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "
- "{$vars['url']}mod/tidypics/pages/server_analysis.php",
+ 'text' => elgg_echo('tidypics:settings:server:analysis'),
+));
-$url = "{$vars['url']}mod/tidypics/pages/server_analysis.php";
-$text = elgg_echo('tidypics:settings:server:analysis');
+echo elgg_view('output/longtext', array('value' => elgg_echo('tidypics:admin:instructions')));
-echo "$text";
-?>
- ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:uploader') => 'enabled'), 'internalname' => 'uploader', 'value' => $uploader )) . " " . elgg_echo('tidypics:settings:watermark') . " " . elgg_echo('tidypics:settings:maxfilesize') . " " . elgg_echo('tidypics:settings:quota') . " ' . elgg_echo('tidypics:settings:image_lib') . ': ';
-$form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[image_lib]',
- 'options_values' => $img_lib_options,
- 'value' => $image_lib
-));
-$form_body .= ' " . elgg_echo('tidypics:settings:im_path') . " ' . elgg_echo('tidypics:settings:img_river_view');
-$form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[img_river_view]',
- 'options_values' => array(
- 'all' => 'all',
- 'batch' => '1',
- 'none' => 'none',
- ),
- 'value' => $img_river_view
-));
-$form_body .= ' ' . elgg_echo('tidypics:settings:album_river_view');
-$form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[album_river_view]',
- 'options_values' => array(
- 'cover' => 'cover',
- 'set' => 'set',
- ),
- 'value' => $album_river_view
-));
-$form_body .= ' " . elgg_echo('tidypics:settings:largesize') . " " . elgg_echo('tidypics:settings:smallsize') . " " . elgg_echo('tidypics:settings:thumbsize') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "
+
+ guid . '" />';
+ }
+ if ($access_id) {
+ echo '';
+ }
+ ?>
+ " onclick="displayProgress();" />
+ ". elgg_echo( 'flickr:intro' ) . " ";
-$form_body .= elgg_echo( 'flickr:usernamesetup') . "
-
- guid . '" />';
- }
- if ($access_id) {
- echo '';
- }
- ?>
- " onclick="displayProgress();" />
- In addition to the information found in the default output,
- * a notation of the number of columns is provided by the
- * num_fields element while the order
- * element provides an array with the column names as the keys and
- * their location index number (corresponding to the keys in the
- * the default output) as the values. If a result set has identical field names, the last one is
- * used. Similar to DB_TABLEINFO_ORDER but adds more
- * dimensions to the array in which the table names are keys and
- * the field names are sub-keys. This is helpful for queries that
- * join tables which have identical field names.
- * timed_out (bool) - The socket timed out waiting for data ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:uploader') => 'enabled'), 'internalname' => 'uploader', 'value' => $uploader )) . " " . elgg_echo('tidypics:settings:watermark') . " " . elgg_echo('tidypics:settings:maxfilesize') . " " . elgg_echo('tidypics:settings:quota') . " ' . elgg_echo('tidypics:settings:image_lib') . ': ';
+$form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[image_lib]',
+ 'options_values' => $img_lib_options,
+ 'value' => $image_lib
+));
+$form_body .= ' " . elgg_echo('tidypics:settings:im_path') . " ' . elgg_echo('tidypics:settings:img_river_view') . ': ';
+$form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[img_river_view]',
+ 'options_values' => array(
+ 'all' => 'all',
+ 'batch' => '1',
+ 'none' => 'none',
+ ),
+ 'value' => $img_river_view
+));
+$form_body .= ' ' . elgg_echo('tidypics:settings:album_river_view') . ': ';
+$form_body .= elgg_view('input/pulldown', array(
+ 'internalname' => 'params[album_river_view]',
+ 'options_values' => array(
+ 'cover' => 'cover',
+ 'set' => 'set',
+ ),
+ 'value' => $album_river_view
+));
+$form_body .= ' " . elgg_echo('tidypics:settings:largesize') . " " . elgg_echo('tidypics:settings:smallsize') . " " . elgg_echo('tidypics:settings:thumbsize') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "
+
+ guid . '" />';
+ }
+ if ($access_id) {
+ echo '';
+ }
+ ?>
+ " onclick="displayProgress();" />
+ ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:uploader') => 'enabled'), 'internalname' => 'uploader', 'value' => $uploader )) . " " . elgg_echo('tidypics:settings:watermark') . " " . elgg_echo('tidypics:settings:maxfilesize') . " " . elgg_echo('tidypics:settings:quota') . " ' . elgg_echo('tidypics:settings:image_lib') . ': ';
-$form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[image_lib]',
- 'options_values' => $img_lib_options,
- 'value' => $image_lib
-));
-$form_body .= ' " . elgg_echo('tidypics:settings:im_path') . " ' . elgg_echo('tidypics:settings:img_river_view') . ': ';
-$form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[img_river_view]',
- 'options_values' => array(
- 'all' => 'all',
- 'batch' => '1',
- 'none' => 'none',
- ),
- 'value' => $img_river_view
-));
-$form_body .= ' ' . elgg_echo('tidypics:settings:album_river_view') . ': ';
-$form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[album_river_view]',
- 'options_values' => array(
- 'cover' => 'cover',
- 'set' => 'set',
- ),
- 'value' => $album_river_view
-));
-$form_body .= ' " . elgg_echo('tidypics:settings:largesize') . " " . elgg_echo('tidypics:settings:smallsize') . " " . elgg_echo('tidypics:settings:thumbsize') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "
-
- guid . '" />';
- }
- if ($access_id) {
- echo '';
- }
- ?>
- " onclick="displayProgress();" />
-
-
- guid . '" />';
- }
- if ($access_id) {
- echo '';
- }
- ?>
- " onclick="displayProgress();" />
- " . elgg_echo('tidypics:settings:smallsize') . " " . elgg_echo('tidypics:settings:thumbsize') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . " " . elgg_echo('tidypics:settings:smallsize') . " " . elgg_echo('tidypics:settings:thumbsize') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:download_link') => 'enabled'), 'internalname' => 'download_link', 'value' => $download_link )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:photo_ratings') => 'enabled'), 'internalname' => 'photo_ratings', 'value' => $photo_ratings )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:uploader') => 'enabled'), 'internalname' => 'uploader', 'value' => $uploader )) . " " . elgg_echo('tidypics:settings:watermark') . " " . elgg_echo('tidypics:settings:maxfilesize') . " " . elgg_echo('tidypics:settings:quota') . " ' . elgg_echo('tidypics:settings:image_lib') . ': ';
-$form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[image_lib]',
- 'options_values' => $img_lib_options,
- 'value' => $image_lib
-));
-$form_body .= ' " . elgg_echo('tidypics:settings:im_path') . " ' . elgg_echo('tidypics:settings:img_river_view') . ': ';
-$form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[img_river_view]',
- 'options_values' => array(
- 'all' => 'all',
- 'batch' => '1',
- 'none' => 'none',
- ),
- 'value' => $img_river_view
-));
-$form_body .= ' ' . elgg_echo('tidypics:settings:album_river_view') . ': ';
-$form_body .= elgg_view('input/pulldown', array(
- 'internalname' => 'params[album_river_view]',
- 'options_values' => array(
- 'cover' => 'cover',
- 'set' => 'set',
- ),
- 'value' => $album_river_view
-));
-$form_body .= ' " . elgg_echo('tidypics:settings:largesize') . " " . elgg_echo('tidypics:settings:smallsize') . " " . elgg_echo('tidypics:settings:thumbsize') . " ' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . " ' . elgg_echo('tidypics:none') . '
-num_display == '') {
+// set default value
+if (!isset($vars['entity']->num_display)) {
$vars['entity']->num_display = 5;
}
+
+$params = array(
+ 'name' => 'params[num_display]',
+ 'value' => $vars['entity']->num_display,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20),
+);
+$dropdown = elgg_view('input/dropdown', $params);
+
?>
-
-num_display == '') {
+// set default value
+if (!isset($vars['entity']->num_display)) {
$vars['entity']->num_display = 6;
}
+$params = array(
+ 'name' => 'params[num_display]',
+ 'value' => $vars['entity']->num_display,
+ 'options' => array(3, 6, 9, 12),
+);
+$dropdown = elgg_view('input/dropdown', $params);
+
?>
- ';
+ echo elgg_view('output/url', array(
+ 'text' => elgg_echo('tidypics:upgrade'),
+ 'href' => 'action/photos/admin/upgrade',
+ 'is_action' => true,
+ ));
+ echo '
-
+ '/mod/tidypics/docs/configure_server.txt',
+ 'text' => elgg_echo('tidypics:server_configuration_doc')
+ ));
+ ?>
+
- '/mod/tidypics/docs/configure_server.txt',
- 'text' => elgg_echo('tidypics:server_configuration_doc')
- ));
- ?>
-
+ '/mod/tidypics/docs/configure_server.txt',
+ 'text' => elgg_echo('tidypics:server_configuration_doc')
+ ));
+ ?>
+ ' . elgg_echo('tidypics:lib_tools:testing') . '
- An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping.
- There are three image library options with Tidypics: PHP extension GD,
- ImageMagick called via a system call, and the PHP extension
- imagick. GD is the most common of the three on hosted servers but suffers
- from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the
- PHP extension), we recommend that you use that.
-
- To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can check our
- server analysis page to find out the
- configuration of your server. Next, you need to determine the path to ImageMagick on your server. Your hosting service should
- be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of
- ImageMagick installed on your server.
-
-
- '/mod/tidypics/docs/configure_server.txt',
- 'text' => elgg_echo('tidypics:server_configuration_doc')
- ));
- ?>
- ' . elgg_echo('tidypics:lib_tools:testing') . ' ';
- echo elgg_view('output/url', array(
- 'text' => elgg_echo('tidypics:upgrade'),
- 'href' => 'action/photos/admin/upgrade',
- 'is_action' => true,
- ));
- echo '
+If it is not a memory issue, you should see some other error appear. Once you have fixed the error,
+change display_error back to 0.
+
+Another possible cause is using ImageMagick when your server does not support it or specifying
+the wrong path to the ImageMagick executables.
+ ' . elgg_echo('tidypics:lib_tools:testing') . '
+ '/mod/tidypics/docs/configure_server.txt',
+ 'text' => elgg_echo('tidypics:server_configuration_doc')
+ ));
+ ?>
+ ';
+ echo elgg_view('output/url', array(
+ 'text' => elgg_echo('tidypics:upgrade'),
+ 'href' => 'action/photos/admin/upgrade',
+ 'is_action' => true,
+ ));
+ echo '
-Tidypics tries to calculate the maximum size of an image that your server will support. If it
-guesses incorrectly and someone uploads a photo that is too large, the script may crash when
-resizing the image if you are using GD. The easiest way to test this is to set display_errors
-to 1 in your .htaccess file and upload large images. If this causes a problem, a php memory error
-should display on the screen. You can increased your php memory limit (see the docs directory).
-A better option is to use ImageMagick if your server supports it (again see the docs directory).
-
-If it is not a memory issue, you should see some other error appear. Once you have fixed the error,
-change display_error back to 0.
-
-If you see question mark images when you look at your albums, this means the resizing of the images
-failed. This could be due to the memory limits as described above. There are other causes. Tidypics
-tries to detect these problems and write the cause to the error log. You should check your server
-error log right after an upload that results in a question mark for these error messages. The messages
-will begin with "Tidypics warning:". It is possible if you have turned off php warnings that you will
-not see these warnings.
-
-Another possible cause is using ImageMagick when your server does not support it or specifying
-the wrong path to the ImageMagick executables.
- If you are unable to settings, there are two possible causes. First,
-Apache can be configured to block pages that use file paths as Tidypics
-does when setting the location of the ImageMagick executable. In this case,
-leave that field blank. Second, there is some bad code in the Izaps video
-plugin that can prevent the settings from being saved. Try disabling that plugin.
- ';
-echo elgg_view('tidypics/admin/upgrade');
-echo $server_analysis_link;
-echo '
-This page allows you to create thumbnails for images when the thumbnail creation failed during upload.
-You may experience problems with thumbnail creation if your image library is not configured properly or
-if there is not enough memory for the GD library to load and resize an image. If your users have
-experienced problems with thumbnail creation and you have corrected your configuration, you can try to redo the
-thumbnails. Find the unique identifier of the photo (it is the number near the end of the url when viewing
-a photo) and enter it below.
-
-:
-
-
- ';
+$content .= elgg_view('input/submit', array(
+ 'value' => elgg_echo('submit'),
+ 'id' => 'tidypics-im-test'
+));
+$content .= ' ';
+ echo elgg_view('output/url', array(
+ 'text' => elgg_echo('tidypics:upgrade'),
+ 'href' => 'action/photos/admin/upgrade',
+ 'is_action' => true,
+ ));
+ echo '
+ $submit
+ ';
-$content .= elgg_view('input/submit', array(
- 'value' => elgg_echo('submit'),
- 'id' => 'tidypics-im-test'
-));
-$content .= ' ';
- echo elgg_view('output/url', array(
- 'text' => elgg_echo('tidypics:upgrade'),
- 'href' => 'action/photos/admin/upgrade',
- 'is_action' => true,
- ));
- echo '
';
\ No newline at end of file
+echo '
';
--
cgit v1.2.3
From e7c68e41e7076d32aa885dcee230bdd98bf1fbd7 Mon Sep 17 00:00:00 2001
From: Cash Costello
';
--
cgit v1.2.3
From d6fcd6f942c8e882866f5404cb987aa3c6fde690 Mon Sep 17 00:00:00 2001
From: Cash Costello
+
-Add titles and descriptions
-
-Basic uploader
-
-
+
-
+
+
--
cgit v1.2.3
From 621e0a079c4f9410356c49a39bdd68c098e3bc96 Mon Sep 17 00:00:00 2001
From: Cash Costello wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> ';
+ }
+}
+
+$string .= "
Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.';
-if (is_callable('exec') && !in_array('exec',$disablefunc)) {
+if (is_callable('exec') && !in_array('exec', $disablefunc)) {
// Image Magick Path
$im_path = $plugin->im_path;
if(!$im_path) {
@@ -108,14 +108,14 @@ if (is_callable('exec') && !in_array('exec',$disablefunc)) {
$form_body .= '' . elgg_echo('tidypics:settings:heading:river') . '
';
$img_river_view = $plugin->img_river_view;
if (!$img_river_view) {
- $img_river_view = '1';
+ $img_river_view = 'batch';
}
$form_body .= '
+
+
+";
+ }
+ ?>
+
";
$form_body .= "";
-$albums = get_entities( "object", "album", $user->guid );
+$albums = elgg_get_entities(array(
+ "type=" => "object",
+ "subtype" => "album",
+ "owner_guid" => $user->guid,
+));
$options = array( 0 => elgg_echo( 'flickr:selectalbum' ));
foreach( $albums as $album ) {
$title = $album->title;
diff --git a/views/rss/object/album.php b/views/rss/object/album.php
index 8a8f97cc2..a37fdd041 100644
--- a/views/rss/object/album.php
+++ b/views/rss/object/album.php
@@ -43,7 +43,11 @@ if (get_context() == "search" && get_input('search_viewtype') == "gallery") {
}
- $images = get_entities("object", "image", 0, "", 0, 0, false, 0, $album->guid);
+ $images = elgg_get_entities(array(
+ "type" => "object",
+ "subtype" => "image",
+ "container_guid" => $album->guid,
+ ));
foreach ($images as $image) {
--
cgit v1.2.3
From aab76ab18aa6c191dd16c3672afdacfa61ae69bb Mon Sep 17 00:00:00 2001
From: Cash Costello
";
$form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "
";
$form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "
+
+
Cookie only sessions
+
+ Cookie only sessions may affect the Flash uploader
+
";
+$form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "
";
+$form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "
";
+$form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "' . elgg_echo('tidypics:settings:heading:img_lib') . '
';
+$image_lib = $plugin->image_lib;
+if (!$image_lib) {
+ $image_lib = 'GD';
+}
+$form_body .= '
Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.
";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "' . elgg_echo('tidypics:settings:heading:river') . '
';
+$img_river_view = $plugin->img_river_view;
+if (!$img_river_view) {
+ $img_river_view = 'batch';
+}
+$form_body .= '' . elgg_echo('tidypics:settings:heading:sizes') . '
';
+$form_body .= "You must edit the css if you change the default sizes
";
+$image_sizes = $plugin->image_sizes;
+if(!$image_sizes) {
+ $image_sizes = array(); // set default values
+ $image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
+ $image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
+ $image_sizes['thumb_image_width'] = $image_sizes['thumb_image_height'] = 60;
+} else {
+ $image_sizes = unserialize($image_sizes);
+}
+$form_body .= "
";
+$form_body .= 'width: ';
+$form_body .= 'height:
";
+$form_body .= 'width and height: ';
+//$form_body .= 'height:
";
+$form_body .= 'width and height: ';
+//$form_body .= 'height: ' . elgg_echo('tidypics:settings:heading:groups') . '
';
+$grp_perm_override = $plugin->grp_perm_override;
+if (!$grp_perm_override) {
+ $grp_perm_override = "enabled";
+}
+$form_body .= '
";
-$form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "
";
-$form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "
";
-$form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "' . elgg_echo('tidypics:settings:heading:img_lib') . '
';
-$image_lib = $plugin->image_lib;
-if (!$image_lib) {
- $image_lib = 'GD';
-}
-$form_body .= '
Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.
";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "' . elgg_echo('tidypics:settings:heading:river') . '
';
-$img_river_view = $plugin->img_river_view;
-if (!$img_river_view) {
- $img_river_view = 'batch';
-}
-$form_body .= '' . elgg_echo('tidypics:settings:heading:sizes') . '
';
-$form_body .= "You must edit the css if you change the default sizes
";
-$image_sizes = $plugin->image_sizes;
-if(!$image_sizes) {
- $image_sizes = array(); // set default values
- $image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
- $image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
- $image_sizes['thumb_image_width'] = $image_sizes['thumb_image_height'] = 60;
-} else {
- $image_sizes = unserialize($image_sizes);
-}
-$form_body .= "
";
-$form_body .= 'width: ';
-$form_body .= 'height:
";
-$form_body .= 'width and height: ';
-//$form_body .= 'height:
";
-$form_body .= 'width and height: ';
-//$form_body .= 'height: ' . elgg_echo('tidypics:settings:heading:groups') . '
';
-$grp_perm_override = $plugin->grp_perm_override;
-if (!$grp_perm_override) {
- $grp_perm_override = "enabled";
-}
-$form_body .= '
";
-
- $count = 0;
- $looper = 0;
- //create links to import photos 10 at a time
- while( $photoset["photos"] > $count ) {
- $looper++;
- $body .= " $looper";
- $count = $count + 10;
- }
- $body .= "
$photoset[photos] images";
- $body .= ""; var_dump( $photoset ); echo "
"; die;
- }
-
-// $body .= elgg_view("tidypics/forms/setupFlickr", array(), false, true );
- flickr_menu();
- page_draw( elgg_echo( 'flickr:importmanager' ), elgg_view_layout("two_column_left_sidebar", '', $body));
-
-?>
\ No newline at end of file
diff --git a/pages/flickr/setup.php b/pages/flickr/setup.php
deleted file mode 100644
index 1de8c29c2..000000000
--- a/pages/flickr/setup.php
+++ /dev/null
@@ -1,17 +0,0 @@
-"; var_dump($body); echo "";
- page_draw( elgg_echo( 'flickr:setup'), elgg_view_layout("two_column_left_sidebar", '', $body));
-?>
\ No newline at end of file
diff --git a/pages/upload.php b/pages/upload.php
index 7ac4930b5..6580c6f52 100644
--- a/pages/upload.php
+++ b/pages/upload.php
@@ -6,6 +6,8 @@
include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+global $CONFIG;
+
// must be logged in to upload images
gatekeeper();
@@ -43,9 +45,16 @@ $title = elgg_echo('album:addpix') . ': ' . $album->title;
$area2 .= elgg_view_title($title);
if ($uploader == 'basic') {
- $area2 .= elgg_view("tidypics/forms/upload", array('album' => $album));
+ $area2 .= elgg_view('input/form', array(
+ 'action' => "{$CONFIG->wwwroot}action/tidypics/upload",
+ 'body' => elgg_view('forms/tidypics/basic_upload', array('album' => $album)),
+ 'internalid' => 'tidypicsUpload',
+ 'enctype' => 'multipart/form-data',
+ 'method' => 'post',
+ ));
+
} else {
- $area2 .= elgg_view("tidypics/forms/ajax_upload", array('album' => $album));
+ $area2 .= elgg_view("forms/tidypics/ajax_upload", array('album' => $album));
}
$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
diff --git a/views/default/forms/tidypics/ajax_upload.php b/views/default/forms/tidypics/ajax_upload.php
new file mode 100644
index 000000000..a1d13e80b
--- /dev/null
+++ b/views/default/forms/tidypics/ajax_upload.php
@@ -0,0 +1,141 @@
+salt);
+
+$basic_uploader_url = current_page_url() . '/basic';
+$upload_endpoint_url = "{$vars['url']}action/tidypics/ajax_upload/";
+$upload_complete_url = "{$vars['url']}action/tidypics/ajax_upload_complete/";
+
+$maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
+if (!$maxfilesize) {
+ $maxfilesize = 5;
+}
+
+$quota = get_plugin_setting('quota','tidypics');
+if ($quota) {
+ $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
+ $image_repo_size = (int)$image_repo_size_md->value;
+ $image_repo_size = $image_repo_size / 1024 / 1024;
+ $quote_percentage = round(100 * ($image_repo_size / $quota));
+ // for small quotas, so one decimal place
+ if ($quota < 10) {
+ $image_repo_size = sprintf('%.1f', $image_repo_size);
+ } else {
+ $image_repo_size = round($image_repo_size);
+ }
+ if ($image_repo_size > $quota) {
+ $image_repo_size = $quota;
+ }
+}
+
+?>
+
+
+
+
diff --git a/views/default/forms/tidypics/basic_upload.php b/views/default/forms/tidypics/basic_upload.php
new file mode 100644
index 000000000..55ab854a4
--- /dev/null
+++ b/views/default/forms/tidypics/basic_upload.php
@@ -0,0 +1,104 @@
+access_id;
+
+$maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
+if (!$maxfilesize) {
+ $maxfilesize = 5;
+}
+
+$quota = get_plugin_setting('quota','tidypics');
+if ($quota) {
+ $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
+ $image_repo_size = (int)$image_repo_size_md->value;
+ $image_repo_size = $image_repo_size / 1024 / 1024;
+ $quote_percentage = round(100 * ($image_repo_size / $quota));
+ // for small quotas, so one decimal place
+ if ($quota < 10) {
+ $image_repo_size = sprintf('%.1f', $image_repo_size);
+ } else {
+ $image_repo_size = round($image_repo_size);
+ }
+ if ($image_repo_size > $quota) {
+ $image_repo_size = $quota;
+ }
+}
+
+?>
+
+
+
+
+
+
+
+
+ ' . elgg_view("input/file",array('internalname' => "upload_$x")) . '';
+ }
+ ?>
+
+
+
";
-$form_body .= "";
-
-$albums = elgg_get_entities(array(
- "type=" => "object",
- "subtype" => "album",
- "owner_guid" => $user->guid,
-));
-$options = array( 0 => elgg_echo( 'flickr:selectalbum' ));
-foreach( $albums as $album ) {
- $title = $album->title;
- switch( $album->access_id ) {
- case ACCESS_PRIVATE:
- $title .= " (" . elgg_echo( 'private' ) . ")";
- break;
- case ACCESS_PUBLIC:
- $title .= " (" . elgg_echo( 'public' ) . ")";
- break;
- default:
- $title .= " (no known permission set)";
- break;
- }
- $options[$album->guid] = $title;
-}
-
-$form_body .= "
" . elgg_echo( 'flickr:albumdesc' );
-$form_body .= elgg_view('input/pulldown', array('internalname' => 'album_id',
- 'options_values' => $options,
- 'value' => $flickr_album_id->value ));
-$form_body .= "
";
-$form_body .= elgg_view('input/submit', array('value' => elgg_echo("save")));
-
-flickr_menu();
-
-echo elgg_view('input/form', array('action' => $action, 'body' => $form_body));
diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php
deleted file mode 100644
index 8bbda08b3..000000000
--- a/views/default/tidypics/forms/upload.php
+++ /dev/null
@@ -1,103 +0,0 @@
-access_id;
-
-$maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
-if (!$maxfilesize) {
- $maxfilesize = 5;
-}
-
-$quota = get_plugin_setting('quota','tidypics');
-if ($quota) {
- $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
- $image_repo_size = (int)$image_repo_size_md->value;
- $image_repo_size = $image_repo_size / 1024 / 1024;
- $quote_percentage = round(100 * ($image_repo_size / $quota));
- // for small quotas, so one decimal place
- if ($quota < 10) {
- $image_repo_size = sprintf('%.1f', $image_repo_size);
- } else {
- $image_repo_size = round($image_repo_size);
- }
- if ($image_repo_size > $quota) {
- $image_repo_size = $quota;
- }
-}
-
-?>
-
-
-
-
-
-
-
- ' . elgg_view("input/file",array('internalname' => "upload_$x")) . '';
- }
- ?>
-
-
-"; var_dump( array($flickr_username, $return_url )); echo "
";
diff --git a/actions/flickrImportPhotoset.php b/actions/flickrImportPhotoset.php
deleted file mode 100644
index c92e5c795..000000000
--- a/actions/flickrImportPhotoset.php
+++ /dev/null
@@ -1,337 +0,0 @@
-guid, "flickr_id" );
-
-if( empty( $flickr_id )) {
- register_error( elgg_echo( 'flickr:errorusername2' ));
- forward( $return_url );
- die; //just in case
-}
-
-// Get the friendly URL of the user's photos
-$photos_url = $f->urls_getUserPhotos( $flickr_id->value );
-$photos = $f->photosets_getPhotos( $set_id, null, null, 10, $page_pp );
-
-$photos_to_upload = array();
-foreach ($photos["photoset"]["photo"] as $photo) {
-
- //check if we already have this image
- $meta = get_metadata_byname( $user->guid, $photo["id"] );
- if ($meta->value == 1) { //we've downloaded this already
- register_error( elgg_echo( 'flickr:errorimageimport' ));
- continue;
- }
- //store this so we don't download the same photo multiple times
- create_metadata( $user->guid, $photo["id"], "1", "text", $user->guid, ACCESS_PUBLIC );
-
- $photo_info = $f->photos_getInfo( $photo["id"], $photo["secret"] );
- $tags = array();
- foreach ($photo_info["tags"]["tag"] as $tag) {
- $tags[] = $tag["raw"];
- }
- $tags = implode( ", ", $tags );
-
- $image_url = $f->buildPhotoURL( $photo );
- $photos_to_upload[ $photo_info["id"] . ".jpg" ] = array( "url"=> $image_url, "tags" => $tags, "title" => $photo_info["title"], "description" => $photo_info["description"], "flickr_page" => "$photos_url$photo[id]" );
-
- $body .= "
Views: $photo_info[views]
";
- $body .= "";
- $body .= "";
- $body .= "";
-}
-// echo "
"; var_dump( $photos_to_upload );; die;
-
-/**
- * Elgg multi-image uploader action
-*
-* This will upload up to 10 images at at time to an album
- */
-
-global $CONFIG;
-include dirname(dirname(__FILE__)) . "/lib/resize.php";
-include dirname(dirname(__FILE__)) . "/lib/exif.php";
-
-// Make sure we're logged in
-gatekeeper();
-
-// Get common variables
-$access_id = (int) get_input("access_id");
-$container_guid = (int) get_input('container_guid', 0);
-$container_guid = intval ($album_id);
-
-$album = get_entity($container_guid);
-
-$maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
-if (!$maxfilesize)
- $maxfilesize = 5; // default to 5 MB if not set
-$maxfilesize = 1024 * 1024 * $maxfilesize; // convert to bytes from MBs
-
-$quota = get_plugin_setting('quota','tidypics');
-$quota = 1024 * 1024 * $quota;
-$image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
-$image_repo_size = (int)$image_repo_size_md->value;
-
-$image_lib = get_plugin_setting('image_lib', 'tidypics');
-if (!$image_lib)
- $image_lib = "GD";
-
-/*
-// post limit exceeded
-if (count($_FILES) == 0) {
- trigger_error('Tidypics warning: user exceeded post limit on image upload', E_USER_WARNING);
- register_error(elgg_echo('tidypics:exceedpostlimit'));
- forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
-}
-*/
-
-/*
-// test to make sure at least 1 image was selected by user
-$num_images = 0;
-foreach($_FILES as $key => $sent_file) {
- if (!empty($sent_file['name']))
- $num_images++;
-}
-*/
-if ( count( $photos_to_upload ) == 0 ) {
- // have user try again
- register_error(elgg_echo('tidypics:noimages'));
- forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
- die; //just in case
-}
-
-$uploaded_images = array();
-$not_uploaded = array();
-$error_msgs = array();
-
-$img_river_view = get_plugin_setting('img_river_view', 'tidypics');
-
-/*
-$accepted_formats = array(
- 'image/jpeg',
- 'image/png',
- 'image/gif',
- 'image/pjpeg',
- 'image/x-png',
- );
-
-*/
-//foreach($_FILES as $key => $sent_file) {
-foreach( $photos_to_upload as $name => $photo ) {
-
-/*
- // skip empty entries
- if (empty($sent_file['name']))
- continue;
-
- $name = $sent_file['name'];
- $mime = $sent_file['type'];
-
- if ($sent_file['error']) {
- array_push($not_uploaded, $sent_file['name']);
- if ($sent_file['error'] == 1) {
- trigger_error('Tidypics warning: image exceed server php upload limit', E_USER_WARNING);
- array_push($error_msgs, elgg_echo('tidypics:image_mem'));
- }
- else {
- array_push($error_msgs, elgg_echo('tidypics:unk_error'));
- }
- continue;
- }
-
- //make sure file is an image
- if (!in_array($mime, $accepted_formats)) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:not_image'));
- continue;
- }
-
-*/
-/* I'm not going to check filesize here because flickr has already resized it for me
- // check quota
- if ($quota) {
- if ($image_repo_size + $sent_file['size'] > $quota) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:exceed_quota'));
- continue;
- }
- }
-
- // make sure file does not exceed memory limit
- if ($sent_file['size'] > $maxfilesize) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:image_mem'));
- continue;
- }
-
- // make sure the in memory image size does not exceed memory available - GD only
- $imginfo = getimagesize($sent_file['tmp_name']);
- $mem_avail = ini_get('memory_limit');
- $mem_avail = rtrim($mem_avail, 'M');
- $mem_avail = $mem_avail * 1024 * 1024;
- if ($image_lib == 'GD') {
- $mem_required = ceil(5.35 * $imginfo[0] * $imginfo[1]);
-
- $mem_used = memory_get_usage();
-
- $mem_avail = $mem_avail - $mem_used - 2097152; // 2 MB buffer
- if ($mem_required > $mem_avail) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:image_pixels'));
- trigger_error('Tidypics warning: image memory size too large for resizing so rejecting', E_USER_WARNING);
- continue;
- }
- } else if ($image_lib == 'ImageMagickPHP') {
- // haven't been able to determine a limit like there is for GD
- }
-*/
- $mime = "image/jpeg"; //not sure how to get this from the file if we aren't posting it
-
- //this will save to users folder in /image/ and organize by photo album
- $prefix = "image/" . $container_guid . "/";
- $file = new ElggFile();
- $filestorename = elgg_strtolower(time().$name);
- $file->setFilename($prefix.$filestorename . ".jpg"); //that's all flickr stores so I think this is safe
- $file->setMimeType($mime);
- $file->originalfilename = $name;
- $file->subtype="image";
- $file->simpletype="image";
- $file->access_id = $access_id;
- if ($container_guid) {
- $file->container_guid = $container_guid;
- }
-
- // get the file from flickr and save it locally
- $filename = $file->getFilenameOnFilestore();
- $destination=fopen($filename,"w");
- $source=fopen($photo["url"],"r");
-
- while ($a=fread($source,1024)) fwrite($destination,$a);
- fclose($source);
- fclose($destination);
-
- /*
- $file->open("write");
- $file->write();
- $file->write(get_uploaded_file($key));
- $file->close();
- */
- $result = $file->save();
-
- if (!$result) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:save_error'));
- continue;
- }
-
- //add tags
- create_metadata( $file->guid, "tags", $photo["tags"], "text", $user->guid, ACCESS_PUBLIC );
-
- //add title and description
- create_object_entity( $file->guid, $photo["title"], $photo["description"] );
-
- //get and store the exif data
- td_get_exif($file);
-
- // resize photos to create thumbnails
- if ($image_lib == 'ImageMagick') { // ImageMagick command line
-
- if (tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING);
- }
-
- } else if ($image_lib == 'ImageMagickPHP') { // imagick php extension
-
- if (tp_create_imagick_thumbnails($file, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING);
- }
-
- } else {
-
- if (tp_create_gd_thumbnails($file, $prefix, $filestorename) != true) {
- trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING);
- }
-
- } // end of image library selector
-
- //keep one file handy so we can add a notice to the river if single image option selected
- if(!$file_for_river) {
- $file_for_river = $file;
- }
-
- array_push($uploaded_images, $file->guid);
-
- // update user/group size for checking quota
- $image_repo_size += $sent_file['size'];
-
- // successful upload so check if this is a new album and throw river event/notification if so
- if ($album->new_album == TP_NEW_ALBUM) {
- $album->new_album = TP_OLD_ALBUM;
-
- // we throw the notification manually here so users are not told about the new album until there
- // is at least a few photos in it
- object_notifications('create', 'object', $album);
-
- add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid);
- }
-
- if ($img_river_view == "all") {
- add_to_river('river/object/image/create', 'create', $file->getObjectOwnerGUID(), $file->getGUID());
- }
- unset($file); // may not be needed but there seems to be a memory leak
-
-} //end of for loop
-
-if (count($not_uploaded) > 0) {
- if (count($uploaded_images) > 0)
- $error = sprintf(elgg_echo("tidypics:partialuploadfailure"), count($not_uploaded), count($not_uploaded) + count($uploaded_images)) . '
';
- else
- $error = elgg_echo("tidypics:completeuploadfailure") . '
';
-
- $num_failures = count($not_uploaded);
- for ($i = 0; $i < $num_failures; $i++) {
- $error .= "{$not_uploaded[$i]}: {$error_msgs[$i]}
";
- }
- register_error($error);
-
- if (count($uploaded_images) == 0)
- forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //upload failed, so forward to previous page
- else {
- // some images did upload so we fall through
- }
-} else {
- system_message(elgg_echo('tidypics:upl_success'));
-}
-
-if (count($uploaded_images) && $img_river_view == "1") {
- if (function_exists('add_to_river')) {
- add_to_river('river/object/image/create', 'create', $file_for_river->getObjectOwnerGUID(), $file_for_river->getGUID());
- }
-}
-
-// update image repo size
-create_metadata($album->container_guid, "image_repo_size", $image_repo_size, 'integer', $album->container_guid);
-
-// plugins can register to be told when a Tidypics album has had images added
-trigger_elgg_event('upload', 'tp_album', $album);
-
-//forward to multi-image edit page
-
-$url = $CONFIG->wwwroot . 'mod/tidypics/pages/edit_multiple.php?files=' . implode('-', $uploaded_images);
-forward($url);
diff --git a/languages/en.php b/languages/en.php
index 4213e0b6a..8bc66a5f6 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -48,16 +48,6 @@ $english = array(
'tidypics:nophotosingroup' => 'This groups does not have any photos yet',
'tidypics:upgrade' => 'Upgrade',
'tidypics:sort' => 'Sorting the %s album',
-
- 'flickr:setup' => 'Flickr Setup',
- 'flickr:usernamesetup' => 'Please enter your Flickr username here:',
- 'flickr:selectalbum' => 'Select album to import photos into',
- 'flickr:albumdesc' => 'Album to import photos to:',
- 'flickr:importmanager' => 'Photoset Import Manager',
- 'flickr:desc' => 'Click on the set you wish to import into this site.
Copies of the photos will be made and stored on this site where they can be viewed and commented on.',
- 'flickr:intro' => 'Flickr Integration allows you to import photos from your flickr account into this Elgg site. By entering your username and choosing an album to import into, you can begin the process.
When you have saved your username and album selection, click on the Import Flickr Photos link to the left to select which Flickr set you would like to import photos from.',
- 'flickr:menusetup' => 'Flickr Setup',
- 'flickr:menuimport' => 'Import Flickr Photos',
//settings
'tidypics:settings' => 'Settings',
@@ -188,10 +178,6 @@ The photo can be viewed here: %s",
'tidypics:settings:save:ok' => 'Successfully saved the Tidypics plugin settings',
'tidypics:album:sorted' => 'The album %s is sorted',
'tidypics:upgrade:success' => 'Upgrade of Tidypics a success',
- 'flickr:enterusername' => 'You must enter a username',
- 'flickr:savedusername' => 'Successfully saved username of %s',
- 'flickr:saveduserid' => 'Successfully saved userid of %s',
- 'flickr:savedalbum' => 'Album saved - %s',
//Error messages
'tidypics:baduploadform' => "There was an error with the upload form",
@@ -214,11 +200,7 @@ The photo can be viewed here: %s",
'album:uploadfailed' => "Sorry; we could not save your album.",
'album:deletefailed' => "Your album could not be deleted.",
'album:blank' => "Please give this album a title and description.",
- 'tidypics:upgrade:failed' => "The upgrade of Tidypics failed",
- 'flickr:errorusername' => 'Username %s not found on Flickr',
- 'flickr:errorusername2' => 'You must enter a username',
- 'flickr:errorimageimport' => 'This image has already been imported',
- 'flickr:errornoalbum' => "No album selected. Please choose and save an album: %s"
+ 'tidypics:upgrade:failed' => "The upgrade of Tidypics failed",
);
add_translation("en", $english);
diff --git a/lib/phpFlickr/PEAR/DB.php b/lib/phpFlickr/PEAR/DB.php
deleted file mode 100644
index a3eede070..000000000
--- a/lib/phpFlickr/PEAR/DB.php
+++ /dev/null
@@ -1,1388 +0,0 @@
-
- * @author Tomas V.V.Cox
- * DB The main DB class. This is simply a utility class
- * with some "static" methods for creating DB objects as
- * well as common utility functions for other DB classes.
- *
- * DB_common The base for each DB implementation. Provides default
- * | implementations (in OO lingo virtual methods) for
- * | the actual DB implementations as well as a bunch of
- * | query utility functions.
- * |
- * +-DB_mysql The DB implementation for MySQL. Inherits DB_common.
- * When calling DB::factory or DB::connect for MySQL
- * connections, the object returned is an instance of this
- * class.
- *
- *
- * @category Database
- * @package DB
- * @author Stig Bakken
- * require_once 'DB.php';
- *
- * $dsn = 'pgsql://user:password@host/database';
- * $options = array(
- * 'debug' => 2,
- * 'portability' => DB_PORTABILITY_ALL,
- * );
- *
- * $db =& DB::connect($dsn, $options);
- * if (PEAR::isError($db)) {
- * die($db->getMessage());
- * }
- *
- *
- * @param mixed $dsn the string "data source name" or array in the
- * format returned by DB::parseDSN()
- * @param array $options an associative array of option names and values
- *
- * @return object a new DB object. A DB_Error object on failure.
- *
- * @uses DB_dbase::connect(), DB_fbsql::connect(), DB_ibase::connect(),
- * DB_ifx::connect(), DB_msql::connect(), DB_mssql::connect(),
- * DB_mysql::connect(), DB_mysqli::connect(), DB_oci8::connect(),
- * DB_odbc::connect(), DB_pgsql::connect(), DB_sqlite::connect(),
- * DB_sybase::connect()
- *
- * @uses DB::parseDSN(), DB_common::setOption(), PEAR::isError()
- */
- function &connect($dsn, $options = array())
- {
- $dsninfo = DB::parseDSN($dsn);
- $type = $dsninfo['phptype'];
-
- if (!is_array($options)) {
- /*
- * For backwards compatibility. $options used to be boolean,
- * indicating whether the connection should be persistent.
- */
- $options = array('persistent' => $options);
- }
-
- if (isset($options['debug']) && $options['debug'] >= 2) {
- // expose php errors with sufficient debug level
- include_once "DB/${type}.php";
- } else {
- @include_once "DB/${type}.php";
- }
-
- $classname = "DB_${type}";
- if (!class_exists($classname)) {
- $tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
- "Unable to include the DB/{$type}.php"
- . " file for '$dsn'",
- 'DB_Error', true);
- return $tmp;
- }
-
- @$obj =& new $classname;
-
- foreach ($options as $option => $value) {
- $test = $obj->setOption($option, $value);
- if (DB::isError($test)) {
- return $test;
- }
- }
-
- $err = $obj->connect($dsninfo, $obj->getOption('persistent'));
- if (DB::isError($err)) {
- $err->addUserInfo($dsn);
- return $err;
- }
-
- return $obj;
- }
-
- // }}}
- // {{{ apiVersion()
-
- /**
- * Return the DB API version
- *
- * @return string the DB API version number
- */
- function apiVersion()
- {
- return '@package_version@';
- }
-
- // }}}
- // {{{ isError()
-
- /**
- * Determines if a variable is a DB_Error object
- *
- * @param mixed $value the variable to check
- *
- * @return bool whether $value is DB_Error object
- */
- function isError($value)
- {
- return is_a($value, 'DB_Error');
- }
-
- // }}}
- // {{{ isConnection()
-
- /**
- * Determines if a value is a DB_
- * phptype(dbsyntax)://username:password@protocol+hostspec/database?option=8&another=true
- *
- *
- * Most variations are allowed:
- *
- * phptype://username:password@protocol+hostspec:110//usr/db_file.db?mode=0644
- * phptype://username:password@hostspec/database_name
- * phptype://username:password@hostspec
- * phptype://username@hostspec
- * phptype://hostspec/database
- * phptype://hostspec
- * phptype(dbsyntax)
- * phptype
- *
- *
- * @param string $dsn Data Source Name to be parsed
- *
- * @return array an associative array with the following keys:
- * + phptype: Database backend used in PHP (mysql, odbc etc.)
- * + dbsyntax: Database used with regards to SQL syntax etc.
- * + protocol: Communication protocol to use (tcp, unix etc.)
- * + hostspec: Host specification (hostname[:port])
- * + database: Database to use on the DBMS server
- * + username: User name for login
- * + password: Password for login
- */
- function parseDSN($dsn)
- {
- $parsed = array(
- 'phptype' => false,
- 'dbsyntax' => false,
- 'username' => false,
- 'password' => false,
- 'protocol' => false,
- 'hostspec' => false,
- 'port' => false,
- 'socket' => false,
- 'database' => false,
- );
-
- if (is_array($dsn)) {
- $dsn = array_merge($parsed, $dsn);
- if (!$dsn['dbsyntax']) {
- $dsn['dbsyntax'] = $dsn['phptype'];
- }
- return $dsn;
- }
-
- // Find phptype and dbsyntax
- if (($pos = strpos($dsn, '://')) !== false) {
- $str = substr($dsn, 0, $pos);
- $dsn = substr($dsn, $pos + 3);
- } else {
- $str = $dsn;
- $dsn = null;
- }
-
- // Get phptype and dbsyntax
- // $str => phptype(dbsyntax)
- if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
- $parsed['phptype'] = $arr[1];
- $parsed['dbsyntax'] = !$arr[2] ? $arr[1] : $arr[2];
- } else {
- $parsed['phptype'] = $str;
- $parsed['dbsyntax'] = $str;
- }
-
- if (!count($dsn)) {
- return $parsed;
- }
-
- // Get (if found): username and password
- // $dsn => username:password@protocol+hostspec/database
- if (($at = strrpos($dsn,'@')) !== false) {
- $str = substr($dsn, 0, $at);
- $dsn = substr($dsn, $at + 1);
- if (($pos = strpos($str, ':')) !== false) {
- $parsed['username'] = rawurldecode(substr($str, 0, $pos));
- $parsed['password'] = rawurldecode(substr($str, $pos + 1));
- } else {
- $parsed['username'] = rawurldecode($str);
- }
- }
-
- // Find protocol and hostspec
-
- if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) {
- // $dsn => proto(proto_opts)/database
- $proto = $match[1];
- $proto_opts = $match[2] ? $match[2] : false;
- $dsn = $match[3];
-
- } else {
- // $dsn => protocol+hostspec/database (old format)
- if (strpos($dsn, '+') !== false) {
- list($proto, $dsn) = explode('+', $dsn, 2);
- }
- if (strpos($dsn, '/') !== false) {
- list($proto_opts, $dsn) = explode('/', $dsn, 2);
- } else {
- $proto_opts = $dsn;
- $dsn = null;
- }
- }
-
- // process the different protocol options
- $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp';
- $proto_opts = rawurldecode($proto_opts);
- if ($parsed['protocol'] == 'tcp') {
- if (strpos($proto_opts, ':') !== false) {
- list($parsed['hostspec'],
- $parsed['port']) = explode(':', $proto_opts);
- } else {
- $parsed['hostspec'] = $proto_opts;
- }
- } elseif ($parsed['protocol'] == 'unix') {
- $parsed['socket'] = $proto_opts;
- }
-
- // Get dabase if any
- // $dsn => database
- if ($dsn) {
- if (($pos = strpos($dsn, '?')) === false) {
- // /database
- $parsed['database'] = rawurldecode($dsn);
- } else {
- // /database?param1=value1¶m2=value2
- $parsed['database'] = rawurldecode(substr($dsn, 0, $pos));
- $dsn = substr($dsn, $pos + 1);
- if (strpos($dsn, '&') !== false) {
- $opts = explode('&', $dsn);
- } else { // database?param1=value1
- $opts = array($dsn);
- }
- foreach ($opts as $opt) {
- list($key, $value) = explode('=', $opt);
- if (!isset($parsed[$key])) {
- // don't allow params overwrite
- $parsed[$key] = rawurldecode($value);
- }
- }
- }
- }
-
- return $parsed;
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class DB_Error
-
-/**
- * DB_Error implements a class for reporting portable database error
- * messages
- *
- * @category Database
- * @package DB
- * @author Stig Bakken
- *
- *
- * @see DB_common::escapeSimple()
- * @since Method available since Release 1.6.0
- */
- function quoteSmart($in)
- {
- if (is_int($in) || is_double($in)) {
- return $in;
- } elseif (is_bool($in)) {
- return $in ? 1 : 0;
- } elseif (is_null($in)) {
- return 'NULL';
- } else {
- return "'" . $this->escapeSimple($in) . "'";
- }
- }
-
- // }}}
- // {{{ escapeSimple()
-
- /**
- * Escapes a string according to the current DBMS's standards
- *
- * In SQLite, this makes things safe for inserts/updates, but may
- * cause problems when performing text comparisons against columns
- * containing binary data. See the
- * {@link http://php.net/sqlite_escape_string PHP manual} for more info.
- *
- * @param string $str the string to be escaped
- *
- * @return string the escaped string
- *
- * @see DB_common::quoteSmart()
- * @since Method available since Release 1.6.0
- */
- function escapeSimple($str)
- {
- return str_replace("'", "''", $str);
- }
-
- // }}}
- // {{{ provides()
-
- /**
- * Tells whether the present driver supports a given feature
- *
- * @param string $feature the feature you're curious about
- *
- * @return bool whether this driver supports $feature
- */
- function provides($feature)
- {
- return $this->features[$feature];
- }
-
- // }}}
- // {{{ setFetchMode()
-
- /**
- * Sets the fetch mode that should be used by default for query results
- *
- * @param integer $fetchmode DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC
- * or DB_FETCHMODE_OBJECT
- * @param string $object_class the class name of the object to be returned
- * by the fetch methods when the
- * DB_FETCHMODE_OBJECT mode is selected.
- * If no class is specified by default a cast
- * to object from the assoc array row will be
- * done. There is also the posibility to use
- * and extend the 'DB_row' class.
- *
- * @see DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_OBJECT
- */
- function setFetchMode($fetchmode, $object_class = 'stdClass')
- {
- switch ($fetchmode) {
- case DB_FETCHMODE_OBJECT:
- $this->fetchmode_object_class = $object_class;
- case DB_FETCHMODE_ORDERED:
- case DB_FETCHMODE_ASSOC:
- $this->fetchmode = $fetchmode;
- break;
- default:
- return $this->raiseError('invalid fetchmode mode');
- }
- }
-
- // }}}
- // {{{ setOption()
-
- /**
- * Sets run-time configuration options for PEAR DB
- *
- * Options, their data types, default values and description:
- *
- *
- * [1] Accommodate the lowest common denominator because not all
- * versions of have BOOLEAN.
- *
- *
- *
- * -----------------------------------------
- *
- * PORTABILITY MODES
- *
- * These modes are bitwised, so they can be combined using |
- * and removed using ^. See the examples section below on how
- * to do this.
- *
- * DB_PORTABILITY_NONE
- * turn off all portability features
- *
- * This mode gets automatically turned on if the deprecated
- * optimize option gets set to performance.
- *
- *
- * DB_PORTABILITY_LOWERCASE
- * convert names of tables and fields to lower case when using
- * get*(), fetch*() and tableInfo()
- *
- * This mode gets automatically turned on in the following databases
- * if the deprecated option optimize gets set to
- * portability:
- * + oci8
- *
- *
- * DB_PORTABILITY_RTRIM
- * right trim the data output by get*() fetch*()
- *
- *
- * DB_PORTABILITY_DELETE_COUNT
- * force reporting the number of rows deleted
- *
- * Some DBMS's don't count the number of rows deleted when performing
- * simple DELETE FROM tablename queries. This portability
- * mode tricks such DBMS's into telling the count by adding
- * WHERE 1=1 to the end of DELETE queries.
- *
- * This mode gets automatically turned on in the following databases
- * if the deprecated option optimize gets set to
- * portability:
- * + fbsql
- * + mysql
- * + mysqli
- * + sqlite
- *
- *
- * DB_PORTABILITY_NUMROWS
- * enable hack that makes numRows() work in Oracle
- *
- * This mode gets automatically turned on in the following databases
- * if the deprecated option optimize gets set to
- * portability:
- * + oci8
- *
- *
- * DB_PORTABILITY_ERRORS
- * makes certain error messages in certain drivers compatible
- * with those from other DBMS's
- *
- * + mysql, mysqli: change unique/primary key constraints
- * DB_ERROR_ALREADY_EXISTS -> DB_ERROR_CONSTRAINT
- *
- * + odbc(access): MS's ODBC driver reports 'no such field' as code
- * 07001, which means 'too few parameters.' When this option is on
- * that code gets mapped to DB_ERROR_NOSUCHFIELD.
- * DB_ERROR_MISMATCH -> DB_ERROR_NOSUCHFIELD
- *
- * DB_PORTABILITY_NULL_TO_EMPTY
- * convert null values to empty strings in data output by get*() and
- * fetch*(). Needed because Oracle considers empty strings to be null,
- * while most other DBMS's know the difference between empty and null.
- *
- *
- * DB_PORTABILITY_ALL
- * turn on all portability features
- *
- * -----------------------------------------
- *
- * Example 1. Simple setOption() example
- *
should results be freed automatically when there are no
- * more rows?
- *
how many rows of the result set should be buffered?
- *
In mysql: mysql_unbuffered_query() is used instead of
- * mysql_query() if this value is 0. (Release 1.7.0)
- *
In oci8: this value is passed to ocisetprefetch().
- * (Release 1.7.0)
- *
debug level
- *
should the connection be persistent?
- *
portability mode constant (see below)
- *
the sprintf() format string used on sequence names. This
- * format is applied to sequence names passed to
- * createSequence(), nextID() and dropSequence().
- *
use ssl to connect?
- *
- * $db->setOption('autofree', true);
- *
- *
- * Example 2. Portability for lowercasing and trimming
- *
- * $db->setOption('portability',
- * DB_PORTABILITY_LOWERCASE | DB_PORTABILITY_RTRIM);
- *
- *
- * Example 3. All portability options except trimming
- *
- * $db->setOption('portability',
- * DB_PORTABILITY_ALL ^ DB_PORTABILITY_RTRIM);
- *
- *
- * @param string $option option name
- * @param mixed $value value for the option
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::$options
- */
- function setOption($option, $value)
- {
- if (isset($this->options[$option])) {
- $this->options[$option] = $value;
-
- /*
- * Backwards compatibility check for the deprecated 'optimize'
- * option. Done here in case settings change after connecting.
- */
- if ($option == 'optimize') {
- if ($value == 'portability') {
- switch ($this->phptype) {
- case 'oci8':
- $this->options['portability'] =
- DB_PORTABILITY_LOWERCASE |
- DB_PORTABILITY_NUMROWS;
- break;
- case 'fbsql':
- case 'mysql':
- case 'mysqli':
- case 'sqlite':
- $this->options['portability'] =
- DB_PORTABILITY_DELETE_COUNT;
- break;
- }
- } else {
- $this->options['portability'] = DB_PORTABILITY_NONE;
- }
- }
-
- return DB_OK;
- }
- return $this->raiseError("unknown option $option");
- }
-
- // }}}
- // {{{ getOption()
-
- /**
- * Returns the value of an option
- *
- * @param string $option the option name you're curious about
- *
- * @return mixed the option's value
- */
- function getOption($option)
- {
- if (isset($this->options[$option])) {
- return $this->options[$option];
- }
- return $this->raiseError("unknown option $option");
- }
-
- // }}}
- // {{{ prepare()
-
- /**
- * Prepares a query for multiple execution with execute()
- *
- * Creates a query that can be run multiple times. Each time it is run,
- * the placeholders, if any, will be replaced by the contents of
- * execute()'s $data argument.
- *
- * Three types of placeholders can be used:
- * + ? scalar value (i.e. strings, integers). The system
- * will automatically quote and escape the data.
- * + ! value is inserted 'as is'
- * + & requires a file name. The file's contents get
- * inserted into the query (i.e. saving binary
- * data in a db)
- *
- * Example 1.
- *
- * $sth = $db->prepare('INSERT INTO tbl (a, b, c) VALUES (?, !, &)');
- * $data = array(
- * "John's text",
- * "'it''s good'",
- * 'filename.txt'
- * );
- * $res = $db->execute($sth, $data);
- *
- *
- * Use backslashes to escape placeholder characters if you don't want
- * them to be interpreted as placeholders:
- *
- * "UPDATE foo SET col=? WHERE col='over \& under'"
- *
- *
- * With some database backends, this is emulated.
- *
- * {@internal ibase and oci8 have their own prepare() methods.}}
- *
- * @param string $query the query to be prepared
- *
- * @return mixed DB statement resource on success. A DB_Error object
- * on failure.
- *
- * @see DB_common::execute()
- */
- function prepare($query)
- {
- $tokens = preg_split('/((?prepare_tokens[] = &$newtokens;
- end($this->prepare_tokens);
-
- $k = key($this->prepare_tokens);
- $this->prepare_types[$k] = $types;
- $this->prepared_queries[$k] = implode(' ', $newtokens);
-
- return $k;
- }
-
- // }}}
- // {{{ autoPrepare()
-
- /**
- * Automaticaly generates an insert or update query and pass it to prepare()
- *
- * @param string $table the table name
- * @param array $table_fields the array of field names
- * @param int $mode a type of query to make:
- * DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
- * @param string $where for update queries: the WHERE clause to
- * append to the SQL statement. Don't
- * include the "WHERE" keyword.
- *
- * @return resource the query handle
- *
- * @uses DB_common::prepare(), DB_common::buildManipSQL()
- */
- function autoPrepare($table, $table_fields, $mode = DB_AUTOQUERY_INSERT,
- $where = false)
- {
- $query = $this->buildManipSQL($table, $table_fields, $mode, $where);
- if (DB::isError($query)) {
- return $query;
- }
- return $this->prepare($query);
- }
-
- // }}}
- // {{{ autoExecute()
-
- /**
- * Automaticaly generates an insert or update query and call prepare()
- * and execute() with it
- *
- * @param string $table the table name
- * @param array $fields_values the associative array where $key is a
- * field name and $value its value
- * @param int $mode a type of query to make:
- * DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
- * @param string $where for update queries: the WHERE clause to
- * append to the SQL statement. Don't
- * include the "WHERE" keyword.
- *
- * @return mixed a new DB_result object for successful SELECT queries
- * or DB_OK for successul data manipulation queries.
- * A DB_Error object on failure.
- *
- * @uses DB_common::autoPrepare(), DB_common::execute()
- */
- function autoExecute($table, $fields_values, $mode = DB_AUTOQUERY_INSERT,
- $where = false)
- {
- $sth = $this->autoPrepare($table, array_keys($fields_values), $mode,
- $where);
- if (DB::isError($sth)) {
- return $sth;
- }
- $ret =& $this->execute($sth, array_values($fields_values));
- $this->freePrepared($sth);
- return $ret;
-
- }
-
- // }}}
- // {{{ buildManipSQL()
-
- /**
- * Produces an SQL query string for autoPrepare()
- *
- * Example:
- *
- * buildManipSQL('table_sql', array('field1', 'field2', 'field3'),
- * DB_AUTOQUERY_INSERT);
- *
- *
- * That returns
- *
- * INSERT INTO table_sql (field1,field2,field3) VALUES (?,?,?)
- *
- *
- * NOTES:
- * - This belongs more to a SQL Builder class, but this is a simple
- * facility.
- * - Be carefull! If you don't give a $where param with an UPDATE
- * query, all the records of the table will be updated!
- *
- * @param string $table the table name
- * @param array $table_fields the array of field names
- * @param int $mode a type of query to make:
- * DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
- * @param string $where for update queries: the WHERE clause to
- * append to the SQL statement. Don't
- * include the "WHERE" keyword.
- *
- * @return string the sql query for autoPrepare()
- */
- function buildManipSQL($table, $table_fields, $mode, $where = false)
- {
- if (count($table_fields) == 0) {
- return $this->raiseError(DB_ERROR_NEED_MORE_DATA);
- }
- $first = true;
- switch ($mode) {
- case DB_AUTOQUERY_INSERT:
- $values = '';
- $names = '';
- foreach ($table_fields as $value) {
- if ($first) {
- $first = false;
- } else {
- $names .= ',';
- $values .= ',';
- }
- $names .= $value;
- $values .= '?';
- }
- return "INSERT INTO $table ($names) VALUES ($values)";
- case DB_AUTOQUERY_UPDATE:
- $set = '';
- foreach ($table_fields as $value) {
- if ($first) {
- $first = false;
- } else {
- $set .= ',';
- }
- $set .= "$value = ?";
- }
- $sql = "UPDATE $table SET $set";
- if ($where) {
- $sql .= " WHERE $where";
- }
- return $sql;
- default:
- return $this->raiseError(DB_ERROR_SYNTAX);
- }
- }
-
- // }}}
- // {{{ execute()
-
- /**
- * Executes a DB statement prepared with prepare()
- *
- * Example 1.
- *
- * $sth = $db->prepare('INSERT INTO tbl (a, b, c) VALUES (?, !, &)');
- * $data = array(
- * "John's text",
- * "'it''s good'",
- * 'filename.txt'
- * );
- * $res =& $db->execute($sth, $data);
- *
- *
- * @param resource $stmt a DB statement resource returned from prepare()
- * @param mixed $data array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return mixed a new DB_result object for successful SELECT queries
- * or DB_OK for successul data manipulation queries.
- * A DB_Error object on failure.
- *
- * {@internal ibase and oci8 have their own execute() methods.}}
- *
- * @see DB_common::prepare()
- */
- function &execute($stmt, $data = array())
- {
- $realquery = $this->executeEmulateQuery($stmt, $data);
- if (DB::isError($realquery)) {
- return $realquery;
- }
- $result = $this->simpleQuery($realquery);
-
- if ($result === DB_OK || DB::isError($result)) {
- return $result;
- } else {
- $tmp =& new DB_result($this, $result);
- return $tmp;
- }
- }
-
- // }}}
- // {{{ executeEmulateQuery()
-
- /**
- * Emulates executing prepared statements if the DBMS not support them
- *
- * @param resource $stmt a DB statement resource returned from execute()
- * @param mixed $data array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return mixed a string containing the real query run when emulating
- * prepare/execute. A DB_Error object on failure.
- *
- * @access protected
- * @see DB_common::execute()
- */
- function executeEmulateQuery($stmt, $data = array())
- {
- $stmt = (int)$stmt;
- $data = (array)$data;
- $this->last_parameters = $data;
-
- if (count($this->prepare_types[$stmt]) != count($data)) {
- $this->last_query = $this->prepared_queries[$stmt];
- return $this->raiseError(DB_ERROR_MISMATCH);
- }
-
- $realquery = $this->prepare_tokens[$stmt][0];
-
- $i = 0;
- foreach ($data as $value) {
- if ($this->prepare_types[$stmt][$i] == DB_PARAM_SCALAR) {
- $realquery .= $this->quoteSmart($value);
- } elseif ($this->prepare_types[$stmt][$i] == DB_PARAM_OPAQUE) {
- $fp = @fopen($value, 'rb');
- if (!$fp) {
- return $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
- }
- $realquery .= $this->quoteSmart(fread($fp, filesize($value)));
- fclose($fp);
- } else {
- $realquery .= $value;
- }
-
- $realquery .= $this->prepare_tokens[$stmt][++$i];
- }
-
- return $realquery;
- }
-
- // }}}
- // {{{ executeMultiple()
-
- /**
- * Performs several execute() calls on the same statement handle
- *
- * $data must be an array indexed numerically
- * from 0, one execute call is done for every "row" in the array.
- *
- * If an error occurs during execute(), executeMultiple() does not
- * execute the unfinished rows, but rather returns that error.
- *
- * @param resource $stmt query handle from prepare()
- * @param array $data numeric array containing the
- * data to insert into the query
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::prepare(), DB_common::execute()
- */
- function executeMultiple($stmt, $data)
- {
- foreach ($data as $value) {
- $res =& $this->execute($stmt, $value);
- if (DB::isError($res)) {
- return $res;
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ freePrepared()
-
- /**
- * Frees the internal resources associated with a prepared query
- *
- * @param resource $stmt the prepared statement's PHP resource
- * @param bool $free_resource should the PHP resource be freed too?
- * Use false if you need to get data
- * from the result set later.
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_common::prepare()
- */
- function freePrepared($stmt, $free_resource = true)
- {
- $stmt = (int)$stmt;
- if (isset($this->prepare_tokens[$stmt])) {
- unset($this->prepare_tokens[$stmt]);
- unset($this->prepare_types[$stmt]);
- unset($this->prepared_queries[$stmt]);
- return true;
- }
- return false;
- }
-
- // }}}
- // {{{ modifyQuery()
-
- /**
- * Changes a query string for various DBMS specific reasons
- *
- * It is defined here to ensure all drivers have this method available.
- *
- * @param string $query the query string to modify
- *
- * @return string the modified query string
- *
- * @access protected
- * @see DB_mysql::modifyQuery(), DB_oci8::modifyQuery(),
- * DB_sqlite::modifyQuery()
- */
- function modifyQuery($query)
- {
- return $query;
- }
-
- // }}}
- // {{{ modifyLimitQuery()
-
- /**
- * Adds LIMIT clauses to a query string according to current DBMS standards
- *
- * It is defined here to assure that all implementations
- * have this method defined.
- *
- * @param string $query the query to modify
- * @param int $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return string the query string with LIMIT clauses added
- *
- * @access protected
- */
- function modifyLimitQuery($query, $from, $count, $params = array())
- {
- return $query;
- }
-
- // }}}
- // {{{ query()
-
- /**
- * Sends a query to the database server
- *
- * The query string can be either a normal statement to be sent directly
- * to the server OR if $params are passed the query can have
- * placeholders and it will be passed through prepare() and execute().
- *
- * @param string $query the SQL query or the statement to prepare
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return mixed a new DB_result object for successful SELECT queries
- * or DB_OK for successul data manipulation queries.
- * A DB_Error object on failure.
- *
- * @see DB_result, DB_common::prepare(), DB_common::execute()
- */
- function &query($query, $params = array())
- {
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
- if (DB::isError($sth)) {
- return $sth;
- }
- $ret =& $this->execute($sth, $params);
- $this->freePrepared($sth, false);
- return $ret;
- } else {
- $this->last_parameters = array();
- $result = $this->simpleQuery($query);
- if ($result === DB_OK || DB::isError($result)) {
- return $result;
- } else {
- $tmp =& new DB_result($this, $result);
- return $tmp;
- }
- }
- }
-
- // }}}
- // {{{ limitQuery()
-
- /**
- * Generates and executes a LIMIT query
- *
- * @param string $query the query
- * @param intr $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return mixed a new DB_result object for successful SELECT queries
- * or DB_OK for successul data manipulation queries.
- * A DB_Error object on failure.
- */
- function &limitQuery($query, $from, $count, $params = array())
- {
- $query = $this->modifyLimitQuery($query, $from, $count, $params);
- if (DB::isError($query)){
- return $query;
- }
- $result =& $this->query($query, $params);
- if (is_a($result, 'DB_result')) {
- $result->setOption('limit_from', $from);
- $result->setOption('limit_count', $count);
- }
- return $result;
- }
-
- // }}}
- // {{{ getOne()
-
- /**
- * Fetches the first column of the first row from a query result
- *
- * Takes care of doing the query and freeing the results when finished.
- *
- * @param string $query the SQL query
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return mixed the returned value of the query.
- * A DB_Error object on failure.
- */
- function &getOne($query, $params = array())
- {
- $params = (array)$params;
- // modifyLimitQuery() would be nice here, but it causes BC issues
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
- if (DB::isError($sth)) {
- return $sth;
- }
- $res =& $this->execute($sth, $params);
- $this->freePrepared($sth);
- } else {
- $res =& $this->query($query);
- }
-
- if (DB::isError($res)) {
- return $res;
- }
-
- $err = $res->fetchInto($row, DB_FETCHMODE_ORDERED);
- $res->free();
-
- if ($err !== DB_OK) {
- return $err;
- }
-
- return $row[0];
- }
-
- // }}}
- // {{{ getRow()
-
- /**
- * Fetches the first row of data returned from a query result
- *
- * Takes care of doing the query and freeing the results when finished.
- *
- * @param string $query the SQL query
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- * @param int $fetchmode the fetch mode to use
- *
- * @return array the first row of results as an array.
- * A DB_Error object on failure.
- */
- function &getRow($query, $params = array(),
- $fetchmode = DB_FETCHMODE_DEFAULT)
- {
- // compat check, the params and fetchmode parameters used to
- // have the opposite order
- if (!is_array($params)) {
- if (is_array($fetchmode)) {
- if ($params === null) {
- $tmp = DB_FETCHMODE_DEFAULT;
- } else {
- $tmp = $params;
- }
- $params = $fetchmode;
- $fetchmode = $tmp;
- } elseif ($params !== null) {
- $fetchmode = $params;
- $params = array();
- }
- }
- // modifyLimitQuery() would be nice here, but it causes BC issues
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
- if (DB::isError($sth)) {
- return $sth;
- }
- $res =& $this->execute($sth, $params);
- $this->freePrepared($sth);
- } else {
- $res =& $this->query($query);
- }
-
- if (DB::isError($res)) {
- return $res;
- }
-
- $err = $res->fetchInto($row, $fetchmode);
-
- $res->free();
-
- if ($err !== DB_OK) {
- return $err;
- }
-
- return $row;
- }
-
- // }}}
- // {{{ getCol()
-
- /**
- * Fetches a single column from a query result and returns it as an
- * indexed array
- *
- * @param string $query the SQL query
- * @param mixed $col which column to return (integer [column number,
- * starting at 0] or string [column name])
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return array the results as an array. A DB_Error object on failure.
- *
- * @see DB_common::query()
- */
- function &getCol($query, $col = 0, $params = array())
- {
- $params = (array)$params;
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
-
- if (DB::isError($sth)) {
- return $sth;
- }
-
- $res =& $this->execute($sth, $params);
- $this->freePrepared($sth);
- } else {
- $res =& $this->query($query);
- }
-
- if (DB::isError($res)) {
- return $res;
- }
-
- $fetchmode = is_int($col) ? DB_FETCHMODE_ORDERED : DB_FETCHMODE_ASSOC;
-
- if (!is_array($row = $res->fetchRow($fetchmode))) {
- $ret = array();
- } else {
- if (!array_key_exists($col, $row)) {
- $ret =& $this->raiseError(DB_ERROR_NOSUCHFIELD);
- } else {
- $ret = array($row[$col]);
- while (is_array($row = $res->fetchRow($fetchmode))) {
- $ret[] = $row[$col];
- }
- }
- }
-
- $res->free();
-
- if (DB::isError($row)) {
- $ret = $row;
- }
-
- return $ret;
- }
-
- // }}}
- // {{{ getAssoc()
-
- /**
- * Fetches an entire query result and returns it as an
- * associative array using the first column as the key
- *
- * If the result set contains more than two columns, the value
- * will be an array of the values from column 2-n. If the result
- * set contains only two columns, the returned value will be a
- * scalar with the value of the second column (unless forced to an
- * array with the $force_array parameter). A DB error code is
- * returned on errors. If the result set contains fewer than two
- * columns, a DB_ERROR_TRUNCATED error is returned.
- *
- * For example, if the table "mytable" contains:
- *
- *
- * ID TEXT DATE
- * --------------------------------
- * 1 'one' 944679408
- * 2 'two' 944679408
- * 3 'three' 944679408
- *
- *
- * Then the call getAssoc('SELECT id,text FROM mytable') returns:
- *
- * array(
- * '1' => 'one',
- * '2' => 'two',
- * '3' => 'three',
- * )
- *
- *
- * ...while the call getAssoc('SELECT id,text,date FROM mytable') returns:
- *
- * array(
- * '1' => array('one', '944679408'),
- * '2' => array('two', '944679408'),
- * '3' => array('three', '944679408')
- * )
- *
- *
- * If the more than one row occurs with the same value in the
- * first column, the last row overwrites all previous ones by
- * default. Use the $group parameter if you don't want to
- * overwrite like this. Example:
- *
- *
- * getAssoc('SELECT category,id,name FROM mytable', false, null,
- * DB_FETCHMODE_ASSOC, true) returns:
- *
- * array(
- * '1' => array(array('id' => '4', 'name' => 'number four'),
- * array('id' => '6', 'name' => 'number six')
- * ),
- * '9' => array(array('id' => '4', 'name' => 'number four'),
- * array('id' => '6', 'name' => 'number six')
- * )
- * )
- *
- *
- * Keep in mind that database functions in PHP usually return string
- * values for results regardless of the database's internal type.
- *
- * @param string $query the SQL query
- * @param bool $force_array used only when the query returns
- * exactly two columns. If true, the values
- * of the returned array will be one-element
- * arrays instead of scalars.
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of
- * items passed must match quantity of
- * placeholders in query: meaning 1
- * placeholder for non-array parameters or
- * 1 placeholder per array element.
- * @param int $fetchmode the fetch mode to use
- * @param bool $group if true, the values of the returned array
- * is wrapped in another array. If the same
- * key value (in the first column) repeats
- * itself, the values will be appended to
- * this array instead of overwriting the
- * existing values.
- *
- * @return array the associative array containing the query results.
- * A DB_Error object on failure.
- */
- function &getAssoc($query, $force_array = false, $params = array(),
- $fetchmode = DB_FETCHMODE_DEFAULT, $group = false)
- {
- $params = (array)$params;
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
-
- if (DB::isError($sth)) {
- return $sth;
- }
-
- $res =& $this->execute($sth, $params);
- $this->freePrepared($sth);
- } else {
- $res =& $this->query($query);
- }
-
- if (DB::isError($res)) {
- return $res;
- }
- if ($fetchmode == DB_FETCHMODE_DEFAULT) {
- $fetchmode = $this->fetchmode;
- }
- $cols = $res->numCols();
-
- if ($cols < 2) {
- $tmp =& $this->raiseError(DB_ERROR_TRUNCATED);
- return $tmp;
- }
-
- $results = array();
-
- if ($cols > 2 || $force_array) {
- // return array values
- // XXX this part can be optimized
- if ($fetchmode == DB_FETCHMODE_ASSOC) {
- while (is_array($row = $res->fetchRow(DB_FETCHMODE_ASSOC))) {
- reset($row);
- $key = current($row);
- unset($row[key($row)]);
- if ($group) {
- $results[$key][] = $row;
- } else {
- $results[$key] = $row;
- }
- }
- } elseif ($fetchmode == DB_FETCHMODE_OBJECT) {
- while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
- $arr = get_object_vars($row);
- $key = current($arr);
- if ($group) {
- $results[$key][] = $row;
- } else {
- $results[$key] = $row;
- }
- }
- } else {
- while (is_array($row = $res->fetchRow(DB_FETCHMODE_ORDERED))) {
- // we shift away the first element to get
- // indices running from 0 again
- $key = array_shift($row);
- if ($group) {
- $results[$key][] = $row;
- } else {
- $results[$key] = $row;
- }
- }
- }
- if (DB::isError($row)) {
- $results = $row;
- }
- } else {
- // return scalar values
- while (is_array($row = $res->fetchRow(DB_FETCHMODE_ORDERED))) {
- if ($group) {
- $results[$row[0]][] = $row[1];
- } else {
- $results[$row[0]] = $row[1];
- }
- }
- if (DB::isError($row)) {
- $results = $row;
- }
- }
-
- $res->free();
-
- return $results;
- }
-
- // }}}
- // {{{ getAll()
-
- /**
- * Fetches all of the rows from a query result
- *
- * @param string $query the SQL query
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of
- * items passed must match quantity of
- * placeholders in query: meaning 1
- * placeholder for non-array parameters or
- * 1 placeholder per array element.
- * @param int $fetchmode the fetch mode to use:
- * + DB_FETCHMODE_ORDERED
- * + DB_FETCHMODE_ASSOC
- * + DB_FETCHMODE_ORDERED | DB_FETCHMODE_FLIPPED
- * + DB_FETCHMODE_ASSOC | DB_FETCHMODE_FLIPPED
- *
- * @return array the nested array. A DB_Error object on failure.
- */
- function &getAll($query, $params = array(),
- $fetchmode = DB_FETCHMODE_DEFAULT)
- {
- // compat check, the params and fetchmode parameters used to
- // have the opposite order
- if (!is_array($params)) {
- if (is_array($fetchmode)) {
- if ($params === null) {
- $tmp = DB_FETCHMODE_DEFAULT;
- } else {
- $tmp = $params;
- }
- $params = $fetchmode;
- $fetchmode = $tmp;
- } elseif ($params !== null) {
- $fetchmode = $params;
- $params = array();
- }
- }
-
- if (sizeof($params) > 0) {
- $sth = $this->prepare($query);
-
- if (DB::isError($sth)) {
- return $sth;
- }
-
- $res =& $this->execute($sth, $params);
- $this->freePrepared($sth);
- } else {
- $res =& $this->query($query);
- }
-
- if ($res === DB_OK || DB::isError($res)) {
- return $res;
- }
-
- $results = array();
- while (DB_OK === $res->fetchInto($row, $fetchmode)) {
- if ($fetchmode & DB_FETCHMODE_FLIPPED) {
- foreach ($row as $key => $val) {
- $results[$key][] = $val;
- }
- } else {
- $results[] = $row;
- }
- }
-
- $res->free();
-
- if (DB::isError($row)) {
- $tmp =& $this->raiseError($row);
- return $tmp;
- }
- return $results;
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = false)
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Determines the number of rows in a query result
- *
- * @param resource $result the query result idenifier produced by PHP
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function numRows($result)
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ getSequenceName()
-
- /**
- * Generates the name used inside the database for a sequence
- *
- * The createSequence() docblock contains notes about storing sequence
- * names.
- *
- * @param string $sqn the sequence's public name
- *
- * @return string the sequence's name in the backend
- *
- * @access protected
- * @see DB_common::createSequence(), DB_common::dropSequence(),
- * DB_common::nextID(), DB_common::setOption()
- */
- function getSequenceName($sqn)
- {
- return sprintf($this->getOption('seqname_format'),
- preg_replace('/[^a-z0-9_.]/i', '_', $sqn));
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::dropSequence(),
- * DB_common::getSequenceName()
- */
- function nextId($seq_name, $ondemand = true)
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * Creates a new sequence
- *
- * The name of a given sequence is determined by passing the string
- * provided in the $seq_name argument through PHP's sprintf()
- * function using the value from the seqname_format option as
- * the sprintf()'s format argument.
- *
- * seqname_format is set via setOption().
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_common::nextID()
- */
- function createSequence($seq_name)
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_common::nextID()
- */
- function dropSequence($seq_name)
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ raiseError()
-
- /**
- * Communicates an error and invoke error callbacks, etc
- *
- * Basically a wrapper for PEAR::raiseError without the message string.
- *
- * @param mixed integer error code, or a PEAR error object (all
- * other parameters are ignored if this parameter is
- * an object
- * @param int error mode, see PEAR_Error docs
- * @param mixed if error mode is PEAR_ERROR_TRIGGER, this is the
- * error level (E_USER_NOTICE etc). If error mode is
- * PEAR_ERROR_CALLBACK, this is the callback function,
- * either as a function name, or as an array of an
- * object and method name. For other error modes this
- * parameter is ignored.
- * @param string extra debug information. Defaults to the last
- * query and native error code.
- * @param mixed native error code, integer or string depending the
- * backend
- *
- * @return object the PEAR_Error object
- *
- * @see PEAR_Error
- */
- function &raiseError($code = DB_ERROR, $mode = null, $options = null,
- $userinfo = null, $nativecode = null)
- {
- // The error is yet a DB error object
- if (is_object($code)) {
- // because we the static PEAR::raiseError, our global
- // handler should be used if it is set
- if ($mode === null && !empty($this->_default_error_mode)) {
- $mode = $this->_default_error_mode;
- $options = $this->_default_error_options;
- }
- $tmp = PEAR::raiseError($code, null, $mode, $options,
- null, null, true);
- return $tmp;
- }
-
- if ($userinfo === null) {
- $userinfo = $this->last_query;
- }
-
- if ($nativecode) {
- $userinfo .= ' [nativecode=' . trim($nativecode) . ']';
- } else {
- $userinfo .= ' [DB Error: ' . DB::errorMessage($code) . ']';
- }
-
- $tmp = PEAR::raiseError(null, $code, $mode, $options, $userinfo,
- 'DB_Error', true);
- return $tmp;
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error code produced by the last query
- *
- * @return mixed the DBMS' error code. A DB_Error object on failure.
- */
- function errorNative()
- {
- return $this->raiseError(DB_ERROR_NOT_CAPABLE);
- }
-
- // }}}
- // {{{ errorCode()
-
- /**
- * Maps native error codes to DB's portable ones
- *
- * Uses the $errorcode_map property defined in each driver.
- *
- * @param string|int $nativecode the error code returned by the DBMS
- *
- * @return int the portable DB error code. Return DB_ERROR if the
- * current driver doesn't have a mapping for the
- * $nativecode submitted.
- */
- function errorCode($nativecode)
- {
- if (isset($this->errorcode_map[$nativecode])) {
- return $this->errorcode_map[$nativecode];
- }
- // Fall back to DB_ERROR if there was no mapping.
- return DB_ERROR;
- }
-
- // }}}
- // {{{ errorMessage()
-
- /**
- * Maps a DB error code to a textual message
- *
- * @param integer $dbcode the DB error code
- *
- * @return string the error message corresponding to the error code
- * submitted. FALSE if the error code is unknown.
- *
- * @see DB::errorMessage()
- */
- function errorMessage($dbcode)
- {
- return DB::errorMessage($this->errorcode_map[$dbcode]);
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * The format of the resulting array depends on which $mode
- * you select. The sample output below is based on this query:
- *
- * SELECT tblFoo.fldID, tblFoo.fldPhone, tblBar.fldId
- * FROM tblFoo
- * JOIN tblBar ON tblFoo.fldId = tblBar.fldId
- *
- *
- *
- *
- *
- * The flags element contains a space separated list
- * of extra information about the field. This data is inconsistent
- * between DBMS's due to the way each DBMS works.
- * + primary_key
- * + unique_key
- * + multiple_key
- * + not_null
- *
- * Most DBMS's only provide the table and flags
- * elements if $result is a table name. The following DBMS's
- * provide full information from queries:
- * + fbsql
- * + mysql
- *
- * If the 'portability' option has DB_PORTABILITY_LOWERCASE
- * turned on, the names of tables and fields will be lowercased.
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode either unused or one of the tableInfo modes:
- * DB_TABLEINFO_ORDERTABLE,
- * DB_TABLEINFO_ORDER or
- * DB_TABLEINFO_FULL (which does both).
- * These are bitwise, so the first two can be
- * combined using |.
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::setOption()
- */
- function tableInfo($result, $mode = null)
- {
- /*
- * If the DB_
- * [0] => Array (
- * [table] => tblFoo
- * [name] => fldId
- * [type] => int
- * [len] => 11
- * [flags] => primary_key not_null
- * )
- * [1] => Array (
- * [table] => tblFoo
- * [name] => fldPhone
- * [type] => string
- * [len] => 20
- * [flags] =>
- * )
- * [2] => Array (
- * [table] => tblBar
- * [name] => fldId
- * [type] => int
- * [len] => 11
- * [flags] => primary_key not_null
- * )
- *
- *
- *
- * [num_fields] => 3
- * [order] => Array (
- * [fldId] => 2
- * [fldTrans] => 1
- * )
- *
- *
- *
- * [num_fields] => 3
- * [ordertable] => Array (
- * [tblFoo] => Array (
- * [fldId] => 0
- * [fldPhone] => 1
- * )
- * [tblBar] => Array (
- * [fldId] => 2
- * )
- * )
- *
- *
- *
- * require_once 'DB.php';
- *
- * $dsn = 'pgsql://user:pass@unix(/tmp)/dbname?new_link=true';
- * $options = array(
- * 'portability' => DB_PORTABILITY_ALL,
- * );
- *
- * $db =& DB::connect($dsn, $options);
- * if (PEAR::isError($db)) {
- * die($db->getMessage());
- * }
- *
- *
- * @param array $dsn the data source name
- * @param bool $persistent should the connection be persistent?
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @link http://www.postgresql.org/docs/current/static/libpq.html#LIBPQ-CONNECT
- */
- function connect($dsn, $persistent = false)
- {
- if (!PEAR::loadExtension('pgsql')) {
- return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
- }
-
- $this->dsn = $dsn;
- if ($dsn['dbsyntax']) {
- $this->dbsyntax = $dsn['dbsyntax'];
- }
-
- $protocol = $dsn['protocol'] ? $dsn['protocol'] : 'tcp';
-
- $params = array('');
- if ($protocol == 'tcp') {
- if ($dsn['hostspec']) {
- $params[0] .= 'host=' . $dsn['hostspec'];
- }
- if ($dsn['port']) {
- $params[0] .= ' port=' . $dsn['port'];
- }
- } elseif ($protocol == 'unix') {
- // Allow for pg socket in non-standard locations.
- if ($dsn['socket']) {
- $params[0] .= 'host=' . $dsn['socket'];
- }
- if ($dsn['port']) {
- $params[0] .= ' port=' . $dsn['port'];
- }
- }
- if ($dsn['database']) {
- $params[0] .= ' dbname=\'' . addslashes($dsn['database']) . '\'';
- }
- if ($dsn['username']) {
- $params[0] .= ' user=\'' . addslashes($dsn['username']) . '\'';
- }
- if ($dsn['password']) {
- $params[0] .= ' password=\'' . addslashes($dsn['password']) . '\'';
- }
- if (!empty($dsn['options'])) {
- $params[0] .= ' options=' . $dsn['options'];
- }
- if (!empty($dsn['tty'])) {
- $params[0] .= ' tty=' . $dsn['tty'];
- }
- if (!empty($dsn['connect_timeout'])) {
- $params[0] .= ' connect_timeout=' . $dsn['connect_timeout'];
- }
- if (!empty($dsn['sslmode'])) {
- $params[0] .= ' sslmode=' . $dsn['sslmode'];
- }
- if (!empty($dsn['service'])) {
- $params[0] .= ' service=' . $dsn['service'];
- }
-
- if (isset($dsn['new_link'])
- && ($dsn['new_link'] == 'true' || $dsn['new_link'] === true))
- {
- if (version_compare(phpversion(), '4.3.0', '>=')) {
- $params[] = PGSQL_CONNECT_FORCE_NEW;
- }
- }
-
- $connect_function = $persistent ? 'pg_pconnect' : 'pg_connect';
-
- $ini = ini_get('track_errors');
- $php_errormsg = '';
- if ($ini) {
- $this->connection = @call_user_func_array($connect_function,
- $params);
- } else {
- ini_set('track_errors', 1);
- $this->connection = @call_user_func_array($connect_function,
- $params);
- ini_set('track_errors', $ini);
- }
-
- if (!$this->connection) {
- return $this->raiseError(DB_ERROR_CONNECT_FAILED,
- null, null, null,
- $php_errormsg);
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Disconnects from the database server
- *
- * @return bool TRUE on success, FALSE on failure
- */
- function disconnect()
- {
- $ret = @pg_close($this->connection);
- $this->connection = null;
- return $ret;
- }
-
- // }}}
- // {{{ simpleQuery()
-
- /**
- * Sends a query to the database server
- *
- * @param string the SQL query string
- *
- * @return mixed + a PHP result resrouce for successful SELECT queries
- * + the DB_OK constant for other successful queries
- * + a DB_Error object on failure
- */
- function simpleQuery($query)
- {
- $ismanip = DB::isManip($query);
- $this->last_query = $query;
- $query = $this->modifyQuery($query);
- if (!$this->autocommit && $ismanip) {
- if ($this->transaction_opcount == 0) {
- $result = @pg_exec($this->connection, 'begin;');
- if (!$result) {
- return $this->pgsqlRaiseError();
- }
- }
- $this->transaction_opcount++;
- }
- $result = @pg_exec($this->connection, $query);
- if (!$result) {
- return $this->pgsqlRaiseError();
- }
- // Determine which queries that should return data, and which
- // should return an error code only.
- if ($ismanip) {
- $this->affected = @pg_affected_rows($result);
- return DB_OK;
- } elseif (preg_match('/^\s*\(*\s*(SELECT|EXPLAIN|SHOW)\s/si', $query)) {
- /* PostgreSQL commands:
- ABORT, ALTER, BEGIN, CLOSE, CLUSTER, COMMIT, COPY,
- CREATE, DECLARE, DELETE, DROP TABLE, EXPLAIN, FETCH,
- GRANT, INSERT, LISTEN, LOAD, LOCK, MOVE, NOTIFY, RESET,
- REVOKE, ROLLBACK, SELECT, SELECT INTO, SET, SHOW,
- UNLISTEN, UPDATE, VACUUM
- */
- $this->row[(int)$result] = 0; // reset the row counter.
- $numrows = $this->numRows($result);
- if (is_object($numrows)) {
- return $numrows;
- }
- $this->_num_rows[(int)$result] = $numrows;
- $this->affected = 0;
- return $result;
- } else {
- $this->affected = 0;
- return DB_OK;
- }
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal pgsql result pointer to the next available result
- *
- * @param a valid fbsql result resource
- *
- * @access public
- *
- * @return true if a result is available otherwise return false
- */
- function nextResult($result)
- {
- return false;
- }
-
- // }}}
- // {{{ fetchInto()
-
- /**
- * Places a row from the result set into the given array
- *
- * Formating of the array and the data therein are configurable.
- * See DB_result::fetchInto() for more information.
- *
- * This method is not meant to be called directly. Use
- * DB_result::fetchInto() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result the query result resource
- * @param array $arr the referenced array to put the data in
- * @param int $fetchmode how the resulting array should be indexed
- * @param int $rownum the row number to fetch (0 = first row)
- *
- * @return mixed DB_OK on success, NULL when the end of a result set is
- * reached or on failure
- *
- * @see DB_result::fetchInto()
- */
- function fetchInto($result, &$arr, $fetchmode, $rownum = null)
- {
- $result_int = (int)$result;
- $rownum = ($rownum !== null) ? $rownum : $this->row[$result_int];
- if ($rownum >= $this->_num_rows[$result_int]) {
- return null;
- }
- if ($fetchmode & DB_FETCHMODE_ASSOC) {
- $arr = @pg_fetch_array($result, $rownum, PGSQL_ASSOC);
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
- $arr = array_change_key_case($arr, CASE_LOWER);
- }
- } else {
- $arr = @pg_fetch_row($result, $rownum);
- }
- if (!$arr) {
- return null;
- }
- if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
- $this->_rtrimArrayValues($arr);
- }
- if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
- $this->_convertNullArrayValuesToEmpty($arr);
- }
- $this->row[$result_int] = ++$rownum;
- return DB_OK;
- }
-
- // }}}
- // {{{ freeResult()
-
- /**
- * Deletes the result set and frees the memory occupied by the result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::free() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return bool TRUE on success, FALSE if $result is invalid
- *
- * @see DB_result::free()
- */
- function freeResult($result)
- {
- if (is_resource($result)) {
- unset($this->row[(int)$result]);
- unset($this->_num_rows[(int)$result]);
- $this->affected = 0;
- return @pg_freeresult($result);
- }
- return false;
- }
-
- // }}}
- // {{{ quote()
-
- /**
- * @deprecated Deprecated in release 1.6.0
- * @internal
- */
- function quote($str)
- {
- return $this->quoteSmart($str);
- }
-
- // }}}
- // {{{ quoteSmart()
-
- /**
- * Formats input so it can be safely used in a query
- *
- * @param mixed $in the data to be formatted
- *
- * @return mixed the formatted data. The format depends on the input's
- * PHP type:
- * + null = the string NULL
- * + boolean = string TRUE or FALSE
- * + integer or double = the unquoted number
- * + other (including strings and numeric strings) =
- * the data escaped according to MySQL's settings
- * then encapsulated between single quotes
- *
- * @see DB_common::quoteSmart()
- * @since Method available since Release 1.6.0
- */
- function quoteSmart($in)
- {
- if (is_int($in) || is_double($in)) {
- return $in;
- } elseif (is_bool($in)) {
- return $in ? 'TRUE' : 'FALSE';
- } elseif (is_null($in)) {
- return 'NULL';
- } else {
- return "'" . $this->escapeSimple($in) . "'";
- }
- }
-
- // }}}
- // {{{ escapeSimple()
-
- /**
- * Escapes a string according to the current DBMS's standards
- *
- * {@internal PostgreSQL treats a backslash as an escape character,
- * so they are escaped as well.
- *
- * Not using pg_escape_string() yet because it requires PostgreSQL
- * to be at version 7.2 or greater.}}
- *
- * @param string $str the string to be escaped
- *
- * @return string the escaped string
- *
- * @see DB_common::quoteSmart()
- * @since Method available since Release 1.6.0
- */
- function escapeSimple($str)
- {
- return str_replace("'", "''", str_replace('\\', '\\\\', $str));
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Gets the number of columns in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numCols() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of columns. A DB_Error object on failure.
- *
- * @see DB_result::numCols()
- */
- function numCols($result)
- {
- $cols = @pg_numfields($result);
- if (!$cols) {
- return $this->pgsqlRaiseError();
- }
- return $cols;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Gets the number of rows in a result set
- *
- * This method is not meant to be called directly. Use
- * DB_result::numRows() instead. It can't be declared "protected"
- * because DB_result is a separate object.
- *
- * @param resource $result PHP's query result resource
- *
- * @return int the number of rows. A DB_Error object on failure.
- *
- * @see DB_result::numRows()
- */
- function numRows($result)
- {
- $rows = @pg_numrows($result);
- if ($rows === null) {
- return $this->pgsqlRaiseError();
- }
- return $rows;
- }
-
- // }}}
- // {{{ autoCommit()
-
- /**
- * Enables or disables automatic commits
- *
- * @param bool $onoff true turns it on, false turns it off
- *
- * @return int DB_OK on success. A DB_Error object if the driver
- * doesn't support auto-committing transactions.
- */
- function autoCommit($onoff = false)
- {
- // XXX if $this->transaction_opcount > 0, we should probably
- // issue a warning here.
- $this->autocommit = $onoff ? true : false;
- return DB_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commits the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function commit()
- {
- if ($this->transaction_opcount > 0) {
- // (disabled) hack to shut up error messages from libpq.a
- //@fclose(@fopen("php://stderr", "w"));
- $result = @pg_exec($this->connection, 'end;');
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->pgsqlRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Reverts the current transaction
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- */
- function rollback()
- {
- if ($this->transaction_opcount > 0) {
- $result = @pg_exec($this->connection, 'abort;');
- $this->transaction_opcount = 0;
- if (!$result) {
- return $this->pgsqlRaiseError();
- }
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ affectedRows()
-
- /**
- * Determines the number of rows affected by a data maniuplation query
- *
- * 0 is returned for queries that don't manipulate data.
- *
- * @return int the number of rows. A DB_Error object on failure.
- */
- function affectedRows()
- {
- return $this->affected;
- }
-
- // }}}
- // {{{ nextId()
-
- /**
- * Returns the next free id in a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true, the seqence is automatically
- * created if it does not exist
- *
- * @return int the next id number in the sequence.
- * A DB_Error object on failure.
- *
- * @see DB_common::nextID(), DB_common::getSequenceName(),
- * DB_pgsql::createSequence(), DB_pgsql::dropSequence()
- */
- function nextId($seq_name, $ondemand = true)
- {
- $seqname = $this->getSequenceName($seq_name);
- $repeat = false;
- do {
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result =& $this->query("SELECT NEXTVAL('${seqname}')");
- $this->popErrorHandling();
- if ($ondemand && DB::isError($result) &&
- $result->getCode() == DB_ERROR_NOSUCHTABLE) {
- $repeat = true;
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $result = $this->createSequence($seq_name);
- $this->popErrorHandling();
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- } else {
- $repeat = false;
- }
- } while ($repeat);
- if (DB::isError($result)) {
- return $this->raiseError($result);
- }
- $arr = $result->fetchRow(DB_FETCHMODE_ORDERED);
- $result->free();
- return $arr[0];
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * Creates a new sequence
- *
- * @param string $seq_name name of the new sequence
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::createSequence(), DB_common::getSequenceName(),
- * DB_pgsql::nextID(), DB_pgsql::dropSequence()
- */
- function createSequence($seq_name)
- {
- $seqname = $this->getSequenceName($seq_name);
- $result = $this->query("CREATE SEQUENCE ${seqname}");
- return $result;
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * Deletes a sequence
- *
- * @param string $seq_name name of the sequence to be deleted
- *
- * @return int DB_OK on success. A DB_Error object on failure.
- *
- * @see DB_common::dropSequence(), DB_common::getSequenceName(),
- * DB_pgsql::nextID(), DB_pgsql::createSequence()
- */
- function dropSequence($seq_name)
- {
- return $this->query('DROP SEQUENCE '
- . $this->getSequenceName($seq_name));
- }
-
- // }}}
- // {{{ modifyLimitQuery()
-
- /**
- * Adds LIMIT clauses to a query string according to current DBMS standards
- *
- * @param string $query the query to modify
- * @param int $from the row to start to fetching (0 = the first row)
- * @param int $count the numbers of rows to fetch
- * @param mixed $params array, string or numeric data to be used in
- * execution of the statement. Quantity of items
- * passed must match quantity of placeholders in
- * query: meaning 1 placeholder for non-array
- * parameters or 1 placeholder per array element.
- *
- * @return string the query string with LIMIT clauses added
- *
- * @access protected
- */
- function modifyLimitQuery($query, $from, $count, $params = array())
- {
- return "$query LIMIT $count OFFSET $from";
- }
-
- // }}}
- // {{{ pgsqlRaiseError()
-
- /**
- * Produces a DB_Error object regarding the current problem
- *
- * @param int $errno if the error is being manually raised pass a
- * DB_ERROR* constant here. If this isn't passed
- * the error information gathered from the DBMS.
- *
- * @return object the DB_Error object
- *
- * @see DB_common::raiseError(),
- * DB_pgsql::errorNative(), DB_pgsql::errorCode()
- */
- function pgsqlRaiseError($errno = null)
- {
- $native = $this->errorNative();
- if ($errno === null) {
- $errno = $this->errorCode($native);
- }
- return $this->raiseError($errno, null, null, null, $native);
- }
-
- // }}}
- // {{{ errorNative()
-
- /**
- * Gets the DBMS' native error message produced by the last query
- *
- * {@internal Error messages are used instead of error codes
- * in order to support older versions of PostgreSQL.}}
- *
- * @return string the DBMS' error message
- */
- function errorNative()
- {
- return @pg_errormessage($this->connection);
- }
-
- // }}}
- // {{{ errorCode()
-
- /**
- * Determines PEAR::DB error code from the database's text error message.
- *
- * @param string $errormsg error message returned from the database
- * @return integer an error number from a DB error constant
- */
- function errorCode($errormsg)
- {
- static $error_regexps;
- if (!isset($error_regexps)) {
- $error_regexps = array(
- '/(relation|sequence|table).*does not exist|class .* not found/i'
- => DB_ERROR_NOSUCHTABLE,
- '/index .* does not exist/'
- => DB_ERROR_NOT_FOUND,
- '/column .* does not exist/i'
- => DB_ERROR_NOSUCHFIELD,
- '/relation .* already exists/i'
- => DB_ERROR_ALREADY_EXISTS,
- '/(divide|division) by zero$/i'
- => DB_ERROR_DIVZERO,
- '/pg_atoi: error in .*: can\'t parse /i'
- => DB_ERROR_INVALID_NUMBER,
- '/invalid input syntax for( type)? (integer|numeric)/i'
- => DB_ERROR_INVALID_NUMBER,
- '/value .* is out of range for type \w*int/i'
- => DB_ERROR_INVALID_NUMBER,
- '/integer out of range/i'
- => DB_ERROR_INVALID_NUMBER,
- '/value too long for type character/i'
- => DB_ERROR_INVALID,
- '/attribute .* not found|relation .* does not have attribute/i'
- => DB_ERROR_NOSUCHFIELD,
- '/column .* specified in USING clause does not exist in (left|right) table/i'
- => DB_ERROR_NOSUCHFIELD,
- '/parser: parse error at or near/i'
- => DB_ERROR_SYNTAX,
- '/syntax error at/'
- => DB_ERROR_SYNTAX,
- '/column reference .* is ambiguous/i'
- => DB_ERROR_SYNTAX,
- '/permission denied/'
- => DB_ERROR_ACCESS_VIOLATION,
- '/violates not-null constraint/'
- => DB_ERROR_CONSTRAINT_NOT_NULL,
- '/violates [\w ]+ constraint/'
- => DB_ERROR_CONSTRAINT,
- '/referential integrity violation/'
- => DB_ERROR_CONSTRAINT,
- '/more expressions than target columns/i'
- => DB_ERROR_VALUE_COUNT_ON_ROW,
- );
- }
- foreach ($error_regexps as $regexp => $code) {
- if (preg_match($regexp, $errormsg)) {
- return $code;
- }
- }
- // Fall back to DB_ERROR if there was no mapping.
- return DB_ERROR;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * NOTE: only supports 'table' and 'flags' if $result
- * is a table name.
- *
- * @param object|string $result DB_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A DB_Error object on failure.
- *
- * @see DB_common::tableInfo()
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- /*
- * Probably received a table name.
- * Create a result resource identifier.
- */
- $id = @pg_exec($this->connection, "SELECT * FROM $result LIMIT 0");
- $got_string = true;
- } elseif (isset($result->result)) {
- /*
- * Probably received a result object.
- * Extract the result resource identifier.
- */
- $id = $result->result;
- $got_string = false;
- } else {
- /*
- * Probably received a result resource identifier.
- * Copy it.
- * Deprecated. Here for compatibility only.
- */
- $id = $result;
- $got_string = false;
- }
-
- if (!is_resource($id)) {
- return $this->pgsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
- }
-
- if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strval';
- }
-
- $count = @pg_numfields($id);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- for ($i = 0; $i < $count; $i++) {
- $res[$i] = array(
- 'table' => $got_string ? $case_func($result) : '',
- 'name' => $case_func(@pg_fieldname($id, $i)),
- 'type' => @pg_fieldtype($id, $i),
- 'len' => @pg_fieldsize($id, $i),
- 'flags' => $got_string
- ? $this->_pgFieldFlags($id, $i, $result)
- : '',
- );
- if ($mode & DB_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & DB_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- // free the result only if we were called on a table
- if ($got_string) {
- @pg_freeresult($id);
- }
- return $res;
- }
-
- // }}}
- // {{{ _pgFieldFlags()
-
- /**
- * Get a column's flags
- *
- * Supports "not_null", "default_value", "primary_key", "unique_key"
- * and "multiple_key". The default value is passed through
- * rawurlencode() in case there are spaces in it.
- *
- * @param int $resource the PostgreSQL result identifier
- * @param int $num_field the field number
- *
- * @return string the flags
- *
- * @access private
- */
- function _pgFieldFlags($resource, $num_field, $table_name)
- {
- $field_name = @pg_fieldname($resource, $num_field);
-
- $result = @pg_exec($this->connection, "SELECT f.attnotnull, f.atthasdef
- FROM pg_attribute f, pg_class tab, pg_type typ
- WHERE tab.relname = typ.typname
- AND typ.typrelid = f.attrelid
- AND f.attname = '$field_name'
- AND tab.relname = '$table_name'");
- if (@pg_numrows($result) > 0) {
- $row = @pg_fetch_row($result, 0);
- $flags = ($row[0] == 't') ? 'not_null ' : '';
-
- if ($row[1] == 't') {
- $result = @pg_exec($this->connection, "SELECT a.adsrc
- FROM pg_attribute f, pg_class tab, pg_type typ, pg_attrdef a
- WHERE tab.relname = typ.typname AND typ.typrelid = f.attrelid
- AND f.attrelid = a.adrelid AND f.attname = '$field_name'
- AND tab.relname = '$table_name' AND f.attnum = a.adnum");
- $row = @pg_fetch_row($result, 0);
- $num = preg_replace("/'(.*)'::\w+/", "\\1", $row[0]);
- $flags .= 'default_' . rawurlencode($num) . ' ';
- }
- } else {
- $flags = '';
- }
- $result = @pg_exec($this->connection, "SELECT i.indisunique, i.indisprimary, i.indkey
- FROM pg_attribute f, pg_class tab, pg_type typ, pg_index i
- WHERE tab.relname = typ.typname
- AND typ.typrelid = f.attrelid
- AND f.attrelid = i.indrelid
- AND f.attname = '$field_name'
- AND tab.relname = '$table_name'");
- $count = @pg_numrows($result);
-
- for ($i = 0; $i < $count ; $i++) {
- $row = @pg_fetch_row($result, $i);
- $keys = explode(' ', $row[2]);
-
- if (in_array($num_field + 1, $keys)) {
- $flags .= ($row[0] == 't' && $row[1] == 'f') ? 'unique_key ' : '';
- $flags .= ($row[1] == 't') ? 'primary_key ' : '';
- if (count($keys) > 1)
- $flags .= 'multiple_key ';
- }
- }
-
- return trim($flags);
- }
-
- // }}}
- // {{{ getSpecialQuery()
-
- /**
- * Obtains the query string needed for listing a given type of objects
- *
- * @param string $type the kind of objects you want to retrieve
- *
- * @return string the SQL query string or null if the driver doesn't
- * support the object type requested
- *
- * @access protected
- * @see DB_common::getListOf()
- */
- function getSpecialQuery($type)
- {
- switch ($type) {
- case 'tables':
- return 'SELECT c.relname AS "Name"'
- . ' FROM pg_class c, pg_user u'
- . ' WHERE c.relowner = u.usesysid'
- . " AND c.relkind = 'r'"
- . ' AND NOT EXISTS'
- . ' (SELECT 1 FROM pg_views'
- . ' WHERE viewname = c.relname)'
- . " AND c.relname !~ '^(pg_|sql_)'"
- . ' UNION'
- . ' SELECT c.relname AS "Name"'
- . ' FROM pg_class c'
- . " WHERE c.relkind = 'r'"
- . ' AND NOT EXISTS'
- . ' (SELECT 1 FROM pg_views'
- . ' WHERE viewname = c.relname)'
- . ' AND NOT EXISTS'
- . ' (SELECT 1 FROM pg_user'
- . ' WHERE usesysid = c.relowner)'
- . " AND c.relname !~ '^pg_'";
- case 'schema.tables':
- return "SELECT schemaname || '.' || tablename"
- . ' AS "Name"'
- . ' FROM pg_catalog.pg_tables'
- . ' WHERE schemaname NOT IN'
- . " ('pg_catalog', 'information_schema', 'pg_toast')";
- case 'views':
- // Table cols: viewname | viewowner | definition
- return 'SELECT viewname from pg_views WHERE schemaname'
- . " NOT IN ('information_schema', 'pg_catalog')";
- case 'users':
- // cols: usename |usesysid|usecreatedb|usetrace|usesuper|usecatupd|passwd |valuntil
- return 'SELECT usename FROM pg_user';
- case 'databases':
- return 'SELECT datname FROM pg_database';
- case 'functions':
- case 'procedures':
- return 'SELECT proname FROM pg_proc WHERE proowner <> 1';
- default:
- return null;
- }
- }
-
- // }}}
-
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/phpFlickr/PEAR/DB/storage.php b/lib/phpFlickr/PEAR/DB/storage.php
deleted file mode 100644
index f597b36d7..000000000
--- a/lib/phpFlickr/PEAR/DB/storage.php
+++ /dev/null
@@ -1,504 +0,0 @@
-
- * @copyright 1997-2005 The PHP Group
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: storage.php 32 2005-08-01 06:21:02Z dancoulter $
- * @link http://pear.php.net/package/DB
- */
-
-/**
- * Obtain the DB class so it can be extended from
- */
-require_once 'DB.php';
-
-/**
- * Provides an object interface to a table row
- *
- * It lets you add, delete and change rows using objects rather than SQL
- * statements.
- *
- * @category Database
- * @package DB
- * @author Stig Bakken
\n";
- }
- }
-
- // }}}
- // {{{ &create()
-
- /**
- * Static method used to create new DB storage objects.
- * @param $data assoc. array where the keys are the names
- * of properties/columns
- * @return object a new instance of DB_storage or a subclass of it
- */
- function &create($table, &$data)
- {
- $classname = strtolower(get_class($this));
- $obj =& new $classname($table);
- foreach ($data as $name => $value) {
- $obj->_properties[$name] = true;
- $obj->$name = &$value;
- }
- return $obj;
- }
-
- // }}}
- // {{{ loadFromQuery()
-
- /**
- * Loads data into this object from the given query. If this
- * object already contains table data, changes will be saved and
- * the object re-initialized first.
- *
- * @param $query SQL query
- *
- * @param $params parameter list in case you want to use
- * prepare/execute mode
- *
- * @return int DB_OK on success, DB_WARNING_READ_ONLY if the
- * returned object is read-only (because the object's specified
- * key column was not found among the columns returned by $query),
- * or another DB error code in case of errors.
- */
-// XXX commented out for now
-/*
- function loadFromQuery($query, $params = null)
- {
- if (sizeof($this->_properties)) {
- if (sizeof($this->_changes)) {
- $this->store();
- $this->_changes = array();
- }
- $this->_properties = array();
- }
- $rowdata = $this->_dbh->getRow($query, DB_FETCHMODE_ASSOC, $params);
- if (DB::isError($rowdata)) {
- return $rowdata;
- }
- reset($rowdata);
- $found_keycolumn = false;
- while (list($key, $value) = each($rowdata)) {
- if ($key == $this->_keycolumn) {
- $found_keycolumn = true;
- }
- $this->_properties[$key] = true;
- $this->$key = &$value;
- unset($value); // have to unset, or all properties will
- // refer to the same value
- }
- if (!$found_keycolumn) {
- $this->_readonly = true;
- return DB_WARNING_READ_ONLY;
- }
- return DB_OK;
- }
- */
-
- // }}}
- // {{{ set()
-
- /**
- * Modify an attriute value.
- */
- function set($property, $newvalue)
- {
- // only change if $property is known and object is not
- // read-only
- if ($this->_readonly) {
- return $this->raiseError(null, DB_WARNING_READ_ONLY, null,
- null, null, null, true);
- }
- if (@isset($this->_properties[$property])) {
- if (empty($this->_validator)) {
- $valid = true;
- } else {
- $valid = @call_user_func($this->_validator,
- $this->_table,
- $property,
- $newvalue,
- $this->$property,
- $this);
- }
- if ($valid) {
- $this->$property = $newvalue;
- if (empty($this->_changes[$property])) {
- $this->_changes[$property] = 0;
- } else {
- $this->_changes[$property]++;
- }
- } else {
- return $this->raiseError(null, DB_ERROR_INVALID, null,
- null, "invalid field: $property",
- null, true);
- }
- return true;
- }
- return $this->raiseError(null, DB_ERROR_NOSUCHFIELD, null,
- null, "unknown field: $property",
- null, true);
- }
-
- // }}}
- // {{{ &get()
-
- /**
- * Fetch an attribute value.
- *
- * @param string attribute name
- *
- * @return attribute contents, or null if the attribute name is
- * unknown
- */
- function &get($property)
- {
- // only return if $property is known
- if (isset($this->_properties[$property])) {
- return $this->$property;
- }
- $tmp = null;
- return $tmp;
- }
-
- // }}}
- // {{{ _DB_storage()
-
- /**
- * Destructor, calls DB_storage::store() if there are changes
- * that are to be kept.
- */
- function _DB_storage()
- {
- if (sizeof($this->_changes)) {
- $this->store();
- }
- $this->_properties = array();
- $this->_changes = array();
- $this->_table = null;
- }
-
- // }}}
- // {{{ store()
-
- /**
- * Stores changes to this object in the database.
- *
- * @return DB_OK or a DB error
- */
- function store()
- {
- foreach ($this->_changes as $name => $foo) {
- $params[] = &$this->$name;
- $vars[] = $name . ' = ?';
- }
- if ($vars) {
- $query = 'UPDATE ' . $this->_table . ' SET ' .
- implode(', ', $vars) . ' WHERE ' .
- $this->_makeWhere();
- $stmt = $this->_dbh->prepare($query);
- $res = $this->_dbh->execute($stmt, $params);
- if (DB::isError($res)) {
- return $res;
- }
- $this->_changes = array();
- }
- return DB_OK;
- }
-
- // }}}
- // {{{ remove()
-
- /**
- * Remove the row represented by this object from the database.
- *
- * @return mixed DB_OK or a DB error
- */
- function remove()
- {
- if ($this->_readonly) {
- return $this->raiseError(null, DB_WARNING_READ_ONLY, null,
- null, null, null, true);
- }
- $query = 'DELETE FROM ' . $this->_table .' WHERE '.
- $this->_makeWhere();
- $res = $this->_dbh->query($query);
- if (DB::isError($res)) {
- return $res;
- }
- foreach ($this->_properties as $prop => $foo) {
- unset($this->$prop);
- }
- $this->_properties = array();
- $this->_changes = array();
- return DB_OK;
- }
-
- // }}}
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-?>
diff --git a/lib/phpFlickr/PEAR/HTTP/Request.php b/lib/phpFlickr/PEAR/HTTP/Request.php
deleted file mode 100644
index 55e227b3a..000000000
--- a/lib/phpFlickr/PEAR/HTTP/Request.php
+++ /dev/null
@@ -1,1484 +0,0 @@
-
- * @author Alexey Borzov
- * $a = &new HTTP_Request('http://www.yahoo.com/');
- * $a->sendRequest();
- * echo $a->getResponseBody();
- *
- *
- * @category HTTP
- * @package HTTP_Request
- * @author Richard Heyes
- *
- * @access public
- */
- function HTTP_Request($url = '', $params = array())
- {
- $this->_method = HTTP_REQUEST_METHOD_GET;
- $this->_http = HTTP_REQUEST_HTTP_VER_1_1;
- $this->_requestHeaders = array();
- $this->_postData = array();
- $this->_body = null;
-
- $this->_user = null;
- $this->_pass = null;
-
- $this->_proxy_host = null;
- $this->_proxy_port = null;
- $this->_proxy_user = null;
- $this->_proxy_pass = null;
-
- $this->_allowRedirects = false;
- $this->_maxRedirects = 3;
- $this->_redirects = 0;
-
- $this->_timeout = null;
- $this->_response = null;
-
- foreach ($params as $key => $value) {
- $this->{'_' . $key} = $value;
- }
-
- if (!empty($url)) {
- $this->setURL($url);
- }
-
- // Default useragent
- $this->addHeader('User-Agent', 'PEAR HTTP_Request class ( http://pear.php.net/ )');
-
- // We don't do keep-alives by default
- $this->addHeader('Connection', 'close');
-
- // Basic authentication
- if (!empty($this->_user)) {
- $this->addHeader('Authorization', 'Basic ' . base64_encode($this->_user . ':' . $this->_pass));
- }
-
- // Proxy authentication (see bug #5913)
- if (!empty($this->_proxy_user)) {
- $this->addHeader('Proxy-Authorization', 'Basic ' . base64_encode($this->_proxy_user . ':' . $this->_proxy_pass));
- }
-
- // Use gzip encoding if possible
- if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && extension_loaded('zlib')) {
- $this->addHeader('Accept-Encoding', 'gzip');
- }
- }
-
- /**
- * Generates a Host header for HTTP/1.1 requests
- *
- * @access private
- * @return string
- */
- function _generateHostHeader()
- {
- if ($this->_url->port != 80 AND strcasecmp($this->_url->protocol, 'http') == 0) {
- $host = $this->_url->host . ':' . $this->_url->port;
-
- } elseif ($this->_url->port != 443 AND strcasecmp($this->_url->protocol, 'https') == 0) {
- $host = $this->_url->host . ':' . $this->_url->port;
-
- } elseif ($this->_url->port == 443 AND strcasecmp($this->_url->protocol, 'https') == 0 AND strpos($this->_url->url, ':443') !== false) {
- $host = $this->_url->host . ':' . $this->_url->port;
-
- } else {
- $host = $this->_url->host;
- }
-
- return $host;
- }
-
- /**
- * Resets the object to its initial state (DEPRECATED).
- * Takes the same parameters as the constructor.
- *
- * @param string $url The url to be requested
- * @param array $params Associative array of parameters
- * (see constructor for details)
- * @access public
- * @deprecated deprecated since 1.2, call the constructor if this is necessary
- */
- function reset($url, $params = array())
- {
- $this->HTTP_Request($url, $params);
- }
-
- /**
- * Sets the URL to be requested
- *
- * @param string The url to be requested
- * @access public
- */
- function setURL($url)
- {
- $this->_url = &new Net_URL($url, $this->_useBrackets);
-
- if (!empty($this->_url->user) || !empty($this->_url->pass)) {
- $this->setBasicAuth($this->_url->user, $this->_url->pass);
- }
-
- if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http) {
- $this->addHeader('Host', $this->_generateHostHeader());
- }
-
- // set '/' instead of empty path rather than check later (see bug #8662)
- if (empty($this->_url->path)) {
- $this->_url->path = '/';
- }
- }
-
- /**
- * Returns the current request URL
- *
- * @return string Current request URL
- * @access public
- */
- function getUrl()
- {
- return empty($this->_url)? '': $this->_url->getUrl();
- }
-
- /**
- * Sets a proxy to be used
- *
- * @param string Proxy host
- * @param int Proxy port
- * @param string Proxy username
- * @param string Proxy password
- * @access public
- */
- function setProxy($host, $port = 8080, $user = null, $pass = null)
- {
- $this->_proxy_host = $host;
- $this->_proxy_port = $port;
- $this->_proxy_user = $user;
- $this->_proxy_pass = $pass;
-
- if (!empty($user)) {
- $this->addHeader('Proxy-Authorization', 'Basic ' . base64_encode($user . ':' . $pass));
- }
- }
-
- /**
- * Sets basic authentication parameters
- *
- * @param string Username
- * @param string Password
- */
- function setBasicAuth($user, $pass)
- {
- $this->_user = $user;
- $this->_pass = $pass;
-
- $this->addHeader('Authorization', 'Basic ' . base64_encode($user . ':' . $pass));
- }
-
- /**
- * Sets the method to be used, GET, POST etc.
- *
- * @param string Method to use. Use the defined constants for this
- * @access public
- */
- function setMethod($method)
- {
- $this->_method = $method;
- }
-
- /**
- * Sets the HTTP version to use, 1.0 or 1.1
- *
- * @param string Version to use. Use the defined constants for this
- * @access public
- */
- function setHttpVer($http)
- {
- $this->_http = $http;
- }
-
- /**
- * Adds a request header
- *
- * @param string Header name
- * @param string Header value
- * @access public
- */
- function addHeader($name, $value)
- {
- $this->_requestHeaders[strtolower($name)] = $value;
- }
-
- /**
- * Removes a request header
- *
- * @param string Header name to remove
- * @access public
- */
- function removeHeader($name)
- {
- if (isset($this->_requestHeaders[strtolower($name)])) {
- unset($this->_requestHeaders[strtolower($name)]);
- }
- }
-
- /**
- * Adds a querystring parameter
- *
- * @param string Querystring parameter name
- * @param string Querystring parameter value
- * @param bool Whether the value is already urlencoded or not, default = not
- * @access public
- */
- function addQueryString($name, $value, $preencoded = false)
- {
- $this->_url->addQueryString($name, $value, $preencoded);
- }
-
- /**
- * Sets the querystring to literally what you supply
- *
- * @param string The querystring data. Should be of the format foo=bar&x=y etc
- * @param bool Whether data is already urlencoded or not, default = already encoded
- * @access public
- */
- function addRawQueryString($querystring, $preencoded = true)
- {
- $this->_url->addRawQueryString($querystring, $preencoded);
- }
-
- /**
- * Adds postdata items
- *
- * @param string Post data name
- * @param string Post data value
- * @param bool Whether data is already urlencoded or not, default = not
- * @access public
- */
- function addPostData($name, $value, $preencoded = false)
- {
- if ($preencoded) {
- $this->_postData[$name] = $value;
- } else {
- $this->_postData[$name] = $this->_arrayMapRecursive('urlencode', $value);
- }
- }
-
- /**
- * Recursively applies the callback function to the value
- *
- * @param mixed Callback function
- * @param mixed Value to process
- * @access private
- * @return mixed Processed value
- */
- function _arrayMapRecursive($callback, $value)
- {
- if (!is_array($value)) {
- return call_user_func($callback, $value);
- } else {
- $map = array();
- foreach ($value as $k => $v) {
- $map[$k] = $this->_arrayMapRecursive($callback, $v);
- }
- return $map;
- }
- }
-
- /**
- * Adds a file to upload
- *
- * This also changes content-type to 'multipart/form-data' for proper upload
- *
- * @access public
- * @param string name of file-upload field
- * @param mixed file name(s)
- * @param mixed content-type(s) of file(s) being uploaded
- * @return bool true on success
- * @throws PEAR_Error
- */
- function addFile($inputName, $fileName, $contentType = 'application/octet-stream')
- {
- if (!is_array($fileName) && !is_readable($fileName)) {
- return PEAR::raiseError("File '{$fileName}' is not readable", HTTP_REQUEST_ERROR_FILE);
- } elseif (is_array($fileName)) {
- foreach ($fileName as $name) {
- if (!is_readable($name)) {
- return PEAR::raiseError("File '{$name}' is not readable", HTTP_REQUEST_ERROR_FILE);
- }
- }
- }
- $this->addHeader('Content-Type', 'multipart/form-data');
- $this->_postFiles[$inputName] = array(
- 'name' => $fileName,
- 'type' => $contentType
- );
- return true;
- }
-
- /**
- * Adds raw postdata (DEPRECATED)
- *
- * @param string The data
- * @param bool Whether data is preencoded or not, default = already encoded
- * @access public
- * @deprecated deprecated since 1.3.0, method setBody() should be used instead
- */
- function addRawPostData($postdata, $preencoded = true)
- {
- $this->_body = $preencoded ? $postdata : urlencode($postdata);
- }
-
- /**
- * Sets the request body (for POST, PUT and similar requests)
- *
- * @param string Request body
- * @access public
- */
- function setBody($body)
- {
- $this->_body = $body;
- }
-
- /**
- * Clears any postdata that has been added (DEPRECATED).
- *
- * Useful for multiple request scenarios.
- *
- * @access public
- * @deprecated deprecated since 1.2
- */
- function clearPostData()
- {
- $this->_postData = null;
- }
-
- /**
- * Appends a cookie to "Cookie:" header
- *
- * @param string $name cookie name
- * @param string $value cookie value
- * @access public
- */
- function addCookie($name, $value)
- {
- $cookies = isset($this->_requestHeaders['cookie']) ? $this->_requestHeaders['cookie']. '; ' : '';
- $this->addHeader('Cookie', $cookies . $name . '=' . $value);
- }
-
- /**
- * Clears any cookies that have been added (DEPRECATED).
- *
- * Useful for multiple request scenarios
- *
- * @access public
- * @deprecated deprecated since 1.2
- */
- function clearCookies()
- {
- $this->removeHeader('Cookie');
- }
-
- /**
- * Sends the request
- *
- * @access public
- * @param bool Whether to store response body in Response object property,
- * set this to false if downloading a LARGE file and using a Listener
- * @return mixed PEAR error on error, true otherwise
- */
- function sendRequest($saveBody = true)
- {
- if (!is_a($this->_url, 'Net_URL')) {
- return PEAR::raiseError('No URL given', HTTP_REQUEST_ERROR_URL);
- }
-
- $host = isset($this->_proxy_host) ? $this->_proxy_host : $this->_url->host;
- $port = isset($this->_proxy_port) ? $this->_proxy_port : $this->_url->port;
-
- // 4.3.0 supports SSL connections using OpenSSL. The function test determines
- // we running on at least 4.3.0
- if (strcasecmp($this->_url->protocol, 'https') == 0 AND function_exists('file_get_contents') AND extension_loaded('openssl')) {
- if (isset($this->_proxy_host)) {
- return PEAR::raiseError('HTTPS proxies are not supported', HTTP_REQUEST_ERROR_PROXY);
- }
- $host = 'ssl://' . $host;
- }
-
- // magic quotes may fuck up file uploads and chunked response processing
- $magicQuotes = ini_get('magic_quotes_runtime');
- ini_set('magic_quotes_runtime', false);
-
- // RFC 2068, section 19.7.1: A client MUST NOT send the Keep-Alive
- // connection token to a proxy server...
- if (isset($this->_proxy_host) && !empty($this->_requestHeaders['connection']) &&
- 'Keep-Alive' == $this->_requestHeaders['connection'])
- {
- $this->removeHeader('connection');
- }
-
- $keepAlive = (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && empty($this->_requestHeaders['connection'])) ||
- (!empty($this->_requestHeaders['connection']) && 'Keep-Alive' == $this->_requestHeaders['connection']);
- $sockets = &PEAR::getStaticProperty('HTTP_Request', 'sockets');
- $sockKey = $host . ':' . $port;
- unset($this->_sock);
-
- // There is a connected socket in the "static" property?
- if ($keepAlive && !empty($sockets[$sockKey]) &&
- !empty($sockets[$sockKey]->fp))
- {
- $this->_sock =& $sockets[$sockKey];
- $err = null;
- } else {
- $this->_notify('connect');
- $this->_sock =& new Net_Socket();
- $err = $this->_sock->connect($host, $port, null, $this->_timeout, $this->_socketOptions);
- }
- PEAR::isError($err) or $err = $this->_sock->write($this->_buildRequest());
-
- if (!PEAR::isError($err)) {
- if (!empty($this->_readTimeout)) {
- $this->_sock->setTimeout($this->_readTimeout[0], $this->_readTimeout[1]);
- }
-
- $this->_notify('sentRequest');
-
- // Read the response
- $this->_response = &new HTTP_Response($this->_sock, $this->_listeners);
- $err = $this->_response->process(
- $this->_saveBody && $saveBody,
- HTTP_REQUEST_METHOD_HEAD != $this->_method
- );
-
- if ($keepAlive) {
- $keepAlive = (isset($this->_response->_headers['content-length'])
- || (isset($this->_response->_headers['transfer-encoding'])
- && strtolower($this->_response->_headers['transfer-encoding']) == 'chunked'));
- if ($keepAlive) {
- if (isset($this->_response->_headers['connection'])) {
- $keepAlive = strtolower($this->_response->_headers['connection']) == 'keep-alive';
- } else {
- $keepAlive = 'HTTP/'.HTTP_REQUEST_HTTP_VER_1_1 == $this->_response->_protocol;
- }
- }
- }
- }
-
- ini_set('magic_quotes_runtime', $magicQuotes);
-
- if (PEAR::isError($err)) {
- return $err;
- }
-
- if (!$keepAlive) {
- $this->disconnect();
- // Store the connected socket in "static" property
- } elseif (empty($sockets[$sockKey]) || empty($sockets[$sockKey]->fp)) {
- $sockets[$sockKey] =& $this->_sock;
- }
-
- // Check for redirection
- if ( $this->_allowRedirects
- AND $this->_redirects <= $this->_maxRedirects
- AND $this->getResponseCode() > 300
- AND $this->getResponseCode() < 399
- AND !empty($this->_response->_headers['location'])) {
-
-
- $redirect = $this->_response->_headers['location'];
-
- // Absolute URL
- if (preg_match('/^https?:\/\//i', $redirect)) {
- $this->_url = &new Net_URL($redirect);
- $this->addHeader('Host', $this->_generateHostHeader());
- // Absolute path
- } elseif ($redirect{0} == '/') {
- $this->_url->path = $redirect;
-
- // Relative path
- } elseif (substr($redirect, 0, 3) == '../' OR substr($redirect, 0, 2) == './') {
- if (substr($this->_url->path, -1) == '/') {
- $redirect = $this->_url->path . $redirect;
- } else {
- $redirect = dirname($this->_url->path) . '/' . $redirect;
- }
- $redirect = Net_URL::resolvePath($redirect);
- $this->_url->path = $redirect;
-
- // Filename, no path
- } else {
- if (substr($this->_url->path, -1) == '/') {
- $redirect = $this->_url->path . $redirect;
- } else {
- $redirect = dirname($this->_url->path) . '/' . $redirect;
- }
- $this->_url->path = $redirect;
- }
-
- $this->_redirects++;
- return $this->sendRequest($saveBody);
-
- // Too many redirects
- } elseif ($this->_allowRedirects AND $this->_redirects > $this->_maxRedirects) {
- return PEAR::raiseError('Too many redirects', HTTP_REQUEST_ERROR_REDIRECTS);
- }
-
- return true;
- }
-
- /**
- * Disconnect the socket, if connected. Only useful if using Keep-Alive.
- *
- * @access public
- */
- function disconnect()
- {
- if (!empty($this->_sock) && !empty($this->_sock->fp)) {
- $this->_notify('disconnect');
- $this->_sock->disconnect();
- }
- }
-
- /**
- * Returns the response code
- *
- * @access public
- * @return mixed Response code, false if not set
- */
- function getResponseCode()
- {
- return isset($this->_response->_code) ? $this->_response->_code : false;
- }
-
- /**
- * Returns either the named header or all if no name given
- *
- * @access public
- * @param string The header name to return, do not set to get all headers
- * @return mixed either the value of $headername (false if header is not present)
- * or an array of all headers
- */
- function getResponseHeader($headername = null)
- {
- if (!isset($headername)) {
- return isset($this->_response->_headers)? $this->_response->_headers: array();
- } else {
- $headername = strtolower($headername);
- return isset($this->_response->_headers[$headername]) ? $this->_response->_headers[$headername] : false;
- }
- }
-
- /**
- * Returns the body of the response
- *
- * @access public
- * @return mixed response body, false if not set
- */
- function getResponseBody()
- {
- return isset($this->_response->_body) ? $this->_response->_body : false;
- }
-
- /**
- * Returns cookies set in response
- *
- * @access public
- * @return mixed array of response cookies, false if none are present
- */
- function getResponseCookies()
- {
- return isset($this->_response->_cookies) ? $this->_response->_cookies : false;
- }
-
- /**
- * Builds the request string
- *
- * @access private
- * @return string The request string
- */
- function _buildRequest()
- {
- $separator = ini_get('arg_separator.output');
- ini_set('arg_separator.output', '&');
- $querystring = ($querystring = $this->_url->getQueryString()) ? '?' . $querystring : '';
- ini_set('arg_separator.output', $separator);
-
- $host = isset($this->_proxy_host) ? $this->_url->protocol . '://' . $this->_url->host : '';
- $port = (isset($this->_proxy_host) AND $this->_url->port != 80) ? ':' . $this->_url->port : '';
- $path = $this->_url->path . $querystring;
- $url = $host . $port . $path;
-
- if (!strlen($url)) {
- $url = '/';
- }
-
- $request = $this->_method . ' ' . $url . ' HTTP/' . $this->_http . "\r\n";
-
- if (in_array($this->_method, $this->_bodyDisallowed) ||
- (0 == strlen($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method ||
- (empty($this->_postData) && empty($this->_postFiles)))))
- {
- $this->removeHeader('Content-Type');
- } else {
- if (empty($this->_requestHeaders['content-type'])) {
- // Add default content-type
- $this->addHeader('Content-Type', 'application/x-www-form-urlencoded');
- } elseif ('multipart/form-data' == $this->_requestHeaders['content-type']) {
- $boundary = 'HTTP_Request_' . md5(uniqid('request') . microtime());
- $this->addHeader('Content-Type', 'multipart/form-data; boundary=' . $boundary);
- }
- }
-
- // Request Headers
- if (!empty($this->_requestHeaders)) {
- foreach ($this->_requestHeaders as $name => $value) {
- $canonicalName = implode('-', array_map('ucfirst', explode('-', $name)));
- $request .= $canonicalName . ': ' . $value . "\r\n";
- }
- }
-
- // No post data or wrong method, so simply add a final CRLF
- if (in_array($this->_method, $this->_bodyDisallowed) ||
- (HTTP_REQUEST_METHOD_POST != $this->_method && 0 == strlen($this->_body))) {
-
- $request .= "\r\n";
-
- // Post data if it's an array
- } elseif (HTTP_REQUEST_METHOD_POST == $this->_method &&
- (!empty($this->_postData) || !empty($this->_postFiles))) {
-
- // "normal" POST request
- if (!isset($boundary)) {
- $postdata = implode('&', array_map(
- create_function('$a', 'return $a[0] . \'=\' . $a[1];'),
- $this->_flattenArray('', $this->_postData)
- ));
-
- // multipart request, probably with file uploads
- } else {
- $postdata = '';
- if (!empty($this->_postData)) {
- $flatData = $this->_flattenArray('', $this->_postData);
- foreach ($flatData as $item) {
- $postdata .= '--' . $boundary . "\r\n";
- $postdata .= 'Content-Disposition: form-data; name="' . $item[0] . '"';
- $postdata .= "\r\n\r\n" . urldecode($item[1]) . "\r\n";
- }
- }
- foreach ($this->_postFiles as $name => $value) {
- if (is_array($value['name'])) {
- $varname = $name . ($this->_useBrackets? '[]': '');
- } else {
- $varname = $name;
- $value['name'] = array($value['name']);
- }
- foreach ($value['name'] as $key => $filename) {
- $fp = fopen($filename, 'r');
- $data = fread($fp, filesize($filename));
- fclose($fp);
- $basename = basename($filename);
- $type = is_array($value['type'])? @$value['type'][$key]: $value['type'];
-
- $postdata .= '--' . $boundary . "\r\n";
- $postdata .= 'Content-Disposition: form-data; name="' . $varname . '"; filename="' . $basename . '"';
- $postdata .= "\r\nContent-Type: " . $type;
- $postdata .= "\r\n\r\n" . $data . "\r\n";
- }
- }
- $postdata .= '--' . $boundary . "--\r\n";
- }
- $request .= 'Content-Length: ' .
- (HTTP_REQUEST_MBSTRING? mb_strlen($postdata, 'iso-8859-1'): strlen($postdata)) .
- "\r\n\r\n";
- $request .= $postdata;
-
- // Explicitly set request body
- } elseif (0 < strlen($this->_body)) {
-
- $request .= 'Content-Length: ' .
- (HTTP_REQUEST_MBSTRING? mb_strlen($this->_body, 'iso-8859-1'): strlen($this->_body)) .
- "\r\n\r\n";
- $request .= $this->_body;
-
- // Terminate headers with CRLF on POST request with no body, too
- } else {
-
- $request .= "\r\n";
- }
-
- return $request;
- }
-
- /**
- * Helper function to change the (probably multidimensional) associative array
- * into the simple one.
- *
- * @param string name for item
- * @param mixed item's values
- * @return array array with the following items: array('item name', 'item value');
- * @access private
- */
- function _flattenArray($name, $values)
- {
- if (!is_array($values)) {
- return array(array($name, $values));
- } else {
- $ret = array();
- foreach ($values as $k => $v) {
- if (empty($name)) {
- $newName = $k;
- } elseif ($this->_useBrackets) {
- $newName = $name . '[' . $k . ']';
- } else {
- $newName = $name;
- }
- $ret = array_merge($ret, $this->_flattenArray($newName, $v));
- }
- return $ret;
- }
- }
-
-
- /**
- * Adds a Listener to the list of listeners that are notified of
- * the object's events
- *
- * Events sent by HTTP_Request object
- * - 'connect': on connection to server
- * - 'sentRequest': after the request was sent
- * - 'disconnect': on disconnection from server
- *
- * Events sent by HTTP_Response object
- * - 'gotHeaders': after receiving response headers (headers are passed in $data)
- * - 'tick': on receiving a part of response body (the part is passed in $data)
- * - 'gzTick': on receiving a gzip-encoded part of response body (ditto)
- * - 'gotBody': after receiving the response body (passes the decoded body in $data if it was gzipped)
- *
- * @param HTTP_Request_Listener listener to attach
- * @return boolean whether the listener was successfully attached
- * @access public
- */
- function attach(&$listener)
- {
- if (!is_a($listener, 'HTTP_Request_Listener')) {
- return false;
- }
- $this->_listeners[$listener->getId()] =& $listener;
- return true;
- }
-
-
- /**
- * Removes a Listener from the list of listeners
- *
- * @param HTTP_Request_Listener listener to detach
- * @return boolean whether the listener was successfully detached
- * @access public
- */
- function detach(&$listener)
- {
- if (!is_a($listener, 'HTTP_Request_Listener') ||
- !isset($this->_listeners[$listener->getId()])) {
- return false;
- }
- unset($this->_listeners[$listener->getId()]);
- return true;
- }
-
-
- /**
- * Notifies all registered listeners of an event.
- *
- * @param string Event name
- * @param mixed Additional data
- * @access private
- * @see HTTP_Request::attach()
- */
- function _notify($event, $data = null)
- {
- foreach (array_keys($this->_listeners) as $id) {
- $this->_listeners[$id]->update($this, $event, $data);
- }
- }
-}
-
-
-/**
- * Response class to complement the Request class
- *
- * @category HTTP
- * @package HTTP_Request
- * @author Richard Heyes
- * blocked (bool) - The socket was blocked
- * eof (bool) - Indicates EOF event
- * unread_bytes (int) - Number of bytes left in the socket buffer
- *
";
-}
-?>
diff --git a/lib/phpFlickr/getToken.php b/lib/phpFlickr/getToken.php
deleted file mode 100644
index 55180ea29..000000000
--- a/lib/phpFlickr/getToken.php
+++ /dev/null
@@ -1,19 +0,0 @@
-auth("read");
-
- echo "Copy this token into your code: " . $_SESSION['phpFlickr_auth_token'];
-
-?>
\ No newline at end of file
diff --git a/lib/phpFlickr/phpFlickr.php b/lib/phpFlickr/phpFlickr.php
deleted file mode 100644
index 8ef65c581..000000000
--- a/lib/phpFlickr/phpFlickr.php
+++ /dev/null
@@ -1,1453 +0,0 @@
-api_key = $api_key;
- $this->secret = $secret;
- $this->die_on_error = $die_on_error;
- $this->service = "flickr";
-
- //Find the PHP version and store it for future reference
- $this->php_version = explode("-", phpversion());
- $this->php_version = explode(".", $this->php_version[0]);
-
- //All calls to the API are done via the POST method using the PEAR::HTTP_Request package.
- require_once 'HTTP/Request.php';
- $this->req =& new HTTP_Request();
- $this->req->setMethod(HTTP_REQUEST_METHOD_POST);
- }
-
- function enableCache ($type, $connection, $cache_expire = 600, $table = 'flickr_cache') {
- // Turns on caching. $type must be either "db" (for database caching) or "fs" (for filesystem).
- // When using db, $connection must be a PEAR::DB connection string. Example:
- // "mysql://user:password@server/database"
- // If the $table, doesn't exist, it will attempt to create it.
- // When using file system, caching, the $connection is the folder that the web server has write
- // access to. Use absolute paths for best results. Relative paths may have unexpected behavior
- // when you include this. They'll usually work, you'll just want to test them.
- if ($type == 'db') {
- require_once 'DB.php';
- $db =& DB::connect($connection);
- if (PEAR::isError($db)) {
- die($db->getMessage());
- }
-
- /*
- * If high performance is crucial, you can easily comment
- * out this query once you've created your database table.
- */
-
- $db->query("
- CREATE TABLE IF NOT EXISTS `$table` (
- `request` CHAR( 35 ) NOT NULL ,
- `response` MEDIUMTEXT NOT NULL ,
- `expiration` DATETIME NOT NULL ,
- INDEX ( `request` )
- ) TYPE = MYISAM");
-
- if ($db->getOne("SELECT COUNT(*) FROM $table") > $this->max_cache_rows) {
- $db->query("DELETE FROM $table WHERE expiration < DATE_SUB(NOW(), INTERVAL $cache_expire second)");
- $db->query('OPTIMIZE TABLE ' . $this->cache_table);
- }
-
- $this->cache = 'db';
- $this->cache_db = $db;
- $this->cache_table = $table;
- } elseif ($type == 'fs') {
- $this->cache = 'fs';
- $connection = realpath($connection);
- $this->cache_dir = $connection;
- if ($dir = opendir($this->cache_dir)) {
- while ($file = readdir($dir)) {
- if (substr($file, -6) == '.cache' && ((filemtime($this->cache_dir . '/' . $file) + $cache_expire) < time()) ) {
- unlink($this->cache_dir . '/' . $file);
- }
- }
- }
- }
- $this->cache_expire = $cache_expire;
- }
-
- function getCached ($request) {
- //Checks the database or filesystem for a cached result to the request.
- //If there is no cache result, it returns a value of false. If it finds one,
- //it returns the unparsed XML.
- $reqhash = md5(serialize($request));
- if ($this->cache == 'db') {
- $result = $this->cache_db->getOne("SELECT response FROM " . $this->cache_table . " WHERE request = ? AND DATE_SUB(NOW(), INTERVAL " . (int) $this->cache_expire . " SECOND) < expiration", $reqhash);
- if (!empty($result)) {
- return $result;
- }
- } elseif ($this->cache == 'fs') {
- $file = $this->cache_dir . '/' . $reqhash . '.cache';
- if (file_exists($file)) {
- if ($this->php_version[0] > 4 || ($this->php_version[0] == 4 && $this->php_version[1] >= 3)) {
- return file_get_contents($file);
- } else {
- return implode('', file($file));
- }
- }
- }
- return false;
- }
-
- function cache ($request, $response) {
- //Caches the unparsed XML of a request.
- $reqhash = md5(serialize($request));
- if ($this->cache == 'db') {
- //$this->cache_db->query("DELETE FROM $this->cache_table WHERE request = '$reqhash'");
- if ($this->cache_db->getOne("SELECT COUNT(*) FROM {$this->cache_table} WHERE request = '$reqhash'")) {
- $sql = "UPDATE " . $this->cache_table . " SET response = ?, expiration = ? WHERE request = ?";
- $this->cache_db->query($sql, array($response, strftime("%Y-%m-%d %H:%M:%S"), $reqhash));
- } else {
- $sql = "INSERT INTO " . $this->cache_table . " (request, response, expiration) VALUES ('$reqhash', '" . str_replace("'", "''", $response) . "', '" . strftime("%Y-%m-%d %H:%M:%S") . "')";
- $this->cache_db->query($sql);
- }
- } elseif ($this->cache == "fs") {
- $file = $this->cache_dir . "/" . $reqhash . ".cache";
- $fstream = fopen($file, "w");
- $result = fwrite($fstream,$response);
- fclose($fstream);
- return $result;
- }
- return false;
- }
-
- function request ($command, $args = array(), $nocache = false) {
- //Sends a request to Flickr's REST endpoint via POST.
- $this->req->setURL($this->REST);
- $this->req->clearPostData();
- if (substr($command,0,7) != "flickr.") {
- $command = "flickr." . $command;
- }
-
- //Process arguments, including method and login data.
- $args = array_merge(array("method" => $command, "format" => "php_serial", "api_key" => $this->api_key), $args);
- if (!empty($this->token)) {
- $args = array_merge($args, array("auth_token" => $this->token));
- } elseif (!empty($_SESSION['phpFlickr_auth_token'])) {
- $args = array_merge($args, array("auth_token" => $_SESSION['phpFlickr_auth_token']));
- }
- ksort($args);
- $auth_sig = "";
- if (!($this->response = $this->getCached($args)) || $nocache) {
- foreach ($args as $key => $data) {
- $auth_sig .= $key . $data;
- $this->req->addPostData($key, $data);
- }
- if (!empty($this->secret)) {
- $api_sig = md5($this->secret . $auth_sig);
- $this->req->addPostData("api_sig", $api_sig);
- }
-
- $this->req->addHeader("Connection", "Keep-Alive");
-
- //Send Requests
- if ($this->req->sendRequest()) {
- $this->response = $this->req->getResponseBody();
- $this->cache($args, $this->response);
- } else {
- die("There has been a problem sending your command to the server.");
- }
- }
- /*
- * Uncomment this line (and comment out the next one) if you're doing large queries
- * and you're concerned about time. This will, however, change the structure of
- * the result, so be sure that you look at the results.
- */
- //$this->parsed_response = unserialize($this->response);
- $this->parsed_response = $this->clean_text_nodes(unserialize($this->response));
- if ($this->parsed_response['stat'] == 'fail') {
- if ($this->die_on_error) die("The Flickr API returned the following error: #{$this->parsed_response['code']} - {$this->parsed_response['message']}");
- else {
- $this->error_code = $this->parsed_response['code'];
- $this->error_msg = $this->parsed_response['message'];
- $this->parsed_response = false;
- }
- } else {
- $this->error_code = false;
- $this->error_msg = false;
- }
- return $this->response;
- }
-
- function clean_text_nodes ($arr) {
- if (!is_array($arr)) {
- return $arr;
- } elseif (count($arr) == 0) {
- return $arr;
- } elseif (count($arr) == 1 && array_key_exists('_content', $arr)) {
- return $arr['_content'];
- } else {
- foreach ($arr as $key => $element) {
- $arr[$key] = $this->clean_text_nodes($element);
- }
- return($arr);
- }
- }
-
- function setToken ($token) {
- // Sets an authentication token to use instead of the session variable
- $this->token = $token;
- }
-
- function setProxy ($server, $port) {
- // Sets the proxy for all phpFlickr calls.
- $this->req->setProxy($server, $port);
- }
-
- function getErrorCode () {
- // Returns the error code of the last call. If the last call did not
- // return an error. This will return a false boolean.
- return $this->error_code;
- }
-
- function getErrorMsg () {
- // Returns the error message of the last call. If the last call did not
- // return an error. This will return a false boolean.
- return $this->error_msg;
- }
-
- /* These functions are front ends for the flickr calls */
-
- function buildPhotoURL ($photo, $size = "Medium") {
- //receives an array (can use the individual photo data returned
- //from an API call) and returns a URL (doesn't mean that the
- //file size exists)
- $sizes = array(
- "square" => "_s",
- "thumbnail" => "_t",
- "small" => "_m",
- "medium" => "",
- "large" => "_b",
- "original" => "_o"
- );
-
- $size = strtolower($size);
- if (!array_key_exists($size, $sizes)) {
- $size = "medium";
- }
-
- if ($size == "original") {
- $url = "http://farm" . $photo['farm'] . ".static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['originalsecret'] . "_o" . "." . $photo['originalformat'];
- } else {
- $url = "http://farm" . $photo['farm'] . ".static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['secret'] . $sizes[$size] . ".jpg";
- }
- return $url;
- }
-
- function getFriendlyGeodata ($lat, $lon) {
- /* I've added this method to get the friendly geodata (i.e. 'in New York, NY') that the
- * website provides, but isn't available in the API. I'm providing this service as long
- * as it doesn't flood my server with requests and crash it all the time.
- */
- return unserialize(file_get_contents('http://phpflickr.com/geodata/?format=php&lat=' . $lat . '&lon=' . $lon));
- }
-
- function sync_upload ($photo, $title = null, $description = null, $tags = null, $is_public = null, $is_friend = null, $is_family = null) {
- $upload_req =& new HTTP_Request();
- $upload_req->setMethod(HTTP_REQUEST_METHOD_POST);
-
-
- $upload_req->setURL($this->Upload);
- $upload_req->clearPostData();
-
- //Process arguments, including method and login data.
- $args = array("api_key" => $this->api_key, "title" => $title, "description" => $description, "tags" => $tags, "is_public" => $is_public, "is_friend" => $is_friend, "is_family" => $is_family);
- if (!empty($this->email)) {
- $args = array_merge($args, array("email" => $this->email));
- }
- if (!empty($this->password)) {
- $args = array_merge($args, array("password" => $this->password));
- }
- if (!empty($this->token)) {
- $args = array_merge($args, array("auth_token" => $this->token));
- } elseif (!empty($_SESSION['phpFlickr_auth_token'])) {
- $args = array_merge($args, array("auth_token" => $_SESSION['phpFlickr_auth_token']));
- }
-
- ksort($args);
- $auth_sig = "";
- foreach ($args as $key => $data) {
- if ($data !== null) {
- $auth_sig .= $key . $data;
- $upload_req->addPostData($key, $data);
- }
- }
- if (!empty($this->secret)) {
- $api_sig = md5($this->secret . $auth_sig);
- $upload_req->addPostData("api_sig", $api_sig);
- }
-
- $photo = realpath($photo);
-
- $result = $upload_req->addFile("photo", $photo);
-
- if (PEAR::isError($result)) {
- die($result->getMessage());
- }
-
- //Send Requests
- if ($upload_req->sendRequest()) {
- $this->response = $upload_req->getResponseBody();
- } else {
- die("There has been a problem sending your command to the server.");
- }
-
- $rsp = explode("\n", $this->response);
- foreach ($rsp as $line) {
- if (ereg('No flickr username set: $temp_user->guid"; die;
- forward( "/" );
- die;
-}
-$flickr_user = $f->people_findByUsername( $flickr_username->value );
-
-// Get the friendly URL of the user's photos
-$photos_url = $f->urls_getUserPhotos( $flickr_user["id"] );
-
-if( !empty( $flickr_user )) {
- $recent = $f->people_getPublicPhotos( $flickr_user['id'], NULL, NULL, 5 );
-} else {
- echo "user not found"; die;
-}
-//echo "
"; var_dump( $recent ); echo "
";
-
-//echo ""; var_dump( $user ); echo "
";
-$body = elgg_view_title( "Flickr photos for $flickr_user[username]" );
-
-$count = 0;
-foreach ($recent['photos']['photo'] as $photo) {
-
- $photo_info = $f->photos_getInfo( $photo["id"], $photo["secret"] );
- $body .= "
Views: $photo_info[views]
";
- $body .= "";
- $body .= "buildPhotoURL($photo, "Square") . ">";
- $body .= "";
-
- $tag_count = 0;
- $body .= "
";
- foreach( $photo_info["tags"]["tag"] as $tag ) {
- if( $tag_count ) $body .= ", ";
- $body .= "$tag[_content]";
- $tag_count++;
- }
-
- $body .= "';
- } else {
- $album_cover = '
';
- }
-?>
-
- name;?>
-
- getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")";
- }
-?>
-
-';
- } else {
- $icon = "getURL()}\">" . '
';
- }
- echo elgg_view_listing($icon, $info);
- }
+if ($full_view) {
+ echo elgg_view('object/album/full', $vars);
} else {
-
-/******************************************************************************
- *
- * Individual view of an album object
- *
- * This is called when getting a listing of the photos in an album
- *
- *
- *****************************************************************************/
-
- $page = get_input("page");
- list($album_placeholder, $album_id, $album_title) = split("/", $page);
-
- $photo_ratings = get_plugin_setting('photo_ratings', 'tidypics');
- if ($photo_ratings == "enabled") {
- add_submenu_item( elgg_echo("tidypics:highestrated"),
- $CONFIG->wwwroot . "pg/photos/highestrated/group:" . $album_id,
- 'photos');
- }
- echo elgg_view_title($title);
-?>
-
";
+$form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "
";
+$form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "
";
+$form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "' . elgg_echo('tidypics:settings:heading:img_lib') . '
';
+$image_lib = $plugin->image_lib;
+if (!$image_lib) {
+ $image_lib = 'GD';
+}
+$form_body .= '
Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.
";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "' . elgg_echo('tidypics:settings:heading:river') . '
';
+$img_river_view = $plugin->img_river_view;
+if (!$img_river_view) {
+ $img_river_view = 'batch';
+}
+$form_body .= '' . elgg_echo('tidypics:settings:heading:sizes') . '
';
+$form_body .= "You must edit the css if you change the default sizes
";
+$image_sizes = $plugin->image_sizes;
+if(!$image_sizes) {
+ $image_sizes = array(); // set default values
+ $image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
+ $image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
+ $image_sizes['thumb_image_width'] = $image_sizes['thumb_image_height'] = 60;
+} else {
+ $image_sizes = unserialize($image_sizes);
+}
+$form_body .= "
";
+$form_body .= 'width: ';
+$form_body .= 'height:
";
+$form_body .= 'width and height: ';
+//$form_body .= 'height:
";
+$form_body .= 'width and height: ';
+//$form_body .= 'height: ' . elgg_echo('tidypics:settings:heading:groups') . '
';
+$grp_perm_override = $plugin->grp_perm_override;
+if (!$grp_perm_override) {
+ $grp_perm_override = "enabled";
+}
+$form_body .= '
+
+
+
+
+
+
+ ' . elgg_view("input/file",array('internalname' => "upload_$x")) . '';
+ }
+ ?>
+
+
+
";
-$form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "
";
-$form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "
";
-$form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "' . elgg_echo('tidypics:settings:heading:img_lib') . '
';
-$image_lib = $plugin->image_lib;
-if (!$image_lib) {
- $image_lib = 'GD';
-}
-$form_body .= '
Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.
";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "' . elgg_echo('tidypics:settings:heading:river') . '
';
-$img_river_view = $plugin->img_river_view;
-if (!$img_river_view) {
- $img_river_view = 'batch';
-}
-$form_body .= '' . elgg_echo('tidypics:settings:heading:sizes') . '
';
-$form_body .= "You must edit the css if you change the default sizes
";
-$image_sizes = $plugin->image_sizes;
-if(!$image_sizes) {
- $image_sizes = array(); // set default values
- $image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
- $image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
- $image_sizes['thumb_image_width'] = $image_sizes['thumb_image_height'] = 60;
-} else {
- $image_sizes = unserialize($image_sizes);
-}
-$form_body .= "
";
-$form_body .= 'width: ';
-$form_body .= 'height:
";
-$form_body .= 'width and height: ';
-//$form_body .= 'height:
";
-$form_body .= 'width and height: ';
-//$form_body .= 'height: ' . elgg_echo('tidypics:settings:heading:groups') . '
';
-$grp_perm_override = $plugin->grp_perm_override;
-if (!$grp_perm_override) {
- $grp_perm_override = "enabled";
-}
-$form_body .= '
-
-
-
-
-
-
- ' . elgg_view("input/file",array('internalname' => "upload_$x")) . '';
- }
- ?>
-
-
-
';
+ } else {
+ $error = elgg_echo("tidypics:completeuploadfailure") . '
';
+ }
+
+ $num_failures = count($not_uploaded);
+ for ($i = 0; $i < $num_failures; $i++) {
+ $error .= "{$not_uploaded[$i]}: {$error_msgs[$i]}
";
+ }
+ register_error($error);
+
+ if (count($uploaded_images) == 0) {
+ //upload failed, so forward to previous page
+ forward(REFERER);
+ } else {
+ // some images did upload so we fall through
+ }
+} else {
+ system_message(elgg_echo('tidypics:upl_success'));
+}
+
+forward("photos/edit/$batch->guid");
diff --git a/actions/upload.php b/actions/upload.php
deleted file mode 100644
index 3bbd97e60..000000000
--- a/actions/upload.php
+++ /dev/null
@@ -1,202 +0,0 @@
-new_album == TP_NEW_ALBUM) {
- $new_album = true;
-} else {
- $new_album = false;
-}
-
-
-// post limit exceeded
-if (count($_FILES) == 0) {
- trigger_error('Tidypics warning: user exceeded post limit on image upload', E_USER_WARNING);
- register_error(elgg_echo('tidypics:exceedpostlimit'));
- forward($_SERVER['HTTP_REFERER']);
-}
-
-// test to make sure at least 1 image was selected by user
-$num_images = 0;
-foreach($_FILES as $key => $sent_file) {
- if (!empty($sent_file['name'])) {
- $num_images++;
- }
-}
-if ($num_images == 0) {
- // have user try again
- register_error(elgg_echo('tidypics:noimages'));
- forward($_SERVER['HTTP_REFERER']);
-}
-
-$uploaded_images = array();
-$not_uploaded = array();
-$error_msgs = array();
-
-foreach($_FILES as $key => $sent_file) {
-
- // skip empty entries
- if (empty($sent_file['name'])) {
- continue;
- }
-
- $name = $sent_file['name'];
- $mime = $sent_file['type'];
-
- if ($sent_file['error']) {
- array_push($not_uploaded, $sent_file['name']);
- if ($sent_file['error'] == 1) {
- trigger_error('Tidypics warning: image exceeded server php upload limit', E_USER_WARNING);
- array_push($error_msgs, elgg_echo('tidypics:image_mem'));
- } else {
- array_push($error_msgs, elgg_echo('tidypics:unk_error'));
- }
- continue;
- }
-
- // must be an image
- if (!tp_upload_check_format($mime)) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:not_image'));
- continue;
- }
-
- // check quota
- if (!tp_upload_check_quota($sent_file['size'], get_loggedin_userid())) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:exceed_quota'));
- continue;
- }
-
- // make sure file does not exceed memory limit
- if (!tp_upload_check_max_size($sent_file['size'])) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:image_mem'));
- continue;
- }
-
- // make sure the in memory image size does not exceed memory available
- $imginfo = getimagesize($sent_file['tmp_name']);
- if (!tp_upload_memory_check($image_lib, $imginfo[0] * $imginfo[1])) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:image_pixels'));
- trigger_error('Tidypics warning: image memory size too large for resizing so rejecting', E_USER_WARNING);
- continue;
- }
-
- //this will save to user's folder in /image/ and organize by photo album
- $file = new TidypicsImage();
- $file->container_guid = $album_guid;
- $file->setMimeType($mime);
- $file->simpletype = "image";
- $file->access_id = $access_id;
- //$file->title = substr($name, 0, strrpos($name, '.'));
-
- $result = $file->save();
-
- if (!$result) {
- array_push($not_uploaded, $sent_file['name']);
- array_push($error_msgs, elgg_echo('tidypics:save_error'));
- continue;
- }
-
- $file->setOriginalFilename($name);
- $file->saveImageFile($sent_file['tmp_name'], $sent_file['size']);
- $file->extractExifData();
- $file->saveThumbnails($image_lib);
-
- array_push($uploaded_images, $file->guid);
-
- // plugins can register to be told when a new image has been uploaded
- trigger_elgg_event('upload', 'tp_image', $file);
-
- // successful upload so check if this is a new album and throw river event/notification if so
- if ($album->new_album == TP_NEW_ALBUM) {
- $album->new_album = TP_OLD_ALBUM;
-
- // we throw the notification manually here so users are not told about the new album until there
- // is at least a few photos in it
- object_notifications('create', 'object', $album);
-
- add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid);
- }
-
- if ($img_river_view == "all") {
- add_to_river('river/object/image/create', 'create', $file->getObjectOwnerGUID(), $file->getGUID());
- }
- unset($file); // may not be needed but there seems to be a memory leak
-
-} //end of for loop
-
-if (count($not_uploaded) > 0) {
- if (count($uploaded_images) > 0) {
- $error = sprintf(elgg_echo("tidypics:partialuploadfailure"), count($not_uploaded), count($not_uploaded) + count($uploaded_images)) . '
';
- } else {
- $error = elgg_echo("tidypics:completeuploadfailure") . '
';
- }
-
- $num_failures = count($not_uploaded);
- for ($i = 0; $i < $num_failures; $i++) {
- $error .= "{$not_uploaded[$i]}: {$error_msgs[$i]}
";
- }
- register_error($error);
-
- if (count($uploaded_images) == 0) {
- //upload failed, so forward to previous page
- forward($_SERVER['HTTP_REFERER']);
- } else {
- // some images did upload so we fall through
- }
-} else {
- system_message(elgg_echo('tidypics:upl_success'));
-}
-
-if (count($uploaded_images)) {
- // Create a new batch object to contain these photos
- $batch = new ElggObject();
- $batch->subtype = "tidypics_batch";
- $batch->access_id = $access_id;
- $batch->container_guid = $album_guid;
-
- if ($batch->save()) {
- foreach ($uploaded_images as $uploaded_guid) {
- add_entity_relationship($uploaded_guid, "belongs_to_batch", $batch->getGUID());
- }
- if ($img_river_view == "batch" && $new_album == false) {
- add_to_river('river/object/tidypics_batch/create', 'create', $batch->getObjectOwnerGUID(), $batch->getGUID());
- }
- }
-}
-
-
-if (count($uploaded_images) > 0) {
- $album->prependImageList($uploaded_images);
-}
-
-// plugins can register to be told when a Tidypics album has had images added
-trigger_elgg_event('upload', 'tp_album', $album);
-
-
-//forward to multi-image edit page
-forward($CONFIG->wwwroot . 'mod/tidypics/pages/edit_multiple.php?files=' . implode('-', $uploaded_images));
diff --git a/classes/TidypicsAlbum.php b/classes/TidypicsAlbum.php
index 75a018410..18fa556e3 100644
--- a/classes/TidypicsAlbum.php
+++ b/classes/TidypicsAlbum.php
@@ -3,6 +3,8 @@
* Tidypics Album class
*
* @package TidypicsAlbum
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
*/
diff --git a/classes/TidypicsImage.php b/classes/TidypicsImage.php
index 652cc9e9b..c604d869e 100644
--- a/classes/TidypicsImage.php
+++ b/classes/TidypicsImage.php
@@ -3,6 +3,8 @@
* Tidypics Image class
*
* @package TidypicsImage
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
*/
@@ -17,6 +19,29 @@ class TidypicsImage extends ElggFile {
parent::__construct($guid);
}
+ /**
+ *
+ * @warning container_guid must be set first
+ *
+ * @param array $data
+ * @return bool
+ */
+ public function save($data = null) {
+
+ if (!parent::save()) {
+ return false;
+ }
+
+ if ($data) {
+ // new image
+ $this->simpletype = "image";
+ $this->saveImageFile($data);
+ $this->saveThumbnails();
+ }
+
+ return true;
+ }
+
/**
* Get the title of the image
*
@@ -26,8 +51,13 @@ class TidypicsImage extends ElggFile {
return $this->title;
}
- public function getSrcUrl() {
- return "pg/photos/thumbnail/$this->guid/small/";
+ /**
+ * Get the src URL for the image
+ *
+ * @return string
+ */
+ public function getSrcUrl($size = 'small') {
+ return "photos/thumbnail/$this->guid/$size/";
}
/**
@@ -73,10 +103,8 @@ class TidypicsImage extends ElggFile {
/**
* Set the internal filenames
- *
- * @warning container needs to be set first
*/
- public function setOriginalFilename($originalName) {
+ protected function setOriginalFilename($originalName) {
$prefix = "image/" . $this->container_guid . "/";
$filestorename = elgg_strtolower(time() . $originalName);
$this->setFilename($prefix . $filestorename);
@@ -85,24 +113,23 @@ class TidypicsImage extends ElggFile {
/**
* Save the uploaded image
- *
- * @warning filename needs to be set first
*
- * @param string $uploadedFilename name of the uploaded file
- * @param int $size
+ * @param array $data
*/
- public function saveImageFile($uploadedFilename, $size) {
+ protected function saveImageFile($data) {
+ $this->checkUploadErrors($data);
// we need to make sure the directory for the album exists
// @note for group albums, the photos are distributed among the users
- $dir = tp_get_img_dir() . $this->getContainer();
+ $dir = tp_get_img_dir() . $this->getContainerGUID();
if (!file_exists($dir)) {
mkdir($dir, 0755, true);
}
+ // move the uploaded file into album directory
+ $this->setOriginalFilename($data['name']);
$filename = $this->getFilenameOnFilestore();
-
- $result = move_uploaded_file($uploadedFilename, $filename);
+ $result = move_uploaded_file($data['tmp_name'], $filename);
if (!$result) {
return false;
}
@@ -113,15 +140,42 @@ class TidypicsImage extends ElggFile {
return true;
}
+ protected function checkUploadErrors($data) {
+ // check for upload errors
+ if ($data['error']) {
+ if ($data['error'] == 1) {
+ trigger_error('Tidypics warning: image exceeded server php upload limit', E_USER_WARNING);
+ throw new Exception(elgg_echo('tidypics:image_mem'));
+ } else {
+ throw new Exception(elgg_echo('tidypics:unk_error'));
+ }
+ }
+
+ // must be an image
+ if (!tp_upload_check_format($data['type'])) {
+ throw new Exception(elgg_echo('tidypics:not_image'));
+ }
+
+ // make sure file does not exceed memory limit
+ if (!tp_upload_check_max_size($data['size'])) {
+ throw new Exception(elgg_echo('tidypics:image_mem'));
+ }
+
+ // make sure the in memory image size does not exceed memory available
+ $imginfo = getimagesize($data['tmp_name']);
+ if (!tp_upload_memory_check($image_lib, $imginfo[0] * $imginfo[1])) {
+ trigger_error('Tidypics warning: image memory size too large for resizing so rejecting', E_USER_WARNING);
+ throw new Exception(elgg_echo('tidypics:image_pixels'));
+ }
+ }
+
/**
* Save the image thumbnails
- *
- * @warning container guid and filename must be set
- *
- * @param string $imageLib
*/
- public function saveThumbnails($imageLib) {
- include_once dirname(dirname(__FILE__)) . "/lib/resize.php";
+ protected function saveThumbnails() {
+ elgg_load_library('tidypics:resize');
+
+ $imageLib = elgg_get_plugin_setting('image_lib', 'tidypics');
$prefix = "image/" . $this->container_guid . "/";
$filename = $this->getFilename();
@@ -144,6 +198,38 @@ class TidypicsImage extends ElggFile {
}
}
+ /**
+ * Get the image data of a thumbnail
+ *
+ * @param string $size
+ * @return string
+ */
+ public function getThumbnail($size) {
+ switch ($size) {
+ case 'thumb':
+ $thumb = $this->thumbnail;
+ break;
+ case 'small':
+ $thumb = $this->smallthumb;
+ break;
+ case 'large':
+ $thumb = $this->largethumb;
+ break;
+ default:
+ return '';
+ break;
+ }
+
+ if (!$thumb) {
+ return '';
+ }
+
+ $file = new ElggFile();
+ $file->owner_guid = $this->getObjectOwnerGUID();
+ $file->setFilename($thumb);
+ return $file->grabFile();
+ }
+
/**
* Extract EXIF Data from image
*
diff --git a/pages/edit_multiple.php b/pages/edit_multiple.php
deleted file mode 100644
index 7c7b989cf..000000000
--- a/pages/edit_multiple.php
+++ /dev/null
@@ -1,52 +0,0 @@
- 'batch',
- 'metadata_value' => $batch,
- 'type' => 'object',
- 'subtype' => 'image',
- 'owner_guid' => get_loggedin_userid(),
- 'limit' => ELGG_ENTITIES_NO_VALUE,
- ));
-} else {
- // parse out photo guids
- $file_string = get_input('files');
- $file_array_sent = explode('-', $file_string);
-
- $images = array();
- foreach ($file_array_sent as $file_guid) {
- if ($entity = get_entity($file_guid)) {
- if ($entity->canEdit()) {
- array_push($images, $entity);
- }
- }
- }
-}
-
-if (!$images) {
- forward($_SERVER['HTTP_REFERER']);
-}
-
-
-$title = elgg_echo('tidypics:editprops');
-
-$content .= elgg_view_title($title);
-$content .= elgg_view("tidypics/forms/edit_multi", array('images' => $images));
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $content);
-page_draw($title, $body);
diff --git a/pages/photos/batch/edit.php b/pages/photos/batch/edit.php
new file mode 100644
index 000000000..b96ddf408
--- /dev/null
+++ b/pages/photos/batch/edit.php
@@ -0,0 +1,44 @@
+canEdit()) {
+ // @todo cannot change it
+ forward('photos/all');
+}
+
+$album = $batch->getContainerEntity();
+
+elgg_set_page_owner_guid($batch->getContainerEntity()->getContainerGUID());
+$owner = elgg_get_page_owner_entity();
+
+$title = elgg_echo('tidypics:editprops');
+
+elgg_push_breadcrumb(elgg_echo('photos'), "photos/all");
+elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username");
+elgg_push_breadcrumb($album->title, $album->getURL());
+elgg_push_breadcrumb($title);
+
+$content = elgg_view_form('photos/batch/edit', array(), array('batch' => $batch));
+
+$body = elgg_view_layout('content', array(
+ 'filter' => false,
+ 'content' => $content,
+ 'title' => elgg_echo('tidypics:editprops'),
+ 'sidebar' => elgg_view('tidypics/sidebar', array('page' => 'album')),
+));
+
+echo elgg_view_page($title, $body);
diff --git a/pages/photos/image/thumbnail.php b/pages/photos/image/thumbnail.php
new file mode 100644
index 000000000..ae07f2706
--- /dev/null
+++ b/pages/photos/image/thumbnail.php
@@ -0,0 +1,34 @@
+getThumbnail($size);
+if (!$contents) {
+ forward("mod/tidypics/graphics/image_error_$size");
+}
+
+// expires every 14 days
+$expires = 14 * 60*60*24;
+
+// overwrite header caused by php session code so images can be cached
+$mime = $image->getMimeType();
+header("Content-Type: $mime");
+header("Content-Length: " . strlen($contents));
+header("Cache-Control: public", true);
+header("Pragma: public", true);
+header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
+
+// Return the thumbnail and exit
+echo $contents;
+exit;
diff --git a/pages/photos/image/upload.php b/pages/photos/image/upload.php
index 6580c6f52..526972a35 100644
--- a/pages/photos/image/upload.php
+++ b/pages/photos/image/upload.php
@@ -1,62 +1,59 @@
canEdit()) {
+ // @todo
// throw warning and forward to previous page
- forward($_SERVER['HTTP_REFERER']);
+ forward(REFERER);
+}
+
+if (!$album->canEdit()) {
+ // @todo have to be able to edit album to upload photos
}
// set page owner based on container (user or group)
-set_page_owner($album->container_guid);
+elgg_set_page_owner_guid($album->getContainerGUID());
+$owner = elgg_get_page_owner_entity();
-$page_owner = page_owner_entity();
-if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
-}
+$title = elgg_echo('album:addpix');
-set_context('photos');
-$title = elgg_echo('album:addpix') . ': ' . $album->title;
-$area2 .= elgg_view_title($title);
+// set up breadcrumbs
+elgg_push_breadcrumb(elgg_echo('photos'), "photos/all");
+elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username");
+elgg_push_breadcrumb($album->getTitle(), $album->getURL());
+elgg_push_breadcrumb(elgg_echo('album:addpix'));
-if ($uploader == 'basic') {
- $area2 .= elgg_view('input/form', array(
- 'action' => "{$CONFIG->wwwroot}action/tidypics/upload",
- 'body' => elgg_view('forms/tidypics/basic_upload', array('album' => $album)),
- 'internalid' => 'tidypicsUpload',
- 'enctype' => 'multipart/form-data',
- 'method' => 'post',
- ));
+if ($uploader == 'basic') {
+ $content = elgg_view('forms/photos/basic_upload', array('entity' => $album));
} else {
- $area2 .= elgg_view("forms/tidypics/ajax_upload", array('album' => $album));
+ $content = elgg_view('forms/photos/ajax_upload', array('entity' => $album));
}
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+));
-page_draw($title, $body);
+echo elgg_view_page($title, $body);
diff --git a/pages/thumbnail.php b/pages/thumbnail.php
deleted file mode 100644
index 9daa2f9c0..000000000
--- a/pages/thumbnail.php
+++ /dev/null
@@ -1,78 +0,0 @@
-getSubtype() != "image") {
- forward('mod/tidypics/graphics/' . $error_image);
-}
-
-// Get filename
-if ($size == "thumb") {
- $thumbfile = $file->thumbnail;
-} else if ($size == "small") {
- $thumbfile = $file->smallthumb;
-} else {
- $thumbfile = $file->largethumb;
-}
-
-if (!$thumbfile) {
- forward('mod/tidypics/graphics/' . $error_image);
-}
-
-// create Elgg File object
-$readfile = new ElggFile();
-$readfile->owner_guid = $file->owner_guid;
-$readfile->setFilename($thumbfile);
-$contents = $readfile->grabFile();
-
-// send error image if file could not be read
-if (!$contents) {
- forward('mod/tidypics/graphics/' . $error_image);
-}
-
-// expires every 14 days
-$expires = 14 * 60*60*24;
-
-// overwrite header caused by php session code so images can be cached
-$mime = $file->getMimeType();
-header("Content-Type: $mime");
-header("Content-Length: " . strlen($contents));
-header("Cache-Control: public", true);
-header("Pragma: public", true);
-header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
-
-// Return the thumbnail and exit
-echo $contents;
-exit;
diff --git a/start.php b/start.php
index 953789924..fff4ebf8d 100644
--- a/start.php
+++ b/start.php
@@ -6,16 +6,7 @@
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
*/
-// set some simple defines
-define('TP_OLD_ALBUM', 0);
-define('TP_NEW_ALBUM', 1);
-
-// include core libraries
-require dirname(__FILE__) . "/lib/tidypics.php";
-
-
-// Make sure tidypics_init is called on initialization
-register_elgg_event_handler('init', 'system', 'tidypics_init');
+elgg_register_event_handler('init', 'system', 'tidypics_init');
/**
* Tidypics plugin initialization
@@ -23,6 +14,9 @@ register_elgg_event_handler('init', 'system', 'tidypics_init');
function tidypics_init() {
global $CONFIG;
+ // include core libraries
+ require dirname(__FILE__) . "/lib/tidypics.php";
+
// Set up site menu
elgg_register_menu_item('site', array(
'name' => 'photos',
@@ -85,18 +79,21 @@ function tidypics_init() {
// Register actions
$base_dir = $CONFIG->pluginspath . "tidypics/actions/photos";
elgg_register_action("photos/album/save", "$base_dir/album/save.php");
- register_action("tidypics/upload", false, "$base_dir/upload.php");
+ elgg_register_action("photos/delete", "$base_dir/delete.php");
+ elgg_register_action("photos/image/upload", "$base_dir/image/upload.php");
+ elgg_register_action("photos/batch/edit", "$base_dir/batch/edit.php");
register_action("tidypics/ajax_upload", true, "$base_dir/ajax_upload.php");
register_action("tidypics/ajax_upload_complete", true, "$base_dir/ajax_upload_complete.php");
register_action("tidypics/sortalbum", false, "$base_dir/sortalbum.php");
register_action("tidypics/edit", false, "$base_dir/edit.php");
- register_action("tidypics/delete", false, "$base_dir/delete.php");
- register_action("tidypics/edit_multi", false, "$base_dir/edit_multi.php");
register_action("tidypics/addtag", false, "$base_dir/addtag.php");
register_action("tidypics/deletetag", false, "$base_dir/deletetag.php");
register_action("tidypics/admin/settings", false, "$base_dir/admin/settings.php", true);
register_action("tidypics/admin/upgrade", false, "$base_dir/admin/upgrade.php", true);
+
+ elgg_register_library('tidypics:upload', $CONFIG->pluginspath . 'tidypics/lib/upload.php');
+ elgg_register_library('tidypics:resize', $CONFIG->pluginspath . 'tidypics/lib/resize.php');
}
/**
@@ -301,9 +298,10 @@ function tidypics_page_handler($page) {
case 'album':
require "$base/album/edit.php";
break;
+ case 'tidypics_batch':
+ require "$base/batch/edit.php";
+ break;
default:
- echo 'not album';
- exit;
return false;
}
break;
@@ -315,21 +313,22 @@ function tidypics_page_handler($page) {
include($CONFIG->pluginspath . "tidypics/pages/sortalbum.php");
break;
- case "view": //view an image individually
- if (isset($page[1])) {
- set_input('guid', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/viewimage.php");
+ case "image": //view an image
+ case "view":
+ set_input('guid', $page[1]);
+ require "$base/image/view.php";
break;
-
- case "upload": //upload images to album
- if (isset($page[1])) {
- set_input('album_guid', $page[1]);
- }
- if (isset($page[2])) {
- set_input('uploader', 'basic');
- }
- include($CONFIG->pluginspath . "tidypics/pages/photos/image/upload.php");
+
+ case "thumbnail": // tidypics thumbnail
+ set_input('guid', $page[1]);
+ set_input('size', elgg_extract(2, $page, 'small'));
+ require "$base/image/thumbnail.php";
+ break;
+
+ case "upload": // upload images to album
+ set_input('guid', $page[1]);
+ set_input('uploader', elgg_extract(2, $page, 'basic'));
+ require "$base/image/upload.php";
break;
case "batch": //update titles and descriptions
@@ -349,16 +348,6 @@ function tidypics_page_handler($page) {
include($CONFIG->pluginspath . "tidypics/pages/download.php");
break;
- case "thumbnail": // tidypics thumbnail
- if (isset($page[1])) {
- set_input('file_guid', $page[1]);
- }
- if (isset($page[2])) {
- set_input('size', $page[2]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/thumbnail.php");
- break;
-
case "tagged": // all photos tagged with user
if (isset($page[1])) {
set_input('guid', $page[1]);
diff --git a/views/default/forms/photos/basic_upload.php b/views/default/forms/photos/basic_upload.php
index 55ab854a4..e4535814b 100644
--- a/views/default/forms/photos/basic_upload.php
+++ b/views/default/forms/photos/basic_upload.php
@@ -1,24 +1,22 @@
access_id;
-$maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
-if (!$maxfilesize) {
- $maxfilesize = 5;
-}
-
-$quota = get_plugin_setting('quota','tidypics');
+$maxfilesize = (float) elgg_get_plugin_setting('maxfilesize', 'tidypics');
+$quota = elgg_get_plugin_setting('quota', 'tidypics');
+/*
if ($quota) {
$image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
$image_repo_size = (int)$image_repo_size_md->value;
@@ -34,16 +32,6 @@ if ($quota) {
$image_repo_size = $quota;
}
}
-
-?>
-
-
-
@@ -51,54 +39,37 @@ if ($quota) {
-
-
- ' . elgg_view("input/file",array('internalname' => "upload_$x")) . '';
- }
- ?>
-
-
-';
+foreach ($images as $image) {
+ echo '
';
+
+echo '' . elgg_echo('tidypics:settings:heading:sizes') . '
';
+echo "You must edit the css if you change the default sizes
";
+$image_sizes = unserialize($plugin->image_sizes);
+
+/*
+if(!$image_sizes) {
+ $image_sizes = array(); // set default values
+ $image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
+ $image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
+ $image_sizes['thumb_image_width'] = $image_sizes['thumb_image_height'] = 60;
+} else {
+ $image_sizes = unserialize($image_sizes);
+}
+ *
+ */
+
+$sizes = array('large', 'small', 'tiny');
+foreach ($sizes as $size) {
+ echo elgg_echo("tidypics:settings:{$size}size");
+ echo ' width: ';
+ echo elgg_view('input/text', array(
+ 'name' => "{$size}_thumb_width",
+ 'value' => $image_sizes["{$size}_image_width"],
+ 'style' => 'width: 150px;'
+ ));
+ echo ' height: ';
+ echo elgg_view('input/text', array(
+ 'name' => "{$size}_thumb_height",
+ 'value' => $image_sizes["{$size}_image_height"],
+ 'style' => 'width: 150px;'
+ ));
+}
+
+$form_body .= 'width: ';
+$form_body .= 'height: ';
+
+$form_body .= "
";
+$form_body .= 'width and height: ';
+//$form_body .= 'height:
";
+$form_body .= 'width and height: ';
+//$form_body .= 'height: ' . elgg_echo('tidypics:settings:heading:main') . '
';
+echo '' . elgg_echo('tidypics:settings:heading:main') . '
';
// Tagging
-$tagging = $plugin->tagging;
-if (!$tagging) {
- $tagging = "enabled";
-}
-$form_body .= '' . elgg_echo('tidypics:settings:heading:img_lib') . '
';
+echo'' . elgg_echo('tidypics:settings:heading:sizes') . '
';
-echo "You must edit the css if you change the default sizes
";
-$image_sizes = unserialize($plugin->image_sizes);
+echo elgg_echo('tidypics:settings:im_path') . ' ';
+echo elgg_view("input/text", array('name' => 'params[im_path]', 'value' => $$plugin->im_path));
+echo '' . elgg_echo('tidypics:settings:heading:river') . '
';
+echo '' . elgg_echo('tidypics:settings:heading:sizes') . '
';
+echo '' . elgg_echo('tidypics:settings:sizes:instructs') . '
';
+$image_sizes = unserialize($plugin->image_sizes);
+echo '';
$sizes = array('large', 'small', 'tiny');
foreach ($sizes as $size) {
+ echo '
';
echo '';
+ echo ' ';
}
-
-$form_body .= 'width: ';
-$form_body .= 'height: ';
-
-$form_body .= "';
echo elgg_echo("tidypics:settings:{$size}size");
- echo ' width: ';
+ echo ' ';
+ echo 'width: ';
echo elgg_view('input/text', array(
- 'name' => "{$size}_thumb_width",
+ 'name' => "{$size}_image_width",
'value' => $image_sizes["{$size}_image_width"],
- 'style' => 'width: 150px;'
+ 'class' => 'tidypics-input-thin',
));
- echo ' height: ';
+ echo ' ';
+ echo 'height: ';
echo elgg_view('input/text', array(
- 'name' => "{$size}_thumb_height",
+ 'name' => "{$size}_image_height",
'value' => $image_sizes["{$size}_image_height"],
- 'style' => 'width: 150px;'
+ 'class' => 'tidypics-input-thin',
));
+ echo ' ';
+ echo '
";
-$form_body .= 'width and height: ';
-//$form_body .= 'height:
";
-$form_body .= 'width and height: ';
-//$form_body .= 'height: ' . elgg_echo('tidypics:settings:heading:main') . '
';
-
-// Tagging
-$tagging = $plugin->tagging ? $plugin->tagging : 'enabled';
+// Group albums
+echo '' . elgg_echo('tidypics:settings:heading:groups') . '
';
echo '
";
$form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "
";
-$form_body .= elgg_view("input/text",array('internalname' => 'params[maxfilesize]', 'value' => $maxfilesize)) . "
";
$form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "' . elgg_echo('tidypics:settings:heading:img_lib') . '
';
-$image_lib = $plugin->image_lib;
-if (!$image_lib) {
- $image_lib = 'GD';
-}
-$form_body .= '
Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.
";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "' . elgg_echo('tidypics:settings:heading:river') . '
';
-$img_river_view = $plugin->img_river_view;
-if (!$img_river_view) {
- $img_river_view = 'batch';
-}
-$form_body .= '' . elgg_echo('tidypics:settings:heading:sizes') . '
';
-$form_body .= "You must edit the css if you change the default sizes
";
-$image_sizes = $plugin->image_sizes;
-if(!$image_sizes) {
- $image_sizes = array(); // set default values
- $image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
- $image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
- $image_sizes['thumb_image_width'] = $image_sizes['thumb_image_height'] = 60;
-} else {
- $image_sizes = unserialize($image_sizes);
-}
-$form_body .= "
";
-$form_body .= 'width: ';
-$form_body .= 'height:
";
-$form_body .= 'width and height: ';
-//$form_body .= 'height:
";
-$form_body .= 'width and height: ';
-//$form_body .= 'height: ' . elgg_echo('tidypics:settings:heading:groups') . '
';
-$grp_perm_override = $plugin->grp_perm_override;
-if (!$grp_perm_override) {
- $grp_perm_override = "enabled";
-}
-$form_body .= '';
+foreach ($image_guids as $image_guid) {
+ $image = get_entity($image_guid);
+ $img = elgg_view('output/img', array(
+ 'src' => $image->getSrcURL(),
+ ));
+ echo "
';
diff --git a/views/default/js/photos/tidypics.php b/views/default/js/photos/tidypics.php
new file mode 100644
index 000000000..509d2116a
--- /dev/null
+++ b/views/default/js/photos/tidypics.php
@@ -0,0 +1,26 @@
+
+
+elgg.provide('elgg.tidypics');
+
+elgg.tidypics.init = function() {
+ $("#tidypics-sort").sortable({
+ opacity: 0.7,
+ revert: true,
+ scroll: true
+ });
+
+ $('.elgg-form-photos-album-sort').submit(function() {
+ var tidypics_guids = [];
+ $("#tidypics-sort li").each(function(index) {
+ tidypics_guids.push($(this).attr('id'));
+ });
+ $('input[name="guids"]').val(tidypics_guids.toString());
+ });
+};
+
+elgg.register_hook_handler('init', 'system', elgg.tidypics.init);
diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php
index 542123bd0..82594db0e 100644
--- a/views/default/tidypics/css.php
+++ b/views/default/tidypics/css.php
@@ -22,6 +22,12 @@
width: 120px;
}
+#tidypics-sort li {
+width:153px;
+height:153px;
+}
+
+
diff --git a/views/default/tidypics/sort.php b/views/default/tidypics/sort.php
deleted file mode 100644
index 66dd8a999..000000000
--- a/views/default/tidypics/sort.php
+++ /dev/null
@@ -1,54 +0,0 @@
-getImageList();
-
-// create submission form
-$body = elgg_view('input/hidden', array('internalname' => 'guids'));
-$body .= elgg_view('input/hidden', array('internalname' => 'album_guid', 'value' => $album->guid));
-$body .= elgg_view('input/submit', array('value' => elgg_echo('save')));
-?>
-
-
-
-";
- }
- ?>
-
wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album_cover_guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/>' . "
';
foreach($images as $image) {
- $string .= "getURL() . "\">
';
}
-
- $string .= "wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> ';
+ $attachments .= '
wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> ';
-$string .= "
';
+ $attachments = '
';
foreach($images as $image) {
- $attachments .= '
';
foreach($images as $image) {
- $string .= "getURL() . "\">
';
}
-$string .= "wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" class="tidypics_album_cover" alt="thumbnail"/> ';
+ $attachments .= '
';
foreach($images as $image) {
$attachments .= '
';
diff --git a/views/default/river/object/image/create.php b/views/default/river/object/image/create.php
index 44efa0c59..08cfdc550 100644
--- a/views/default/river/object/image/create.php
+++ b/views/default/river/object/image/create.php
@@ -1,6 +1,9 @@
getSubjectEntity();
@@ -12,10 +15,8 @@ $subject_link = elgg_view('output/url', array(
));
$image = $vars['item']->getObjectEntity();
-$attachments = elgg_view('output/img', array(
- 'src' => $image->getSrcUrl('thumb'),
- 'class' => 'elgg-photo',
-));
+$attachments = elgg_view_entity_icon($image, 'tiny');
+
$image_link = elgg_view('output/url', array(
'href' => $image->getURL(),
'text' => $image->getTitle(),
diff --git a/views/default/river/object/tidypics_batch/create.php b/views/default/river/object/tidypics_batch/create.php
index 1dfce6925..44c40c110 100644
--- a/views/default/river/object/tidypics_batch/create.php
+++ b/views/default/river/object/tidypics_batch/create.php
@@ -1,6 +1,9 @@
getObjectEntity();
@@ -34,10 +37,7 @@ if (count($images)) {
$attachments = '';
foreach($images as $image) {
$attachments .= '
';
diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php
index b95e24193..0c0f33c2c 100644
--- a/views/default/tidypics/css.php
+++ b/views/default/tidypics/css.php
@@ -8,15 +8,27 @@
.elgg-module-tidypics-image {
width: 161px;
text-align: center;
- margin: 5px 10px;
+ margin: 5px 0;
}
.elgg-module-tidypics-image {
margin: 5px auto;
}
+
.tidypics-gallery-widget > li {
width: 100%;
}
+.tidypics-photo {
+ margin: 0 auto;
+}
+
+.tidypics-heading {
+ color: #0054A7;
+}
+.tidypics-heading:hover {
+ color: #0054A7;
+ text-decoration: none;
+}
.tidypics-input-thin {
width: 120px;
@@ -35,6 +47,9 @@
margin-left: 7px;
}
+.tidypics-gallery > li {
+ padding: 0 10px;
+}
getSrcUrl('thumb');
-$download_url = $vars['entity']->getSrcUrl('large');
+$thumbnail_url = $vars['entity']->getIconURL('tiny');
+$download_url = $vars['entity']->getIconURL('large');
$mime_type = $vars['entity']->getMimeType();
--
cgit v1.2.3
From f057f68c6f946244b3afe0340ae11efdde0d8136 Mon Sep 17 00:00:00 2001
From: cash ';
- } else {
- $album_cover = '
';
- }
-?>
-
- username) || empty($owner->username)) {
- echo ' ';
- } else {
- echo '';
- }
-
-}
-
-if (can_write_to_container(0, $owner->guid)) {
- echo '';
-}
-
-
-//close album_widget_container div
-echo "
guid; ?>">Group albums
-' . elgg_echo('album:group') . '';
- echo elgg_view('tidypics/albums', array('num_albums' => 5));
- echo '';
- } else {
- return ' ';
- }
- }
-
- function make_form()
- {
- var f = (!options.isFieldset) ? 'form' : 'fieldset';
- /*return '<' + f + ' action="#" ' + 'id="'+ options.formId + '" ' + 'class="quicksearch">' +
- make_form_label() + make_form_input() + make_form_loader() +
- '' + f + '>';*/
- return make_form_label() + make_form_input() + make_form_loader()
- }
-
- function focus_on_load()
- {
- $('input[rel="' + options.randomElement + '"]').get(0).focus();
- }
-
- function toggle_text() {
- $('input[rel="' + options.randomElement + '"]').focus(function () {
- if ($(this).val() === options.inputText) {
- $(this).val('');
- }
- });
- $('input[rel="' + options.randomElement + '"]').blur(function () {
- if ($(this).val() === "") {
- $(this).val(options.inputText);
- }
- });
- }
-
- function get_cache(el)
- {
- return $(el).map(function(){
- return strip_html(this.innerHTML);
- });
- }
-
- function init()
- {
- place_form();
- if (options.fixWidths) fix_widths(el);
- if (options.focusOnLoad) focus_on_load();
- if (options.inputText != "" && options.inputText != null) toggle_text();
-
- cache = get_cache(el);
-
- stripe(el);
- loader('hide');
- }
-
- function qs()
- {
- clearTimeout(timeout);
- timeout = setTimeout(function () {
-
- loader('show');
-
- setTimeout(function () {
- options.onBefore();
-
- var k = get_key();
- var k_type = (typeof k);
- var i = 0;
-
- k = options.filter(k);
-
- if (k != "")
- {
- if (typeof score[k] === "undefined")
- {
- score[k] = new Array();
- cache.each(function (i) {
- if (test_key(k, cache[i], k_type))
- {
- score[k][i] = true;
- }
- });
- }
-
- if (score[k].length === 0)
- {
- select_element(el).hide();
- }
- else
- {
- /*console.log(score[k].length);
- if(score[k].length==1)
- {
- //$(el).parents('ul').find('li:visible:eq(0) a').addClass('selected');
- }
- else
- {
- //$(el).parents('ul').find('li:visible:eq(0) a').removeClass('selected')
- }*/
-
- $(el).each(function (i) {
- if (score[k][i])
- {
- select_element(this).show();
- }
- else
- {
- select_element(this).hide();
- }
- }
- );
-
- if($(el).parents('ul').find('li:visible').length==1)
- $(el).parents('ul').find('li:visible:eq(0) a').addClass('selected');
- else
- $(el).parents('ul').find('li:visible:eq(0) a').removeClass('selected');
-
- }
- }
- else
- {
- select_element(el).show();
- }
-
- stripe(el);
- }, options.delay/2);
-
- setTimeout( function () {
- loader('hide');
- }, options.delay/2);
-
- options.onAfter();
-
- }, options.delay/2);
- }
-
- var options = $.extend({
- position: 'prepend',
- attached: 'body',
- formId: 'quicksearch',
- labelText: 'Quick Search',
- labelClass: 'qs_label',
- inputText: null,
- inputClass: 'qs_input',
- loaderId: 'loader',
- loaderClass: 'loader',
- loaderImg: null,
- loaderText: 'Loading...',
- stripeRowClass: null,
- hideElement: null,
- delay: 500,
- focusOnLoad: false,
- onBefore: function () { },
- onAfter: function () { },
- filter: function (i) {
- return i;
- },
- randomElement: 'qs' + Math.floor(Math.random() * 1000000),
- isFieldset: false,
- fixWidths: false
- }, opt);
-
- var timeout;
- var score = {};
- var stripeRowLength = (!is_empty(options.stripeRowClass)) ? options.stripeRowClass.length : 0;
- var doStripe = (stripeRowLength > 0) ? true : false;
- var el = this;
- var cache;
- var selector = $(this).selector;
-
- $.fn.extend({
- reset_cache: function () {
- el = $(selector);
- cache = get_cache(el);
- }
- });
-
- init();
-
- $('input[rel="' + options.randomElement + '"]').keydown(function (e) {
- var keycode = e.keyCode;
- if (!(keycode === 9 || keycode === 13 || keycode === 16 || keycode === 17 || keycode === 18 || keycode === 38 || keycode === 40 || keycode === 224))
- {
- qs();
- }
- });
-
- //$('#quicksearch').submit( function () { addTag()});
-
- return this;
- };
-});
\ No newline at end of file
diff --git a/vendors/lytebox/images/blank.gif b/vendors/lytebox/images/blank.gif
deleted file mode 100644
index 1d11fa9ad..000000000
Binary files a/vendors/lytebox/images/blank.gif and /dev/null differ
diff --git a/vendors/lytebox/images/close_blue.png b/vendors/lytebox/images/close_blue.png
deleted file mode 100644
index 297368c82..000000000
Binary files a/vendors/lytebox/images/close_blue.png and /dev/null differ
diff --git a/vendors/lytebox/images/close_gold.png b/vendors/lytebox/images/close_gold.png
deleted file mode 100644
index d1b847694..000000000
Binary files a/vendors/lytebox/images/close_gold.png and /dev/null differ
diff --git a/vendors/lytebox/images/close_green.png b/vendors/lytebox/images/close_green.png
deleted file mode 100644
index 83909e2d7..000000000
Binary files a/vendors/lytebox/images/close_green.png and /dev/null differ
diff --git a/vendors/lytebox/images/close_grey.png b/vendors/lytebox/images/close_grey.png
deleted file mode 100644
index bc83ac55e..000000000
Binary files a/vendors/lytebox/images/close_grey.png and /dev/null differ
diff --git a/vendors/lytebox/images/close_red.png b/vendors/lytebox/images/close_red.png
deleted file mode 100644
index 3d835bb30..000000000
Binary files a/vendors/lytebox/images/close_red.png and /dev/null differ
diff --git a/vendors/lytebox/images/loading.gif b/vendors/lytebox/images/loading.gif
deleted file mode 100644
index f864d5fd3..000000000
Binary files a/vendors/lytebox/images/loading.gif and /dev/null differ
diff --git a/vendors/lytebox/images/next_blue.gif b/vendors/lytebox/images/next_blue.gif
deleted file mode 100644
index 4666e44d3..000000000
Binary files a/vendors/lytebox/images/next_blue.gif and /dev/null differ
diff --git a/vendors/lytebox/images/next_gold.gif b/vendors/lytebox/images/next_gold.gif
deleted file mode 100644
index c5ba21f5c..000000000
Binary files a/vendors/lytebox/images/next_gold.gif and /dev/null differ
diff --git a/vendors/lytebox/images/next_green.gif b/vendors/lytebox/images/next_green.gif
deleted file mode 100644
index 85a1433b8..000000000
Binary files a/vendors/lytebox/images/next_green.gif and /dev/null differ
diff --git a/vendors/lytebox/images/next_grey.gif b/vendors/lytebox/images/next_grey.gif
deleted file mode 100644
index f1773cd19..000000000
Binary files a/vendors/lytebox/images/next_grey.gif and /dev/null differ
diff --git a/vendors/lytebox/images/next_red.gif b/vendors/lytebox/images/next_red.gif
deleted file mode 100644
index 4ddff3dae..000000000
Binary files a/vendors/lytebox/images/next_red.gif and /dev/null differ
diff --git a/vendors/lytebox/images/pause_blue.png b/vendors/lytebox/images/pause_blue.png
deleted file mode 100644
index 3d4e34f68..000000000
Binary files a/vendors/lytebox/images/pause_blue.png and /dev/null differ
diff --git a/vendors/lytebox/images/pause_gold.png b/vendors/lytebox/images/pause_gold.png
deleted file mode 100644
index ee529699c..000000000
Binary files a/vendors/lytebox/images/pause_gold.png and /dev/null differ
diff --git a/vendors/lytebox/images/pause_green.png b/vendors/lytebox/images/pause_green.png
deleted file mode 100644
index c52f28c1c..000000000
Binary files a/vendors/lytebox/images/pause_green.png and /dev/null differ
diff --git a/vendors/lytebox/images/pause_grey.png b/vendors/lytebox/images/pause_grey.png
deleted file mode 100644
index 1c2e9e0b2..000000000
Binary files a/vendors/lytebox/images/pause_grey.png and /dev/null differ
diff --git a/vendors/lytebox/images/pause_red.png b/vendors/lytebox/images/pause_red.png
deleted file mode 100644
index 5ee4dcf5c..000000000
Binary files a/vendors/lytebox/images/pause_red.png and /dev/null differ
diff --git a/vendors/lytebox/images/play_blue.png b/vendors/lytebox/images/play_blue.png
deleted file mode 100644
index c8cd259c4..000000000
Binary files a/vendors/lytebox/images/play_blue.png and /dev/null differ
diff --git a/vendors/lytebox/images/play_gold.png b/vendors/lytebox/images/play_gold.png
deleted file mode 100644
index 766d6513c..000000000
Binary files a/vendors/lytebox/images/play_gold.png and /dev/null differ
diff --git a/vendors/lytebox/images/play_green.png b/vendors/lytebox/images/play_green.png
deleted file mode 100644
index 6e832a438..000000000
Binary files a/vendors/lytebox/images/play_green.png and /dev/null differ
diff --git a/vendors/lytebox/images/play_grey.png b/vendors/lytebox/images/play_grey.png
deleted file mode 100644
index 8e18760be..000000000
Binary files a/vendors/lytebox/images/play_grey.png and /dev/null differ
diff --git a/vendors/lytebox/images/play_red.png b/vendors/lytebox/images/play_red.png
deleted file mode 100644
index 887d64496..000000000
Binary files a/vendors/lytebox/images/play_red.png and /dev/null differ
diff --git a/vendors/lytebox/images/prev_blue.gif b/vendors/lytebox/images/prev_blue.gif
deleted file mode 100644
index beba13ef5..000000000
Binary files a/vendors/lytebox/images/prev_blue.gif and /dev/null differ
diff --git a/vendors/lytebox/images/prev_gold.gif b/vendors/lytebox/images/prev_gold.gif
deleted file mode 100644
index b48193258..000000000
Binary files a/vendors/lytebox/images/prev_gold.gif and /dev/null differ
diff --git a/vendors/lytebox/images/prev_green.gif b/vendors/lytebox/images/prev_green.gif
deleted file mode 100644
index 2d4e14e52..000000000
Binary files a/vendors/lytebox/images/prev_green.gif and /dev/null differ
diff --git a/vendors/lytebox/images/prev_grey.gif b/vendors/lytebox/images/prev_grey.gif
deleted file mode 100644
index a7f2260a5..000000000
Binary files a/vendors/lytebox/images/prev_grey.gif and /dev/null differ
diff --git a/vendors/lytebox/images/prev_red.gif b/vendors/lytebox/images/prev_red.gif
deleted file mode 100644
index f702e6333..000000000
Binary files a/vendors/lytebox/images/prev_red.gif and /dev/null differ
diff --git a/vendors/lytebox/lytebox.css b/vendors/lytebox/lytebox.css
deleted file mode 100644
index 5303fac1b..000000000
--- a/vendors/lytebox/lytebox.css
+++ /dev/null
@@ -1,93 +0,0 @@
-#lbOverlay { position: fixed; top: 0; left: 0; z-index: 99998; width: 100%; height: 500px; }
- #lbOverlay.grey { background-color: #000000; }
- #lbOverlay.red { background-color: #330000; }
- #lbOverlay.green { background-color: #003300; }
- #lbOverlay.blue { background-color: #011D50; }
- #lbOverlay.gold { background-color: #666600; }
-
-#lbMain { position: absolute; left: 0; width: 100%; z-index: 99999; text-align: center; line-height: 0; }
-#lbMain a img { border: none; }
-
-#lbOuterContainer { position: relative; background-color: #fff; width: 200px; height: 200px; margin: 0 auto; }
- #lbOuterContainer.grey { border: 3px solid #888888; }
- #lbOuterContainer.red { border: 3px solid #DD0000; }
- #lbOuterContainer.green { border: 3px solid #00B000; }
- #lbOuterContainer.blue { border: 3px solid #5F89D8; }
- #lbOuterContainer.gold { border: 3px solid #B0B000; }
-
-#lbDetailsContainer { font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; width: 100%; line-height: 1.4em; overflow: auto; margin: 0 auto; }
- #lbDetailsContainer.grey { border: 3px solid #888888; border-top: none; }
- #lbDetailsContainer.red { border: 3px solid #DD0000; border-top: none; }
- #lbDetailsContainer.green { border: 3px solid #00B000; border-top: none; }
- #lbDetailsContainer.blue { border: 3px solid #5F89D8; border-top: none; }
- #lbDetailsContainer.gold { border: 3px solid #B0B000; border-top: none; }
-
-#lbImageContainer, #lbIframeContainer { padding: 10px; }
-#lbLoading {
- position: absolute; top: 45%; left: 0%; height: 32px; width: 100%; text-align: center; line-height: 0; background: url(images/loading.gif) center no-repeat;
-}
-
-#lbHoverNav { position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; }
-#lbImageContainer>#lbHoverNav { left: 0; }
-#lbHoverNav a { outline: none; }
-
-#lbPrev { width: 49%; height: 100%; background: transparent url(images/blank.gif) no-repeat; display: block; left: 0; float: left; }
- #lbPrev.grey:hover, #lbPrev.grey:visited:hover { background: url(images/prev_grey.gif) left 15% no-repeat; }
- #lbPrev.red:hover, #lbPrev.red:visited:hover { background: url(images/prev_red.gif) left 15% no-repeat; }
- #lbPrev.green:hover, #lbPrev.green:visited:hover { background: url(images/prev_green.gif) left 15% no-repeat; }
- #lbPrev.blue:hover, #lbPrev.blue:visited:hover { background: url(images/prev_blue.gif) left 15% no-repeat; }
- #lbPrev.gold:hover, #lbPrev.gold:visited:hover { background: url(images/prev_gold.gif) left 15% no-repeat; }
-
-#lbNext { width: 49%; height: 100%; background: transparent url(images/blank.gif) no-repeat; display: block; right: 0; float: right; }
- #lbNext.grey:hover, #lbNext.grey:visited:hover { background: url(images/next_grey.gif) right 15% no-repeat; }
- #lbNext.red:hover, #lbNext.red:visited:hover { background: url(images/next_red.gif) right 15% no-repeat; }
- #lbNext.green:hover, #lbNext.green:visited:hover { background: url(images/next_green.gif) right 15% no-repeat; }
- #lbNext.blue:hover, #lbNext.blue:visited:hover { background: url(images/next_blue.gif) right 15% no-repeat; }
- #lbNext.gold:hover, #lbNext.gold:visited:hover { background: url(images/next_gold.gif) right 15% no-repeat; }
-
-#lbPrev2, #lbNext2 { text-decoration: none; font-weight: bold; }
- #lbPrev2.grey, #lbNext2.grey, #lbSpacer.grey { color: #333333; }
- #lbPrev2.red, #lbNext2.red, #lbSpacer.red { color: #620000; }
- #lbPrev2.green, #lbNext2.green, #lbSpacer.green { color: #003300; }
- #lbPrev2.blue, #lbNext2.blue, #lbSpacer.blue { color: #01379E; }
- #lbPrev2.gold, #lbNext2.gold, #lbSpacer.gold { color: #666600; }
-
-#lbPrev2_Off, #lbNext2_Off { font-weight: bold; }
- #lbPrev2_Off.grey, #lbNext2_Off.grey { color: #CCCCCC; }
- #lbPrev2_Off.red, #lbNext2_Off.red { color: #FFCCCC; }
- #lbPrev2_Off.green, #lbNext2_Off.green { color: #82FF82; }
- #lbPrev2_Off.blue, #lbNext2_Off.blue { color: #B7CAEE; }
- #lbPrev2_Off.gold, #lbNext2_Off.gold { color: #E1E100; }
-
-#lbDetailsData { padding: 0 10px; }
- #lbDetailsData.grey { color: #333333; }
- #lbDetailsData.red { color: #620000; }
- #lbDetailsData.green { color: #003300; }
- #lbDetailsData.blue { color: #01379E; }
- #lbDetailsData.gold { color: #666600; }
-
-#lbDetails { width: 60%; float: left; text-align: left; }
-#lbCaption { display: block; font-weight: bold; }
-#lbNumberDisplay { float: left; display: block; padding-bottom: 1.0em; }
-#lbNavDisplay { float: left; display: block; padding-bottom: 1.0em; }
-
-#lbClose { width: 64px; height: 28px; float: right; margin-bottom: 1px; }
- #lbClose.grey { background: url(images/close_grey.png) no-repeat; }
- #lbClose.red { background: url(images/close_red.png) no-repeat; }
- #lbClose.green { background: url(images/close_green.png) no-repeat; }
- #lbClose.blue { background: url(images/close_blue.png) no-repeat; }
- #lbClose.gold { background: url(images/close_gold.png) no-repeat; }
-
-#lbPlay { width: 64px; height: 28px; float: right; margin-bottom: 1px; }
- #lbPlay.grey { background: url(images/play_grey.png) no-repeat; }
- #lbPlay.red { background: url(images/play_red.png) no-repeat; }
- #lbPlay.green { background: url(images/play_green.png) no-repeat; }
- #lbPlay.blue { background: url(images/play_blue.png) no-repeat; }
- #lbPlay.gold { background: url(images/play_gold.png) no-repeat; }
-
-#lbPause { width: 64px; height: 28px; float: right; margin-bottom: 1px; }
- #lbPause.grey { background: url(images/pause_grey.png) no-repeat; }
- #lbPause.red { background: url(images/pause_red.png) no-repeat; }
- #lbPause.green { background: url(images/pause_green.png) no-repeat; }
- #lbPause.blue { background: url(images/pause_blue.png) no-repeat; }
- #lbPause.gold { background: url(images/pause_gold.png) no-repeat; }
\ No newline at end of file
diff --git a/vendors/lytebox/lytebox.js b/vendors/lytebox/lytebox.js
deleted file mode 100644
index 1cf7210d0..000000000
--- a/vendors/lytebox/lytebox.js
+++ /dev/null
@@ -1,843 +0,0 @@
-//***********************************************************************************************************************************/
-// LyteBox v3.22
-//
-// Author: Markus F. Hay
-// Website: http://www.dolem.com/lytebox
-// Date: October 2, 2007
-// License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/)
-// Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE and Strict/Transitional/Loose DOCTYPES):
-// * Firefox: 2.0.0.7, 1.5.0.12
-// * Internet Explorer: 7.0, 6.0 SP2, 5.5 SP2
-// * Opera: 9.23
-//
-// Releases: For up-to-date and complete release information, visit http://www.dolem.com/forum/showthread.php?tid=62
-// * v3.22 (10/02/07)
-// * v3.21 (09/30/07)
-// * v3.20 (07/12/07)
-// * v3.10 (05/28/07)
-// * v3.00 (05/15/07)
-// * v2.02 (11/13/06)
-//
-// Credit: LyteBox was originally derived from the Lightbox class (v2.02) that was written by Lokesh Dhakar. For more
-// information please visit http://huddletogether.com/projects/lightbox2/
-//***********************************************************************************************************************************/
-Array.prototype.removeDuplicates = function () { for (var i = 1; i < this.length; i++) { if (this[i][0] == this[i-1][0]) { this.splice(i,1); } } }
-Array.prototype.empty = function () { for (var i = 0; i <= this.length; i++) { this.shift(); } }
-String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }
-
-function LyteBox() {
- /*** Start Global Configuration ***/
- this.theme = 'grey'; // themes: grey (default), red, green, blue, gold
- this.hideFlash = true; // controls whether or not Flash objects should be hidden
- this.outerBorder = true; // controls whether to show the outer grey (or theme) border
- this.resizeSpeed = 8; // controls the speed of the image resizing (1=slowest and 10=fastest)
- this.maxOpacity = 80; // higher opacity = darker overlay, lower opacity = lighter overlay
- this.navType = 1; // 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number
- this.autoResize = true; // controls whether or not images should be resized if larger than the browser window dimensions
- this.doAnimations = true; // controls whether or not "animate" Lytebox, i.e. resize transition between images, fade in/out effects, etc.
-
- this.borderSize = 12; // if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone...
- /*** End Global Configuration ***/
-
- /*** Configure Slideshow Options ***/
- this.slideInterval = 4000; // Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds)
- this.showNavigation = true; // true to display Next/Prev buttons/text during slideshow, false to hide
- this.showClose = true; // true to display the Close button, false to hide
- this.showDetails = true; // true to display image details (caption, count), false to hide
- this.showPlayPause = true; // true to display pause/play buttons next to close button, false to hide
- this.autoEnd = true; // true to automatically close Lytebox after the last image is reached, false to keep open
- this.pauseOnNextClick = false; // true to pause the slideshow when the "Next" button is clicked
- this.pauseOnPrevClick = true; // true to pause the slideshow when the "Prev" button is clicked
- /*** End Slideshow Configuration ***/
-
- if(this.resizeSpeed > 10) { this.resizeSpeed = 10; }
- if(this.resizeSpeed < 1) { resizeSpeed = 1; }
- this.resizeDuration = (11 - this.resizeSpeed) * 0.15;
- this.resizeWTimerArray = new Array();
- this.resizeWTimerCount = 0;
- this.resizeHTimerArray = new Array();
- this.resizeHTimerCount = 0;
- this.showContentTimerArray = new Array();
- this.showContentTimerCount = 0;
- this.overlayTimerArray = new Array();
- this.overlayTimerCount = 0;
- this.imageTimerArray = new Array();
- this.imageTimerCount = 0;
- this.timerIDArray = new Array();
- this.timerIDCount = 0;
- this.slideshowIDArray = new Array();
- this.slideshowIDCount = 0;
- this.imageArray = new Array();
- this.activeImage = null;
- this.slideArray = new Array();
- this.activeSlide = null;
- this.frameArray = new Array();
- this.activeFrame = null;
- this.checkFrame();
- this.isSlideshow = false;
- this.isLyteframe = false;
- /*@cc_on
- /*@if (@_jscript)
- this.ie = (document.all && !window.opera) ? true : false;
- /*@else @*/
- this.ie = false;
- /*@end
- @*/
- this.ie7 = (this.ie && window.XMLHttpRequest);
- this.initialize();
-}
-LyteBox.prototype.initialize = function() {
- this.updateLyteboxItems();
- var objBody = this.doc.getElementsByTagName("body").item(0);
- if (this.doc.getElementById('lbOverlay')) {
- objBody.removeChild(this.doc.getElementById("lbOverlay"));
- objBody.removeChild(this.doc.getElementById("lbMain"));
- }
- var objOverlay = this.doc.createElement("div");
- objOverlay.setAttribute('id','lbOverlay');
- objOverlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);
- if ((this.ie && !this.ie7) || (this.ie7 && this.doc.compatMode == 'BackCompat')) {
- objOverlay.style.position = 'absolute';
- }
- objOverlay.style.display = 'none';
- objBody.appendChild(objOverlay);
- var objLytebox = this.doc.createElement("div");
- objLytebox.setAttribute('id','lbMain');
- objLytebox.style.display = 'none';
- objBody.appendChild(objLytebox);
- var objOuterContainer = this.doc.createElement("div");
- objOuterContainer.setAttribute('id','lbOuterContainer');
- objOuterContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);
- objLytebox.appendChild(objOuterContainer);
- var objIframeContainer = this.doc.createElement("div");
- objIframeContainer.setAttribute('id','lbIframeContainer');
- objIframeContainer.style.display = 'none';
- objOuterContainer.appendChild(objIframeContainer);
- var objIframe = this.doc.createElement("iframe");
- objIframe.setAttribute('id','lbIframe');
- objIframe.setAttribute('name','lbIframe');
- objIframe.style.display = 'none';
- objIframeContainer.appendChild(objIframe);
- var objImageContainer = this.doc.createElement("div");
- objImageContainer.setAttribute('id','lbImageContainer');
- objOuterContainer.appendChild(objImageContainer);
- var objLyteboxImage = this.doc.createElement("img");
- objLyteboxImage.setAttribute('id','lbImage');
- objImageContainer.appendChild(objLyteboxImage);
- var objLoading = this.doc.createElement("div");
- objLoading.setAttribute('id','lbLoading');
- objOuterContainer.appendChild(objLoading);
- var objDetailsContainer = this.doc.createElement("div");
- objDetailsContainer.setAttribute('id','lbDetailsContainer');
- objDetailsContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);
- objLytebox.appendChild(objDetailsContainer);
- var objDetailsData =this.doc.createElement("div");
- objDetailsData.setAttribute('id','lbDetailsData');
- objDetailsData.setAttribute((this.ie ? 'className' : 'class'), this.theme);
- objDetailsContainer.appendChild(objDetailsData);
- var objDetails = this.doc.createElement("div");
- objDetails.setAttribute('id','lbDetails');
- objDetailsData.appendChild(objDetails);
- var objCaption = this.doc.createElement("span");
- objCaption.setAttribute('id','lbCaption');
- objDetails.appendChild(objCaption);
- var objHoverNav = this.doc.createElement("div");
- objHoverNav.setAttribute('id','lbHoverNav');
- objImageContainer.appendChild(objHoverNav);
- var objBottomNav = this.doc.createElement("div");
- objBottomNav.setAttribute('id','lbBottomNav');
- objDetailsData.appendChild(objBottomNav);
- var objPrev = this.doc.createElement("a");
- objPrev.setAttribute('id','lbPrev');
- objPrev.setAttribute((this.ie ? 'className' : 'class'), this.theme);
- objPrev.setAttribute('href','#');
- objHoverNav.appendChild(objPrev);
- var objNext = this.doc.createElement("a");
- objNext.setAttribute('id','lbNext');
- objNext.setAttribute((this.ie ? 'className' : 'class'), this.theme);
- objNext.setAttribute('href','#');
- objHoverNav.appendChild(objNext);
- var objNumberDisplay = this.doc.createElement("span");
- objNumberDisplay.setAttribute('id','lbNumberDisplay');
- objDetails.appendChild(objNumberDisplay);
- var objNavDisplay = this.doc.createElement("span");
- objNavDisplay.setAttribute('id','lbNavDisplay');
- objNavDisplay.style.display = 'none';
- objDetails.appendChild(objNavDisplay);
- var objClose = this.doc.createElement("a");
- objClose.setAttribute('id','lbClose');
- objClose.setAttribute((this.ie ? 'className' : 'class'), this.theme);
- objClose.setAttribute('href','#');
- objBottomNav.appendChild(objClose);
- var objPause = this.doc.createElement("a");
- objPause.setAttribute('id','lbPause');
- objPause.setAttribute((this.ie ? 'className' : 'class'), this.theme);
- objPause.setAttribute('href','#');
- objPause.style.display = 'none';
- objBottomNav.appendChild(objPause);
- var objPlay = this.doc.createElement("a");
- objPlay.setAttribute('id','lbPlay');
- objPlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);
- objPlay.setAttribute('href','#');
- objPlay.style.display = 'none';
- objBottomNav.appendChild(objPlay);
-};
-LyteBox.prototype.updateLyteboxItems = function() {
- var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');
- for (var i = 0; i < anchors.length; i++) {
- var anchor = anchors[i];
- var relAttribute = String(anchor.getAttribute('rel'));
- if (anchor.getAttribute('href')) {
- if (relAttribute.toLowerCase().match('lytebox')) {
- anchor.onclick = function () { myLytebox.start(this, false, false); return false; }
- } else if (relAttribute.toLowerCase().match('lyteshow')) {
- anchor.onclick = function () { myLytebox.start(this, true, false); return false; }
- } else if (relAttribute.toLowerCase().match('lyteframe')) {
- anchor.onclick = function () { myLytebox.start(this, false, true); return false; }
- }
- }
- }
-};
-LyteBox.prototype.start = function(imageLink, doSlide, doFrame) {
- if (this.ie && !this.ie7) { this.toggleSelects('hide'); }
- if (this.hideFlash) { this.toggleFlash('hide'); }
- this.isLyteframe = (doFrame ? true : false);
- var pageSize = this.getPageSize();
- var objOverlay = this.doc.getElementById('lbOverlay');
- var objBody = this.doc.getElementsByTagName("body").item(0);
- objOverlay.style.height = pageSize[1] + "px";
- objOverlay.style.display = '';
- this.appear('lbOverlay', (this.doAnimations ? 0 : this.maxOpacity));
- var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');
- if (this.isLyteframe) {
- this.frameArray = [];
- this.frameNum = 0;
- if ((imageLink.getAttribute('rel') == 'lyteframe')) {
- var rev = imageLink.getAttribute('rev');
- this.frameArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev)));
- } else {
- if (imageLink.getAttribute('rel').indexOf('lyteframe') != -1) {
- for (var i = 0; i < anchors.length; i++) {
- var anchor = anchors[i];
- if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
- var rev = anchor.getAttribute('rev');
- this.frameArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev)));
- }
- }
- this.frameArray.removeDuplicates();
- while(this.frameArray[this.frameNum][0] != imageLink.getAttribute('href')) { this.frameNum++; }
- }
- }
- } else {
- this.imageArray = [];
- this.imageNum = 0;
- this.slideArray = [];
- this.slideNum = 0;
- if ((imageLink.getAttribute('rel') == 'lytebox')) {
- this.imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title')));
- } else {
- if (imageLink.getAttribute('rel').indexOf('lytebox') != -1) {
- for (var i = 0; i < anchors.length; i++) {
- var anchor = anchors[i];
- if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
- this.imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));
- }
- }
- this.imageArray.removeDuplicates();
- while(this.imageArray[this.imageNum][0] != imageLink.getAttribute('href')) { this.imageNum++; }
- }
- if (imageLink.getAttribute('rel').indexOf('lyteshow') != -1) {
- for (var i = 0; i < anchors.length; i++) {
- var anchor = anchors[i];
- if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
- this.slideArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));
- }
- }
- this.slideArray.removeDuplicates();
- while(this.slideArray[this.slideNum][0] != imageLink.getAttribute('href')) { this.slideNum++; }
- }
- }
- }
- var object = this.doc.getElementById('lbMain');
- object.style.top = (this.getPageScroll() + (pageSize[3] / 15)) + "px";
- object.style.display = '';
- if (!this.outerBorder) {
- this.doc.getElementById('lbOuterContainer').style.border = 'none';
- this.doc.getElementById('lbDetailsContainer').style.border = 'none';
- } else {
- this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
- this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
- }
- this.doc.getElementById('lbOverlay').onclick = function() { myLytebox.end(); return false; }
- this.doc.getElementById('lbMain').onclick = function(e) {
- var e = e;
- if (!e) {
- if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
- e = window.parent.window.event;
- } else {
- e = window.event;
- }
- }
- var id = (e.target ? e.target.id : e.srcElement.id);
- if (id == 'lbMain') { myLytebox.end(); return false; }
- }
- this.doc.getElementById('lbClose').onclick = function() { myLytebox.end(); return false; }
- this.doc.getElementById('lbPause').onclick = function() { myLytebox.togglePlayPause("lbPause", "lbPlay"); return false; }
- this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; }
- this.isSlideshow = doSlide;
- this.isPaused = (this.slideNum != 0 ? true : false);
- if (this.isSlideshow && this.showPlayPause && this.isPaused) {
- this.doc.getElementById('lbPlay').style.display = '';
- this.doc.getElementById('lbPause').style.display = 'none';
- }
- if (this.isLyteframe) {
- this.changeContent(this.frameNum);
- } else {
- if (this.isSlideshow) {
- this.changeContent(this.slideNum);
- } else {
- this.changeContent(this.imageNum);
- }
- }
-};
-LyteBox.prototype.changeContent = function(imageNum) {
- if (this.isSlideshow) {
- for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
- }
- this.activeImage = this.activeSlide = this.activeFrame = imageNum;
- if (!this.outerBorder) {
- this.doc.getElementById('lbOuterContainer').style.border = 'none';
- this.doc.getElementById('lbDetailsContainer').style.border = 'none';
- } else {
- this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
- this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
- }
- this.doc.getElementById('lbLoading').style.display = '';
- this.doc.getElementById('lbImage').style.display = 'none';
- this.doc.getElementById('lbIframe').style.display = 'none';
- this.doc.getElementById('lbPrev').style.display = 'none';
- this.doc.getElementById('lbNext').style.display = 'none';
- this.doc.getElementById('lbIframeContainer').style.display = 'none';
- this.doc.getElementById('lbDetailsContainer').style.display = 'none';
- this.doc.getElementById('lbNumberDisplay').style.display = 'none';
- if (this.navType == 2 || this.isLyteframe) {
- object = this.doc.getElementById('lbNavDisplay');
- object.innerHTML = ' || ';
- object.style.display = 'none';
- }
- if (this.isLyteframe) {
- var iframe = myLytebox.doc.getElementById('lbIframe');
- var styles = this.frameArray[this.activeFrame][2];
- var aStyles = styles.split(';');
- for (var i = 0; i < aStyles.length; i++) {
- if (aStyles[i].indexOf('width:') >= 0) {
- var w = aStyles[i].replace('width:', '');
- iframe.width = w.trim();
- } else if (aStyles[i].indexOf('height:') >= 0) {
- var h = aStyles[i].replace('height:', '');
- iframe.height = h.trim();
- } else if (aStyles[i].indexOf('scrolling:') >= 0) {
- var s = aStyles[i].replace('scrolling:', '');
- iframe.scrolling = s.trim();
- } else if (aStyles[i].indexOf('border:') >= 0) {
- // Not implemented yet, as there are cross-platform issues with setting the border (from a GUI standpoint)
- //var b = aStyles[i].replace('border:', '');
- //iframe.style.border = b.trim();
- }
- }
- this.resizeContainer(parseInt(iframe.width), parseInt(iframe.height));
- } else {
- imgPreloader = new Image();
- imgPreloader.onload = function() {
- var imageWidth = imgPreloader.width;
- var imageHeight = imgPreloader.height;
- if (myLytebox.autoResize) {
- var pagesize = myLytebox.getPageSize();
- var x = pagesize[2] - 150;
- var y = pagesize[3] - 150;
- if (imageWidth > x) {
- imageHeight = Math.round(imageHeight * (x / imageWidth));
- imageWidth = x;
- if (imageHeight > y) {
- imageWidth = Math.round(imageWidth * (y / imageHeight));
- imageHeight = y;
- }
- } else if (imageHeight > y) {
- imageWidth = Math.round(imageWidth * (y / imageHeight));
- imageHeight = y;
- if (imageWidth > x) {
- imageHeight = Math.round(imageHeight * (x / imageWidth));
- imageWidth = x;
- }
- }
- }
- var lbImage = myLytebox.doc.getElementById('lbImage')
- lbImage.src = (myLytebox.isSlideshow ? myLytebox.slideArray[myLytebox.activeSlide][0] : myLytebox.imageArray[myLytebox.activeImage][0]);
- lbImage.width = imageWidth;
- lbImage.height = imageHeight;
- myLytebox.resizeContainer(imageWidth, imageHeight);
- imgPreloader.onload = function() {};
- }
- imgPreloader.src = (this.isSlideshow ? this.slideArray[this.activeSlide][0] : this.imageArray[this.activeImage][0]);
- }
-};
-LyteBox.prototype.resizeContainer = function(imgWidth, imgHeight) {
- this.wCur = this.doc.getElementById('lbOuterContainer').offsetWidth;
- this.hCur = this.doc.getElementById('lbOuterContainer').offsetHeight;
- this.xScale = ((imgWidth + (this.borderSize * 2)) / this.wCur) * 100;
- this.yScale = ((imgHeight + (this.borderSize * 2)) / this.hCur) * 100;
- var wDiff = (this.wCur - this.borderSize * 2) - imgWidth;
- var hDiff = (this.hCur - this.borderSize * 2) - imgHeight;
- if (!(hDiff == 0)) {
- this.hDone = false;
- this.resizeH('lbOuterContainer', this.hCur, imgHeight + this.borderSize*2, this.getPixelRate(this.hCur, imgHeight));
- } else {
- this.hDone = true;
- }
- if (!(wDiff == 0)) {
- this.wDone = false;
- this.resizeW('lbOuterContainer', this.wCur, imgWidth + this.borderSize*2, this.getPixelRate(this.wCur, imgWidth));
- } else {
- this.wDone = true;
- }
- if ((hDiff == 0) && (wDiff == 0)) {
- if (this.ie){ this.pause(250); } else { this.pause(100); }
- }
- this.doc.getElementById('lbPrev').style.height = imgHeight + "px";
- this.doc.getElementById('lbNext').style.height = imgHeight + "px";
- this.doc.getElementById('lbDetailsContainer').style.width = (imgWidth + (this.borderSize * 2) + (this.ie && this.doc.compatMode == "BackCompat" && this.outerBorder ? 2 : 0)) + "px";
- this.showContent();
-};
-LyteBox.prototype.showContent = function() {
- if (this.wDone && this.hDone) {
- for (var i = 0; i < this.showContentTimerCount; i++) { window.clearTimeout(this.showContentTimerArray[i]); }
- if (this.outerBorder) {
- this.doc.getElementById('lbOuterContainer').style.borderBottom = 'none';
- }
- this.doc.getElementById('lbLoading').style.display = 'none';
- if (this.isLyteframe) {
- this.doc.getElementById('lbIframe').style.display = '';
- this.appear('lbIframe', (this.doAnimations ? 0 : 100));
- } else {
- this.doc.getElementById('lbImage').style.display = '';
- this.appear('lbImage', (this.doAnimations ? 0 : 100));
- this.preloadNeighborImages();
- }
- if (this.isSlideshow) {
- if(this.activeSlide == (this.slideArray.length - 1)) {
- if (this.autoEnd) {
- this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.end('slideshow')", this.slideInterval);
- }
- } else {
- if (!this.isPaused) {
- this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")", this.slideInterval);
- }
- }
- this.doc.getElementById('lbHoverNav').style.display = (this.showNavigation && this.navType == 1 ? '' : 'none');
- this.doc.getElementById('lbClose').style.display = (this.showClose ? '' : 'none');
- this.doc.getElementById('lbDetails').style.display = (this.showDetails ? '' : 'none');
- this.doc.getElementById('lbPause').style.display = (this.showPlayPause && !this.isPaused ? '' : 'none');
- this.doc.getElementById('lbPlay').style.display = (this.showPlayPause && !this.isPaused ? 'none' : '');
- this.doc.getElementById('lbNavDisplay').style.display = (this.showNavigation && this.navType == 2 ? '' : 'none');
- } else {
- this.doc.getElementById('lbHoverNav').style.display = (this.navType == 1 && !this.isLyteframe ? '' : 'none');
- if ((this.navType == 2 && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) {
- this.doc.getElementById('lbNavDisplay').style.display = '';
- } else {
- this.doc.getElementById('lbNavDisplay').style.display = 'none';
- }
- this.doc.getElementById('lbClose').style.display = '';
- this.doc.getElementById('lbDetails').style.display = '';
- this.doc.getElementById('lbPause').style.display = 'none';
- this.doc.getElementById('lbPlay').style.display = 'none';
- }
- this.doc.getElementById('lbImageContainer').style.display = (this.isLyteframe ? 'none' : '');
- this.doc.getElementById('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none');
- try {
- this.doc.getElementById('lbIframe').src = this.frameArray[this.activeFrame][0];
- } catch(e) { }
- } else {
- this.showContentTimerArray[this.showContentTimerCount++] = setTimeout("myLytebox.showContent()", 200);
- }
-};
-LyteBox.prototype.updateDetails = function() {
- var object = this.doc.getElementById('lbCaption');
- var sTitle = (this.isSlideshow ? this.slideArray[this.activeSlide][1] : (this.isLyteframe ? this.frameArray[this.activeFrame][1] : this.imageArray[this.activeImage][1]));
- object.style.display = '';
- object.innerHTML = (sTitle == null ? '' : sTitle);
- this.updateNav();
- this.doc.getElementById('lbDetailsContainer').style.display = '';
- object = this.doc.getElementById('lbNumberDisplay');
- if (this.isSlideshow && this.slideArray.length > 1) {
- object.style.display = '';
- object.innerHTML = "Image " + eval(this.activeSlide + 1) + " of " + this.slideArray.length;
- this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 && this.showNavigation ? '' : 'none');
- } else if (this.imageArray.length > 1 && !this.isLyteframe) {
- object.style.display = '';
- object.innerHTML = "Image " + eval(this.activeImage + 1) + " of " + this.imageArray.length;
- this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 ? '' : 'none');
- } else if (this.frameArray.length > 1 && this.isLyteframe) {
- object.style.display = '';
- object.innerHTML = "Page " + eval(this.activeFrame + 1) + " of " + this.frameArray.length;
- this.doc.getElementById('lbNavDisplay').style.display = '';
- } else {
- this.doc.getElementById('lbNavDisplay').style.display = 'none';
- }
- this.appear('lbDetailsContainer', (this.doAnimations ? 0 : 100));
-};
-LyteBox.prototype.updateNav = function() {
- if (this.isSlideshow) {
- if (this.activeSlide != 0) {
- var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
- object.style.display = '';
- object.onclick = function() {
- if (myLytebox.pauseOnPrevClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
- myLytebox.changeContent(myLytebox.activeSlide - 1); return false;
- }
- } else {
- if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
- }
- if (this.activeSlide != (this.slideArray.length - 1)) {
- var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
- object.style.display = '';
- object.onclick = function() {
- if (myLytebox.pauseOnNextClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
- myLytebox.changeContent(myLytebox.activeSlide + 1); return false;
- }
- } else {
- if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
- }
- } else if (this.isLyteframe) {
- if(this.activeFrame != 0) {
- var object = this.doc.getElementById('lbPrev2');
- object.style.display = '';
- object.onclick = function() {
- myLytebox.changeContent(myLytebox.activeFrame - 1); return false;
- }
- } else {
- this.doc.getElementById('lbPrev2_Off').style.display = '';
- }
- if(this.activeFrame != (this.frameArray.length - 1)) {
- var object = this.doc.getElementById('lbNext2');
- object.style.display = '';
- object.onclick = function() {
- myLytebox.changeContent(myLytebox.activeFrame + 1); return false;
- }
- } else {
- this.doc.getElementById('lbNext2_Off').style.display = '';
- }
- } else {
- if(this.activeImage != 0) {
- var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
- object.style.display = '';
- object.onclick = function() {
- myLytebox.changeContent(myLytebox.activeImage - 1); return false;
- }
- } else {
- if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
- }
- if(this.activeImage != (this.imageArray.length - 1)) {
- var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
- object.style.display = '';
- object.onclick = function() {
- myLytebox.changeContent(myLytebox.activeImage + 1); return false;
- }
- } else {
- if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
- }
- }
- this.enableKeyboardNav();
-};
-LyteBox.prototype.enableKeyboardNav = function() { document.onkeydown = this.keyboardAction; };
-LyteBox.prototype.disableKeyboardNav = function() { document.onkeydown = ''; };
-LyteBox.prototype.keyboardAction = function(e) {
- var keycode = key = escape = null;
- keycode = (e == null) ? event.keyCode : e.which;
- key = String.fromCharCode(keycode).toLowerCase();
- escape = (e == null) ? 27 : e.DOM_VK_ESCAPE;
- if ((key == 'x') || (key == 'c') || (keycode == escape)) {
- myLytebox.end();
- } else if ((key == 'p') || (keycode == 37)) {
- if (myLytebox.isSlideshow) {
- if(myLytebox.activeSlide != 0) {
- myLytebox.disableKeyboardNav();
- myLytebox.changeContent(myLytebox.activeSlide - 1);
- }
- } else if (myLytebox.isLyteframe) {
- if(myLytebox.activeFrame != 0) {
- myLytebox.disableKeyboardNav();
- myLytebox.changeContent(myLytebox.activeFrame - 1);
- }
- } else {
- if(myLytebox.activeImage != 0) {
- myLytebox.disableKeyboardNav();
- myLytebox.changeContent(myLytebox.activeImage - 1);
- }
- }
- } else if ((key == 'n') || (keycode == 39)) {
- if (myLytebox.isSlideshow) {
- if(myLytebox.activeSlide != (myLytebox.slideArray.length - 1)) {
- myLytebox.disableKeyboardNav();
- myLytebox.changeContent(myLytebox.activeSlide + 1);
- }
- } else if (myLytebox.isLyteframe) {
- if(myLytebox.activeFrame != (myLytebox.frameArray.length - 1)) {
- myLytebox.disableKeyboardNav();
- myLytebox.changeContent(myLytebox.activeFrame + 1);
- }
- } else {
- if(myLytebox.activeImage != (myLytebox.imageArray.length - 1)) {
- myLytebox.disableKeyboardNav();
- myLytebox.changeContent(myLytebox.activeImage + 1);
- }
- }
- }
-};
-LyteBox.prototype.preloadNeighborImages = function() {
- if (this.isSlideshow) {
- if ((this.slideArray.length - 1) > this.activeSlide) {
- preloadNextImage = new Image();
- preloadNextImage.src = this.slideArray[this.activeSlide + 1][0];
- }
- if(this.activeSlide > 0) {
- preloadPrevImage = new Image();
- preloadPrevImage.src = this.slideArray[this.activeSlide - 1][0];
- }
- } else {
- if ((this.imageArray.length - 1) > this.activeImage) {
- preloadNextImage = new Image();
- preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
- }
- if(this.activeImage > 0) {
- preloadPrevImage = new Image();
- preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
- }
- }
-};
-LyteBox.prototype.togglePlayPause = function(hideID, showID) {
- if (this.isSlideshow && hideID == "lbPause") {
- for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
- }
- this.doc.getElementById(hideID).style.display = 'none';
- this.doc.getElementById(showID).style.display = '';
- if (hideID == "lbPlay") {
- this.isPaused = false;
- if (this.activeSlide == (this.slideArray.length - 1)) {
- this.end();
- } else {
- this.changeContent(this.activeSlide + 1);
- }
- } else {
- this.isPaused = true;
- }
-};
-LyteBox.prototype.end = function(caller) {
- var closeClick = (caller == 'slideshow' ? false : true);
- if (this.isSlideshow && this.isPaused && !closeClick) { return; }
- this.disableKeyboardNav();
- this.doc.getElementById('lbMain').style.display = 'none';
- this.fade('lbOverlay', (this.doAnimations ? this.maxOpacity : 0));
- this.toggleSelects('visible');
- if (this.hideFlash) { this.toggleFlash('visible'); }
- if (this.isSlideshow) {
- for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
- }
- if (this.isLyteframe) {
- this.initialize();
- }
-};
-LyteBox.prototype.checkFrame = function() {
- if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
- this.isFrame = true;
- this.lytebox = "window.parent." + window.name + ".myLytebox";
- this.doc = parent.document;
- } else {
- this.isFrame = false;
- this.lytebox = "myLytebox";
- this.doc = document;
- }
-};
-LyteBox.prototype.getPixelRate = function(cur, img) {
- var diff = (img > cur) ? img - cur : cur - img;
- if (diff >= 0 && diff <= 100) { return 10; }
- if (diff > 100 && diff <= 200) { return 15; }
- if (diff > 200 && diff <= 300) { return 20; }
- if (diff > 300 && diff <= 400) { return 25; }
- if (diff > 400 && diff <= 500) { return 30; }
- if (diff > 500 && diff <= 600) { return 35; }
- if (diff > 600 && diff <= 700) { return 40; }
- if (diff > 700) { return 45; }
-};
-LyteBox.prototype.appear = function(id, opacity) {
- var object = this.doc.getElementById(id).style;
- object.opacity = (opacity / 100);
- object.MozOpacity = (opacity / 100);
- object.KhtmlOpacity = (opacity / 100);
- object.filter = "alpha(opacity=" + (opacity + 10) + ")";
- if (opacity == 100 && (id == 'lbImage' || id == 'lbIframe')) {
- try { object.removeAttribute("filter"); } catch(e) {} /* Fix added for IE Alpha Opacity Filter bug. */
- this.updateDetails();
- } else if (opacity >= this.maxOpacity && id == 'lbOverlay') {
- for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); }
- return;
- } else if (opacity >= 100 && id == 'lbDetailsContainer') {
- try { object.removeAttribute("filter"); } catch(e) {} /* Fix added for IE Alpha Opacity Filter bug. */
- for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); }
- this.doc.getElementById('lbOverlay').style.height = this.getPageSize()[1] + "px";
- } else {
- if (id == 'lbOverlay') {
- this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+20) + ")", 1);
- } else {
- this.imageTimerArray[this.imageTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+10) + ")", 1);
- }
- }
-};
-LyteBox.prototype.fade = function(id, opacity) {
- var object = this.doc.getElementById(id).style;
- object.opacity = (opacity / 100);
- object.MozOpacity = (opacity / 100);
- object.KhtmlOpacity = (opacity / 100);
- object.filter = "alpha(opacity=" + opacity + ")";
- if (opacity <= 0) {
- try {
- object.display = 'none';
- } catch(err) { }
- } else if (id == 'lbOverlay') {
- this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-20) + ")", 1);
- } else {
- this.timerIDArray[this.timerIDCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-10) + ")", 1);
- }
-};
-LyteBox.prototype.resizeW = function(id, curW, maxW, pixelrate, speed) {
- if (!this.hDone) {
- this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + curW + ", " + maxW + ", " + pixelrate + ")", 100);
- return;
- }
- var object = this.doc.getElementById(id);
- var timer = speed ? speed : (this.resizeDuration/2);
- var newW = (this.doAnimations ? curW : maxW);
- object.style.width = (newW) + "px";
- if (newW < maxW) {
- newW += (newW + pixelrate >= maxW) ? (maxW - newW) : pixelrate;
- } else if (newW > maxW) {
- newW -= (newW - pixelrate <= maxW) ? (newW - maxW) : pixelrate;
- }
- this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + newW + ", " + maxW + ", " + pixelrate + ", " + (timer+0.02) + ")", timer+0.02);
- if (parseInt(object.style.width) == maxW) {
- this.wDone = true;
- for (var i = 0; i < this.resizeWTimerCount; i++) { window.clearTimeout(this.resizeWTimerArray[i]); }
- }
-};
-LyteBox.prototype.resizeH = function(id, curH, maxH, pixelrate, speed) {
- var timer = speed ? speed : (this.resizeDuration/2);
- var object = this.doc.getElementById(id);
- var newH = (this.doAnimations ? curH : maxH);
- object.style.height = (newH) + "px";
- if (newH < maxH) {
- newH += (newH + pixelrate >= maxH) ? (maxH - newH) : pixelrate;
- } else if (newH > maxH) {
- newH -= (newH - pixelrate <= maxH) ? (newH - maxH) : pixelrate;
- }
- this.resizeHTimerArray[this.resizeHTimerCount++] = setTimeout("myLytebox.resizeH('" + id + "', " + newH + ", " + maxH + ", " + pixelrate + ", " + (timer+.02) + ")", timer+.02);
- if (parseInt(object.style.height) == maxH) {
- this.hDone = true;
- for (var i = 0; i < this.resizeHTimerCount; i++) { window.clearTimeout(this.resizeHTimerArray[i]); }
- }
-};
-LyteBox.prototype.getPageScroll = function() {
- if (self.pageYOffset) {
- return this.isFrame ? parent.pageYOffset : self.pageYOffset;
- } else if (this.doc.documentElement && this.doc.documentElement.scrollTop){
- return this.doc.documentElement.scrollTop;
- } else if (document.body) {
- return this.doc.body.scrollTop;
- }
-};
-LyteBox.prototype.getPageSize = function() {
- var xScroll, yScroll, windowWidth, windowHeight;
- if (window.innerHeight && window.scrollMaxY) {
- xScroll = this.doc.scrollWidth;
- yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY);
- } else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){
- xScroll = this.doc.body.scrollWidth;
- yScroll = this.doc.body.scrollHeight;
- } else {
- xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth;
- yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight;
- xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll;
- yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll;
- }
- if (self.innerHeight) {
- windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth;
- windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight;
- } else if (document.documentElement && document.documentElement.clientHeight) {
- windowWidth = this.doc.documentElement.clientWidth;
- windowHeight = this.doc.documentElement.clientHeight;
- } else if (document.body) {
- windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth;
- windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight;
- windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth;
- windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight;
- }
- var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
- var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
- return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
-};
-LyteBox.prototype.toggleFlash = function(state) {
- var objects = this.doc.getElementsByTagName("object");
- for (var i = 0; i < objects.length; i++) {
- objects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
- }
- var embeds = this.doc.getElementsByTagName("embed");
- for (var i = 0; i < embeds.length; i++) {
- embeds[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
- }
- if (this.isFrame) {
- for (var i = 0; i < parent.frames.length; i++) {
- try {
- objects = parent.frames[i].window.document.getElementsByTagName("object");
- for (var j = 0; j < objects.length; j++) {
- objects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
- }
- } catch(e) { }
- try {
- embeds = parent.frames[i].window.document.getElementsByTagName("embed");
- for (var j = 0; j < embeds.length; j++) {
- embeds[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
- }
- } catch(e) { }
- }
- }
-};
-LyteBox.prototype.toggleSelects = function(state) {
- var selects = this.doc.getElementsByTagName("select");
- for (var i = 0; i < selects.length; i++ ) {
- selects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
- }
- if (this.isFrame) {
- for (var i = 0; i < parent.frames.length; i++) {
- try {
- selects = parent.frames[i].window.document.getElementsByTagName("select");
- for (var j = 0; j < selects.length; j++) {
- selects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
- }
- } catch(e) { }
- }
- }
-};
-LyteBox.prototype.pause = function(numberMillis) {
- var now = new Date();
- var exitTime = now.getTime() + numberMillis;
- while (true) {
- now = new Date();
- if (now.getTime() > exitTime) { return; }
- }
-};
-if (window.addEventListener) {
- window.addEventListener("load",initLytebox,false);
-} else if (window.attachEvent) {
- window.attachEvent("onload",initLytebox);
-} else {
- window.onload = function() {initLytebox();}
-}
-function initLytebox() { myLytebox = new LyteBox(); }
\ No newline at end of file
--
cgit v1.2.3
From be94a34e652571eb61c3e306abfb7cce673823d7 Mon Sep 17 00:00:00 2001
From: cash
' . elgg_echo('tidypics:settings:heading:groups') . '
';
-echo '';
foreach ($image_guids as $image_guid) {
$image = get_entity($image_guid);
$img = elgg_view('output/img', array(
- 'src' => $image->getSrcURL(),
+ 'src' => $image->getIconURL(),
));
echo "
';
+
+foreach ($stats as $str => $value) {
+ $str = elgg_echo("tidypics:stats:$str");
+ $value = (int)$value;
+
+ $content .= <<
+
';
+
+echo elgg_view_module('inline', elgg_echo('tidypics:stats'), $content);
\ No newline at end of file
diff --git a/views/default/tidypics/admin/stats.php b/views/default/tidypics/admin/stats.php
deleted file mode 100644
index 0b088dc2e..000000000
--- a/views/default/tidypics/admin/stats.php
+++ /dev/null
@@ -1,36 +0,0 @@
-dbprefix}entities where subtype={$img_type}";
-$total = get_data_row($query);
-$num_images = $total->total;
-
-$img_type = get_subtype_id('object', 'album');
-$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
-$total = get_data_row($query);
-$num_albums = $total->total;
-
-$num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment');
-$num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment');
-
-$num_views = count_annotations(0, 'object', 'image', 'tp_view');
-
-if (get_plugin_setting('tagging', 'tidypics') != "disabled") {
- $num_tags = count_annotations(0, 'object', 'image', 'phototag');
-}
-?>
-$str:
+ $value
+
+HTML;
+}
+
+$content .= '
- Photos:
- Albums:
- Comments on photos:
- Comments on albums:
- Total views:
-
- Photo tags:
-
-
-
-
-
-
- PHP version
-
-
-
-
- GD
-
- Elgg requires the GD extension to be loaded
-
-
- IMagick PHP extension
-
-
-
-
- exec()
-
- Required for ImageMagick command line
-
-
- Memory Available to PHP
-
- Change memory_limit to increase
-
-
- Memory Used to Load This Page
-
- This is approximately the minimum per page
-
-
- Max File Upload Size
-
- Max size of an uploaded image
-
-
- Max Post Size
-
- Max post size = sum of images + html form
-
-
- Max Input Time
- s
- Time script waits for upload to finish
-
-
- Max Execution Time
- s
- Max time a script will run
-
-
- GD imagejpeg
-
-
-
-
- GD imagepng
-
-
-
-
- GD imagegif
-
-
-
-
- EXIF
-
-
-
-
- Cookie only sessions
-
- Cookie only sessions may affect the Flash uploader
-
+
+
+
+
+
+
+
+
+
+ GD
+
+
+
+
+ IMagick
+
+
+
+
+ exec()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ s
+
+
+
+
+ s
+
+
+
+ GD imagejpeg
+
+
+
+
+ GD imagepng
+
+
+
+
+ GD imagegif
+
+
+
+
+ EXIF
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
- GD
-
-
-
-
- IMagick
-
-
-
-
- exec()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- s
-
-
-
-
- s
-
-
-
- GD imagejpeg
-
-
-
-
- GD imagepng
-
-
-
-
- GD imagegif
-
-
-
-
- EXIF
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ GD
+
+
+
+
+ IMagick
+
+
+
+
+ exec()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ s
+
+
+
+
+ s
+
+
+
+ GD imagejpeg
+
+
+
+
+ GD imagepng
+
+
+
+
+ GD imagegif
+
+
+
+
+ EXIF
+
+
+
+
+
+
+
+
-Overview
-Testing ImageMagick Commandline
-
-
-
-
-wwwroot}mod/tidypics/thumbnail.php?file_guid={$guid}&size=large\" alt=\"{$title}\" />";
diff --git a/actions/admin/imtest.php b/actions/admin/imtest.php
deleted file mode 100644
index a58643d0e..000000000
--- a/actions/admin/imtest.php
+++ /dev/null
@@ -1,18 +0,0 @@
-getFilename();
+$container_guid = $image->container_guid;
+if (!$filename || !$container_guid) {
+ register_error(elgg_echo('tidypics:thumbnail_tool:invalid_image_info'));
+ forward(REFERER);
+}
+
+$title = $image->title;
+$prefix = "image/$container_guid/";
+$filestorename = substr($filename, strlen($prefix));
+
+$image_lib = elgg_get_plugin_setting('image_lib', 'tidypics');
+if (!$image_lib) {
+ $image_lib = "GD";
+}
+
+// ImageMagick command line
+if ($image_lib == 'ImageMagick') {
+ if (!tp_create_im_cmdline_thumbnails($image, $prefix, $filestorename)) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING);
+ register_error(elgg_echo('tidypics:thumbnail_tool:create_failed'));
+ forward(REFERER);
+ }
+
+// imagick PHP extension
+} else if ($image_lib == 'ImageMagickPHP') {
+ if (!tp_create_imagick_thumbnails($image, $prefix, $filestorename)) {
+ trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING);
+ register_error(elgg_echo('tidypics:thumbnail_tool:create_failed'));
+ forward(REFERER);
+ }
+// gd
+} else {
+ if (!tp_create_gd_thumbnails($image, $prefix, $filestorename)) {
+ trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING);
+ register_error(elgg_echo('tidypics:thumbnail_tool:create_failed'));
+ forward(REFERER);
+ }
+}
+
+$url = elgg_normalize_url("photos/thumbnail/$guid/large");
+system_message(elgg_echo('tidypics:thumbnail_tool:created'));
+
+if (elgg_is_xhr()) {
+ echo json_encode(array(
+ 'guid' => $guid,
+ 'title' => $title,
+ 'thumbnail_src' => $url
+ ));
+}
+
+forward(REFERER);
\ No newline at end of file
diff --git a/actions/photos/admin/imtest.php b/actions/photos/admin/imtest.php
new file mode 100644
index 000000000..a58643d0e
--- /dev/null
+++ b/actions/photos/admin/imtest.php
@@ -0,0 +1,18 @@
+ "by %s users (not including you)",
'tidypics:viewsbyothers' => "(%s by you)",
'tidypics:administration' => 'Tidypics Administration',
- 'tidypics:stats' => 'Tidypics Stats',
+ 'tidypics:stats' => 'Stats',
'tidypics:nophotosingroup' => 'This groups does not have any photos yet',
'tidypics:upgrade' => 'Upgrade',
'tidypics:sort' => 'Sorting the %s album',
@@ -103,7 +103,7 @@ $english = array(
'tidypics:stats:tags' => 'Total tags',
// server analysis
- 'tidypics:server_info' => 'Server information',
+ 'tidypics:server_info' => 'Server Information',
'tidypics:server_info:gd_desc' => 'Elgg requires the GD extension to be loaded',
'tidypics:server_info:exec_desc' => 'Required for ImageMagick command line',
'tidypics:server_info:memory_limit_desc' => 'Change memory_limit to increase',
@@ -136,9 +136,24 @@ $english = array(
PHP extension), we recommend that you use that.',
'tidypics:lib_tools:testing' =>
'To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can see the
- configuration of your server above. Next, you need to determine the path to ImageMagick on your server. Your hosting service should
- be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of
- ImageMagick installed on your server.',
+ configuration of your server on the "Server Information" tab.. Next, you need to determine the path to
+ ImageMagick on your server. Your hosting service should be able to provide this to you. You can test
+ if the location is correct below. If successful, it should display the version of ImageMagick installed
+ on your server.',
+
+ // thumbnail tool
+ 'tidypics:thumbnail_tool' => 'Thumbnail Creation',
+ 'tidypics:thumbnail_tool_blurb' =>
+ 'This page allows you to create thumbnails for images when the thumbnail creation failed during upload.
+ You may experience problems with thumbnail creation if your image library is not configured properly or
+ if there is not enough memory for the GD library to load and resize an image. If your users have
+ experienced problems with thumbnail creation and you have corrected your configuration, you can try to redo the
+ thumbnails. Find the unique identifier of the photo (it is the number near the end of the url when viewing
+ a photo) and enter it below.',
+ 'tidypics:thumbnail_tool:unknown_image' => 'Unable to get original image',
+ 'tidypics:thumbnail_tool:invalid_image_info' => 'Error retrieving information about the image',
+ 'tidypics:thumbnail_tool:create_failed' => 'Failed to create thumbnails',
+ 'tidypics:thumbnail_tool:created' => 'Created thumbnails.',
//actions
'album:create' => "Create new album",
diff --git a/start.php b/start.php
index 1391184c7..ad540bc8f 100644
--- a/start.php
+++ b/start.php
@@ -48,10 +48,8 @@ function tidypics_init() {
// Add photos link to owner block/hover menus
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'tidypics_owner_block_menu');
- // Add admin menu items
+ // Add admin menu item
elgg_register_admin_menu_item('configure', 'tidypics', 'settings');
- elgg_register_admin_menu_item('administer', 'tidypics', 'statistics');
- elgg_register_admin_menu_item('administer', 'tidypics_tools', 'administer_utilities');
// Register for search
elgg_register_entity_type('object', 'image');
@@ -107,6 +105,7 @@ function tidypics_init() {
//register_action("tidypics/deletetag", false, "$base_dir/deletetag.php");
elgg_register_action("photos/admin/settings", "$base_dir/admin/settings.php", 'admin');
+ elgg_register_action("photos/admin/create_thumbnails", "$base_dir/admin/create_thumbnails.php", 'admin');
elgg_register_action("photos/admin/upgrade", "$base_dir/admin/upgrade.php", 'admin');
// Register libraries
diff --git a/views/default/admin/administer_utilities/tidypics_tools.php b/views/default/admin/administer_utilities/tidypics_tools.php
deleted file mode 100644
index 1df664be8..000000000
--- a/views/default/admin/administer_utilities/tidypics_tools.php
+++ /dev/null
@@ -1,166 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- GD
-
-
-
-
- IMagick
-
-
-
-
- exec()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- s
-
-
-
-
- s
-
-
-
- GD imagejpeg
-
-
-
-
- GD imagepng
-
-
-
-
- GD imagegif
-
-
-
-
- EXIF
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ GD
+
+
+
+
+ IMagick
+
+
+
+
+ exec()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ s
+
+
+
+
+ s
+
+
+
+ GD imagejpeg
+
+
+
+
+ GD imagepng
+
+
+
+
+ GD imagegif
+
+
+
+
+ EXIF
+
+
+
+
+
+
+
+ ';
+
+foreach ($stats as $str => $value) {
+ $str = elgg_echo("tidypics:stats:$str");
+ $value = (int)$value;
+
+ $content .= <<
+
';
+
+echo elgg_view_module('inline', elgg_echo('tidypics:stats'), $content);
\ No newline at end of file
diff --git a/views/default/admin/settings/tidypics/thumbnail.php b/views/default/admin/settings/tidypics/thumbnail.php
new file mode 100644
index 000000000..502b5739e
--- /dev/null
+++ b/views/default/admin/settings/tidypics/thumbnail.php
@@ -0,0 +1,52 @@
+' . elgg_echo('tidypics:thumbnail_tool_blurb') . '';
+$im_id = elgg_echo('tidypics:settings:im_id');
+$input = elgg_view('input/text', array(
+ 'name' => 'image_id'
+));
+$submit = elgg_view('input/submit', array(
+ 'value' => elgg_echo('submit'),
+ 'id' => 'elgg-tidypics-im-test'
+));
+
+$body .=<<
+
+ $submit
+
+
+HTML;
+
+echo elgg_view_module('inline', $title, $body);
+
+?>
+
+
\ No newline at end of file
diff --git a/views/default/admin/statistics/tidypics.php b/views/default/admin/statistics/tidypics.php
deleted file mode 100644
index 25ace77da..000000000
--- a/views/default/admin/statistics/tidypics.php
+++ /dev/null
@@ -1,63 +0,0 @@
-dbprefix}entities where subtype={$img_type}";
-$total = get_data_row($query);
-$num_images = $total->total;
-$stats['images'] = $total->total;
-
-// number of albums
-$img_type = get_subtype_id('object', 'album');
-$query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";
-$total = get_data_row($query);
-$num_albums = $total->total;
-$stats['albums'] = $total->total;
-
-$options = array(
- 'count' => true,
- 'type' => 'object',
- 'subtype' => 'image',
- 'annotation_name' => 'generic_comment'
-);
-
-// number of comments on photos
-$stats['photo_comments'] = elgg_get_annotations($options);
-
-// number of comments on albums
-$options['subtype'] = 'album';
-$stats['album_comments'] = elgg_get_annotations($options);
-
-// number of views on images
-$options['subtype'] = 'image';
-$options['annotation_name'] = 'tp_view';
-$stats['views'] = elgg_get_annotations($options);
-
-// number of photo tags on images
-if (elgg_get_plugin_setting('tagging', 'tidypics') != 'disabled') {
- $options['annotation_name'] = 'phototag';
- $stats['tags'] = elgg_get_annotations($options);
-}
-
-$content = '$str:
+ $value
+
+HTML;
+}
+
+$content .= '';
-
-foreach ($stats as $str => $value) {
- $str = elgg_echo("tidypics:stats:$str");
- $value = (int)$value;
-
- $content .= <<
-
';
-
-echo elgg_view_module('inline', elgg_echo('tidypics:stats'), $content);
\ No newline at end of file
diff --git a/views/default/tidypics/admin/help.php b/views/default/tidypics/admin/help.php
deleted file mode 100644
index b939a74a8..000000000
--- a/views/default/tidypics/admin/help.php
+++ /dev/null
@@ -1,32 +0,0 @@
-$str:
- $value
-
-HTML;
-}
-
-$content .= '
-White screen when uploading images
-Question mark images appear
-Unable to save settings
-
-Overview
-Thumbnail Creation
-
';
--
cgit v1.2.3
From 67d855d73499f36f15331e1ff18cccd13aa8aa74 Mon Sep 17 00:00:00 2001
From: Brett Profitt ';
-
-foreach ($stats as $str => $value) {
- $str = elgg_echo("tidypics:stats:$str");
- $value = (int)$value;
-
- $content .= <<
-
';
-
-echo elgg_view_module('inline', elgg_echo('tidypics:stats'), $content);
\ No newline at end of file
--
cgit v1.2.3
From 894ea6758f3f99c49807df99ef4bbd95f74273dc Mon Sep 17 00:00:00 2001
From: Brett Profitt $str:
- $value
-
-HTML;
-}
-
-$content .= '
+
+
+';
+ echo '
+
+
+
+
+
+
+ GD
+
+
+
+
+ imagick
+
+
+
+
+ exec()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ s
+
+
+
+
+ s
+
+
+
+ GD imagejpeg
+
+
+
+
+ GD imagepng
+
+
+
+
+ GD imagegif
+
+
+
+
+ EXIF
+
+
+
+
+
+
+
+
-
-
-';
- echo '
-
-
-
-
-
-
- GD
-
-
-
-
- IMagick
-
-
-
-
- exec()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- s
-
-
-
-
- s
-
-
-
- GD imagejpeg
-
-
-
-
- GD imagepng
-
-
-
-
- GD imagegif
-
-
-
-
- EXIF
-
-
-
-
-
-
-
-
- $submit -
- -HTML; - -echo elgg_view_module('inline', $title, $body); - -?> - - \ No newline at end of file -- cgit v1.2.3 From 65548983c054a48fe0adb94c327847a7101db390 Mon Sep 17 00:00:00 2001 From: Cash Costello'; - echo elgg_echo("tidypics:settings:{$size}size"); - echo ' | '; - echo 'width: '; - echo elgg_view('input/text', array( - 'name' => "{$size}_image_width", - 'value' => $image_sizes["{$size}_image_width"], - 'class' => 'tidypics-input-thin', - )); - echo ' | '; - echo 'height: '; - echo elgg_view('input/text', array( - 'name' => "{$size}_image_height", - 'value' => $image_sizes["{$size}_image_height"], - 'class' => 'tidypics-input-thin', - )); - echo ' | '; - echo '
'; + echo elgg_echo("tidypics:settings:{$size}size"); + echo ' | '; + echo 'width: '; + echo elgg_view('input/text', array( + 'name' => "{$size}_image_width", + 'value' => $image_sizes["{$size}_image_width"], + 'class' => 'tidypics-input-thin', + )); + echo ' | '; + echo 'height: '; + echo elgg_view('input/text', array( + 'name' => "{$size}_image_height", + 'value' => $image_sizes["{$size}_image_height"], + 'class' => 'tidypics-input-thin', + )); + echo ' | '; + echo '
" . elgg_echo('tidypics:settings:watermark') . "
";
-$form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "
" . elgg_echo('tidypics:settings:quota') . "
";
-$form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "
+ +
- -
- - diff --git a/views/default/js/photos/uploading.php b/views/default/js/photos/uploading.php deleted file mode 100644 index 465f937ab..000000000 --- a/views/default/js/photos/uploading.php +++ /dev/null @@ -1,94 +0,0 @@ - - -// - - - - - - - - - - - diff --git a/vendors/uploadify/example/scripts/_notes/dwsync.xml b/vendors/uploadify/example/scripts/_notes/dwsync.xml deleted file mode 100644 index 13ca04347..000000000 --- a/vendors/uploadify/example/scripts/_notes/dwsync.xml +++ /dev/null @@ -1,10 +0,0 @@ - -++File Upload widget with multiple file selection, drag&drop support, progress bars and preview images for jQuery.
+
+ Supports cross-domain, chunked and resumable file uploads and client-side image resizing.
+ Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.
Ctrl
or Shift
keys to select more than one file. You also can drag&drop photos from desktop.',
'tidypics:sort:instruct' => 'Sort the album photos by dragging and dropping the images. Then click the save button.',
'tidypics:sort:no_images' => 'No images found to sort. Upload images using the link above.',
diff --git a/pages/photos/image/upload.php b/pages/photos/image/upload.php
index 61be8523b..c8e57038c 100644
--- a/pages/photos/image/upload.php
+++ b/pages/photos/image/upload.php
@@ -38,7 +38,21 @@ elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username");
elgg_push_breadcrumb($album->getTitle(), $album->getURL());
elgg_push_breadcrumb(elgg_echo('album:addpix'));
-$content = elgg_view('forms/photos/basic_upload', array('entity' => $album));
+// load javascript dependences
+elgg_load_js('jquery-tmpl');
+elgg_load_js('jquery-load-image');
+elgg_load_js('jquery-canvas-to-blob');
+elgg_load_js('jquery-fileupload');
+elgg_load_js('jquery-fileupload-ui');
+elgg_load_js('tidypics:upload');
+
+$form_vars = array(
+ 'id' => 'fileupload',
+ 'action' => 'action/photos/image/upload',
+ 'enctype' => 'multipart/form-data',
+);
+
+$content = elgg_view_form('photos/basic_upload', $form_vars, array('entity' => $album));
$body = elgg_view_layout('content', array(
'content' => $content,
diff --git a/start.php b/start.php
index 45e9257f5..376c7985d 100644
--- a/start.php
+++ b/start.php
@@ -38,12 +38,28 @@ function tidypics_init() {
$js = elgg_get_simplecache_url('js', 'photos/tidypics');
elgg_register_simplecache_view('js/photos/tidypics');
elgg_register_js('tidypics', $js, 'footer');
+ $js = elgg_get_simplecache_url('js', 'photos/upload');
+ elgg_register_simplecache_view('js/photos/upload');
+ elgg_register_js('tidypics:upload', $js, 'footer');
$js = elgg_get_simplecache_url('js', 'photos/tagging');
elgg_register_simplecache_view('js/photos/tagging');
elgg_register_js('tidypics:tagging', $js, 'footer');
elgg_register_js('tidypics:slideshow', 'mod/tidypics/vendors/PicLensLite/piclens_optimized.js', 'footer');
+ $js_base = 'mod/tidypics/vendors/jquery-file-upload/js';
+
+ elgg_register_js('jquery-tmpl', "http://blueimp.github.com/JavaScript-Templates/tmpl.js", 'footer');
+ elgg_register_js('jquery-load-image', "$js_base/vendor/load-image.min.js", 'footer');
+ elgg_register_js('jquery-canvas-to-blob', "$js_base/vendor/canvas-to-blob.min.js", 'footer');
+ elgg_register_js('jquery-image-gallery', "$js_base/vendor/jquery.image-gallery.min.js", 'footer');
+ elgg_register_js('jquery-iframe-transport', "$js_base/jquery.iframe-transport.js", 'footer');
+
+ elgg_register_js('jquery-fileupload', "$js_base/jquery.fileupload.js", 'footer');
+ elgg_register_js('jquery-fileupload-fp', "$js_base/jquery.fileupload-fp.js", 'footer');
+ elgg_register_js('jquery-fileupload-ui', "$js_base/jquery.fileupload-ui.js", 'footer');
+ elgg_register_js('jquery-fileupload-jui', "$js_base/jquery.fileupload-jui.js", 'footer');
+
// Add photos link to owner block/hover menus
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'tidypics_owner_block_menu');
diff --git a/views/default/forms/photos/basic_upload.php b/views/default/forms/photos/basic_upload.php
index ba849d1b4..9e71cf59e 100644
--- a/views/default/forms/photos/basic_upload.php
+++ b/views/default/forms/photos/basic_upload.php
@@ -1,48 +1,63 @@
access_id;
+$help = elgg_echo('tidypics:uploader:help');
-$maxfilesize = (float) elgg_get_plugin_setting('maxfilesize', 'tidypics');
+$input = elgg_view('input/file', array(
+ 'name' => 'images[]',
+ 'multiple' => 'multiple',
+ 'class' => 'hidden-js',
+));
-$instructions = elgg_echo("tidypics:uploader:upload");
-$max = elgg_echo('tidypics:uploader:basic', array($maxfilesize));
+$button = elgg_view('output/url', array(
+ 'text' => elgg_echo('tidypics:uploader:upload') . $input,
+ 'class' => 'elgg-button elgg-button-action fileinput-button',
+));
-$list = '';
-for ($x = 0; $x < 10; $x++) {
- $list .= '$help
+Ctrl
o Shift
per seleccionar més d\'un arxiu. A més pots arrossegar fotos des de l\'escriptori.',
+ 'tidypics:sort:instruct' => 'Ordena les fotos de l\'àlbum arrossegant-les. Fes clic després al botó de desar.',
+ 'tidypics:sort:no_images' => 'No s\'han trobat imatges per ordenar. Puja imatges amb l\'enllaç de més a dalt.',
+ 'album:num' => 'Fotos de %s',
+ 'image:total' => 'Images a l\'àlbum:',
+ 'image:by' => 'Imatges afegida per',
+ 'album:by' => 'Àlbum creat per',
+ 'album:created:on' => 'Creat',
+ 'image:none' => 'No s\'han afegit imatges encara',
+ 'image:back' => 'Previ',
+ 'image:next' => 'Següent',
+ 'image:index' => '%u de %s',
+ 'tidypics:posted' => 'Ha penjat una foto:',
+ 'tidypics:widget:albums' => 'Àlbums de fotos',
+ 'tidypics:widget:album_descr' => 'Mostra els teus àlbums',
+ 'tidypics:widget:num_albums' => 'Nombre d\'àlbums a mostrar',
+ 'tidypics:widget:latest' => 'Últimes fotos',
+ 'tidypics:widget:latest_descr' => 'Mostra les teves últimes fotos',
+ 'tidypics:widget:num_latest' => 'Nombre d\'imatges a mostrar',
+ 'album:more' => 'Veure tots els àlbums',
+ 'river:create:object:image' => '%s ha pujat la foto %s',
+ 'image:river:created' => '%s ha afegit una foto a l\'àlbum %s',
+ 'image:river:created:multiple' => '%s ha afegit %u fotos a l\'àlbum %s',
+ 'image:river:item' => 'una foto',
+ 'image:river:annotate' => 'un comentari a la foto',
+ 'river:create:object:album' => '%s ha creat un nou àlbum %s',
+ 'album:river:group' => 'al grup',
+ 'album:river:item' => 'un àlbum',
+ 'album:river:annotate' => 'un comentari a l\'àlbum',
+ 'river:comment:object:image' => '%s ha comentat a la foto %s',
+ 'river:comment:object:album' => '%s ha comentat a la foto %s',
+ 'tidypics:newalbum_subject' => 'Nou àlbum de fotos',
+ 'tidypics:newalbum' => '%s ha creat un nou àlbum de fotos',
+ 'tidypics:updatealbum' => '%s ha pujat noves fotos a l\'àlbum %s',
+ 'tidypics:upl_success' => 'Les teves imatges s\'han pujat correctament.',
+ 'image:saved' => 'La teva imatge s\'ha desat correctament.',
+ 'images:saved' => 'Totes les imatges s\'han desat correctament.',
+ 'image:deleted' => 'La teva imatges s\'ha esborrat correctament.',
+ 'image:delete:confirm' => 'Estàs segur de voler esborrar aquesta imatge?',
+ 'images:edited' => 'Les teves imatges s\'han actualitzat correctament.',
+ 'album:edited' => 'El teu àlbum s\'ha actualitzat correctament.',
+ 'album:saved' => 'El teu àlbum s\'ha desat correctament.',
+ 'album:deleted' => 'El teu àlbum s\'ha esborrat correctament.',
+ 'album:delete:confirm' => 'Estàs segur de voler esborrar l\'àlbum?',
+ 'album:created' => 'El teu nou àlbum s\'ha creat.',
+ 'album:save_cover_image' => 'S\'ha desat la caràtula.',
+ 'tidypics:settings:save:ok' => 'S\'han desat correctament les opcions del complement Tidypics',
+ 'tidypics:album:sorted' => 'L\'àlbum %s està ordenat',
+ 'tidypics:album:could_not_sort' => 'No es pot ordenar l\'àlbum %s. Assegura\'t que hi ha imatges a l\'àlbum i torna-ho a intentar.',
+ 'tidypics:upgrade:success' => 'Millora dels Tidypics ha estat correcta',
+ 'tidypics:baduploadform' => 'Hi ha hagut algun error amb el formulari de pujades',
+ 'tidypics:partialuploadfailure' => 'Hi ha hagut errors pujant algunes de les imatges (%s de %s).',
+ 'tidypics:completeuploadfailure' => 'La pujada de les imatges ha fallat',
+ 'tidypics:exceedpostlimit' => 'Són massa imatges o massa grans - prova pujant-ne menys o més petites.',
+ 'tidypics:noimages' => 'No s\'han seleccionat imatges',
+ 'tidypics:image_mem' => 'La imatge és massa gran - massa bytes',
+ 'tidypics:image_pixels' => 'La imatge té massa píxels',
+ 'tidypics:unk_error' => 'Error de pujada desconegut',
+ 'tidypics:save_error' => 'Error desconegut en desar la imatge al servidor',
+ 'tidypics:not_image' => 'No és un tipus d\'imatge reconegut',
+ 'tidypics:deletefailed' => 'Ho sentim, ha fallat en esborrar.',
+ 'tidypics:deleted' => 'Esborrat correcte',
+ 'tidypics:nosettings' => 'L\'administradora del lloc no ha establert configuració per a l\'àlbum de fotos',
+ 'tidypics:exceed_quota' => 'Has excedit la quota que t\'ha assignat l\'administradora',
+ 'tidypics:cannot_upload_exceeds_quota' => 'Imatge no pujada. L\'arxiu excedeix la teva quota disponible',
+ 'album:none' => 'No s\'ha creat cap àlbum encara.',
+ 'album:uploadfailed' => 'Ho sento, no podem desar el teu àlbum.',
+ 'album:deletefailed' => 'El teu àlbum no pot ser esborrat.',
+ 'album:blank' => 'Si us plau posa un títol a l\'àlbum',
+ 'album:invalid_album' => 'Àlbum invàlid',
+ 'album:cannot_save_cover_image' => 'No es pot desar la caràtula',
+ 'image:downloadfailed' => 'Ho sentim, aquesta imatge no està disponible',
+ 'images:notedited' => 'No totes les imatges s\'han actualitzat correctament',
+ 'image:blank' => 'Si us plau posa un títol a la imatge',
+ 'image:error' => 'No es pot desar la imatge.',
+ 'tidypics:upgrade:failed' => 'La millora de Tidypics ha fallat',
+ 'untitled' => 'Sense títol',
+);
+add_translation("ca", $language);
\ No newline at end of file
diff --git a/languages/es.php b/languages/es.php
index 154d7188a..b3c773584 100644
--- a/languages/es.php
+++ b/languages/es.php
@@ -1,155 +1,210 @@
"sin titulo",
-
- // Menu items and titles
- 'image' => "Imagen",
- 'images' => "Imagenes",
- 'caption' => "Título",
- 'photos' => "Fotos",
- 'images:upload' => "Cargar Imagenes",
- 'images:multiupload:todo' => "Selecciona uno a más archivos para cargar..",
- 'album' => "Álbum de Fotos",
- 'albums' => "Álbumnes de Fotos",
- 'album:slideshow' => "Ver presentación de fotos",
- 'album:yours' => "Tu álbum de fotos",
- 'album:yours:friends' => "Álbum de fotos de tus amigos",
- 'album:user' => "Álbum de fotos de %s",
- 'album:friends' => "Álbum de fotos de los amigos de %s",
- 'album:all' => "Todos los álbumnes de fotos",
- 'album:group' => "Grupo de álbumnes",
- 'item:object:image' => "Fotos",
- 'item:object:album' => "Álbumnes",
- 'tidypics:enablephotos' => 'Habilitar Álbumnes de foto del Grupo',
- 'tidypics:editprops' => 'Editar Propiedades de Imagen',
- 'tidypics:mostcommented' => 'imagenes más comentadas',
- 'tidypics:mostcommentedthismonth' => 'Más comentadas este mes',
- 'tidypics:mostcommentedtoday' => 'Más comentadas del día de hoy',
- 'tidypics:mostviewed' => 'Imagenes más vistas',
- 'tidypics:mostvieweddashboard' => 'tablero m&as visto',
- 'tidypics:mostviewedthisyear' => 'Más vistas este año',
- 'tidypics:mostviewedthismonth' => 'Más vistas este mes',
- 'tidypics:mostviewedlastmonth' => 'Más vistas el &ultimo mes',
- 'tidypics:mostviewedtoday' => 'Más vistas durante el día de hoy',
- 'tidypics:recentlyviewed' => 'Imagenes vistas recientemente',
- 'tidypics:mostrecent' => 'Imagenes vistas más recientemente',
- 'tidypics:yourmostviewed' => 'Tu imagen más vista',
- 'tidypics:yourmostrecent' => 'Tu imagen más reciente',
- 'tidypics:friendmostviewed' => "La imagen más vista de %s",
- 'tidypics:friendmostrecent' => "La imagen más reciente de %s",
- 'tidypics:highestrated' => "Imagenes mejor catalogadas",
- 'tidypics:viewsbyowner' => "Vistas: %s por %s (no te incluye a ti)",
- 'tidypics:viewsbyothers' => "Vistas: %s (%s por ti)",
- 'tidypics:administration' => 'Administración de Tidypics',
- 'tidypics:stats' => 'Estatus',
-
- //settings
- 'tidypics:settings' => 'Configuración',
- 'tidypics:admin:instructions' => 'Este es el corazón de las preferencias de Tidypics. Cambialas y luego guardalas.',
- 'tidypics:settings:image_lib' => "Libreria de Imagenes: ",
- 'tidypics:settings:download_link' => "Mostrar vinculo de descarga",
- 'tidypics:settings:photo_ratings' => "Habilitar ratings de fotos(requiere instalar el e plugin de Miguel Montes o compatible)",
- 'tidypics:settings:exif' => "Mostrar data de EXIF",
- 'tidypics:settings:view_count' => "Ver contador",
- 'tidypics:settings:grp_perm_override' => "Permitir acceso completo a los miembros de este grupo al album de fotos",
- 'tidypics:settings:maxfilesize' => "Tamaño máximo de la imagen en megabytes (MB):",
- 'tidypics:settings:quota' => "Usuario/Grupo Cuota (MB) - 0 MB de cuota",
- 'tidypics:settings:im_path' => "Ingresa la ruta de tu ImageMagick commands (incluye el slash)",
- 'tidypics:settings:img_river_view' => "¿Cuántas entradas deseas para cada grupo de imágenes cargadas?",
- 'tidypics:settings:album_river_view' => "Muestra la portada del álbum o el set de fotos para el álbum nuevo",
- 'tidypics:settings:largesize' => "Tamaño inicial de la imagen",
- 'tidypics:settings:smallsize' => "Tamaño de imagen de vista del álbum",
- 'tidypics:settings:thumbsize' => "Tamaño de imagen miniatura",
-
- //actions
- 'album:create' => "Crear nuevo álbum",
- 'album:add' => "Añadir álbum de fotos",
- 'album:addpix' => "Añadir fotos al álbum",
- 'album:edit' => "Editar álbum",
- 'album:delete' => "Borrar álbum",
- 'image:edit' => "Editar imagen",
- 'image:delete' => "Borrar imagen",
- 'image:download' => "Descargar imagen",
-
- //forms
- 'album:title' => "Titulo",
- 'album:desc' => "Descripción",
- 'album:tags' => "Etiquetas",
- 'album:cover' => "¿Desea hacer de esta imagen la portada del álbum?",
- 'tidypics:quota' => "Cuota usada:",
-
- //views
- 'image:total' => "Imagenes en el álbum:",
- 'image:by' => "Imagenes añadidas por",
- 'album:by' => "Álbum creador por",
- 'album:created:on' => "Creado",
- 'image:none' => "Ninguna imagen ha sido añadida aún.",
- 'image:back' => "Anterior",
- 'image:next' => "Siguiente",
-
- //rss
- 'tidypics:posted' => 'publicar una foto:',
-
- //widgets
- 'tidypics:widget:albums' => "Álbumnes de fotos",
- 'tidypics:widget:album_descr' => "Mosrar tu último álbum de fotos",
- 'tidypics:widget:num_albums' => "Número de álbumnes a mostrar",
- 'tidypics:widget:latest' => "Latest Photos",
- 'tidypics:widget:latest_descr' => "Display your latest photos",
- 'tidypics:widget:num_latest' => "Number of images to display",
- 'album:more' => "Ver todos los álbumnes",
-
- // river
- 'image:river:created' => "%s añadio la foto %s al álbum %s",
- 'image:river:item' => "una foto",
- 'image:river:annotate' => "un comentario en la foto",
- 'album:river:created' => "%s creo un nuevo álbum de fotos",
- 'album:river:group' => "en el grupo",
- 'album:river:item' => "un álbum",
- 'album:river:annotate' => "un comentario en el álbum de fotos",
-
- // notifications
- 'tidypics:newalbum' => 'Nuevo álbum de fotos',
-
-
- // Status messages
- 'tidypics:upl_success' => "Tu imagen fue cargada exitosamente.",
- 'image:saved' => "Tu imagen fue guardada exitosamente.",
- 'images:saved' => "Todas tus imagenes fueron guardadas exitosamente.",
- 'image:deleted' => "Tu imagen fue borrada exitosamente.",
- 'image:delete:confirm' => "¿Estás seguro de que deseas borrar esta imagen?",
- 'images:edited' => "Tu imagen fue editada exitosamente.",
- 'album:edited' => "Tu álbum fue cargado exitosamente.",
- 'album:saved' => "Tu álbum fue guardado exitosamente.",
- 'album:deleted' => "Tu álbum fue borrado exitosamente.",
- 'album:delete:confirm' => "¿Estás seguro de que deseas borrar esta imagen?",
- 'album:created' => "Tu nuevo álbum ha sido creado.",
- 'tidypics:settings:save:ok' => 'Las preferencias del plugin de Tidypics han sido exitosamente guardadas',
- 'tidypics:upgrade:success' => 'La actualización de Tidypics ha sido un exito',
-
- //Error messages
- 'tidypics:partialuploadfailure' => "Ocurrieron errores mientas se cargaban algunas de las imagenes (%s de %s imagenes).",
- 'tidypics:completeuploadfailure' => "Carga de imagenes fallidas.",
- 'tidypics:exceedpostlimit' => "Las imagenes son muy grandes - trate de cargar imagenes m&ás pequeñas.",
- 'tidypics:noimages' => "Ninguna imagen fue seleccionada.",
- 'tidypics:image_mem' => "La image is muy grande - demasiados bytes",
- 'tidypics:image_pixels' => "La image tiene demasiados pixeles",
- 'tidypics:unk_error' => "Error de carga desconocido",
- 'tidypics:save_error' => "Error desconocido guardando la imagen en el servidor",
- 'tidypics:not_image' => "Este no es un tipo de imagen soportada por el sistema",
- 'image:deletefailed' => "Tu imagen no pudo ser borrada en este momento.",
- 'image:downloadfailed' => "Lo sentimos; esta imagen no está disponible en este momento.",
- 'tidypics:nosettings' => "El Administrador de este sitio no ha configurado las preferencias de los álbumnes de fotos.",
- 'tidypics:exceed_quota' => "Has excedido la cuota asignada por el administrador",
- 'images:notedited' => "No todas las imagenes fueron actualizas exitosamente",
- 'album:none' => "No ha sido creado ningún álbum aún.",
- 'album:uploadfailed' => "Lo sentimos; no pudimos guardar tu álbum.",
- 'album:deletefailed' => "Tu álbum no pudo ser borrado en este momento.",
- 'album:blank' => "Por favor, dale a este Álbum un titulo y una descripción.",
- 'tidypics:upgrade:failed' => "La actualización de Tidypics ha fallado",
+$language = array (
+ 'image' => 'Imagen',
+ 'images' => 'Imágenes',
+ 'caption' => 'Leyenda',
+ 'photos' => 'Fotos',
+ 'album' => 'Álbum de fotos',
+ 'albums' => 'Álbumes de fotos',
+ 'tidypics:disabled' => 'Desactivado',
+ 'tidypics:enabled' => 'Activado',
+ 'admin:settings:photos' => 'Lightpics',
+ 'photos:add' => 'Crear álbum',
+ 'images:upload' => 'Subir fotos',
+ 'album:slideshow' => 'Presentación de diapositivas',
+ 'album:yours' => 'Tus álbumes de fotos',
+ 'album:yours:friends' => 'Los álbumes de fotos de tus amigas',
+ 'album:user' => 'Álbumes de %s',
+ 'album:friends' => 'Álbumes de tus amigas',
+ 'album:all' => 'Todos los álbumes del sitio',
+ 'photos:group' => 'Fotos del grupo',
+ 'item:object:image' => 'Fotos',
+ 'item:object:album' => 'Álbumes',
+ 'tidypics:uploading:images' => 'Por favor espera. Subiendo imágenes',
+ 'tidypics:enablephotos' => 'Activar álbumes de fotos del grupo',
+ 'tidypics:editprops' => 'Editar propiedades de la imagen',
+ 'tidypics:mostcommented' => 'Imágenes más comentadas',
+ 'tidypics:mostcommentedthismonth' => 'Más comentadas este mes',
+ 'tidypics:mostcommentedtoday' => 'Más comentadas hoy',
+ 'tidypics:mostviewed' => 'Imágenes más vistas',
+ 'tidypics:mostvieweddashboard' => 'Escritorio más visto',
+ 'tidypics:mostviewedthisyear' => 'Más vistas este año',
+ 'tidypics:mostviewedthismonth' => 'Más vistas este mes',
+ 'tidypics:mostviewedlastmonth' => 'Más vistas el último més',
+ 'tidypics:mostviewedtoday' => 'Más vistas hoy',
+ 'tidypics:recentlyviewed' => 'Vistas recientemente',
+ 'tidypics:recentlycommented' => 'Imágenes comentadas recientemente',
+ 'tidypics:mostrecent' => 'Imágenes más recientes',
+ 'tidypics:yourmostviewed' => 'Tus imágenes más vistas',
+ 'tidypics:yourmostrecent' => 'Tus imágenes más recientes',
+ 'tidypics:friendmostviewed' => 'Imágenes más vistas de %s',
+ 'tidypics:friendmostrecent' => 'Imágenes más recientes de %s',
+ 'tidypics:highestrated' => 'Imágenes mejor valoradas',
+ 'tidypics:views' => '%s vistas',
+ 'tidypics:viewsbyowner' => 'por %s usuarias (sin incluirte)',
+ 'tidypics:viewsbyothers' => '(%s por ti)',
+ 'tidypics:administration' => 'Administración del Tidypics',
+ 'tidypics:stats' => 'Estadísticas',
+ 'tidypics:nophotosingroup' => 'Estos grupos no tienen ninguna foto',
+ 'tidypics:upgrade' => 'Mejorar',
+ 'tidypics:sort' => 'Ordenando el álbum %s',
+ 'tidypics:none' => 'No hay álbumes de fotos',
+ 'tidypics:upload:error' => 'Error:',
+ 'tidypics:upload:maxfilesize' => 'El archivo es demasiado grande',
+ 'tidypics:upload:minfilesize' => 'El archivo es demasiado pequeño',
+ 'tidypics:upload:acceptfiletypes' => 'Tipo de archivo no permitido',
+ 'tidypics:upload:maxnumberoffiles' => 'Número máximo de archivos excedido',
+ 'tidypics:settings' => 'Opciones',
+ 'tidypics:settings:main' => 'Opciones principales',
+ 'tidypics:settings:image_lib' => 'Librería de imágenes',
+ 'tidypics:settings:thumbnail' => 'Creación de previsualizaciones',
+ 'tidypics:settings:help' => 'Ayuda',
+ 'tidypics:settings:download_link' => 'Muestra enlace de descarga',
+ 'tidypics:settings:photo_ratings' => 'Activa puntuación de fotos (requiere la extensión de Miguel Montes o alguna compatible)',
+ 'tidypics:settings:exif' => 'Muestra los datos EXIF',
+ 'tidypics:settings:view_count' => 'Muestra un contador de vistas',
+ 'tidypics:settings:grp_perm_override' => 'Permitir acceso completo a los habitantes de este grupo al album de fotos',
+ 'tidypics:settings:maxfilesize' => 'Tamaño máximo de imagen, en megabytes (MB)',
+ 'tidypics:settings:quota' => 'Cuota de usuario (MB) - 0 significa sin cuota',
+ 'tidypics:settings:im_path' => 'Introduce la ruta a los comandos de ImageMagick',
+ 'tidypics:settings:img_river_view' => 'Cuantas entradas de actividad para cada paquete de imágenes subidas',
+ 'tidypics:settings:album_river_view' => 'Muestra la cubierta del álbum o un conjunto de fotos para un nuevo álbum',
+ 'tidypics:settings:largesize' => 'Tamaño de la imagen primaria',
+ 'tidypics:settings:smallsize' => 'Tamaño de la imagen en la vista de álbum',
+ 'tidypics:settings:tinysize' => 'Tamaño de la imagen de previsualización',
+ 'tidypics:settings:sizes:instructs' => 'Puede que tengas que cambiar el CSS si cambias los tamaños predefinidos',
+ 'tidypics:settings:im_id' => 'ID de imagen',
+ 'tidypics:settings:heading:img_lib' => 'Opciones de la librería de imágenes',
+ 'tidypics:settings:heading:main' => 'Opciones avanzadas',
+ 'tidypics:settings:heading:river' => 'Opciones de integración de actividad',
+ 'tidypics:settings:heading:sizes' => 'Tamaño de la previsualización',
+ 'tidypics:settings:heading:groups' => 'Opciones del grupo',
+ 'tidypics:option:all' => 'Todas',
+ 'tidypics:option:none' => 'Ninguna',
+ 'tidypics:option:cover' => 'Cubierta',
+ 'tidypics:option:set' => 'Conjunto',
+ 'tidypics:server_info' => 'Información del servidor',
+ 'tidypics:server_info:gd_desc' => 'El Elgg requiere que cargues la extensión GD',
+ 'tidypics:server_info:exec_desc' => 'Requerido para la línea de comandos de ImageMagick',
+ 'tidypics:server_info:memory_limit_desc' => 'Cambia el memory_limit para incrementarlo',
+ 'tidypics:server_info:peak_usage_desc' => 'Esto es aproximadamente el mínimo por página',
+ 'tidypics:server_info:upload_max_filesize_desc' => 'Tamaño máximo de una imagen subida',
+ 'tidypics:server_info:post_max_size_desc' => 'Tamaño máximo del mensaje = suma de las imágenes + formulario HTML',
+ 'tidypics:server_info:max_input_time_desc' => 'Tiempo que espera el script de subida para terminar',
+ 'tidypics:server_info:max_execution_time_desc' => 'Tiempo máximo que un script está funcionando',
+ 'tidypics:server_info:php_version' => 'Versión de PHP',
+ 'tidypics:server_info:memory_limit' => 'Memoria disponible para PHP',
+ 'tidypics:server_info:peak_usage' => 'Memoria utilizada para cargar esta página',
+ 'tidypics:server_info:upload_max_filesize' => 'Tamaño máximo de subida de archivos',
+ 'tidypics:server_info:post_max_size' => 'Tamaño máximo de las entradas',
+ 'tidypics:server_info:max_input_time' => 'Tiempo máximo para enviar',
+ 'tidypics:server_info:max_execution_time' => 'Tiempo máximo para la ejecución',
+ 'tidypics:server_info:use_only_cookies' => 'Sesiones sólo con cookies',
+ 'tidypics:server_config' => 'Configuración del servidor',
+ 'tidypics:server_configuration_doc' => 'Documentación de configuración del servidor',
+ 'tidypics:lib_tools:testing' => 'Tidypics necesita conocer la localización de los ejecutables de ImageMagick si lo has seleccionado como librería de imágenes. Tu servicio de hospedaje debería poder proporcionarte esto. Puedes comprobar si la localización es correcta más abajo. Si es así, debería mostrar la versión de ImageMagick que hay instalada en tu servidor.',
+ 'tidypics:thumbnail_tool' => 'Creación de previsualizaciones',
+ 'tidypics:thumbnail_tool_blurb' => 'Esta página te permite crear previsualizaciones para las imágenes cuando la creación de previsualizaciones falla durante la subida. Puedes tener algunos problemas con la creación de vistas previas si tu librería de imágenes no está configurada adecuadamente o si no hay suficiente memoria para que la librería GD cargue y cambie el tamaño de una imange. Si tus usuarias han tenido problemas con la creación de previsualizaciones y tienes configurada correctamente la aplicación, puedes probar de volver a hacer las vistas previas. Encuentra el identificador único de la foto (es el número cerca del final de la URL cuando ves una foto) y escríbelo aquí abajo.',
+ 'tidypics:thumbnail_tool:unknown_image' => 'No se puede conseguir la imagen original',
+ 'tidypics:thumbnail_tool:invalid_image_info' => 'Error al tratar de conseguir información sobre la imagen',
+ 'tidypics:thumbnail_tool:create_failed' => 'No se han podido crear las previsualizaciones',
+ 'tidypics:thumbnail_tool:created' => 'Previsualizaciones creadas.',
+ 'album:create' => 'Crear nuevo álbum',
+ 'album:add' => 'Añadir álbum de fotos',
+ 'album:addpix' => 'Añadir fotos al álbum',
+ 'album:edit' => 'Editar álbum',
+ 'album:delete' => 'Borrar álbum',
+ 'album:sort' => 'Ordenar',
+ 'image:edit' => 'Editar imagen',
+ 'image:delete' => 'Borrar imagen',
+ 'image:download' => 'Descargar imagen',
+ 'album:title' => 'Título',
+ 'album:desc' => 'Descripción',
+ 'album:tags' => 'Etiquetas',
+ 'album:cover' => '¿Hacer de esta imagen la carátula del álbum?',
+ 'album:cover_link' => 'Hacer caráctula',
+ 'tidypics:title:quota' => 'Couta',
+ 'tidypics:quota' => 'Uso de cuota:',
+ 'tidypics:uploader:choose' => 'Elige fotos',
+ 'tidypics:uploader:upload' => 'Sube fotos',
+ 'tidypics:uploader:describe' => 'Descripción de las fotos',
+ 'tidypics:uploader:filedesc' => 'Archivos de imagen (jpeg, png, gif)',
+ 'tidypics:uploader:help' => 'Consejo: utiliza Ctrl
o Shift
para seleccionar más de un archivo. Además puedes arrastrar fotos desde el escritorio.',
+ 'tidypics:sort:instruct' => 'Ordena las fotos del álbum arrastrándolas. Haz clic después en el botón de guardar.',
+ 'tidypics:sort:no_images' => 'No se han encontrado imágenes para ordenar. Sube imágenes con el enlace de más arriba.',
+ 'album:num' => '%s fotos',
+ 'image:total' => 'Imágenes en el álbum:',
+ 'image:by' => 'Imagen añadida por',
+ 'album:by' => 'Álbum creado por',
+ 'album:created:on' => 'Creado',
+ 'image:none' => 'No se ha añadido ninguna imagen aún.',
+ 'image:back' => 'Previa',
+ 'image:next' => 'Siguiente',
+ 'image:index' => '%u de %u',
+ 'tidypics:posted' => 'ha subido una foto:',
+ 'tidypics:widget:albums' => 'Álbums de fotos',
+ 'tidypics:widget:album_descr' => 'Muestra tus álbumes',
+ 'tidypics:widget:num_albums' => 'Número de álbums a mostrar',
+ 'tidypics:widget:latest' => 'Últimas fotos',
+ 'tidypics:widget:latest_descr' => 'Muestra tus últimas fotos',
+ 'tidypics:widget:num_latest' => 'Número de imágenes a mostrar',
+ 'album:more' => 'Ver todos los álbumes',
+ 'river:create:object:image' => '%s ha subido la foto %s',
+ 'image:river:created' => '%s ha añadido una foto al álbum %s',
+ 'image:river:created:multiple' => '%s ha añadido %u fotos al álbum %s',
+ 'image:river:item' => 'una foto',
+ 'image:river:annotate' => 'un comentario en la foto',
+ 'river:create:object:album' => '%s ha creado un nuevo álbum de fotos %s',
+ 'album:river:group' => 'en el grupo',
+ 'album:river:item' => 'un álbum',
+ 'album:river:annotate' => 'un comentario en el álbum de fotos',
+ 'river:comment:object:image' => '%s ha comentado en la foto %s',
+ 'river:comment:object:album' => '%s ha comentado en el álbum %s',
+ 'tidypics:newalbum_subject' => 'Nuevo álbum de fotos',
+ 'tidypics:newalbum' => '%s ha creado un álbum de fotos nuevo',
+ 'tidypics:updatealbum' => '%s ha subido nuevas fotos al álbum %s',
+ 'tidypics:upl_success' => 'Se han subido correctamente tus imágenes.',
+ 'image:saved' => 'Se ha guardado correctamente tu imagen.',
+ 'images:saved' => 'Todas las imágenes se han guardado correctamente.',
+ 'image:deleted' => 'Se ha eliminado correctamente tu imagen.',
+ 'image:delete:confirm' => '¿Estás segura de querer borrar esta imagen?',
+ 'images:edited' => 'Tus imágenes se han actualizado correctamente.',
+ 'album:edited' => 'Tu álbum se ha actualizado correctamente.',
+ 'album:saved' => 'Tu álbum se ha guardado correctamente.',
+ 'album:deleted' => 'Tu álbum se ha borrado correctamente.',
+ 'album:delete:confirm' => '¿Estás segura de querer borrar este álbum?',
+ 'album:created' => 'Tu nuevo álbum ha sido creado.',
+ 'album:save_cover_image' => 'Imagen de carátula guardada.',
+ 'tidypics:settings:save:ok' => 'Se han guardado correctamente las opciones del plugin Tidypics',
+ 'tidypics:album:sorted' => 'El álbum %s está ordenado',
+ 'tidypics:album:could_not_sort' => 'No se puede ordenar el álbum %s. Asegúrate de que hay imágenes en el álbum y vuélvelo a intentar.',
+ 'tidypics:upgrade:success' => 'La mejora de Tidypics ha sido un éxito',
+ 'tidypics:baduploadform' => 'Ha habido un error con el formulario de subida',
+ 'tidypics:partialuploadfailure' => 'Ha habido algunos errores al subir algunas de las imágenes (%s de %s).',
+ 'tidypics:completeuploadfailure' => 'La subida de imágenes ha fallado.',
+ 'tidypics:exceedpostlimit' => 'Las imágenes son demasiado grandes - inténtalo subiendo menos imágenes o más pequeñas.',
+ 'tidypics:noimages' => 'No has seleccionado ninguna imagen.',
+ 'tidypics:image_mem' => 'La imagen es demasiado grande - demasiados bytes',
+ 'tidypics:image_pixels' => 'La imagen tiene demasiados píxeles',
+ 'tidypics:unk_error' => 'Error desconocido durante la carga',
+ 'tidypics:save_error' => 'Error desconocido al guardar la imagen en el servidor',
+ 'tidypics:not_image' => 'No es un tipo de imagen reconocido',
+ 'tidypics:deletefailed' => 'Lo sentimos, el borrado ha fallado.',
+ 'tidypics:deleted' => 'Borrado correcto.',
+ 'tidypics:nosettings' => 'La administradora del sitio no ha ajustado las opciones para los álbumes.',
+ 'tidypics:exceed_quota' => 'Has excedido la cuota establecida por la administradora',
+ 'tidypics:cannot_upload_exceeds_quota' => 'Imagen no subida. El archivo supera la cuota disponible.',
+ 'album:none' => 'No se ha creado ningún álbum todavía.',
+ 'album:uploadfailed' => 'Lo sentimos, no podemos guardar tu álbum.',
+ 'album:deletefailed' => 'Tu álbum no puede ser borrado.',
+ 'album:blank' => 'Por favor, proporciona un título al álbum.',
+ 'album:invalid_album' => 'Álbum inválido',
+ 'album:cannot_save_cover_image' => 'No se puede guardar la imagen de cubierta',
+ 'image:downloadfailed' => 'Lo sentimos, esta imagen no está disponible.',
+ 'images:notedited' => 'No se han podido actualizar correctamente todas las fotos',
+ 'image:blank' => 'Por favor proporciona un título a la imagen.',
+ 'image:error' => 'No se puede guardar la imagen.',
+ 'tidypics:upgrade:failed' => 'La mejora de Tidypics ha fallado',
+ 'untitled' => 'Sin Título',
);
-
-add_translation("es", $spanish);
+add_translation("es", $language);
\ No newline at end of file
--
cgit v1.2.3
From a57dcab4eb6a96ac986efb178a67758f508a86ac Mon Sep 17 00:00:00 2001
From: Pablo Martin