diff -pr -x .idea -x 'mysql*' gallery3_orig/installer/init_var.php gallery3/installer/init_var.php *** gallery3_orig/installer/init_var.php Fri Jun 28 13:07:36 2013 --- gallery3/installer/init_var.php Sun Jan 5 18:38:55 2014 *************** *** 7,12 **** --- 7,15 ---- !file_exists(VARPATH . "thumbs") && mkdir(VARPATH . "thumbs"); !file_exists(VARPATH . "tmp") && mkdir(VARPATH . "tmp"); !file_exists(VARPATH . "uploads") && mkdir(VARPATH . "uploads"); + //mihail.stoynov: server add dir + !file_exists(VARPATH . "_ftp.upload") && mkdir(VARPATH . "_ftp.upload"); + file_put_contents(VARPATH . "logs/.htaccess", base64_decode("RGlyZWN0b3J5SW5kZXggLmh0YWNjZXNzClNldEhhbmRsZXIgR2FsbGVyeV9TZWN1cml0eV9Eb19Ob3RfUmVtb3ZlCk9wdGlvbnMgTm9uZQo8SWZNb2R1bGUgbW9kX3Jld3JpdGUuYz4KUmV3cml0ZUVuZ2luZSBvZmYKPC9JZk1vZHVsZT4KT3JkZXIgYWxsb3csZGVueQpEZW55IGZyb20gYWxsCg==")); file_put_contents(VARPATH . "tmp/.htaccess", base64_decode("RGlyZWN0b3J5SW5kZXggLmh0YWNjZXNzClNldEhhbmRsZXIgR2FsbGVyeV9TZWN1cml0eV9Eb19Ob3RfUmVtb3ZlCk9wdGlvbnMgTm9uZQo8SWZNb2R1bGUgbW9kX3Jld3JpdGUuYz4KUmV3cml0ZUVuZ2luZSBvZmYKPC9JZk1vZHVsZT4KT3JkZXIgYWxsb3csZGVueQpEZW55IGZyb20gYWxsCg==")); file_put_contents(VARPATH . "uploads/.htaccess", base64_decode("RGlyZWN0b3J5SW5kZXggLmh0YWNjZXNzClNldEhhbmRsZXIgR2FsbGVyeV9TZWN1cml0eV9Eb19Ob3RfUmVtb3ZlCk9wdGlvbnMgTm9uZQo8SWZNb2R1bGUgbW9kX3Jld3JpdGUuYz4KUmV3cml0ZUVuZ2luZSBvZmYKPC9JZk1vZHVsZT4KT3JkZXIgYWxsb3csZGVueQpEZW55IGZyb20gYWxsCg==")); diff -pr -x .idea -x 'mysql*' gallery3_orig/installer/install.sql gallery3/installer/install.sql *** gallery3_orig/installer/install.sql Fri Jun 28 13:07:36 2013 --- gallery3/installer/install.sql Sun Jan 5 18:45:51 2014 *************** CREATE TABLE {items} ( *** 190,196 **** KEY `relative_path_cache` (`relative_path_cache`) ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; ! INSERT INTO {items} VALUES (1,NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,NULL,NULL,2,0,NULL,'','',1,NULL,NULL,2,NULL,'weight','ASC',1,NULL,NULL,'Gallery','album',UNIX_TIMESTAMP(),0,1,NULL,'1','1'); DROP TABLE IF EXISTS {items_tags}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; --- 190,197 ---- KEY `relative_path_cache` (`relative_path_cache`) ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; ! /* mihail.stoynov: default sorting order changed: weight->captured, ASC -> DESC */ ! INSERT INTO {items} VALUES (1,NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,NULL,NULL,2,0,NULL,'','',1,NULL,NULL,2,NULL,'captured','DESC',1,NULL,NULL,'Gallery','album',UNIX_TIMESTAMP(),0,1,NULL,'1','1'); DROP TABLE IF EXISTS {items_tags}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; *************** INSERT INTO {modules} VALUES (6,1,'rss', *** 254,259 **** --- 254,266 ---- INSERT INTO {modules} VALUES (7,1,'search',1,7); INSERT INTO {modules} VALUES (8,1,'slideshow',2,8); INSERT INTO {modules} VALUES (9,1,'tag',3,9); + + /* mihail.stoynov: add the extra modules */ + INSERT INTO {modules} (id, active, name, version, weight) VALUES (10, true, 'themedispatcher', 5, 10); + INSERT INTO {modules} (id, active, name, version, weight) VALUES (12, true, 'exif', 1, 12); + INSERT INTO {modules} (id, active, name, version, weight) VALUES (13, true, 'server_add', 4, 13); + + DROP TABLE IF EXISTS {outgoing_translations}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; *************** INSERT INTO {vars} VALUES (NULL,'info',' *** 431,433 **** --- 438,449 ---- INSERT INTO {vars} VALUES (NULL,'info','show_captured','1'); INSERT INTO {vars} VALUES (NULL,'slideshow','max_scale','0'); INSERT INTO {vars} VALUES (NULL,'tag','tag_cloud_size','30'); + + /* mihail.stoynov extra conf */ + INSERT INTO {vars} (module_name, name, value) VALUES ('themedispatcher', 'useragents', 'a:3:{s:6:"iphone";i:1;s:4:"ipad";i:1;s:4:"ipod";i:1;}'); + INSERT INTO {vars} (module_name, name, value) VALUES ('themedispatcher', 'theme', 'imobile'); + INSERT INTO {vars} (module_name, name, value) VALUES ('themedispatcher', 'overridedispatch', '1'); + INSERT INTO {vars} (module_name, name, value) VALUES ('server_add', 'authorized_paths', 'a:1:{s:25:"var/ftp.upload";i:1;}'); + INSERT INTO {vars} (module_name, name, value) VALUES ('gallery', 'appletouchicon_url', ''); + INSERT INTO {vars} (module_name, name, value) VALUES ('th_pear4gallery3', 'mainmenu_view', 'mosaic'); + UPDATE {vars} SET value='pear4gallery3' WHERE name='active_site_theme'; diff -pr -x .idea -x 'mysql*' gallery3_orig/modules/exif/helpers/exif.php gallery3/modules/exif/helpers/exif.php *** gallery3_orig/modules/exif/helpers/exif.php Fri Jun 28 13:07:36 2013 --- gallery3/modules/exif/helpers/exif.php Sun Jan 5 18:02:34 2014 *************** class exif_Core { *** 97,102 **** --- 97,124 ---- return $exif; } + // mihail.stoynov GET EXIF DATA + static function get_assoc($item) { + $exif = array(); + $record = ORM::factory("exif_record") + ->where("item_id", "=", $item->id) + ->find(); + if (!$record->loaded()) { + return array(); + } + + $definitions = self::_keys(); + $keys = unserialize($record->data); + foreach ($keys as $key => $value) { + $exif[$key] = array("caption" => $definitions[$key][2], "value" => $value); + } + + return $exif; + } + + + + private static function _keys() { if (!isset(self::$exif_keys)) { self::$exif_keys = array( diff -pr -x .idea -x 'mysql*' gallery3_orig/modules/server_add/controllers/server_add.php gallery3/modules/server_add/controllers/server_add.php *** gallery3_orig/modules/server_add/controllers/server_add.php Sun Jan 5 19:09:33 2014 --- gallery3/modules/server_add/controllers/server_add.php Sun Jan 5 18:07:01 2014 *************** class Server_Add_Controller extends Admi *** 175,191 **** } } - - - - - $child_entry = ORM::factory("server_add_entry"); $child_entry->task_id = $task->id; $child_entry->path = $child_path; $child_entry->parent_id = $entry->id; // null if the parent was a staging dir $child_entry->is_directory = is_dir($child_path); ! $child_entry->save(); } // We've processed this entry, mark it as done. --- 175,189 ---- } } $child_entry = ORM::factory("server_add_entry"); $child_entry->task_id = $task->id; $child_entry->path = $child_path; $child_entry->parent_id = $entry->id; // null if the parent was a staging dir $child_entry->is_directory = is_dir($child_path); ! // mihail.stoynov : WE DO NOT ADD THE SERVER ADD DIR AND ANY OTHER DIR. ! if( !is_dir($child_path) ) { ! $child_entry->save(); ! } } // We've processed this entry, mark it as done. *************** class Server_Add_Controller extends Admi *** 239,245 **** // specified, then this belongs as a child of the current item. $parent_entry = ORM::factory("server_add_entry", $entry->parent_id); if (!$parent_entry->loaded()) { ! $parent = ORM::factory("item", $task->get("item_id")); } else { $parent = ORM::factory("item", $parent_entry->item_id); } --- 237,243 ---- // specified, then this belongs as a child of the current item. $parent_entry = ORM::factory("server_add_entry", $entry->parent_id); if (!$parent_entry->loaded()) { ! $parent = ORM::factory("item", $task->get("item_id")); } else { $parent = ORM::factory("item", $parent_entry->item_id); } *************** class Server_Add_Controller extends Admi *** 255,275 **** $album->owner_id = $owner_id; $album->sort_order = $parent->sort_order; $album->sort_column = $parent->sort_column; ! $album->save(); ! $entry->item_id = $album->id; } else { try { $extension = strtolower(pathinfo($name, PATHINFO_EXTENSION)); if (legal_file::get_photo_extensions($extension)) { $photo = ORM::factory("item"); $photo->type = "photo"; ! $photo->parent_id = $parent->id; $photo->set_data_file($entry->path); $photo->name = $name; $photo->title = $title; $photo->owner_id = $owner_id; $photo->save(); $entry->item_id = $photo->id; } else if (legal_file::get_movie_extensions($extension)) { $movie = ORM::factory("item"); $movie->type = "movie"; --- 253,277 ---- $album->owner_id = $owner_id; $album->sort_order = $parent->sort_order; $album->sort_column = $parent->sort_column; ! // mihail.stoynov: we don't save the album (because we don't want to), and the entry id is -1, because we don't want it to be added ! // $album->save(); ! $entry->item_id = -1;//$album->id; } else { try { $extension = strtolower(pathinfo($name, PATHINFO_EXTENSION)); if (legal_file::get_photo_extensions($extension)) { $photo = ORM::factory("item"); $photo->type = "photo"; ! // mihail.stoynov: the parent is the root, not the new album. ! $photo->parent_id = 1;//$parent->id; $photo->set_data_file($entry->path); $photo->name = $name; $photo->title = $title; $photo->owner_id = $owner_id; $photo->save(); $entry->item_id = $photo->id; + //mihail.stoynov: delete file from dir + unlink($entry->path); } else if (legal_file::get_movie_extensions($extension)) { $movie = ORM::factory("item"); $movie->type = "movie"; diff -pr -x .idea -x 'mysql*' gallery3_orig/themes/pear4gallery3/js/pear.js gallery3/themes/pear4gallery3/js/pear.js *** gallery3_orig/themes/pear4gallery3/js/pear.js Wed Nov 20 18:57:58 2013 --- gallery3/themes/pear4gallery3/js/pear.js Sun Jan 5 18:21:36 2014 *************** var pear = {defaultView: "grid", *** 12,17 **** --- 12,84 ---- redirected: false, mosaicEffect: "" }; + ////mihail.stoynov ajaxify my form + function _ajaxify_dialog_mihail() { + var self = this; + $("#mihailstoynov_comments form").ajaxForm({ + beforeSubmit: function(formData, form, options) { + form.find(":submit") + .addClass("ui-state-disabled") + .attr("disabled", "disabled"); + return true; + }, + beforeSend: function(xhr) { + // Until we convert to jquery 1.4, we need to save the XMLHttpRequest object so that we + // can detect the mime type of the reply + this.xhrData = xhr; + }, + success: function(data) { + window.location.reload(true); + // // Pre jquery 1.4, get the saved XMLHttpRequest object + // xhr = this.xhrData; + // if (xhr) { + // var mimeType = /^(\w+\/\w+)\;?/.exec(xhr.getResponseHeader("Content-Type")); + // + // var content = ""; + // if (mimeType[1] == "application/json") { + // data = JSON.parse(data); + // } else { + // data = {"html": escape(data)}; + // } + // } else { + // // Uploading files (eg: watermark) uses a fake xhr in jquery.form.js so + // // all we have is in the data field, which should be some very simple JSON. + // // Weirdly enough in Chrome the result gets wrapped in a
 element and
