/** * Perform the upload and add a new hook for plugins * * @return void */ function processor() { global $wpdb, $ngg, $nggdb; $defaultpath = $ngg->options['gallerypath']; if (isset($_POST['addgallery'])) { check_admin_referer('ngg_addgallery'); if (!nggGallery::current_user_can('NextGEN Add new gallery')) { wp_die(__('Cheatin’ uh?')); } $newgallery = esc_attr($_POST['galleryname']); if (!empty($newgallery)) { nggAdmin::create_gallery($newgallery, $defaultpath); } } if (isset($_POST['zipupload'])) { check_admin_referer('ngg_addgallery'); if (!nggGallery::current_user_can('NextGEN Upload a zip')) { wp_die(__('Cheatin’ uh?')); } if ($_FILES['zipfile']['error'] == 0 || !empty($_POST['zipurl'])) { nggAdmin::import_zipfile(intval($_POST['zipgalselect'])); } else { nggGallery::show_error(__('Upload failed!', 'nggallery')); } } if (isset($_POST['importfolder'])) { check_admin_referer('ngg_addgallery'); if (!nggGallery::current_user_can('NextGEN Import image folder')) { wp_die(__('Cheatin’ uh?')); } $galleryfolder = $_POST['galleryfolder']; if (!empty($galleryfolder) and $defaultpath != $galleryfolder) { nggAdmin::import_gallery($galleryfolder); } } if (isset($_POST['uploadimage'])) { check_admin_referer('ngg_addgallery'); if (!nggGallery::current_user_can('NextGEN Upload in all galleries')) { wp_die(__('Cheatin’ uh?')); } if ($_FILES['imagefiles']['error'][0] == 0) { $messagetext = nggAdmin::upload_images(); } else { nggGallery::show_error(__('Upload failed! ' . nggAdmin::decode_upload_error($_FILES['imagefiles']['error'][0]), 'nggallery')); } } if (isset($_POST['swf_callback'])) { if ($_POST['galleryselect'] == '0') { nggGallery::show_error(__('No gallery selected !', 'nggallery')); } else { if ($_POST['swf_callback'] == '-1') { nggGallery::show_error(__('Upload failed! ', 'nggallery')); } else { $gallery = $nggdb->find_gallery((int) $_POST['galleryselect']); nggAdmin::import_gallery($gallery->path); } } } if (isset($_POST['disable_flash'])) { check_admin_referer('ngg_addgallery'); $ngg->options['swfUpload'] = false; update_option('ngg_options', $ngg->options); } if (isset($_POST['enable_flash'])) { check_admin_referer('ngg_addgallery'); $ngg->options['swfUpload'] = true; update_option('ngg_options', $ngg->options); } do_action('ngg_update_addgallery_page'); }