function publish_RemoveFromXDB($exist, $collName, $packName, $partName, &$operationsPublish) { $toPublish = array(); $component = $collName; if ($packName != '') { $component .= SYS_PATH_SEP . $packName; } $operationsPublish .= '(*) > avvio la de-pubblicazione sul web per "' . $component . '":<br />'; hardFlush(&$operationsPublish); $prosecute = $collName != ''; if ($prosecute) { // DE-PUBBLICA SU XMLDB $operationsPublish .= '> connessione al database "exist":<br />'; hardFlush(&$operationsPublish); $baseDB = XMLDB_PATH_BASE; if ($packName == '') { if (@$exist->removeCollection($baseDB . $collName)) { $operationsPublish .= '> de-pubblico la Collection "' . $collName . '"...<br />'; } else { $operationsPublish .= '<span class="error">impossibile de-pubblicare la Collection "' . $collName . '"!</span><br />'; } } else { if ($exist->removeDocument($baseDB . $collName . SYS_PATH_SEP . $packName . '.xml')) { $operationsPublish .= '> de-pubblico il Package "' . $packName . '" in "' . $collName . '"...<br />'; } else { $operationsPublish .= '<span class="error">impossibile de-pubblicare il Package "' . $packName . '" in "' . $collName . '"!</span><br />'; } } } hardFlush(&$operationsPublish); return TRUE && $prosecute; }
$attachments = get_children(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null, 'output' => 'object')); $total = count($attachments); echo "\n" . sprintf(__('Whe have %d attachments.'), $total); hardFlush(); $i = 0; foreach ($attachments as $attachment) { $i++; // Update attachment link (double quote) $result = $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, %s, %s)", 'href="' . wp_get_attachment_url($attachment->ID), 'href="' . get_attachment_link($attachment->ID))); if (is_int($result) && $result > 0) { echo "\n" . sprintf(__('%d/%d : Link modification OK for the media %d : %s.'), $i, $total, $attachment->ID, $attachment->post_title); hardFlush(); } else { // Echec echo "\n" . sprintf(__('%d/%d : An error occured with the media %d : %s. (no changes in DB)'), $i, $total, $attachment->ID, $attachment->post_title); hardFlush(); } /* This part is optionnaly // Update attachment link (simple quote) $result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_content = REPLACE(post_content, %s, %s)", "href='".wp_get_attachment_url($attachment->ID), "href='".get_attachment_link($attachment->ID)) ); if ( is_int($result) && $result > 0 ) { echo "\n".sprintf(__('%d/%d : Link modification OK for the media %d : %s.'), $i, $total, $attachment->ID, $attachment->post_title); hardFlush(); } else { // Echec echo "\n".sprintf(__('%d/%d : An error occured with the media %d : %s. (no changes in DB)'), $i, $total, $attachment->ID, $attachment->post_title); hardFlush(); } */ }
//OK } } } } } if ($doUnpublish) { if (publish_RemoveFromXDB($existAdmin, $collection_id, $package_id, $part_id, &$resultMsg)) { //OK } } if ($doAdmin) { dctl_xmldb_disconnect($existAdmin); } $resultMsg .= '</ul>'; hardFlush(&$resultMsg); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // COLLEZIONI PUBBLICATE // // SELEZIONA COLLECTION $fDiv0 = 'divSelectCollection'; $collectionPath = DCTL_PROJECT_PATH . $collection_id . SYS_PATH_SEP; getCollectionList(DCTL_PROJECT_PATH, &$collectionList, true); //putOpenCloseLevel $returnText .= putOpenLevel($fDiv0, $loc4msg, $collection_id != '', 'Seleziona una Collection (' . (count($collectionList['path']) - 1) . ')', &$resultMsg); $returnText .= '<form id="form' . $fDiv0 . '" action="' . $_SERVER['PHP_SELF'] . '" method="' . DCTL_FORM_METHOD . '" enctype="' . DCTL_FORM_ENCTYPE . '">'; $returnText .= '<fieldset>'; $returnText .= '<label>Scegli:</label>';