plugins/SpecialPageFuncs.php
changeset 335 67bd3121a12e
parent 334 c72b545f1304
child 343 eefe9ab7fe7c
--- a/plugins/SpecialPageFuncs.php	Wed Dec 26 00:37:26 2007 -0500
+++ b/plugins/SpecialPageFuncs.php	Thu Dec 27 22:09:33 2007 -0500
@@ -72,6 +72,8 @@
 function page_Special_CreatePage()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
+  
   if ( isset($_POST['do']) )
   {
     $p = $_POST['pagename'];
@@ -88,7 +90,8 @@
     {
       $template->header();
       
-      echo '<h3>The page could not be created.</h3><p>The name "'.$p.'" is invalid.</p>';
+      echo '<h3>' . $lang->get('pagetools_create_err_title') . '</h3>
+             <p>' . $lang->get('pagetools_create_err_name_invalid', array('page_name' => htmlspecialchars($p))) . '</p>';
       
       $template->footer();
       $db->close();
@@ -102,7 +105,8 @@
     {
       $template->header();
       
-      echo '<h3>The page could not be created.</h3><p>The name "'.$paths->nslist[$namespace].$p.'" is invalid.</p>';
+      echo '<h3>' . $lang->get('pagetools_create_err_title') . '</h3>
+             <p>' . $lang->get('pagetools_create_err_name_invalid', array('page_name' => htmlspecialchars($paths->nslist[$namespace].$p))) . '</p>';
       
       $template->footer();
       $db->close();
@@ -118,7 +122,8 @@
     {
       $template->header();
       
-      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>';
+      echo '<h3>' . $lang->get('pagetools_create_err_title') . '</h3>
+             <p>' . $lang->get('pagetools_create_err_project_shortcut', array('page_name' => htmlspecialchars($p))) . '</p>';
       
       $template->footer();
       $db->close();
@@ -129,7 +134,7 @@
     $tn = $paths->nslist[$_POST['namespace']] . $urlname;
     if ( isset($paths->pages[$tn]) )
     {
-      die_friendly('Error creating page', '<p>The page already exists.</p>');
+      die_friendly($lang->get('pagetools_create_err_title'), '<p>' . $lang->get('pagetools_create_err_already_exist') . '</p>');
     }
     
     if ( $paths->nslist[$namespace] == substr($urlname, 0, strlen($paths->nslist[$namespace]) ) )
@@ -154,7 +159,7 @@
     
     $perms = $session->fetch_page_acl($urlname, $namespace);
     if ( !$perms->get_permissions('create_page') )
-      die_friendly('Error creating page', '<p>An access control rule is preventing you from creating pages.</p>');
+      die_friendly($lang->get('pagetools_create_err_title'), '<p>An access control rule is preventing you from creating pages.</p>');
     
     $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(time_id,date_string,log_type,action,author,page_id,namespace) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'create\', \''.$session->username.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\');');
     if ( !$q )
@@ -188,7 +193,7 @@
     exit;
   }
   */
-  echo RenderMan::render('Using the form below you can create a page.');
+  echo '<p>' . $lang->get('pagetools_create_blurb') . '</p>';
   ?>
   <form action="" method="post">
     <p>
@@ -199,7 +204,7 @@
         {
           if ( $paths->nslist[$k[$i]] == '' )
           {
-            $s = '[No prefix]';
+            $s = $lang->get('pagetools_create_namespace_none');
           }
           else
           {
@@ -212,7 +217,7 @@
         }
         ?>
       </select> <input type="text" name="pagename" /></p>
-      <p><input type="submit" name="do" value="Create Page" /></p>
+      <p><input type="submit" name="do" value="<?php echo $lang->get('pagetools_create_btn_create'); ?>" /></p>
   </form>
   <?php
   $template->footer();
@@ -263,9 +268,11 @@
 {
   // This should be an easy one
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
+  
   $template->header();
   $sz = sizeof( $paths->pages ) / 2;
-  echo '<p>Below is a list of all of the pages on this website.</p>';
+  echo '<p>' . $lang->get('pagetools_allpages_blurb') . '</p>';
   
   $q = $db->sql_query('SELECT COUNT(urlname) FROM '.table_prefix.'pages WHERE visible!=0;');
   if ( !$q )
@@ -328,7 +335,7 @@
   global $db, $session, $paths, $template, $plugins; // Common objects
   $template->header();
   $sz = sizeof($paths->pages) / 2;
-  echo '<p>Below is a list of all of the special pages on this website.</p><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">';
+  echo '<p>' . $lang->get('pagetools_specialpages_blurb') . '</p><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">';
   $cclass='row1';
   for ( $i = 0; $i < $sz; $i = $i)
   {
@@ -386,7 +393,7 @@
   <br />
   <div class="tblholder">
     <table border="0" cellspacing="1" cellpadding="4">
-      <tr><th colspan="2" style="text-align: left;">About the Enano Content Management System</th></tr>
+      <tr><th colspan="2" style="text-align: left;"><?php echo $lang->get('meta_enano_about_th'); ?></th></tr>
       <tr><td colspan="2" class="row3">
         <?php
         echo $lang->get('meta_enano_about_poweredby');
@@ -501,15 +508,36 @@
 function page_Special_GNU_General_Public_License()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
+  
   $template->header();
-  if(file_exists(ENANO_ROOT.'/GPL'))
+  if(file_exists(ENANO_ROOT . '/GPL'))
   {
+    echo '<p>' . $lang->get('pagetools_gpl_blurb', array('about_url' => makeUrlNS('Special', 'About_Enano'))) . '</p>';
+    
+    if ( $lang->lang_code != 'eng' ):
+    // Do not remove this block of code. Doing so is a violation of the GPL. (A copy of the GPL in other languages
+    // must be accompanied by a copy of the English GPL.)
     echo '<p>The following text represents the license that the <a href="'.makeUrlNS('Special', 'About_Enano').'">Enano</a> content management system is under. To make it easier to read, the text has been wiki-formatted; in no other way has it been changed.</p>';
+    endif;
+    
+    if ( file_exists(ENANO_ROOT . "/GPL_{$lang->lang_code}") )
+    {
+      echo '<h2>' . $lang->get('pagetools_gpl_title_native') . '</h2>';
+      echo '<p><a href="#gpl_english">' . $lang->get('pagetools_gpl_link_to_english') . ' / View the license in English' . '</a></p>';
+      echo RenderMan::render( file_get_contents ( ENANO_ROOT . "/GPL_{$lang->lang_code}" ) );
+      echo '<h2>' . $lang->get('pagetools_gpl_title_english') . ' / English version<a name="gpl_english" id="gpl_english"></a></h2>';
+    }
+    
     echo RenderMan::render( file_get_contents ( ENANO_ROOT . '/GPL' ) );
   }
   else
   {
-    echo '<p>It appears that the file "GPL" is missing from your Enano installation. You may find a wiki-formatted copy of the GPL at: <a href="http://enanocms.org/GPL">http://enanocms.org/GPL</a>.</p>';
+    echo '<p>' . $lang->get('pagetools_gpl_err_file_missing') . '</p>';
+    if ( $lang->lang_code != 'eng')
+      // Also print out English version
+      // Do not remove the following line of code; doing so would be a violation of the GPL.
+      echo '<p>It appears that the file "GPL" is missing from your Enano installation. You may find a wiki-formatted copy of the GPL at: <a href="http://enanocms.org/GPL">http://enanocms.org/GPL</a>. In the mean time, you may wish to contact the site administration and ask them to replace the GPL file.</p>';
   }
   $template->footer();
 }
@@ -517,6 +545,7 @@
 function page_Special_TagCloud()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   
   $template->header();
   
@@ -530,7 +559,7 @@
     {
       echo '<div class="tblholder">
               <table border="0" cellspacing="1" cellpadding="4">';
-      echo '<tr><th colspan="2">Pages tagged "' . htmlspecialchars($tag) . '"</th></tr>';
+      echo '<tr><th colspan="2">' . $lang->get('pagetools_tagcloud_pagelist_th', array('tag' => htmlspecialchars($tag))) . '</th></tr>';
       echo '<tr>';
       $i = 0;
       $td_class = 'row1';
@@ -559,7 +588,7 @@
       }
       // " workaround for jEdit highlighting bug
       echo '<tr>
-              <th colspan="2" class="subhead"><a href="' . makeUrlNS('Special', 'TagCloud') . '" style="color: white;">&laquo; Return to tag cloud</a></th>
+              <th colspan="2" class="subhead"><a href="' . makeUrlNS('Special', 'TagCloud') . '">&laquo; ' . $lang->get('pagetools_tagcloud_btn_return') . '</a></th>
             </tr>';
       echo '</table>';
       echo '</div>';
@@ -574,17 +603,17 @@
       $db->_die();
     if ( $db->numrows() < 1 )
     {
-      echo '<p>No pages are tagged yet.</p>';
+      echo '<p>' . $lang->get('pagetools_tagcloud_msg_no_tags') . '</p>';
     }
     else
     {
-      echo '<h3>Summary of page tagging</h3>';
+      echo '<h3>' . $lang->get('pagetools_tagcloud_blurb') . '</h3>';
       while ( $row = $db->fetchrow() )
       {
         $cloud->add_word($row['tag_name']);
       }
       echo $cloud->make_html('normal');
-      echo '<p>Hover your mouse over a tag to see how many pages have the tag. Click on a tag to see a list of the pages that have it.</p>';
+      echo '<p>' . $lang->get('pagetools_tagcloud_instructions') . '</p>';
     }
   }
   
@@ -595,6 +624,7 @@
 function sidebar_add_tag_cloud()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
   $cloud = new TagCloud();
     
   $q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;');
@@ -602,7 +632,7 @@
     $db->_die();
   if ( $db->numrows() < 1 )
   {
-    $sb_html = 'No pages are tagged yet.';
+    $sb_html = $lang->get('pagetools_tagcloud_msg_no_tags');
   }
   else
   {
@@ -610,9 +640,9 @@
     {
       $cloud->add_word($row['tag_name']);
     }
-    $sb_html = $cloud->make_html('small', 'justify') . '<br /><a style="text-align: center;" href="' . makeUrlNS('Special', 'TagCloud') . '">Larger version</a>';
+    $sb_html = $cloud->make_html('small', 'justify') . '<br /><a style="text-align: center;" href="' . makeUrlNS('Special', 'TagCloud') . '">' . $lang->get('pagetools_tagcloud_sidebar_btn_larger') . '</a>';
   }
-  $template->sidebar_widget('Tag cloud', "<div style='padding: 5px;'>$sb_html</div>");
+  $template->sidebar_widget($lang->get('pagetools_tagcloud_sidebar_title'), "<div style='padding: 5px;'>$sb_html</div>");
 }
 
 $plugins->attachHook('compile_template', 'sidebar_add_tag_cloud();');