Changeset 556

Show
Ignore:
Timestamp:
07/09/08 13:00:01 (3 months ago)
Author:
sidtheduck
Message:

+ Fix for ticket #177 - Deleting albums and collections
+ Fixed errors in "Air" theme comments.php and slideshow.php

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/plog-admin/plog-admin-functions.php

    r555 r556  
    454454        if (!$collection) { 
    455455                return array('errors' => plog_tr('No such collection')); 
    456         }; 
     456        } 
    457457 
    458458        // first delete all albums registered with this album 
     
    461461        while ($row = mysql_fetch_assoc($result)) { 
    462462                delete_album($row['id']); 
    463         }; 
     463        } 
    464464 
    465465        // XXX: un-register collection 
     
    473473 
    474474        $collection_directory = realpath($config['basedir'] . 'plog-content/images/'.$source_collection_name); 
    475         $relative_path = substr($collection_directory,0,strlen($config['basedir'])); 
    476         $collection_path = explode('/',substr($collection_directory,strlen($config['basedir']))); 
    477         // it needs to have 2 parts - images and collection name, if it doesn't, then there is something 
    478         // wrong with collection name and it's probably not safe to try to delete the directory 
    479         if ($relative_path == $config['basedir'] && sizeof($collection_path) == 2) { 
     475        // check to see if the collection_directory is a real directory and then try to delete it 
     476        if (is_dir($collection_directory)){ 
    480477                @chmod($collection_directory,0777); 
    481478                $delete_result = rmdir($collection_directory); 
    482479                if (!$delete_result) { 
    483480                        return array('errors' => plog_tr('Collection directory still contains files after all albums have been deleted.')); 
    484                 }; 
     481                } 
    485482                 
    486483        } else { 
    487484                return array('errors' => plog_tr('Collection has invalid path, not deleting directory')); 
    488         }; 
     485        } 
    489486        return array(); 
    490487} 
     
    718715        if (!$album) { 
    719716                return array('errors' => plog_tr('No such album')); 
    720         }; 
     717        } 
    721718 
    722719        // first delete all pictures registered with this album 
     
    725722        while ($row = mysql_fetch_assoc($result)) { 
    726723                delete_picture($row['id']); 
    727         }; 
     724        } 
    728725 
    729726        // XXX: un-register album 
     
    738735 
    739736        $album_directory = realpath($config['basedir'] . 'plog-content/images/'.$source_collection_name."/".$source_album_name); 
    740         $relative_path = substr($album_directory,0,strlen($config['basedir'])); 
    741         $album_path = explode('/',substr($album_directory,strlen($config['basedir']))); 
    742         // it needs to have 3 parts - images, collection name and album name, if it doesn't, then there is something 
    743         // wrong with either collection or album name and it's probably not safe to try to delete the directory 
    744         if ($relative_path == $config['basedir'] && sizeof($album_path) == 3) { 
     737        // check to see if the album_directory is a real directory and then try to delete it 
     738        if (is_dir($album_directory)){ 
    745739                @chmod($album_directory,0777); 
    746740                $delete_result = rmdir($album_directory); 
    747741                if (!$delete_result) { 
    748742                        return array('errors' => plog_tr('Album directory still contains files after all pictures have been deleted.')); 
    749                 }; 
     743                } 
    750744 
    751745        } else { 
    752746                return array('errors' => plog_tr('Album has invalid path, not deleting directory')); 
    753         }; 
     747        } 
    754748        return array(); 
    755749} 
  • trunk/plog-content/themes/air/comments.php

    r552 r556  
    11 
    22<?php if (plogger_comments_on()) { ?> 
    3                 <a name="comments"></a><h2 class="comment-heading">' . plog_tr('Comments') . ':</h2>'; 
     3                <a name="comments"></a><h2 class="comment-heading"><?php echo plog_tr('Comments'); ?>:</h2> 
    44 
    55                <? if (plogger_picture_has_comments()) { ?> 
  • trunk/plog-content/themes/air/slideshow.php

    r552 r556  
    3636 
    3737<?php function generate_slideshow_interface() { 
    38         global $config; 
     38        global $config, $thumbnail_config; 
    3939        $large_link = ' 
    4040        <a accesskey="v" title="' . plog_tr('View Large Image') . '" href="javascript:slides.hotlink()"> 
    41                 <img src="'.$config["gallery_url"].'graphics/search.gif" width="16" height="16" alt="'. plog_tr('View Large Image') . '"/> 
     41                <img src="'.THEME_URL.'images/search.gif" width="16" height="16" alt="'. plog_tr('View Large Image') . '"/> 
    4242        </a>'; 
    4343 
    4444        $prev_url = ' 
    4545        <a accesskey="," title="' .plog_tr('Previous Image') . '" href="javascript:slides.previous();"> 
    46                 <img src="'.$config["gallery_url"].'graphics/rewind.gif" width="16" height="16" alt="' . plog_tr('Previous Image') . '" /> 
     46                <img src="'.THEME_URL.'images/rewind.gif" width="16" height="16" alt="' . plog_tr('Previous Image') . '" /> 
    4747        </a>'; 
    4848 
    4949        $next_url = ' 
    5050        <a accesskey="." title="' . plog_tr('Next Image') . '" href="javascript:slides.next();"> 
    51                 <img src="'.$config["gallery_url"].'graphics/fforward.gif" width="16" height="16" alt="' . plog_tr('Next Image') . '" /> 
     51                <img src="'.THEME_URL.'images/fforward.gif" width="16" height="16" alt="' . plog_tr('Next Image') . '" /> 
    5252        </a>'; 
    5353 
    5454        $stop_url = ' 
    5555        <a accesskey="x" title="'. plog_tr('Stop Slideshow') . '" href="javascript:slides.pause();"> 
    56                 <img src="'.$config["gallery_url"].'graphics/stop.gif" width="16" height="16" alt="' . plog_tr('Stop Slideshow') . '" /> 
     56                <img src="'.THEME_URL.'images/stop.gif" width="16" height="16" alt="' . plog_tr('Stop Slideshow') . '" /> 
    5757        </a>'; 
    5858 
    5959        $play_url = ' 
    6060        <a accesskey="s" title="'. plog_tr('Start Slideshow') . '" href="javascript:slides.play();"> 
    61                 <img src="'.$config["gallery_url"].'graphics/play.gif" width="16" height="16" alt="' .  plog_tr('Start Slideshow') . '" /> 
     61                <img src="'.THEME_URL.'images/play.gif" width="16" height="16" alt="' .  plog_tr('Start Slideshow') . '" /> 
    6262        </a>'; 
    6363 
    64         $output = '<div class="large-thumb-toolbar" style="width:'.$config["max_display_size"].'">'.$large_link.$prev_url.$stop_url.$play_url.$next_url.'</div>'; 
     64        $output = '<div class="large-thumb-toolbar" style="width:'.$thumbnail_config[THUMB_LARGE]["size"].'">'.$large_link.$prev_url.$stop_url.$play_url.$next_url.'</div>'; 
    6565 
    6666        $imgtag = '<img id="slideshow_image" class="photos-large" src="about:blank" title="" alt="" />';