Copy.php

From Organic Design wiki
Revision as of 08:41, 9 March 2006 by Nad (talk | contribs) (New article-copy feature on the way)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<?

  1. Get article name and content from form

xwGetProperty( $properties, 'example/target', $target ); xwGetProperty( $properties, 'example/summary', $summary );

  1. If both are set, create/edit the article

if ( $target ) { if ( $summary ) $summary = ": $summary"; $newTitle = ucfirst( eregi_replace( '[^a-z0-9_]+', '_', $newTitle ) ); $a = new Article( $t = Title::makeTitleSafe( 0, $newTitle ) ); $id = $t->getArticleID(); if ( $id ) xwMessage( "Could not copy article, target \"$target\" already exists!", 'red' ); else $a->insertNewArticle( $article, "Copied from $title$summary", false, false ); xwMessage( 'Article copied successfully', 'green' ); } else xwMessage( 'Please specify an article title and content', 'red' );

?>