plugins/Newsboy.php
changeset 15 f0cf0b512fbb
parent 14 a5263dadedf3
child 16 3d96dbb770b5
equal deleted inserted replaced
14:a5263dadedf3 15:f0cf0b512fbb
    63   $session->acl_extend_scope('edit_cat',               'NewsBoy', $paths);
    63   $session->acl_extend_scope('edit_cat',               'NewsBoy', $paths);
    64   $session->acl_extend_scope('even_when_protected',    'NewsBoy', $paths);
    64   $session->acl_extend_scope('even_when_protected',    'NewsBoy', $paths);
    65   $session->acl_extend_scope('upload_files',           'NewsBoy', $paths);
    65   $session->acl_extend_scope('upload_files',           'NewsBoy', $paths);
    66   $session->acl_extend_scope('upload_new_version',     'NewsBoy', $paths);
    66   $session->acl_extend_scope('upload_new_version',     'NewsBoy', $paths);
    67   $session->acl_extend_scope('create_page',            'NewsBoy', $paths);
    67   $session->acl_extend_scope('create_page',            'NewsBoy', $paths);
       
    68   $session->acl_extend_scope('html_in_pages',          'NewsBoy', $paths);
    68   $session->acl_extend_scope('php_in_pages',           'NewsBoy', $paths);
    69   $session->acl_extend_scope('php_in_pages',           'NewsBoy', $paths);
    69   $session->acl_extend_scope('edit_acl',               'NewsBoy', $paths);
    70   $session->acl_extend_scope('edit_acl',               'NewsBoy', $paths);
    70   
    71   
    71 }
    72 }
    72 
    73 
   213       ob_start();
   214       ob_start();
   214       NewsBoy_namespace_handler($this);
   215       NewsBoy_namespace_handler($this);
   215       if ( ob_get_contents() == '' )
   216       if ( ob_get_contents() == '' )
   216       {
   217       {
   217         parent::send();
   218         parent::send();
   218       } 
   219       }
       
   220       // transfer OB to parent
       
   221       $c = ob_get_contents();
       
   222       ob_end_clean();
       
   223       echo $c;
   219     }
   224     }
   220   }
   225   }
   221 }
   226 }
   222 
   227 
   223 function NewsBoy_set_page_string()
   228 function NewsBoy_set_page_string()
   834           if(!$e) $db->_die('The page comments could not be deleted.');
   839           if(!$e) $db->_die('The page comments could not be deleted.');
   835           $e = $db->sql_query('DELETE FROM '.table_prefix.'page_text WHERE page_id=\''.$page_id.'\' AND namespace=\''.$namespace.'\'');
   840           $e = $db->sql_query('DELETE FROM '.table_prefix.'page_text WHERE page_id=\''.$page_id.'\' AND namespace=\''.$namespace.'\'');
   836           if(!$e) $db->_die('The page text entry could not be deleted.');
   841           if(!$e) $db->_die('The page text entry could not be deleted.');
   837           $e = $db->sql_query('DELETE FROM '.table_prefix.'pages WHERE urlname=\''.$page_id.'\' AND namespace=\''.$namespace.'\'');
   842           $e = $db->sql_query('DELETE FROM '.table_prefix.'pages WHERE urlname=\''.$page_id.'\' AND namespace=\''.$namespace.'\'');
   838           if(!$e) $db->_die('The page entry could not be deleted.');
   843           if(!$e) $db->_die('The page entry could not be deleted.');
   839           $e = $db->sql_query('DELETE FROM '.table_prefix.'files WHERE page_id=\''.$page_id.'\'');
       
   840           if(!$e) $db->_die('The file entry could not be deleted.');
       
   841           
   844           
   842           $result = 'This page has been deleted. Note that there is still a log of edits and actions in the database, and anyone with admin rights can raise this page from the dead unless the log is cleared. If the deleted file is an image, there may still be cached thumbnails of it in the cache/ directory, which is inaccessible to users.';
   845           $result = 'This page has been deleted. Note that there is still a log of edits and actions in the database, and anyone with admin rights can raise this page from the dead unless the log is cleared. If the deleted file is an image, there may still be cached thumbnails of it in the cache/ directory, which is inaccessible to users.';
   843           
   846           
   844           echo $result . '<br />
   847           echo $result . '<br />
   845                <br />
   848                <br />
   846                <a href="#" onclick="ajaxPage(\'' . $paths->cpage['module'] . '\');">Return to Newsboy</a>';
   849                <a href="#" onclick="ajaxPage(\'' . $paths->cpage['module'] . '\'); return false;">Return to Newsboy</a>';
   847         }
   850         }
   848         else
   851         else
   849         {
   852         {
   850           echo '<form id="nb_delete_form" action="'.makeUrlNS('Special', 'Administration', (( isset($_GET['sqldbg'])) ? 'sqldbg&amp;' : '') .'module='.$paths->cpage['module'] . '&act=del').'" method="post">';
   853           echo '<form id="nb_delete_form" action="'.makeUrlNS('Special', 'Administration', (( isset($_GET['sqldbg'])) ? 'sqldbg&amp;' : '') .'module='.$paths->cpage['module'] . '&act=del').'" method="post">';
   851           echo '<div class="tblholder">
   854           echo '<div class="tblholder">
   924             $publ = ( isset($_POST['published']) ) ? 1 : 0;
   927             $publ = ( isset($_POST['published']) ) ? 1 : 0;
   925             
   928             
   926             $page = new PageProcessor((string)$time, 'NewsBoy');
   929             $page = new PageProcessor((string)$time, 'NewsBoy');
   927             $page->create_page($name, $publ);
   930             $page->create_page($name, $publ);
   928             
   931             
   929             if ( $page->update_page($_POST['content'], 'Initial revision', false) )
   932             if ( $page->update_page($_POST['content'], 'Initial revision', false, 'wikitext') )
   930             {
   933             {
   931               echo '<div class="info-box">Your changes have been saved.</div>';
   934               echo '<div class="info-box">Your changes have been saved.</div>';
       
   935               break;
   932             }
   936             }
   933             else
   937             else
   934             {
   938             {
   935               while ( $err = $page->pop_error() )
   939               while ( $err = $page->pop_error() )
   936               {
   940               {
   937                 $errors[] = $err;
   941                 $errors[] = $err;
   938               }
   942               }
       
   943               $done = false;
   939             }
   944             }
   940             
       
   941             break;
       
   942           }
   945           }
   943         }
   946         }
   944         
   947         
   945         if ( count($errors) > 0 )
   948         if ( count($errors) > 0 )
   946           echo '<div class="warning-box">Errors encountered while preparing data:<ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>';
   949           echo '<div class="warning-box">Errors encountered while preparing data:<ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>';