aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/include/photos_add_direct_process.inc.php84
-rw-r--r--admin/include/uploadify/uploadify.php27
2 files changed, 38 insertions, 73 deletions
diff --git a/admin/include/photos_add_direct_process.inc.php b/admin/include/photos_add_direct_process.inc.php
index 27cb0b9a1..15c7abebb 100644
--- a/admin/include/photos_add_direct_process.inc.php
+++ b/admin/include/photos_add_direct_process.inc.php
@@ -43,44 +43,7 @@ if (isset($_GET['processed']))
);
}
- $category_id = null;
- if (!isset($_POST['category_type']))
- {
- // nothing to do, we certainly have the post_max_size issue
- }
- elseif ('existing' == $_POST['category_type'])
- {
- $category_id = $_POST['category'];
- }
- elseif ('new' == $_POST['category_type'])
- {
- $output_create = create_virtual_category(
- $_POST['category_name'],
- (0 == $_POST['category_parent'] ? null : $_POST['category_parent'])
- );
-
- $category_id = $output_create['id'];
-
- if (isset($output_create['error']))
- {
- array_push($page['errors'], $output_create['error']);
- }
- else
- {
- $category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&cat_id=');
- // information
- array_push(
- $page['infos'],
- sprintf(
- l10n('Album "%s" has been added'),
- '<em>'.$category_name.'</em>'
- )
- );
- // TODO: add the onclick="window.open(this.href); return false;"
- // attribute with jQuery on upload.tpl side for href containing
- // "cat_modify"
- }
- }
+ $category_id = $_POST['category'];
$image_ids = array();
@@ -206,20 +169,6 @@ if (isset($_GET['processed']))
if (isset($_SESSION['uploads'][ $_POST['upload_id'] ]))
{
$image_ids = $_SESSION['uploads'][ $_POST['upload_id'] ];
-
- associate_images_to_categories(
- $image_ids,
- array($category_id)
- );
-
- $query = '
-UPDATE '.IMAGES_TABLE.'
- SET level = '.$_POST['level'].'
- WHERE id IN ('.implode(', ', $image_ids).')
-;';
- pwg_query($query);
-
- invalidate_user_cache();
}
}
@@ -291,28 +240,25 @@ SELECT
);
}
- if ('existing' == $_POST['category_type'])
- {
- $query = '
+ $query = '
SELECT
COUNT(*)
FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id = '.$category_id.'
;';
- list($count) = pwg_db_fetch_row(pwg_query($query));
- $category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&amp;cat_id=');
-
- // information
- array_push(
- $page['infos'],
- sprintf(
- l10n('Album "%s" now contains %d photos'),
- '<em>'.$category_name.'</em>',
- $count
- )
- );
- }
-
+ list($count) = pwg_db_fetch_row(pwg_query($query));
+ $category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&amp;cat_id=');
+
+ // information
+ array_push(
+ $page['infos'],
+ sprintf(
+ l10n('Album "%s" now contains %d photos'),
+ '<em>'.$category_name.'</em>',
+ $count
+ )
+ );
+
$page['batch_link'] = PHOTOS_ADD_BASE_URL.'&batch='.implode(',', $image_ids);
}
}
diff --git a/admin/include/uploadify/uploadify.php b/admin/include/uploadify/uploadify.php
index 8b3f49bb5..948280d90 100644
--- a/admin/include/uploadify/uploadify.php
+++ b/admin/include/uploadify/uploadify.php
@@ -19,7 +19,7 @@ echo '$user'."\n";
print_r($user);
$tmp = ob_get_contents();
ob_end_clean();
-// error_log($tmp, 3, "/tmp/php-".date('YmdHis').'-'.sprintf('%020u', rand()).".log");
+error_log($tmp, 3, "/tmp/php-".date('YmdHis').'-'.sprintf('%020u', rand()).".log");
if ($_FILES['Filedata']['error'] !== UPLOAD_ERR_OK)
{
@@ -43,8 +43,8 @@ ob_start();
$image_id = add_uploaded_file(
$_FILES['Filedata']['tmp_name'],
$_FILES['Filedata']['name'],
- null,
- 8
+ array($_POST['category_id']),
+ $_POST['level']
);
if (!isset($_SESSION['uploads']))
@@ -62,12 +62,31 @@ array_push(
$image_id
);
+$query = '
+SELECT
+ id,
+ path,
+ tn_ext
+ FROM '.IMAGES_TABLE.'
+ WHERE id = '.$image_id.'
+;';
+$image_infos = pwg_db_fetch_assoc(pwg_query($query));
+
+$thumbnail_url = preg_replace('#^'.PHPWG_ROOT_PATH.'#', './', get_thumbnail_url($image_infos));
+
+$return = array(
+ 'image_id' => $image_id,
+ 'category_id' => $_POST['category_id'],
+ 'thumbnail_url' => $thumbnail_url,
+ );
+
$output = ob_get_contents();
ob_end_clean();
if (!empty($output))
{
add_upload_error($_POST['upload_id'], $output);
+ $return['error_message'] = $output;
}
-echo "1";
+echo json_encode($return);
?> \ No newline at end of file