Code

Fixed spelling errors
[gosa.git] / gosa-core / include / functions_helpviewer.inc
index 2f2e9c8142dee217999ba466d97b517eb78bfe25..39739338e1b7a972d0eb566652bdc2ccd9916df6 100644 (file)
@@ -1,21 +1,23 @@
 <?php
 /*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2005, Fabian Hickert
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 /* Simple class to parse the xml help file */
@@ -40,9 +42,9 @@ class parseXml
     $xmldata= fread($fh, 100000);
     fclose($fh);
     if(!xml_parse($this->parser, chop($xmldata))){
-        print(sprintf(_("XML error in guide.xml: %s at line %d"),
-            xml_error_string(xml_get_error_code($this->parser)),
-            xml_get_current_line_number($this->parser)));
+        print(sprintf(_("XML error in guide.xml: %s at line %s"),
+            bold(xml_error_string(xml_get_error_code($this->parser))),
+            bold(xml_get_current_line_number($this->parser))));
         exit;
     }
     return($this->entries);
@@ -61,12 +63,14 @@ function genIndex()
 {
   global $helpobject;
   $str = "";
-  $test = new pluglist($_SESSION['config'],get_userinfo());
+  $helpobject = session::global_get('helpobject');
+  $ui= get_userinfo();
+  $test = new pluglist(session::global_get('config'), $ui);
   $current_hl = "";
-  foreach($_SESSION['helpobject']['helpconf'] as $id => $attrs){
+  foreach($helpobject['helpconf'] as $id => $attrs){
     $path = $test -> get_path($id);
     $exists = true;
-    $helpdir = "../doc/guide/user/".$helpobject['lang']."/html/".preg_replace("/^.*\//i","",$path)."/";
+    $helpdir = "../doc/core/".$helpobject['lang']."/html/".preg_replace("/^.*\//i","",$path)."/";
     if(!is_dir($helpdir)){
       $exists = false;
     }
@@ -81,7 +85,7 @@ function genIndex()
     if($exists){
       $str .= "<p style='padding-left:20px;'><a href='?plug=".$id."'><b>"._($name)."</b></a></p>";
     }else{
-      $str .= "<p style='padding-left:20px;'><b>"._($name)."</b> ("._("No help available for this plugin.").")</p>";
+      $str .= "<p style='padding-left:20px;'><b>"._($name)."</b> ("._("No help available for this plug-in.").")</p>";
     }
   }
   return (utf8_decode($str));
@@ -254,8 +258,7 @@ function remove_unwanted_tags($str,$replacements)
 function linkwrapper($str,$link)
 {
   $str = preg_replace("/HREF=\"http/i","target=\"_blank\" href=\"http",$str);
-  $str = preg_replace("/HREF=\"/","href=\"".$link."?pg=",$str);
-  $str=str_replace("HREF=\"","href=\"".$link."?pg=",$str);  
+  $str = str_replace("HREF=\"","href=\"".$link."?pg=",$str);  
   return($str);
 }
 
@@ -271,8 +274,8 @@ function search($arr,$word)
   $tryword                    = "";     // Temporary searchword handling
   $result['global']['maxhit'] = 0;
   session::un_set('lastresults');
-  unset($_SESSION['parsed_search_keyword']);
-  $_SESSION['parsed_search_keyword']="";
+  session::un_set('parsed_search_keyword');
+  session::set('parsed_search_keyword',"");
 
   error_reporting(E_ALL | E_STRICT);
 
@@ -281,7 +284,7 @@ function search($arr,$word)
 
   /* Filter all unusable chars */
   $word   = preg_replace($allowed_chars_in_searchword,"",$word);
-  $words  = split(" ",str_replace("+"," ",$word));
+  $words  = explode(" ",str_replace("+"," ",$word));
 
   /* Check all wordlengths */
   foreach($words as $tryword){
@@ -289,7 +292,7 @@ function search($arr,$word)
 
     /* Filter words smaler than 3 chars */
     if(strlen($tryword)>=$minwordlength) {
-      $_SESSION['parsed_search_keyword'].=$tryword." ";
+      session::set('parsed_search_keyword', session::get('parsed_search_keyword').$tryword." ");
       $useablewords[]=$tryword;
     }
   }
@@ -341,7 +344,7 @@ function search($arr,$word)
   }
 
   /* Save result in Session, so we can mark words later, or go back to search, without searching again*/
-  $_SESSION['lastresults'] = $result;
+  session::set('lastresults',$result);
   return($result);
 }
 
@@ -373,7 +376,7 @@ function searchlist($arr,$res,$maxresults)
   /* Foreach */  
   foreach($topten as $key => $hits)  {
 
-    $ks = split("\/",$key);
+    $ks = explode("/",$key);
     $k1 = $ks[0];
     $k2 = $ks[1];
     
@@ -383,8 +386,8 @@ function searchlist($arr,$res,$maxresults)
   /* appending footer message for resultlist */
   $ret.= "<br>
               ".sprintf(_("%s results for your search with the keyword %s"), 
-                            "<b>".count($topten)."</b>"
-                            "<b>".$_SESSION['parsed_search_keyword']."</b>");
+                            bold(count($topten))
+                            bold(session::get('parsed_search_keyword')));
   $ret.="<br>
         <br>";
   return($ret);
@@ -455,9 +458,7 @@ function createResultEntry($entry,$res,$name,$max)
              </tr>
              <tr>
               <td colspan=2>
-                <b>
-                  ".(sprintf(_("%s%% hit rate in file %s"),$percentage,$name))."
-                </b>
+                  ".(sprintf(_("%s%% hit rate in file %s"), bold($percentage), bold($name)))."
               </td>
             </tr>
           </table>
@@ -491,7 +492,7 @@ function getheader_from_content($str)
 {
   $str = strip_tags($str);
   $pos = 0;
-  $arr = split("\n",$str);
+  $arr = preg_split("/\n/",$str);
   foreach($arr as $possibleheadline){
     if(strlen($possibleheadline)>=3){
       return $possibleheadline;