Changeset 558 for trunk/plog-admin/plog-import.php
- Timestamp:
- 07/15/08 13:36:59 (5 months ago)
- Files:
-
- 1 modified
-
trunk/plog-admin/plog-import.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plog-admin/plog-import.php
r555 r558 47 47 //print_r($_POST); 48 48 49 if (isset($_POST['upload'])) {49 if (isset($_POST['upload'])) { 50 50 51 51 $destinations = isset($_POST['destinations']) ? $_POST['destinations'] : ''; … … 59 59 $files = get_files($config['basedir'] . 'plog-content/uploads'); 60 60 61 if ($_POST['destination_radio'] == "new" && $_POST["new_album_name"] == "") {61 if ($_POST['destination_radio'] == "new" && $_POST["new_album_name"] == "") { 62 62 $output .= "\n\t" . '<p class="errors">' . plog_tr('New album name not specified!') . '</p>' . "\n"; 63 } 64 else { 63 } else { 65 64 66 65 if ($_POST["destination_radio"] == "new"){ 67 66 // Create the new album 68 $result = add_album($_POST["new_album_name"], NULL, $_POST["collections_menu"]); 69 $album_id = $result["id"]; 70 } 71 else 72 { 67 $result = add_album($_POST['new_album_name'], NULL, $_POST['collections_menu']); 68 if (!$result['errors']) { 69 // no errors, add images to new album 70 $album_id = $result['id']; 71 } else { 72 // errors exist, let's find out what they are 73 if (isset($result['output']) && $result['output'] == "existing" && isset($result['id'])) { 74 // album already exists so try insert images into the existing album 75 // and alert the user that their "new" album is already existing 76 $album_id = $result['id']; 77 // get the collection name for display 78 $sql = "SELECT `name` FROM ".TABLE_PREFIX."collections WHERE id = ".intval($_REQUEST['collections_menu']); 79 $result = run_query($sql); 80 $row = mysql_fetch_assoc($result); 81 $output .= "\n\t" . '<p class="actions">'.sprintf(plog_tr('Album already exists. Uploading file to existing album `%s` in collection `%s`'), $_REQUEST['new_album_name'], $row['name']).'</p>' . "\n"; 82 } else { 83 // error has nothing to do with an existing album, show the returned error 84 $album_id = ''; 85 $output .= "\n\t" . '<p class="errors">' . $result['errors'] . '</p>' . "\n"; 86 } 87 } 88 } else { 89 // use an existing album 73 90 $album_id = $_POST["destination"]; 74 91 } … … 93 110 // delete thumbnail file if it exists 94 111 $thumbpath = $config['basedir'] . 'plog-content/thumbs/import-'.substr($file_key,0,2).'-'.basename($file_name); 95 if (is_file($thumbpath) && is_readable($thumbpath)) 96 { 112 if (is_file($thumbpath) && is_readable($thumbpath)) { 97 113 unlink($thumbpath); 98 } ;99 } ;114 } 115 } 100 116 } 101 117 102 118 $counter++; 103 } ;119 } 104 120 105 121 } … … 108 124 $sql = "SELECT name FROM ".TABLE_PREFIX."albums WHERE id = $album_id"; 109 125 $result = run_query($sql); 110 111 126 $row = mysql_fetch_assoc($result); 112 127 113 128 $output .= "\n\t" . '<p class="actions">'.sprintf(plog_tr('%d picture(s) were successfully imported to album <strong>%s</strong>'),$imported,$row['name']). '</p>' . "\n"; 114 129 115 if ($imported == 0) 116 $output .= "\n\t" . '<p class="errors">' . plog_tr('Make sure to CHMOD 777 your newly created folders within the \'plog-content/uploads/\' directory or else Plogger cannot access them. Plogger cannot CHMOD the directory for you while PHP is in safe mode.') . '</p>' . "\n"; 117 } 118 else 119 $output .= "\n\t" . '<p class="errors">'.$result['output'].'</p>' . "\n"; 120 130 if ($imported == 0) { 131 $output .= "\n\t" . '<p class="errors">' . plog_tr('Make sure to CHMOD 777 your newly created folders within the \'plog-content/uploads/\' directory or else Plogger cannot access them. Plogger cannot CHMOD the directory for you while PHP is in safe mode.') . '</p>' . "\n"; 132 } 133 /* what is this for? 134 else { 135 $output .= "\n\t" . '<p class="errors">'.$result['output'].'</p>' . "\n"; 136 }*/ 137 } 121 138 } 122 139
