Plugin Directory

Changeset 1440713


Ignore:
Timestamp:
06/21/2016 07:56:18 AM (10 years ago)
Author:
uncovery
Message:

smaller fixes

Location:
unc-gallery/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • unc-gallery/trunk/readme.txt

    r1440652 r1440713  
    88Requires at least: 4.5.2
    99Tested up to: 4.5.2
    10 Version: 4.1
    11 Stable tag: 4.1
     10Version: 4.1.2
     11Stable tag: 4.1.2
    1212License: GPLv2
    1313License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6969== Changelog ==
    7070
     71= 4.1.2 =
     72
     731. Bug fixes
     74
    7175= 4.0 =
    7276
     
    82861. automatic post assignments of hierarchical categories based on EXIF/IPCT location info
    83871. featured images can now be latest and random images of the given set
    84 * optional square or rectangular thumbnails
     881. optional square or rectangular thumbnails
    8589
    8690= 3.2.2 =
  • unc-gallery/trunk/unc_config.inc.php

    r1440632 r1440713  
    1313
    1414$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'];
    1616$UNC_GALLERY['photos'] = "photos";                  // subfolder of upload_path where the photos go in
    1717$UNC_GALLERY['thumbnails'] = "thumbs";              // subfolder of upload_path where the thumbs go in
  • unc-gallery/trunk/unc_display.inc.php

    r1440632 r1440713  
    304304    remove_filter('the_content', 'wpautop');
    305305
    306     $photo_folder =  $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR . $UNC_GALLERY['photos'];
     306    $photo_folder =  $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['photos'];
    307307
    308308    // get a json datepicker
     
    369369            $file = $D['file'];
    370370        }
    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;
    372372        $out = unc_display_image_html($file_path, $thumb, false);
    373373    } else {
  • unc-gallery/trunk/unc_gallery.php

    r1440652 r1440713  
    44Plugin URI:  https://uncovery.net/about
    55Description: A simple, self-generating, date-based gallery with bulk uploading
    6 Version:     4.1
     6Version:     4.1.2
    77Author:      Uncovery
    88Author URI:  http://uncovery.net
  • unc-gallery/trunk/unc_image.inc.php

    r1440632 r1440713  
    200200    $folder_info = pathinfo($file_path);
    201201    $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);
    203203    $file_name = $folder_info['basename'];
    204204
    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";
    206206
    207207    // in case the data is missing, write a new file
     
    210210        $check = unc_image_info_write($file_path);
    211211    }
    212     $file_code = md5($date_path . DIRECTORY_SEPARATOR . $file_name . ".php");
     212    $file_code = md5($date_path . "/" . $file_name . ".php");
    213213    // reset the data so we re-read it from file
    214214    $UNC_FILE_DATA[$file_code] = false;
     
    256256    $folder_info = pathinfo($file_path);
    257257    $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);
    259259    $file_name = $folder_info['basename'];
    260260
     
    268268    $thumb_url = content_url($UNC_GALLERY['upload_folder'] . "/" . $UNC_GALLERY['thumbnails'] . "/$date_path/$file_name");
    269269
    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";
    271271
    272272    $data = array(
     
    290290
    291291    // write the file
    292     $file_code = md5($date_path . DIRECTORY_SEPARATOR . $file_name . ".php");
     292    $file_code = md5($date_path . "/" . $file_name . ".php");
    293293    global $UNC_FILE_DATA;
    294294    $UNC_FILE_DATA[$file_code] = $data;
  • unc-gallery/trunk/unc_tools.inc.php

    r1440632 r1440713  
    3131    foreach ($path_arr as $img_folder) {
    3232        // create the complete folder
    33         $base_folder = $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR . $img_folder;
     33        $base_folder = $UNC_GALLERY['upload_path'] . "/" . $img_folder;
    3434        // iterate the date strings y m d
    3535        foreach ($date_folders as $date_folder) {
     
    3737            if ($date_folder) {
    3838                $date_element = $date_obj->format($date_folder);
    39                 $base_folder .= DIRECTORY_SEPARATOR . "$date_element";
     39                $base_folder .= "/$date_element";
    4040            }
    4141            // take the final folder string and check if already exists
     
    7272    }
    7373    // convert date to folder string
    74     $fstr = DIRECTORY_SEPARATOR;
     74    $fstr = "/";
    7575    $out = "";
    7676    $date_folder = date_format($date_obj, "Y{$fstr}m{$fstr}d");
     
    8181    foreach ($path_arr as $img_folder) {
    8282        // 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;
    8484        if (!file_exists($base_folder)) {
    8585            // the folder does not exist, so let's not delete anything
     
    101101        rmdir($base_folder);
    102102        // 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);
    104104    }
    105105    return $out;
     
    121121
    122122    $empty = true;
    123     $path_wildcard = $path . DIRECTORY_SEPARATOR . "*";
     123    $path_wildcard = $path . "/*";
    124124    foreach (@glob($path_wildcard) as $file) {
    125125        if (is_dir($file)) { // recurse lower directory
     
    151151        return false;
    152152    }
    153     foreach (glob($path . DIRECTORY_SEPARATOR . "*") as $file) {
     153    foreach (glob($path . "/*") as $file) {
    154154        if (is_dir($file)) { // recurse lower directory
    155155           unc_tools_import_enumerate($file);
     
    244244    foreach ($dates as $date_str) {
    245245        // 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) {
    250250            $F = unc_image_info_read($file_path, $D);
    251251            if (($D['range']['end_time'] && $D['range']['start_time']) && // only if both are set
     
    343343    if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());}
    344344    // safety net
    345     if (strpos($base_folder, '.' . DIRECTORY_SEPARATOR)) {
     345    if (strpos($base_folder, './')) {
    346346        die("Error, recursive path! $base_folder");
    347347    }
    348     foreach (glob($base_folder . DIRECTORY_SEPARATOR . "*") as $file) {
     348    foreach (glob($base_folder . "/*") as $file) {
    349349        if (is_dir($file)) {
    350350            $TMP_FOLDERS[] = unc_gallery_recurse_files($file, $file_function, $dir_function);
     
    368368    global $TMP_FOLDERS, $UNC_GALLERY;
    369369    if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());}
    370     if (strpos($base_folder, '.' . DIRECTORY_SEPARATOR)) {
     370    if (strpos($base_folder, './')) {
    371371        die("Error, recursive path! $base_folder");
    372372    }
    373373    $has_subfolder = false;
    374374    if (!file_exists($base_folder)) {
     375        if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace("Base folder does not exist: ", $base_folder);}
    375376        return false;
    376377    }
    377     foreach (glob($base_folder . DIRECTORY_SEPARATOR . "*") as $folder) {
     378    foreach (glob($base_folder . "/*") as $folder) {
    378379        // found a sub-folder, go deeper
    379380        if (is_dir($folder)) {
     
    383384    }
    384385    if (!$has_subfolder) {
    385         $path_arr = explode(DIRECTORY_SEPARATOR, $base_folder);
     386        $path_arr = explode("/", $base_folder);
    386387        $date_elements = array_slice($path_arr, -3, 3);
    387         $date_string = implode(DIRECTORY_SEPARATOR, $date_elements);
     388        $date_string = implode("/", $date_elements);
    388389        $TMP_FOLDERS[$date_string] = $base_folder;
    389390    }
     
    401402    if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());}
    402403
    403     $photo_folder =  $UNC_GALLERY['upload_path'] . DIRECTORY_SEPARATOR . $UNC_GALLERY['photos'];
     404    $photo_folder =  $UNC_GALLERY['upload_path'] . "/" . $UNC_GALLERY['photos'];
    404405    $folders = unc_tools_recurse_folders($photo_folder);
    405406    if (count($folders) == 1 ) {
     
    425426    global $UNC_GALLERY;
    426427    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'];
    428429    $folders = unc_tools_recurse_folders($photo_folder);
    429430    if (count($folders) == 0) {
     
    446447    global $UNC_GALLERY, $UNC_FILE_DATA;
    447448    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;
    449450    $folder_files = array();
    450451
    451     foreach (glob($base_folder . DIRECTORY_SEPARATOR . "*") as $file_path) {
     452    foreach (glob($base_folder . "/*") as $file_path) {
    452453        // found a sub-folder, go deeper
    453454        if (!is_dir($file_path)) {
    454455            require_once($file_path);
    455456            $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");
    457458            $file_timestamp = $UNC_FILE_DATA[$file_code]['time_stamp'];
    458459            $folder_files[$file_timestamp] = $UNC_FILE_DATA[$file_code];
     
    475476    global $UNC_GALLERY;
    476477    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;
    478479    $files = array();
    479     foreach (glob($base_folder . DIRECTORY_SEPARATOR . "*") as $file) {
     480    foreach (glob($base_folder . "/*") as $file) {
    480481        // found a sub-folder, go deeper
    481482        if (!is_dir($file)) {
     
    500501    global $UNC_GALLERY;
    501502    if ($UNC_GALLERY['debug']) {XMPP_ERROR_trace(__FUNCTION__, func_get_args());}
    502     $path_arr = explode(DIRECTORY_SEPARATOR, $folder);
     503    $path_arr = explode("/", $folder);
    503504    // get last 3 elements
    504505    $new_date_arr = array_slice($path_arr, -3, 3);
     
    541542    global $UNC_GALLERY;
    542543    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;
    546547    return $file_path;
    547548}
     
    559560    global $UNC_GALLERY;
    560561    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'];
    562563    $base_length = strlen($photo_folder) + 1;
    563564
    564565    $dates = array();
    565     foreach (glob($base_folder . DIRECTORY_SEPARATOR . "*") as $current_path) {
     566    foreach (glob($base_folder . "/*") as $current_path) {
    566567        $file = basename($current_path);
    567568        // get current date from subfolder
    568569        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));
    570571            if (strlen($cur_date) == 10) { // we have a full date, add to array
    571572                $dates[$cur_date] = 0;
     
    577578            }
    578579        } 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));
    580581            $dates[$cur_date][] = $file;
    581582        }
     
    609610
    610611    $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);
    612613
    613614
     
    619620
    620621    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;
    622623        if (file_exists($full_path)) {
    623624            $check = unlink($full_path);
     
    686687    $date_obj = new DateTime($date . " 00:00:00");
    687688    if ($date_obj) {
    688         $format = implode(DIRECTORY_SEPARATOR, array('Y', 'm', 'd'));
     689        $format = implode("/", array('Y', 'm', 'd'));
    689690        $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)) {
    692693            if ($UNC_GALLERY['no_image_alert'] == 'error') {
    693694                $UNC_GALLERY['errors'][] = unc_display_errormsg("No images found for this date!");
  • unc-gallery/trunk/unc_upload.inc.php

    r1440632 r1440713  
    309309
    310310    // 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'));
    312312
    313313    $date_str_folder = $date_obj->format($format);
    314314    // echo "Folder date is $date_str_folder<br>";
    315315
    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;
    320320
    321321    // let's check that file already exists
Note: See TracChangeset for help on using the changeset viewer.