plugins/SpecialPageFuncs.php
changeset 229 97ae8e9d5e29
parent 221 e5302cb1945c
child 304 e2cb5f1432c8
equal deleted inserted replaced
147:d8156d18ac58 229:97ae8e9d5e29
     2 /*
     2 /*
     3 Plugin Name: Special page-related pages
     3 Plugin Name: Special page-related pages
     4 Plugin URI: http://enanocms.org/
     4 Plugin URI: http://enanocms.org/
     5 Description: Provides the page Special:CreatePage, which can be used to create new pages. Also adds the About Enano and GNU General Public License pages.
     5 Description: Provides the page Special:CreatePage, which can be used to create new pages. Also adds the About Enano and GNU General Public License pages.
     6 Author: Dan Fuhry
     6 Author: Dan Fuhry
     7 Version: 1.0.1
     7 Version: 1.0.2
     8 Author URI: http://enanocms.org/
     8 Author URI: http://enanocms.org/
     9 */
     9 */
    10 
    10 
    11 /*
    11 /*
    12  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
    12  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
    13  * Version 1.0 release candidate 2
    13  * Version 1.0.2
    14  * Copyright (C) 2006-2007 Dan Fuhry
    14  * Copyright (C) 2006-2007 Dan Fuhry
    15  *
    15  *
    16  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
    16  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
    17  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
    17  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
    18  *
    18  *
   107       $template->footer();
   107       $template->footer();
   108       $db->close();
   108       $db->close();
   109       
   109       
   110       exit;
   110       exit;
   111     }
   111     }
       
   112     if ( substr($urlname, 0, 8) == 'Project:' )
       
   113     {
       
   114       $template->header();
       
   115       
       
   116       echo '<h3>The page could not be created.</h3><p>The page title can\'t start with "Project:" because this prefix is reserved for a parser shortcut.</p>';
       
   117       
       
   118       $template->footer();
       
   119       $db->close();
       
   120       
       
   121       exit;
       
   122     }
   112     
   123     
   113     $tn = $paths->nslist[$_POST['namespace']] . $urlname;
   124     $tn = $paths->nslist[$_POST['namespace']] . $urlname;
   114     if ( isset($paths->pages[$tn]) )
   125     if ( isset($paths->pages[$tn]) )
   115     {
   126     {
   116       die_friendly('Error creating page', '<p>The page already exists.</p>');
   127       die_friendly('Error creating page', '<p>The page already exists.</p>');
   149     $q = $db->sql_query('INSERT INTO '.table_prefix.'pages(name,urlname,namespace,delvote_ips) VALUES(\''.$name.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\',\'' . $ips . '\');');
   160     $q = $db->sql_query('INSERT INTO '.table_prefix.'pages(name,urlname,namespace,delvote_ips) VALUES(\''.$name.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\',\'' . $ips . '\');');
   150     if ( !$q )
   161     if ( !$q )
   151     {
   162     {
   152       $db->_die('The page entry could not be inserted.');
   163       $db->_die('The page entry could not be inserted.');
   153     }
   164     }
   154     $q = $db->sql_query('INSERT INTO '.table_prefix.'page_text(page_id,namespace,page_text) VALUES(\''.$urlname.'\', \''.$_POST['namespace'].'\', \''.$db->escape('Please edit this page! <nowiki><script type="text/javascript">ajaxEditor();</script></nowiki>').'\');');
   165     $q = $db->sql_query('INSERT INTO '.table_prefix.'page_text(page_id,namespace,page_text) VALUES(\''.$urlname.'\', \''.$_POST['namespace'].'\', \''.'\');');
   155     if ( !$q )
   166     if ( !$q )
   156     {
   167     {
   157       $db->_die('The page text entry could not be inserted.');
   168       $db->_die('The page text entry could not be inserted.');
   158     }
   169     }
   159     
   170     
   160     header('Location: '.makeUrlNS($_POST['namespace'], sanitize_page_id($p)));
   171     header('Location: '.makeUrlNS($_POST['namespace'], sanitize_page_id($p)) . '#do:edit');
   161     exit;
   172     exit;
   162   }
   173   }
   163   $template->header();
   174   $template->header();
   164   if ( !$session->get_permissions('create_page') )
   175   if ( !$session->get_permissions('create_page') )
   165   {
   176   {
   345 }
   356 }
   346 
   357 
   347 function page_Special_About_Enano()
   358 function page_Special_About_Enano()
   348 {
   359 {
   349   global $db, $session, $paths, $template, $plugins; // Common objects
   360   global $db, $session, $paths, $template, $plugins; // Common objects
       
   361   global $lang;
       
   362   
   350   $platform = 'Unknown';
   363   $platform = 'Unknown';
   351   $uname = @file_get_contents('/proc/sys/kernel/ostype');
   364   $uname = @file_get_contents('/proc/sys/kernel/ostype');
   352   if($uname == "Linux\n")
   365   if($uname == "Linux\n")
   353     $platform = 'Linux';
   366     $platform = 'Linux';
   354   else if(file_exists('/hurd/pfinet')) // I have a little experience with GNU/Hurd :-) http://hurdvm.enanocms.org/
   367   else if(file_exists('/hurd/pfinet')) // I have a little experience with GNU/Hurd :-) http://hurdvm.enanocms.org/
   365   ?>
   378   ?>
   366   <br />
   379   <br />
   367   <div class="tblholder">
   380   <div class="tblholder">
   368     <table border="0" cellspacing="1" cellpadding="4">
   381     <table border="0" cellspacing="1" cellpadding="4">
   369       <tr><th colspan="2" style="text-align: left;">About the Enano Content Management System</th></tr>
   382       <tr><th colspan="2" style="text-align: left;">About the Enano Content Management System</th></tr>
   370       <tr><td colspan="2" class="row3"><p>This website is powered by <a href="http://enanocms.org/">Enano</a>, the lightweight and open source
   383       <tr><td colspan="2" class="row3">
   371       CMS that everyone can use. Enano is copyright &copy; 2006-2007 Dan Fuhry. For legal information, along with a list of libraries that Enano
   384         <?php
   372       uses, please see <a href="http://enanocms.org/Legal_information">Legal Information</a>.</p>
   385         echo $lang->get('meta_enano_about_poweredby');
   373       <p>The developers and maintainers of Enano strongly believe that software should not only be free to use, but free to be modified,
   386         $subst = array(
   374          distributed, and used to create derivative works. For more information about Free Software, check out the
   387             'gpl_link' => makeUrlNS('Special', 'GNU_General_Public_License')
   375          <a href="http://en.wikipedia.org/wiki/Free_Software" onclick="window.open(this.href); return false;">Wikipedia page</a> or
   388           );
   376          the <a href="http://www.fsf.org/" onclick="window.open(this.href); return false;">Free Software Foundation's</a> homepage.</p>
   389         echo $lang->get('meta_enano_about_gpl', $subst);
   377       <p>This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License
   390         if ( $lang->lang_code != 'eng' ):
   378       as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p>
   391         // Do not remove this block of code. Doing so is a violation of the GPL. (A copy of the GPL in other languages
   379       <p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
   392         // must be accompanied by a copy of the English GPL.)
   380       warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.</p>
   393         ?>
   381       <p>You should have received <a href="<?php echo makeUrlNS('Special', 'GNU_General_Public_License'); ?>">a copy of
   394         <h3>(English)</h3>
   382          the GNU General Public License</a> along with this program; if not, write to:</p>
   395         <p>
   383       <p style="margin-left 2em;">Free Software Foundation, Inc.,<br />
   396           This website is powered by <a href="http://enanocms.org/">Enano</a>, the lightweight and open source CMS that everyone can use.
   384          51 Franklin Street, Fifth Floor<br />
   397           Enano is copyright &copy; 2006-2007 Dan Fuhry. For legal information, along with a list of libraries that Enano uses, please
   385          Boston, MA 02110-1301, USA</p>
   398           see <a href="http://enanocms.org/Legal_information">Legal Information</a>.
   386       <p>Alternatively, you can <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">read it online</a>.</p>
   399         </p>
       
   400         <p>
       
   401           The developers and maintainers of Enano strongly believe that software should not only be free to use, but free to be modified,
       
   402           distributed, and used to create derivative works. For more information about Free Software, check out the
       
   403           <a href="http://en.wikipedia.org/wiki/Free_Software" onclick="window.open(this.href); return false;">Wikipedia page</a> or
       
   404           the <a href="http://www.fsf.org/" onclick="window.open(this.href); return false;">Free Software Foundation's</a> homepage.
       
   405         </p>
       
   406         <p>
       
   407           This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License
       
   408           as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
       
   409         </p>
       
   410         <p>
       
   411           This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
       
   412           warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
       
   413         </p>
       
   414         <p>
       
   415           You should have received <a href="<?php echo makeUrlNS('Special', 'GNU_General_Public_License'); ?>">a copy of
       
   416           the GNU General Public License</a> along with this program; if not, write to:
       
   417         </p>
       
   418         <p style="margin-left 2em;">
       
   419           Free Software Foundation, Inc.,<br />
       
   420           51 Franklin Street, Fifth Floor<br />
       
   421           Boston, MA 02110-1301, USA
       
   422         </p>
       
   423         <p>
       
   424           Alternatively, you can <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">read it online</a>.
       
   425         </p>
       
   426         <?php
       
   427         endif;
       
   428         ?>
   387       </td></tr>
   429       </td></tr>
   388       <tr>
   430       <tr>
   389         <td class="row2" colspan="2">
   431         <td class="row2" colspan="2">
   390           <table border="0" style="margin: 0 auto; background: none; width: 100%;" cellpadding="5">
   432           <table border="0" style="margin: 0 auto; background: none; width: 100%;" cellpadding="5">
   391             <tr>
   433             <tr>
   404               </td>
   446               </td>
   405             </tr>
   447             </tr>
   406           </table>
   448           </table>
   407         </td>
   449         </td>
   408       </tr>
   450       </tr>
   409       <tr><td style="width: 100px;" class="row1"><a href="http://enanocms.org">Enano</a> version:</td><td class="row1"><?php echo enano_version(true) . ' (' . enano_codename() . ')'; ?></td></tr>
   451       <tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_enanoversion'); ?></td><td class="row1"><?php echo enano_version(true) . ' (' . enano_codename() . ')'; ?></td></tr>
   410       <tr><td style="width: 100px;" class="row2">Web server:</td><td class="row2"><?php if(isset($_SERVER['SERVER_SOFTWARE'])) echo $_SERVER['SERVER_SOFTWARE']; else echo 'Unable to determine web server software.'; ?></td></tr>
   452       <tr><td style="width: 100px;" class="row2"><?php echo $lang->get('meta_enano_about_lbl_webserver'); ?></td><td class="row2"><?php if(isset($_SERVER['SERVER_SOFTWARE'])) echo $_SERVER['SERVER_SOFTWARE']; else echo 'Unable to determine web server software.'; ?></td></tr>
   411       <tr><td style="width: 100px;" class="row1">Server platform:</td><td class="row1"><?php echo $platform; ?></td></tr>
   453       <tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_serverplatform'); ?></td><td class="row1"><?php echo $platform; ?></td></tr>
   412       <tr><td style="width: 100px;" class="row2"><a href="http://www.php.net/">PHP</a> version:</td><td class="row2"><?php echo PHP_VERSION; ?></td></tr>
   454       <tr><td style="width: 100px;" class="row2"><?php echo $lang->get('meta_enano_about_lbl_phpversion'); ?></td><td class="row2"><?php echo PHP_VERSION; ?></td></tr>
   413       <tr><td style="width: 100px;" class="row1"><a href="http://www.mysql.com/">MySQL</a> version:</td><td class="row1"><?php echo mysql_get_server_info($db->_conn); ?></td></tr>
   455       <tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_mysqlversion'); ?></td><td class="row1"><?php echo mysql_get_server_info($db->_conn); ?></td></tr>
   414     </table>
   456     </table>
   415   </div>
   457   </div>
   416   <?php
   458   <?php
   417   $template->footer();
   459   $template->footer();
   418 }
   460 }