[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/sitemgr/sitemgr-site/ -> functions.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare SiteMgr - Web Content Management                              *
   4      * http://www.egroupware.org                                                *
   5      * --------------------------------------------                             *
   6      *  This program is free software; you can redistribute it and/or modify it *
   7      *  under the terms of the GNU General Public License as published by the   *
   8      *  Free Software Foundation; either version 2 of the License, or (at your  *
   9      *  option) any later version.                                              *
  10      \**************************************************************************/
  11  
  12      /* $Id: functions.inc.php 20295 2006-02-15 12:31:25Z  $ */
  13  
  14      /*******************************************************\
  15      * This file is for global functions needed by the       *
  16      * sitemgr-site program.  This includes:                 *
  17      *    - phpgw_link($url, $extravars)                     *
  18      *    - sitemgr_link2($url, $extravars)                  *
  19      \*******************************************************/
  20  
  21  	function phpgw_link($url, $extravars = '')
  22      {
  23          return $GLOBALS['egw']->session->link($url, $extravars);
  24      } 
  25  
  26  	function sitemgr_link2($url, $extravars = '')
  27      {
  28          //I remove the URL argument for sitemgr_link,since it should always be index.php
  29          //which shouldn't be needed since the webserver interprets '/' as '/index.php'.
  30          return sitemgr_link($extravars);
  31      }
  32  
  33  	function sitemgr_link($extravars = '')
  34      {
  35          // Change http://xyz/index.php?page_name=page1 to
  36          // http://xyz/page1/ if the htaccess stuff is enabled
  37          if (!is_array($extravars))
  38          {
  39              parse_str($extravars,$extravarsnew);
  40              $extravars = $extravarsnew;
  41          }
  42  
  43          if ($extravars['page_name'] != '' && $GLOBALS['sitemgr_info']['htaccess_rewrite'])
  44          {
  45              $url = '/'.$extravars['page_name'];
  46              unset($extravars['page_name']);
  47          }
  48  
  49          // In certain instances (wouldn't it be better to fix these instances? MT)
  50          // a url may look like this: 'http://xyz//hi.php' or
  51          // like this: '//index.php?blahblahblah' -- so the code below will remove
  52          // the inappropriate double slashes and leave appropriate ones
  53          $url = $GLOBALS['sitemgr_info']['site_url'] . $url;
  54          $url = substr(ereg_replace('([^:])//','\1/','s'.$url),1);
  55  
  56          if (!isset($GLOBALS['egw_info']['server']['usecookies']) || !$GLOBALS['egw_info']['server']['usecookies'])
  57          {
  58              $extravars['sessionid'] = @$GLOBALS['egw_info']['user']['sessionid'];
  59              $extravars['kp3']       = $_GET['kp3'] ? $_GET['kp3'] : $GLOBALS['egw_info']['user']['kp3'];
  60              $extravars['domain']    = @$GLOBALS['egw_info']['user']['domain'];
  61          }
  62          // build the extravars string from a array
  63          $vars = array();
  64          foreach($extravars as $key => $value)
  65          {
  66              $vars[] = urlencode($key).'='.urlencode($value);
  67          }
  68          return $url . (count($vars) ? '?'.implode('&',$vars) : '');
  69      }
  70  ?>


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