phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site config.inc.php.template,1.1


From: Patrick Walsh <address@hidden>
Subject: [Phpgroupware-cvs] CVS: sitemgr/sitemgr-site config.inc.php.template,1.1.1.1,1.2 index.php,1.1.1.1,1.2 security.inc.php,1.1.1.1,1.2
Date: Sun, 01 Sep 2002 00:22:48 -0400

Update of /cvsroot/phpgroupware/sitemgr/sitemgr-site
In directory subversions:/tmp/cvs-serv26819

Modified Files:
        config.inc.php.template index.php security.inc.php 
Log Message:
Lots of changes, including moving most preferences to the db.


Index: config.inc.php.template
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/config.inc.php.template,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** config.inc.php.template     29 Aug 2002 03:03:17 -0000      1.1.1.1
--- config.inc.php.template     1 Sep 2002 04:22:46 -0000       1.2
***************
*** 5,33 ****
        \***********************************************************/
        $sitemgr_info = array(
!               'phpgw_path'      => '/var/www/html/phpgroupware/',
!               'sitemgr_path'    => '/var/www/html/sitemgr-site/',
!               'sitemgr_url'     => '/sitemgr-site',
!               'domain'          => 'default',
!               'login'                   => 'anonymous',
!               'passwd'                  => 'anonymous',
!               'themesel'                => 'NukeNews'
        );
!       
  
        /***********************************************************\
        * Leave the rest of this file alone.                        *
        \***********************************************************/
        if (
!               ($GLOBALS['phpgw_info']['flags']['currentapp'] != 
'sitemgr-site') 
                && 
                ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'sitemgr')
           )
        {
-               require_once($sitemgr_info['sitemgr_path'] . 
'security.inc.php');
                include($sitemgr_info['phpgw_path'] . 'header.inc.php');
                $GLOBALS['phpgw_info']['flags']['currentapp'] = 'login';
                include(PHPGW_SERVER_ROOT . '/phpgwapi/inc/functions.inc.php');
                $GLOBALS['phpgw_info']['flags']['currentapp'] = 'sitemgr-site';
  
                if (! $GLOBALS['phpgw']->session->verify())
                {
--- 5,44 ----
        \***********************************************************/
        $sitemgr_info = array(
!               // add trailing slash
!               'phpgw_path'           => '/var/www/html/phpgroupware/'
        );
! 
  
        /***********************************************************\
        * Leave the rest of this file alone.                        *
        \***********************************************************/
+       if (!file_exists($sitemgr_info['phpgw_path'].'header.inc.php'))
+       {
+               die("Header file not found.  Either your path to phpGroupWare 
in the config.inc.php file is bad, or you have not setup phpGroupWare.");
+       }
+ 
        if (
!               ($GLOBALS['phpgw_info']['flags']['currentapp'] != 
'sitemgr-link') 
                && 
                ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'sitemgr')
           )
        {
                include($sitemgr_info['phpgw_path'] . 'header.inc.php');
+ 
                $GLOBALS['phpgw_info']['flags']['currentapp'] = 'login';
                include(PHPGW_SERVER_ROOT . '/phpgwapi/inc/functions.inc.php');
                $GLOBALS['phpgw_info']['flags']['currentapp'] = 'sitemgr-site';
  
+               $pref = CreateObject('sitemgr.sitePreference_SO');
+               $sitemgr_info = array(
+                       'phpgw_path'           => $sitemgr_info['phpgw_path'],
+                       'sitemgr-site_path'    => 
$pref->getPreference('sitemgr-site-dir'),
+                       'sitemgr-site_url'     => 
$pref->getPreference('sitemgr-site-url'),
+                       'domain'               => 
$pref->getPreference('login-domain'),
+                       'login'                        => 
$pref->getPreference('anonymous-user'),
+                       'passwd'                       => 
$pref->getPreference('anonymous-passwd'),
+                       'themesel'                 => 
$pref->getPreference('themesel')
+               );
+ 
                if (! $GLOBALS['phpgw']->session->verify())
                {
***************
*** 35,184 ****
                        if (!$GLOBALS['sessionid'])
                        {
!                               echo 'NO ANONYMOUS USER ACCOUNTS INSTALLED.  
NOTIFY THE ADMINISTRATOR.';
!                               exit;
                        }
                        
//$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link($sitemgr_url . 
'index.php'));
                }
-               else
-               {
-               //      echo "session verified";
-               }
        }
        else
        {
!       //      echo "hi";
        }