+ //                // looks like this:
+ //                //   
{"result":"success",
+ //                //   "location":"\/~bharat\/gallery3\/index.php\/admin\/watermarks"}
+ // // bizarre. Strip that off before parsing. + // data = JSON.parse(data.match("({.*})")[0]); + // } + // + // if (data.html) { + // $("#g-dialog").html(data.html); + // $("#g-dialog").dialog("option", "position", "center"); + // $("#g-dialog form :submit").removeClass("ui-state-disabled") + // .attr("disabled", null); + // self._set_title(); + // self._ajaxify_dialog(); + // self.form_loaded(null, $("#g-dialog form")); + // if (typeof data.reset == 'function') { + // eval(data.reset + '()'); + // } + // } + // if (data.result == "success") { + // if (data.location) { + // window.location = data.location; + // } else { + // window.location.reload(); + // } + // } + }, + error: function(xhr, textStatus, errorThrown) { + $("#g-dialog").html(xhr.responseText); + self._set_title(); + self._layout(); + } + }); + } + function thumbPadding() { var size, width, margin; /* Padding on thumbs to make them flow nicer */ *************** function thumbLoad(index) { *** 59,65 **** $('.skimm_div').each( function() { $(this).append(thumbImages[$(this).attr('id')]); }); //Re-initiate all fancyness. ! if (pear.currentView === 'mosaic') { $('p.giTitle,div.giInfo').hide(); } else { $('p.giTitle,div.giInfo').show(); } scaleIt($('#imgSlider').slider('value')); $('.g-photo:not(.g-hover-item)').each(function (index) { $(this).unbind('click'); --- 126,133 ---- $('.skimm_div').each( function() { $(this).append(thumbImages[$(this).attr('id')]); }); //Re-initiate all fancyness. ! // mihail.stoynov: Make the title not clickable, no full size will be opened. We couldn't make it work otherwise. ! if (pear.currentView === 'mosaic') { $('p.giTitle_11111111111,div.giInfo').hide(); } else { $('p.giTitle,div.giInfo').show(); } scaleIt($('#imgSlider').slider('value')); $('.g-photo:not(.g-hover-item)').each(function (index) { $(this).unbind('click'); *************** function swatchImg(imageId) { *** 341,346 **** --- 409,418 ---- $('#mosaicDetailContainer').show(pear.mosaicEffect, options, "slow"); }); } + // mihail.stoynov: add the comments. + $("#mihailstoynov_comments").html(slideshowImages[imageId][7]); + // mihail.stoynov ajaxify the form. + _ajaxify_dialog_mihail(); } /* Set controls for hover view. */ *************** function switchToMosaic() { *** 486,492 **** scaleIt($('#imgSlider').slider('value')); $('#mosaicDetail').show(); $('#gridContainer').css('width', "35%"); ! $('p.giTitle,div.giInfo').each(function (s) { $(this).hide(); }); switchMode('mosaic'); swatchImg(pear.currentImg); mosaicResize(); --- 558,565 ---- scaleIt($('#imgSlider').slider('value')); $('#mosaicDetail').show(); $('#gridContainer').css('width', "35%"); ! // mihail.stoynov: I don't know why we did that. ! $('p.giTitle_11111111111,div.giInfo').each(function (s) { $(this).hide(); }); switchMode('mosaic'); swatchImg(pear.currentImg); mosaicResize(); *************** function pearInit(options) { *** 592,604 **** $('.track').each(function (s) {$(this).css('top', '-16px'); }); //Fix for IE's poor page rendering. } /* 58.5 225 32.5 125 */ ! $('#imgSlider').slider({ min: 75, max: 250, step: 2, value: 125, slide: function (event, ui) { scaleIt(ui.value); }, change: function (event, ui) { scaleIt(ui.value); setCookie('slider', ui.value, '1'); } }); //Set event for Thumb Click. $('.g-item').each(function (index) { $(this).click(function () { if (pear.currentView === 'mosaic') { swatchImg(index); } else { focusImage(index); } }); }); ! $('#mosaicDetailContainer').click(function () { focusImage(pear.currentImg); }); $('#prev').click(function () { swatchImg(pear.currentImg - 1); }); $('#next').click(function () { swatchImg(pear.currentImg + 1); }); $('#img_detail').click(function () { hideDetailView(); }); --- 665,679 ---- $('.track').each(function (s) {$(this).css('top', '-16px'); }); //Fix for IE's poor page rendering. } /* 58.5 225 32.5 125 */ ! // mihail.stoynov - Make images bigger by default: move the slider "value: 125" to "value: 250" ! $('#imgSlider').slider({ min: 75, max: 250, step: 2, value: 250, slide: function (event, ui) { scaleIt(ui.value); }, change: function (event, ui) { scaleIt(ui.value); setCookie('slider', ui.value, '1'); } }); //Set event for Thumb Click. $('.g-item').each(function (index) { $(this).click(function () { if (pear.currentView === 'mosaic') { swatchImg(index); } else { focusImage(index); } }); }); ! // mihail.stoynov remove on click (I don't remember which one though). ! // $('#mosaicDetailContainer').click(function () { focusImage(pear.currentImg); }); $('#prev').click(function () { swatchImg(pear.currentImg - 1); }); $('#next').click(function () { swatchImg(pear.currentImg + 1); }); $('#img_detail').click(function () { hideDetailView(); }); diff -pr -x .idea -x 'mysql*' gallery3_orig/themes/pear4gallery3/views/album.html.php gallery3/themes/pear4gallery3/views/album.html.php *** gallery3_orig/themes/pear4gallery3/views/album.html.php Wed Nov 20 18:57:58 2013 --- gallery3/themes/pear4gallery3/views/album.html.php Sun Jan 5 18:12:19 2014 *************** $(window).load(function () { *** 39,44 **** --- 39,46 ----
+ +
--- 57,75 ---- endforeach; endif; // End skimming // ?> !

! is_photo()) { ! if($child->captured > 0) { ! $title = date('H:i', $child->captured); ! } ! } ! if(!$title) { ! $title = html::purify(text::limit_chars($child->title, 20)); ! } ! echo $title; ! ?> !

