# HG changeset patch # User Dan # Date 1238387577 14400 # Node ID 62c594682bf655231f826ff78ecddb6609f12ed0 # Parent b0995e600bde8209f847aa2ebdaf4d0a0ed1d10a# Parent 0d52ee49c11cb34b927c0b63cd395945d15787e0 Looks like I had something better already in; merged diff -r b0995e600bde -r 62c594682bf6 plugins/Newsboy.php --- a/plugins/Newsboy.php Mon Mar 30 00:31:33 2009 -0400 +++ b/plugins/Newsboy.php Mon Mar 30 00:32:57 2009 -0400 @@ -1,16 +1,16 @@ perms = $session->fetch_page_acl($this->page_id, $this->namespace); - } - - function send() - { - NewsBoy_namespace_handler($this); + function __construct($a, $b, $c = 0) + { + global $db, $session, $paths, $template, $plugins; // Common objects + + parent::__construct($a, $b, $c); + $this->perms = $session->fetch_page_acl($this->page_id, $this->namespace); + } + + function send() + { + ob_start(); + NewsBoy_namespace_handler($this); + if ( ob_get_contents() == '' ) + { + parent::send(); + } + } } } @@ -913,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;