! 
!       function phpgw_link($url, $extravars = '')
!       {
!               return $GLOBALS['phpgw']->session->link($url, $extravars);
!       } 
! 
!       function sitemgr_link2($url, $extravars = '')
!       {
!               $kp3 = $GLOBALS['HTTP_GET_VARS']['kp3'] ? 
$GLOBALS['HTTP_GET_VARS']['kp3'] : $GLOBALS['HTTP_COOKIE_VARS']['kp3'];
! 
!               if (! $kp3)
!               {
!                       $kp3 = $GLOBALS['phpgw_info']['user']['kp3'];
!               }
! 
! 
!               $url = $GLOBALS['sitemgr_info']['sitemgr_url'] . $url;
! 
!               // build the extravars string from a array
!                       
!               if (is_array($extravars))
!               {
!                       while(list($key,$value) = each($extravars))
!                       {
!                               if (!empty($new_extravars))
!                               {
!                                       $new_extravars .= '&';
!                               }
!                               $new_extravars .= "$key=$value";
!                       }
!                       // This needs to be explictly reset to a string 
variable type for PHP3
!                       settype($extravars,'string');
!                       $extravars = $new_extravars;
!               }
!               if (isset($GLOBALS['phpgw_info']['server']['usecookies']) && 
$GLOBALS['phpgw_info']['server']['usecookies'])
!               {
!                       if ($extravars)
!                       {
!                               $url .= '?' . $extravars;
!                       }
!               }
!               else
!               {
!                       $sessionID  = 'sessionid=' . 
@$GLOBALS['phpgw_info']['user']['sessionid'];
!                       $sessionID .= '&kp3=' . $kp3;
!                       $sessionID .= '&domain=' . 
@$GLOBALS['phpgw_info']['user']['domain'];
!                       // This doesn't belong in the API.
!                       // Its up to the app to pass this value. (jengo)
!                       // Putting it into the app requires a massive number of 
updates in email app. 
!                       // Until that happens this needs to stay here (seek3r)
!                       if (isset($GLOBALS['phpgw_info']['flags']['newsmode']) 
&& 
!                               $GLOBALS['phpgw_info']['flags']['newsmode'])
!                       {
!                               $url .= '&newsmode=on';
!                       }
!                       if ($extravars)
!                       {
!                               $url .= '?' . $extravars . '&' . $sessionID;
!                       }
!                       else
!                       {
!                               $url .= '?' . $sessionID;
!                       }
!               }
!               return $url;
!       }
!       
! 
!       function sitemgr_link_x($url, $extravars = '')
!       {
!               $kp3 = $GLOBALS['HTTP_GET_VARS']['kp3'] ? 
$GLOBALS['HTTP_GET_VARS']['kp3'] : $GLOBALS['HTTP_COOKIE_VARS']['kp3'];
! 
!               if (! $kp3)
!               {
!                       $kp3 = $GLOBALS['phpgw_info']['user']['kp3'];
!               }
! 
!               if (! $url)
!               {
!                       $url_root = split ('/', 
$GLOBALS['sitemgr_info']['sitemgr_url']);
!                       $patched_php_self = $GLOBALS['PHP_SELF'];
!                       $url = (strlen($url_root[0])? $url_root[0].'//':'') . 
$url_root[2] . $patched_php_self;
!               }
! 
!               // build the extravars string from an array
!               if (is_array($extravars))
!               {
!                       while(list($key,$value) = each($extravars))
!                       {
!                               if (!empty($new_extravars))
!                               {
!                                       $new_extravars .= '&';
!                               }
!                               $new_extravars .= "$key=$value";
!                       }
! 
!                       // This needs to be explicitly reset to a string var 
for php3
!                       settype($extravars,'string');
!                       $extravars = $new_extravars;
!               }
! 
!               if (isset($GLOBALS['phpgw_info']['server']['usecookies']) && 
$GLOBALS['phpgw_info']['server']['usecookies'])
!               {
!                       if ($extravars)
!                       {
!                               $url .= '?' . $extravars;
!                       }
!               }
!               else
!               {
!                       $sessionID = 'sessionid=' . 
@$GLOBALS['phpgw_info']['user']['sessionid'];
!                       $sessionID .= '&kp3=' . $kp3;
!                       $sessionID .= '&domain=' . 
@$GLOBALS['phpgw_info']['user']['domain'];
!               }
! 
!               $url = str_replace('/?', '/index.php?', $url);
!               $webserver_url_count = 
strlen($GLOBALS['sitemgr_info']['sitemgr_url']);
!               $slash_check = strtolower(substr($url,0,1));
!               if (substr($url,0,$webserver_url_count) != 
$GLOBALS['sitemgr_info']['sitemgr_url'])
!               {
!                       $app = $GLOBALS['phpgw_info']['flags']['currentapp'];
!                       if ($slash_check == '/')
!                       {
!                               $url = $GLOBALS['sitemgr_info']['sitemgr_url'] 
. $url;
!                       }
!                       else
!                       {
!                               $url = $GLOBALS['sitemgr_info']['sitemgr_url'] 
. '/' . $app . '/' . $url;
!                       }
!               }
!               return $url;
!       }
! 
  ?>
