diff -r 162b0f10e3d0 -r 0d52ee49c11c plugins/Newsboy.php --- a/plugins/Newsboy.php Mon Dec 22 14:30:59 2008 -0500 +++ b/plugins/Newsboy.php Sun Jan 25 20:23:09 2009 -0500 @@ -1,16 +1,16 @@ perms = $session->fetch_page_acl($this->page_id, $this->namespace); + } + + function send() + { + ob_start(); + NewsBoy_namespace_handler($this); + if ( ob_get_contents() == '' ) + { + parent::send(); + } + } + } +} + function NewsBoy_set_page_string() { global $db, $session, $paths, $template, $plugins; // Common objects @@ -895,25 +923,19 @@ { $publ = ( isset($_POST['published']) ) ? 1 : 0; - $result = PageUtils::createpage( (string)$time, 'NewsBoy', $name, $publ ); + $page = new PageProcessor((string)$time, 'NewsBoy'); + $page->create_page($name, $publ); - if ( $result == 'good' ) + if ( $page->update_page($_POST['content'], 'Initial revision', false) ) { - // Set content - $content = RenderMan::preprocess_text($_POST['content'], true); // this also SQL-escapes it - - $q = $db->sql_query('UPDATE '.table_prefix.'page_text SET page_text=\'' . $content . '\' WHERE page_id=\'' . $time . '\' AND namespace=\'NewsBoy\';'); - if ( !$q ) - $db->_die(); - - if ( $result ) - echo '
Your changes have been saved.
'; - else - $errors[] = 'PageUtils::createpage returned an error.'; + echo '
Your changes have been saved.
'; } else { - $errors[] = 'PageUtils::createpage returned an error: ' . htmlspecialchars($result); + while ( $err = $page->pop_error() ) + { + $errors[] = $err; + } } break;