Changeset 1440713
- Timestamp:
- 06/21/2016 07:56:18 AM (10 years ago)
- Location:
- unc-gallery/trunk
- Files:
-
- 7 edited
-
readme.txt (modified) (3 diffs)
-
unc_config.inc.php (modified) (1 diff)
-
unc_display.inc.php (modified) (2 diffs)
-
unc_gallery.php (modified) (1 diff)
-
unc_image.inc.php (modified) (5 diffs)
-
unc_tools.inc.php (modified) (22 diffs)
-
unc_upload.inc.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
unc-gallery/trunk/readme.txt
r1440652 r1440713 8 8 Requires at least: 4.5.2 9 9 Tested up to: 4.5.2 10 Version: 4.1 11 Stable tag: 4.1 10 Version: 4.1.2 11 Stable tag: 4.1.2 12 12 License: GPLv2 13 13 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 69 69 == Changelog == 70 70 71 = 4.1.2 = 72 73 1. Bug fixes 74 71 75 = 4.0 = 72 76 … … 82 86 1. automatic post assignments of hierarchical categories based on EXIF/IPCT location info 83 87 1. featured images can now be latest and random images of the given set 84 *optional square or rectangular thumbnails88 1. optional square or rectangular thumbnails 85 89 86 90 = 3.2.2 = -
unc-gallery/trunk/unc_config.inc.php
r1440632 r1440713 13 13 14 14 $UNC_GALLERY['upload_folder'] = "unc_gallery"; 15 $UNC_GALLERY['upload_path'] = WP_CONTENT_DIR . DIRECTORY_SEPARATOR. $UNC_GALLERY['upload_folder'];15 $UNC_GALLERY['upload_path'] = WP_CONTENT_DIR . "/" . $UNC_GALLERY['upload_folder']; 16 16 $UNC_GALLERY['photos'] = "photos"; // subfolder of upload_path where the photos go in 17 17 $UNC_GALLERY['thumbnails'] = "thumbs"; // subfolder of upload_path where the thumbs go in -
unc-gallery/trunk/unc_display.inc.php
r1440632 r1440713 304 304 remove_filter('the_content', 'wpautop'); 305 305 306 $photo_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR. $UNC_GALLERY['photos'];306 $photo_folder = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['photos']; 307 307 308 308 // get a json datepicker … … 369 369 $file = $D['file']; 370 370 } 371 $file_path = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR . $UNC_GALLERY['photos'] . DIRECTORY_SEPARATOR . $date_path . DIRECTORY_SEPARATOR. $file;371 $file_path = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['photos'] . "/" . $date_path . "/" . $file; 372 372 $out = unc_display_image_html($file_path, $thumb, false); 373 373 } else { -
unc-gallery/trunk/unc_gallery.php
r1440652 r1440713 4 4 Plugin URI: https://uncovery.net/about 5 5 Description: A simple, self-generating, date-based gallery with bulk uploading 6 Version: 4.1 6 Version: 4.1.2 7 7 Author: Uncovery 8 8 Author URI: http://uncovery.net -
unc-gallery/trunk/unc_image.inc.php
r1440632 r1440713 200 200 $folder_info = pathinfo($file_path); 201 201 $date_str = unc_tools_folder_date($folder_info['dirname']); 202 $date_path = str_replace("-", DIRECTORY_SEPARATOR, $date_str);202 $date_path = str_replace("-", "/", $date_str); 203 203 $file_name = $folder_info['basename']; 204 204 205 $data_path = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR . $UNC_GALLERY['file_data'] . DIRECTORY_SEPARATOR . $date_path . DIRECTORY_SEPARATOR. $file_name . ".php";205 $data_path = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['file_data'] . "/" . $date_path . "/" . $file_name . ".php"; 206 206 207 207 // in case the data is missing, write a new file … … 210 210 $check = unc_image_info_write($file_path); 211 211 } 212 $file_code = md5($date_path . DIRECTORY_SEPARATOR. $file_name . ".php");212 $file_code = md5($date_path . "/" . $file_name . ".php"); 213 213 // reset the data so we re-read it from file 214 214 $UNC_FILE_DATA[$file_code] = false; … … 256 256 $folder_info = pathinfo($file_path); 257 257 $date_str = unc_tools_folder_date($folder_info['dirname']); 258 $date_path = str_replace("-", DIRECTORY_SEPARATOR, $date_str);258 $date_path = str_replace("-", "/", $date_str); 259 259 $file_name = $folder_info['basename']; 260 260 … … 268 268 $thumb_url = content_url($UNC_GALLERY['upload_folder'] . "/" . $UNC_GALLERY['thumbnails'] . "/$date_path/$file_name"); 269 269 270 $data_path = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR . $UNC_GALLERY['file_data'] . DIRECTORY_SEPARATOR . $date_path . DIRECTORY_SEPARATOR. $file_name . ".php";270 $data_path = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['file_data'] . "/" . $date_path . "/" . $file_name . ".php"; 271 271 272 272 $data = array( … … 290 290 291 291 // write the file 292 $file_code = md5($date_path . DIRECTORY_SEPARATOR. $file_name . ".php");292 $file_code = md5($date_path . "/" . $file_name . ".php"); 293 293 global $UNC_FILE_DATA; 294 294 $UNC_FILE_DATA[$file_code] = $data; -
unc-gallery/trunk/unc_tools.inc.php
r1440632 r1440713 31 31 foreach ($path_arr as $img_folder) { 32 32 // create the complete folder 33 $base_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR. $img_folder;33 $base_folder = $UNC_GALLERY['upload_path'] . "/" . $img_folder; 34 34 // iterate the date strings y m d 35 35 foreach ($date_folders as $date_folder) { … … 37 37 if ($date_folder) { 38 38 $date_element = $date_obj->format($date_folder); 39 $base_folder .= DIRECTORY_SEPARATOR . "$date_element";39 $base_folder .= "/$date_element"; 40 40 } 41 41 // take the final folder string and check if already exists … … 72 72 } 73 73 // convert date to folder string 74 $fstr = DIRECTORY_SEPARATOR;74 $fstr = "/"; 75 75 $out = ""; 76 76 $date_folder = date_format($date_obj, "Y{$fstr}m{$fstr}d"); … … 81 81 foreach ($path_arr as $img_folder) { 82 82 // now let's get the path of that date 83 $base_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR . $img_folder . DIRECTORY_SEPARATOR. $date_folder;83 $base_folder = $UNC_GALLERY['upload_path'] . "/" . $img_folder . "/" . $date_folder; 84 84 if (!file_exists($base_folder)) { 85 85 // the folder does not exist, so let's not delete anything … … 101 101 rmdir($base_folder); 102 102 // now we iterate the tree and make sure we delete all leftover empty months & year folders. 103 unc_tools_folder_delete_empty($UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR. $img_folder);103 unc_tools_folder_delete_empty($UNC_GALLERY['upload_path'] . "/" . $img_folder); 104 104 } 105 105 return $out; … … 121 121 122 122 $empty = true; 123 $path_wildcard = $path . DIRECTORY_SEPARATOR . "*";123 $path_wildcard = $path . "/*"; 124 124 foreach (@glob($path_wildcard) as $file) { 125 125 if (is_dir($file)) { // recurse lower directory … … 151 151 return false; 152 152 } 153 foreach (glob($path . DIRECTORY_SEPARATOR . "*") as $file) {153 foreach (glob($path . "/*") as $file) { 154 154 if (is_dir($file)) { // recurse lower directory 155 155 unc_tools_import_enumerate($file); … … 244 244 foreach ($dates as $date_str) { 245 245 // translate date string to folder 246 $date_path = str_replace("-", DIRECTORY_SEPARATOR, $date_str);247 $photo_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR. $UNC_GALLERY['photos'];248 $folder = $photo_folder . DIRECTORY_SEPARATOR. $date_path;249 foreach (glob($folder . DIRECTORY_SEPARATOR . "*") as $file_path) {246 $date_path = str_replace("-", "/", $date_str); 247 $photo_folder = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['photos']; 248 $folder = $photo_folder . "/" . $date_path; 249 foreach (glob($folder . "/*") as $file_path) { 250 250 $F = unc_image_info_read($file_path, $D); 251 251 if (($D['range']['end_time'] && $D['range']['start_time']) && // only if both are set … … 343 343 if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());} 344 344 // safety net 345 if (strpos($base_folder, '. ' . DIRECTORY_SEPARATOR)) {345 if (strpos($base_folder, './')) { 346 346 die("Error, recursive path! $base_folder"); 347 347 } 348 foreach (glob($base_folder . DIRECTORY_SEPARATOR . "*") as $file) {348 foreach (glob($base_folder . "/*") as $file) { 349 349 if (is_dir($file)) { 350 350 $TMP_FOLDERS[] = unc_gallery_recurse_files($file, $file_function, $dir_function); … … 368 368 global $TMP_FOLDERS, $UNC_GALLERY; 369 369 if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());} 370 if (strpos($base_folder, '. ' . DIRECTORY_SEPARATOR)) {370 if (strpos($base_folder, './')) { 371 371 die("Error, recursive path! $base_folder"); 372 372 } 373 373 $has_subfolder = false; 374 374 if (!file_exists($base_folder)) { 375 if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace("Base folder does not exist: ", $base_folder);} 375 376 return false; 376 377 } 377 foreach (glob($base_folder . DIRECTORY_SEPARATOR . "*") as $folder) {378 foreach (glob($base_folder . "/*") as $folder) { 378 379 // found a sub-folder, go deeper 379 380 if (is_dir($folder)) { … … 383 384 } 384 385 if (!$has_subfolder) { 385 $path_arr = explode( DIRECTORY_SEPARATOR, $base_folder);386 $path_arr = explode("/", $base_folder); 386 387 $date_elements = array_slice($path_arr, -3, 3); 387 $date_string = implode( DIRECTORY_SEPARATOR, $date_elements);388 $date_string = implode("/", $date_elements); 388 389 $TMP_FOLDERS[$date_string] = $base_folder; 389 390 } … … 401 402 if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());} 402 403 403 $photo_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR. $UNC_GALLERY['photos'];404 $photo_folder = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['photos']; 404 405 $folders = unc_tools_recurse_folders($photo_folder); 405 406 if (count($folders) == 1 ) { … … 425 426 global $UNC_GALLERY; 426 427 if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());} 427 $photo_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR. $UNC_GALLERY['photos'];428 $photo_folder = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['photos']; 428 429 $folders = unc_tools_recurse_folders($photo_folder); 429 430 if (count($folders) == 0) { … … 446 447 global $UNC_GALLERY, $UNC_FILE_DATA; 447 448 if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());} 448 $base_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR . $UNC_GALLERY['file_data'] . DIRECTORY_SEPARATOR. $date_path;449 $base_folder = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['file_data'] . "/" . $date_path; 449 450 $folder_files = array(); 450 451 451 foreach (glob($base_folder . DIRECTORY_SEPARATOR . "*") as $file_path) {452 foreach (glob($base_folder . "/*") as $file_path) { 452 453 // found a sub-folder, go deeper 453 454 if (!is_dir($file_path)) { 454 455 require_once($file_path); 455 456 $file_name = basename($file_path, ".php"); 456 $file_code = md5($date_path . DIRECTORY_SEPARATOR. $file_name . ".php");457 $file_code = md5($date_path . "/" . $file_name . ".php"); 457 458 $file_timestamp = $UNC_FILE_DATA[$file_code]['time_stamp']; 458 459 $folder_files[$file_timestamp] = $UNC_FILE_DATA[$file_code]; … … 475 476 global $UNC_GALLERY; 476 477 if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());} 477 $base_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR . $UNC_GALLERY['photos'] . DIRECTORY_SEPARATOR. $date_path;478 $base_folder = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['photos'] . "/" . $date_path; 478 479 $files = array(); 479 foreach (glob($base_folder . DIRECTORY_SEPARATOR . "*") as $file) {480 foreach (glob($base_folder . "/*") as $file) { 480 481 // found a sub-folder, go deeper 481 482 if (!is_dir($file)) { … … 500 501 global $UNC_GALLERY; 501 502 if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());} 502 $path_arr = explode( DIRECTORY_SEPARATOR, $folder);503 $path_arr = explode("/", $folder); 503 504 // get last 3 elements 504 505 $new_date_arr = array_slice($path_arr, -3, 3); … … 541 542 global $UNC_GALLERY; 542 543 if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());} 543 $photo_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR. $UNC_GALLERY['photos'] ;544 $curr_photo_folder = $photo_folder . DIRECTORY_SEPARATOR. $date_path;545 $file_path = $curr_photo_folder . DIRECTORY_SEPARATOR. $file_name;544 $photo_folder = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['photos'] ; 545 $curr_photo_folder = $photo_folder . "/" . $date_path; 546 $file_path = $curr_photo_folder . "/" . $file_name; 546 547 return $file_path; 547 548 } … … 559 560 global $UNC_GALLERY; 560 561 if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());} 561 $photo_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR. $UNC_GALLERY['photos'];562 $photo_folder = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['photos']; 562 563 $base_length = strlen($photo_folder) + 1; 563 564 564 565 $dates = array(); 565 foreach (glob($base_folder . DIRECTORY_SEPARATOR . "*") as $current_path) {566 foreach (glob($base_folder . "/*") as $current_path) { 566 567 $file = basename($current_path); 567 568 // get current date from subfolder 568 569 if (is_dir($current_path)) { // we have a directory 569 $cur_date = str_replace( DIRECTORY_SEPARATOR, "-", substr($current_path, $base_length));570 $cur_date = str_replace("/", "-", substr($current_path, $base_length)); 570 571 if (strlen($cur_date) == 10) { // we have a full date, add to array 571 572 $dates[$cur_date] = 0; … … 577 578 } 578 579 } else { // we have a file 579 $cur_date = str_replace( DIRECTORY_SEPARATOR, "-", substr($base_folder, $base_length));580 $cur_date = str_replace("/", "-", substr($base_folder, $base_length)); 580 581 $dates[$cur_date][] = $file; 581 582 } … … 609 610 610 611 $date_wrong = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); 611 $date_str = str_replace("-", DIRECTORY_SEPARATOR, $date_wrong);612 $date_str = str_replace("-", "/", $date_wrong); 612 613 613 614 … … 619 620 620 621 foreach ($paths as $path => $del_file_name) { 621 $full_path = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR . $path . DIRECTORY_SEPARATOR . $date_str . DIRECTORY_SEPARATOR. $del_file_name;622 $full_path = $UNC_GALLERY['upload_path'] . "/" . $path . "/" . $date_str . "/" . $del_file_name; 622 623 if (file_exists($full_path)) { 623 624 $check = unlink($full_path); … … 686 687 $date_obj = new DateTime($date . " 00:00:00"); 687 688 if ($date_obj) { 688 $format = implode( DIRECTORY_SEPARATOR, array('Y', 'm', 'd'));689 $format = implode("/", array('Y', 'm', 'd')); 689 690 $date_str = $date_obj->format($format); 690 $photo_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR. $UNC_GALLERY['photos'];691 if (!file_exists($photo_folder . DIRECTORY_SEPARATOR. $date_str)) {691 $photo_folder = $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['photos']; 692 if (!file_exists($photo_folder . "/" . $date_str)) { 692 693 if ($UNC_GALLERY['no_image_alert'] == 'error') { 693 694 $UNC_GALLERY['errors'][] = unc_display_errormsg("No images found for this date!"); -
unc-gallery/trunk/unc_upload.inc.php
r1440632 r1440713 309 309 310 310 // let's make the path with system-specific dir. separators 311 $format = implode( DIRECTORY_SEPARATOR, array('Y', 'm', 'd'));311 $format = implode("/", array('Y', 'm', 'd')); 312 312 313 313 $date_str_folder = $date_obj->format($format); 314 314 // echo "Folder date is $date_str_folder<br>"; 315 315 316 $target_subfolder = $dirPath . DIRECTORY_SEPARATOR . $UNC_GALLERY['photos'] . DIRECTORY_SEPARATOR. $date_str_folder;317 $thumb_subfolder = $dirPath . DIRECTORY_SEPARATOR . $UNC_GALLERY['thumbnails'] . DIRECTORY_SEPARATOR. $date_str_folder;318 $new_path = $target_subfolder . DIRECTORY_SEPARATOR. $target_filename;319 $new_thumb_path = $thumb_subfolder . DIRECTORY_SEPARATOR. $target_filename;316 $target_subfolder = $dirPath . "/" . $UNC_GALLERY['photos'] . "/" . $date_str_folder; 317 $thumb_subfolder = $dirPath . "/" . $UNC_GALLERY['thumbnails'] . "/" . $date_str_folder; 318 $new_path = $target_subfolder . "/" . $target_filename; 319 $new_thumb_path = $thumb_subfolder . "/" . $target_filename; 320 320 321 321 // let's check that file already exists
Note: See TracChangeset
for help on using the changeset viewer.