Code

Re-enabled schema checks
[gosa.git] / gosa-core / html / helpviewer.php
index 4cbc459abf94bd630ae888d5c414469b832aef5e..99710fad4ce7b2a145ec65fcb625160c95976323 100644 (file)
@@ -1,21 +1,23 @@
 <?php
 /*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier, 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
  */
 
 /* Include classes and configs */
@@ -27,22 +29,22 @@ error_reporting(E_ALL | E_STRICT);
 restore_error_handler();
 header("Content-type: text/html; charset=UTF-8");
 
-session_start();
-$ui= $_SESSION["ui"];
-$config= $_SESSION['config'];
+session::start();
 
 /* If no config object is found in the session, abort help */
-if (!isset($_SESSION['config'])){
+if (!session::global_is_set('config')){
   new log("security","all/all","",array(),"Help viewer called without session") ;
   header ("Location: index.php");
   exit;
 }
 
+$ui= session::global_get('ui');
+$config= session::global_get('config');
+
 /* Language setup */
-if ($config->data['MAIN']['LANG'] == ""){
+$lang= $config->get_cfg_value("language");
+if ($lang == ""){
   $lang= get_browser_language();
-} else {
-  $lang= $config->data['MAIN']['LANG'];
 }
 
 $lang.=".UTF-8";
@@ -54,30 +56,28 @@ $GLOBALS['t_language']= $lang;
 $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/';
 
 $domain = 'messages';
-bindtextdomain($domain, "$BASE_DIR/locale");
+bindtextdomain($domain, LOCALE_DIR);
 textdomain($domain);
 @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to");
 
-$config= $_SESSION['config'];
-if (isset ($config->data['MAIN']['COMPILE'])){
-  $smarty->compile_dir= $config->data['MAIN']['COMPILE'];
-} else {
-  $smarty->compile_dir= '/var/spool/gosa/';
-}
+$smarty->compile_dir= $config->get_cfg_value("compile", "/var/spool/gosa/");
 $smarty->assign("title", "GOsa - "._("Help browser"));
 
 /* HELP management starts here ...
  */
 
 /* Generate helpobject */
-if(isset($_SESSION['helpobject'])){
-  $helpobject = $_SESSION['helpobject'];
+if(session::global_is_set('helpobject')){
+  $helpobject = session::global_get('helpobject');
 }else{
+
+  $plist = session::global_get('plist');
+
   $helpobject['lang']         = $lang; 
   $helpobject['helpconf']     = array();  
   $helpobject['currentplug']  = "";
   $helpobject['file']         = "index.html";
-  $helpobject['helpconf']     = $_SESSION['plist']->gen_headlines();
+  $helpobject['helpconf']     = $plist->gen_headlines();
 }
 
 $lang = $lang[0].$lang[1];
@@ -97,11 +97,11 @@ $forward  ="node1.html";
 
 $helpdir ="";
 /* Every class which is called within a tab, stores its name in the Session.
- * If $_SESSION['current_class_for_help'] isset
+ * If session::global_is_set('current_class_for_help') is true
  *  get the helpfile specified in the xml file and display it.
  * Unset this Session entry, to avoid displaying it again.
  */
-if(isset($_SESSION['current_class_for_help'])){
+if(session::global_is_set('current_class_for_help')){
 
   /* Create new XML parser with the path to the Xml file */
   $xml = new parseXml("../doc/guide.xml");
@@ -110,37 +110,39 @@ if(isset($_SESSION['current_class_for_help'])){
   $str = $xml->parse();
 
   /* __LANG__ is used as placeholder for the used language*/
-  $helpdir= @preg_replace("/__LANG__/i",$lang,$str[($_SESSION['current_class_for_help'])]['PATH']);
+  $helpdir= @preg_replace("/__LANG__/i",$lang,$str[(session::global_get('current_class_for_help'))]['PATH']);
 
   /* If there is no entry in the xml file for this class, display an error message */
   if($helpdir == ""){
     
     $smarty->assign("help_contents","<br><h2>"._("There is no helpfile specified for this class"))."</h2>";
+    $smarty->assign("iePngWorkaround", $config->get_cfg_value("iePngWorkaround","false" ) == "true");
     $header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('headers.tpl'));
     $display= (  $header.$smarty->fetch(get_template_path('help.tpl')));
     echo $display;
-    unset($_SESSION['current_class_for_help']);
+    session::global_un_set('current_class_for_help');
     exit();  
   }
  
   /* Save filename */
-  $helpobject['file']= $str[($_SESSION['current_class_for_help'])]['FILE'];
+  $helpobject['file']= $str[(session::global_get('current_class_for_help'))]['FILE'];
   
   /* Save path to the file */
   $helpobject['currentplug']  = $helpdir;
   
   /* Avoid displaying the same help every time */
   if(isset($_GET['pg'])){
-    unset($_SESSION['current_class_for_help']);
+    session::global_un_set('current_class_for_help');
   }
 
 }elseif(isset($_GET['plug'])){
   /* This displays helpfiles depending on the current $_GET[plug] */
-  $tmp                          = new pluglist($_SESSION['config'],NULL);
+  $ui= get_userinfo();
+  $tmp                          = new pluglist($config, $ui);
   $path                         = $tmp->get_path($_GET['plug']);
   $helpobject['currentplug']    = $path;
   $helpobject['file']           = "index.html";
-  $helpdir = "../doc/guide/user/".$helpobject['lang']."/html/".preg_replace("/^.*\//i","",$helpobject['currentplug']);
+  $helpdir = "../doc/core/".$helpobject['lang']."/html/".preg_replace("/^.*\//i","",$helpobject['currentplug']);
   if(empty($helpobject['currentplug'])){
     $helpdir= "";
   }
@@ -150,7 +152,7 @@ if(isset($_GET['pg'])){
  
   if(preg_match("/\//",$_GET['pg'])){
     $arr = split("\/",$_GET['pg']);
-    $helpobject['currentplug'] = "../doc/guide/user/".$helpobject['lang']."/html/".$arr[0];
+    $helpobject['currentplug'] = "../doc/core/".$helpobject['lang']."/html/".$arr[0];
     $helpdir = $helpobject['currentplug'];
     $helpobject['file']= $arr[1];
   }else{
@@ -164,7 +166,7 @@ if(isset($_GET['pg'])){
       $helpobject['file'] = "index.html";
     }
     /* Create new helpdir (The path where the requested page is located)*/
-    $helpdir = "../doc/guide/user/".$helpobject['lang']."/html/".preg_replace("/^.*\//i","",$helpobject['currentplug']);
+    $helpdir = "../doc/core/".$helpobject['lang']."/html/".preg_replace("/^.*\//i","",$helpobject['currentplug']);
 
     /* If helpdir is empty, force index */
     if(empty($helpobject['currentplug'])){
@@ -175,7 +177,7 @@ if(isset($_GET['pg'])){
 $helpdir.="/";
 
 /* Save current settings */
-$_SESSION['helpobject'] = $helpobject;
+session::global_set('helpobject',$helpobject);
 
 /* 
  * Display management 
@@ -219,7 +221,7 @@ if($helpobject['file'] == "index.html"){
 
 /* If there is no helpdir or file defined, display the index */
 if(isset($_POST['search'])){
-  $helpdir = "../doc/guide/user/".$helpobject['lang']."/html/";
+  $helpdir = "../doc/core/".$helpobject['lang']."/html/";
   /* read all available directories */
   $index = readfiles($helpdir,$prefix,$suffix,false,false);
   $smarty->assign("help_contents",((searchlist($index,search($index,$_POST['search_string']),10))));
@@ -243,9 +245,11 @@ if(isset($_POST['search'])){
    * parse it, rework links images and so on */
   $index = readfiles($helpdir,$prefix,$suffix,false,$helpobject['file']);
 
+  $lastresults = session::global_get('lastresults');
+
   /* if this page is result from a search, mark the search strings */
   if(isset($_GET['mark'])){
-    $matches = $_SESSION['lastresults'][preg_replace("/^.*\//i","",$helpobject['currentplug'])][$helpobject['file']];
+    $matches = $lastresults[preg_replace("/^.*\//i","",$helpobject['currentplug'])][$helpobject['file']];
     $index[$helpobject['file']]['content']   = markup_page($index[$helpobject['file']]['content'],$matches);
   }