[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/wiki/lib/ -> init.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare Wiki - general initialization of the old tavi code            *
   4      * http://www.egroupware.org                                                *
   5      * -------------------------------------------------                        *
   6      * Originaly from tavi, modified by RalfBecker@outdoor-training.de for eGW  *
   7      * --------------------------------------------                             *
   8      *  This program is free software; you can redistribute it and/or modify it *
   9      *  under the terms of the GNU General Public License as published by the   *
  10      *  Free Software Foundation; either version 2 of the License, or (at your  *
  11      *  option) any later version.                                              *
  12      \**************************************************************************/
  13  
  14      // $Id: init.php 20295 2006-02-15 12:31:25Z  $
  15  
  16      require('lib/defaults.php');
  17  
  18      /**
  19       * Check if we allow anon access and with which creditials
  20       * 
  21       * @param array &$anon_account anon account_info with keys 'login', 'passwd' and optional 'passwd_type'
  22       * @return boolean true if we allow anon access, false otherwise
  23       */
  24  	function wiki_check_anon_access(&$anon_account)
  25      {
  26          $c =& CreateObject('phpgwapi.config','wiki');
  27          $c->read_repository();
  28          $config =& $c->config_data;
  29          unset($c);
  30  
  31          if ($config['allow_anonymous'] && $config['anonymous_username'])
  32          {
  33              $anon_account = array(
  34                  'login'  => $config['anonymous_username'],
  35                  'passwd' => $config['anonymous_password'],
  36                  'passwd_type' => 'text',
  37              );
  38              return true;
  39          }
  40          return false;
  41      }
  42          
  43      // uncomment the next line if wiki should use a eGW domain different from the first one defined in your header.inc.php
  44      // and of cause change the name accordingly ;-)
  45      // $GLOBALS['egw_info']['user']['domain'] = $GLOBALS['egw_info']['server']['default_domain'] = 'developers';
  46  
  47      $GLOBALS['egw_info']['flags'] = array(
  48          'disable_Template_class' => True,
  49          'noheader'  => True,
  50          'currentapp' => 'wiki',
  51          'autocreate_session_callback' => 'wiki_check_anon_access',
  52      );
  53      include('../header.inc.php');
  54  
  55      $c =& CreateObject('phpgwapi.config','wiki');
  56      $c->read_repository();
  57      if (!isset($c->config_data['ExpireLen']))
  58      {
  59          $c->config_data['ExpireLen'] = $ExpireLen;
  60          $c->save_repository();
  61      }
  62      $config = $c->config_data;
  63      unset($c);
  64  
  65      // anonymous sessions have no navbar !!!
  66      $GLOBALS['egw_info']['flags']['nonavbar'] = $config['allow_anonymous'] &&
  67          $config['anonymous_username'] == $GLOBALS['egw_info']['user']['account_lid'];
  68  
  69      $HomePage = (isset($config[wikihome])?$config[wikihome]:'eGroupWare');
  70      $InterWikiPrefix = (isset($config[InterWikiPrefix])?$config[InterWikiPrefix]:'EGroupWare');
  71      $EnableFreeLinks = (isset($config[Enable_Free_Links])?$config[Enable_Free_Links]:1);
  72      $EnableWikiLinks = (isset($config[Enable_Wiki_Links])?$config[Enable_Wiki_Links]:1);
  73      $EditWithPreview = (isset($config[Edit_With_Preview])?$config[Edit_With_Preview]:1);
  74      $ExpireLen = $config['ExpireLen'];
  75  
  76      $UserName = $GLOBALS['egw_info']['user']['account_lid'];
  77      if (!($_GET['action'] == 'save' && !$_POST['Preview']) && $_GET['action'] != 'admin' && !($_GET['action'] == 'prefs' && $_POST['Save']) && $_GET['action'] != 'xml')
  78      {
  79          $GLOBALS['egw']->common->egw_header();
  80      }
  81  
  82      define('TemplateDir', 'template');
  83  
  84      $Charset = $GLOBALS['egw']->translation->charset();
  85      if (strtolower($Charset) == 'iso-8859-1')    // allow all iso-8859-1 extra-chars
  86      {
  87          $UpperPtn = "[A-Z\xc0-\xde]";
  88          $LowerPtn = "[a-z\xdf-\xff]";
  89          $AlphaPtn = "[A-Za-z\xc0-\xff]";
  90          $LinkPtn = $UpperPtn . $AlphaPtn . '*' . $LowerPtn . '+' .
  91              $UpperPtn . $AlphaPtn . '*(\\/' . $UpperPtn . $AlphaPtn . '*)?';
  92      }
  93  
  94      $WikiLogo = $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/default/images/logo.png';
  95      // use eGW's temp dir
  96      $TempDir = $GLOBALS['egw_info']['server']['temp_dir'];
  97  
  98      require('lib/url.php');
  99      require('lib/messages.php');
 100  
 101      $pagestore =& CreateObject('wiki.sowiki');
 102  
 103      $FlgChr = chr(255);                     // Flag character for parse engine.
 104  
 105      $Entity = array();                      // Global parser entity list.
 106  
 107      // Strip slashes from incoming variables.
 108  
 109      if(get_magic_quotes_gpc())
 110      {
 111          $document = stripslashes($document);
 112          $categories = stripslashes($categories);
 113          $comment = stripslashes($comment);
 114          if (is_array($page))
 115          {
 116              $page['name'] = stripslashes($page['name']);
 117          }
 118          else
 119          {
 120              $page = stripslashes($page);
 121          }
 122      }
 123  
 124      // Read user preferences from cookie.
 125  
 126      $prefstr = isset($_COOKIE[$CookieName])
 127      ? $_COOKIE[$CookieName] : '';
 128  
 129      if(!empty($prefstr))
 130      {
 131          if(ereg("rows=([[:digit:]]+)", $prefstr, $result))
 132          { $EditRows = $result[1]; }
 133          if(ereg("cols=([[:digit:]]+)", $prefstr, $result))
 134          { $EditCols = $result[1]; }
 135          if(ereg("user=([^&]*)", $prefstr, $result))
 136          { $UserName = urldecode($result[1]); }
 137          if(ereg("days=([[:digit:]]+)", $prefstr, $result))
 138          { $DayLimit = $result[1]; }
 139          if(ereg("auth=([[:digit:]]+)", $prefstr, $result))
 140          { $AuthorDiff = $result[1]; }
 141          if(ereg("min=([[:digit:]]+)", $prefstr, $result))
 142          { $MinEntries = $result[1]; }
 143          if(ereg("hist=([[:digit:]]+)", $prefstr, $result))
 144          { $HistMax = $result[1]; }
 145          if(ereg("tzoff=([[:digit:]]+)", $prefstr, $result))
 146          { $TimeZoneOff = $result[1]; }
 147      }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7