--- 46,68 ----
                        if (!$GLOBALS['sessionid'])
                        {
!                               die('NO ANONYMOUS USER ACCOUNTS INSTALLED.  
NOTIFY THE ADMINISTRATOR.');
!                               //exit;
                        }
                        
//$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link($sitemgr_url . 
'index.php'));
                }
        }
        else
        {
!               $pref = CreateObject('sitemgr.sitePreference_SO');
!               $sitemgr_info = array(
!                       'phpgw_path'           => $sitemgr_info['phpgw_path'],
!                       'sitemgr-site_path'    => 
$pref->getPreference('sitemgr-site-dir'),
!                       'sitemgr-site_url'     => 
$pref->getPreference('sitemgr-site-url'),
!                       'domain'               => 
$pref->getPreference('login-domain'),
!                       'login'                        => 
$pref->getPreference('anonymous-user'),
!                       'passwd'                       => 
$pref->getPreference('anonymous-passwd'),
!                       'themesel'                 => 
$pref->getPreference('themesel')
!               );
        }
!       unset($pref);
  ?>

Index: index.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/index.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** index.php   29 Aug 2002 03:03:17 -0000      1.1.1.1
--- index.php   1 Sep 2002 04:22:46 -0000       1.2
***************
*** 22,27 ****
                'nonavbar'   => True
        );
!       require_once('./config.inc.php');
!       include './blockconfig.inc.php';
  
        include './inc/class.ui.inc.php';
--- 22,37 ----
                'nonavbar'   => True
        );
!       require_once('./security.inc.php');
! 
!       if (file_exists('./config.inc.php'))
!       {
!               require_once('./config.inc.php');
!       }
!       else
!       {
!               die ("You need to copy config.inc.php.template to 
config.inc.php and edit the file before continuing.");
!       }
!       require_once('./functions.inc.php');
!       require_once('./blockconfig.inc.php');
  
        include './inc/class.ui.inc.php';
***************
*** 61,64 ****
--- 71,75 ----
                $objsp_so = CreateObject('sitemgr.sitePreference_SO');
                $home_page = $objsp_so->getPreference('home-page-id');
+               unset($objsp_so);
                if ($home_page)
                {

Index: security.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/security.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** security.inc.php    29 Aug 2002 03:03:17 -0000      1.1.1.1
--- security.inc.php    1 Sep 2002 04:22:46 -0000       1.2
***************
*** 11,18 ****
        // Security precaution: don't let anyone call xxx.inc.php files or
      // construct URLs with relative paths (ie, /dir1/../dir2/)
!     if (eregi("\.inc\.php",$PHP_SELF) || ereg("\.\.",$PHP_SELF)) 
        {
!               Header("Location: index.php");
!               die();
        }
  ?>
--- 11,18 ----
        // Security precaution: don't let anyone call xxx.inc.php files or
      // construct URLs with relative paths (ie, /dir1/../dir2/)
!       // also deny direct access to blocks.
!     if (eregi("\.inc\.php",$PHP_SELF) || eregi("block-.*\.php",$PHP_SELF) 
||ereg("\.\.",$PHP_SELF)) 
        {
!               die("Invalid URL");
        }
  ?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]