is_album() && !module::get_var("th_pear4gallery3", "hide_item_count")): ?>
photos
*************** endif; *** 55,61 **** $child): ?> is_album() || $child->is_movie())): ?> ! slideshowImages[] = (['resize_url() ?>', 'id ?>', 'resize_width ?>','resize_height ?>', 'title, ENT_QUOTES) ?>', '', 'url() ?>']); --- 77,123 ---- $child): ?> is_album() || $child->is_movie())): ?> ! slideshowImages[] = ( ! ['resize_url() ?>', ! 'id ?>', ! 'resize_width ?>', ! 'resize_height ?>', ! 'captured); ! if(!$title) { ! $title = html::purify(text::limit_chars($child->title, 20)); ! } ! echo htmlentities($title, ENT_QUOTES) ! ?>', ! '', 'url() ?>', ! 'where("item_id", "=", $child->id) ! ->where("state", "=", "published") ! ->order_by("created", "ASC") ! ->find_all(); ! ! // mihail.stoynov extra field for the comments ! $rendered_comments = ""; ! foreach ($comments as $comment): ! $rendered_comments .= 'comment: '.$comment->text."
"; ! endforeach; ! ! $add_comment = '
'. ! ''. ! ''. ! ''. ! ''. ! // ''. ! // ''. ! ''. ! 'add comment:'. ! ''. ! '
'; ! ! echo $rendered_comments."
".$add_comment ! ?>' ! ]);