/** * Inserts the submitted properties of uploaded media items * * @return array array('image_id') holding the last created thumbnail for immediate processing * */ function serendipity_parsePropertyForm() { global $serendipity; if (!is_array($serendipity['POST']['mediaProperties'])) { return false; } serendipity_checkPropertyAccess($serendipity['POST']['mediaProperties'], $serendipity['POST']['mediaKeywords'], 'write'); foreach ($serendipity['POST']['mediaProperties'] as $id => $media) { serendipity_insertMediaProperty('base_property', '', $media['image_id'], $media); $s9y_img = $media['internal']; $s9y_img['image_id'] = $media['image_id']; serendipity_prepareMedia($s9y_img); $s9y_img['metadata'] =& serendipity_getMetaData($s9y_img['realfile'], $s9y_img['header']); serendipity_insertMediaProperty('base_metadata', 'ALL', $media['image_id'], $s9y_img['metadata']); $s9y_img['hidden'] = array('author' => $serendipity['serendipityUser'], 'authorid' => $serendipity['authorid']); serendipity_insertMediaProperty('base_hidden', '', $media['image_id'], $s9y_img['hidden']); if ($serendipity['POST']['oldDir'][$id] != $serendipity['POST']['newDir'][$id]) { serendipity_moveMediaDirectory(serendipity_uploadSecure($serendipity['POST']['oldDir'][$id]), serendipity_uploadSecure($serendipity['POST']['newDir'][$id]), 'filedir', $media['image_id']); } } if (is_array($serendipity['POST']['mediaKeywords'])) { foreach ($serendipity['POST']['mediaKeywords'] as $id => $keywords) { serendipity_insertMediaProperty('base_keyword', '', $serendipity['POST']['mediaProperties'][$id]['image_id'], $keywords); } } $array = array('image_id' => $serendipity['POST']['mediaProperties'][0]['image_id']); return $array; }
serendipity_plugin_api::hook_event('backend_image_add', $target, $created_thumbnail); $new_media[] = array('image_id' => $image_id, 'target' => $target, 'created_thumbnail' => $created_thumbnail); } else { // necessary for the ajax-uplaoder to show upload errors header("Internal Server Error", true, 500); $messages[] = '<span class="msg_error"><span class="icon-attention-circled"></span> ' . ERROR_UNKNOWN_NOUPLOAD . '</span>'; } } } } if (isset($_REQUEST['go_properties'])) { echo serendipity_showPropertyForm($new_media); } else { $hidden = array('author' => $serendipity['serendipityUser'], 'authorid' => $serendipity['authorid']); foreach ($new_media as $nm) { serendipity_insertMediaProperty('base_hidden', '', $nm['image_id'], $hidden); } $data['showML'] = showMediaLibrary(null, true); } $data['messages'] = $messages; break; case 'directoryDoDelete': if (!serendipity_checkFormToken() || !serendipity_checkPermission('adminImagesDirectories')) { return; } $data['case_directoryDoDelete'] = true; $new_dir = serendipity_uploadSecure($serendipity['GET']['dir'], true); if (is_dir($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $new_dir)) { if (!is_writable($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $new_dir)) { $data['print_DIRECTORY_WRITE_ERROR'] = sprintf(DIRECTORY_WRITE_ERROR, $new_dir); } else {