phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [18987] make it so phpgw installs properly without no


From: Dave Hall
Subject: [Phpgroupware-cvs] [18987] make it so phpgw installs properly without notices
Date: Mon, 10 Nov 2008 01:29:39 +0000

Revision: 18987
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18987
Author:   skwashd
Date:     2008-11-10 01:29:39 +0000 (Mon, 10 Nov 2008)

Log Message:
-----------
make it so phpgw installs properly without notices

Modified Paths:
--------------
    core/trunk/phpgwapi/inc/class.contacts_sql.inc.php
    core/trunk/phpgwapi/inc/class.datetime.inc.php
    core/trunk/phpgwapi/inc/class.db.inc.php
    core/trunk/phpgwapi/inc/class.sessions.inc.php
    core/trunk/phpgwapi/inc/class.setup.inc.php
    core/trunk/phpgwapi/inc/functions.inc.php
    core/trunk/phpgwapi/templates/base/images/down_nm.png
    core/trunk/phpgwapi/templates/base/images/stock_add.png
    core/trunk/phpgwapi/templates/base/images/stock_cancel.png
    core/trunk/phpgwapi/templates/base/images/stock_close.png
    core/trunk/phpgwapi/templates/base/images/stock_no.png
    core/trunk/phpgwapi/templates/base/images/stock_ok.png
    core/trunk/phpgwapi/templates/base/images/stock_remove.png
    core/trunk/phpgwapi/templates/base/images/stock_view-fields.png
    core/trunk/phpgwapi/templates/base/images/stock_yes.png
    core/trunk/setup/accounts.php
    core/trunk/setup/config.php
    core/trunk/setup/inc/hook_config.inc.php
    core/trunk/setup/manageheader.php
    core/trunk/setup/templates/base/head.tpl

Modified: core/trunk/phpgwapi/inc/class.contacts_sql.inc.php
===================================================================
--- core/trunk/phpgwapi/inc/class.contacts_sql.inc.php  2008-11-10 01:23:38 UTC 
(rev 18986)
+++ core/trunk/phpgwapi/inc/class.contacts_sql.inc.php  2008-11-10 01:29:39 UTC 
(rev 18987)
@@ -2394,7 +2394,17 @@
                                'cat_id' => $this->get_categories($categories),
                                'contact_type' => $type
                        ), PHPGW_SQL_RUN_SQL);
+                       
+                       if ( !isset($principal['preferred_org']) )
+                       {
+                               $principal['preferred_org'] = null;
+                       }
 
+                       if ( !isset($principal['preferred_address']) )
+                       {
+                               $principal['preferred_address'] = null;
+                       }
+                       
                        $cid = $this->last_id('contact', 'contact_id');
                        $this->unlock_table();
                        $add_type = $this->search_contact_type_id($type);
@@ -2522,6 +2532,7 @@
                                return;
                        }
 
+                       $sql = array();
                        foreach($people as $person)
                        {
                                $orgs = $this->has_preferred_org($person);

Modified: core/trunk/phpgwapi/inc/class.datetime.inc.php
===================================================================
--- core/trunk/phpgwapi/inc/class.datetime.inc.php      2008-11-10 01:23:38 UTC 
(rev 18986)
+++ core/trunk/phpgwapi/inc/class.datetime.inc.php      2008-11-10 01:29:39 UTC 
(rev 18987)
@@ -914,7 +914,7 @@
                * @param int $dow ISO 8601 day of week number
                * @return string local say of week name
                */
-               public static function nr2weekday($selected = 0)
+               public static function nr2weekday($dow = 0)
                {
                        $dow_list = self::get_dow_fullnames();
                        if ( isset($dow_list[$dow]) )
@@ -924,3 +924,14 @@
                        return lang('Unknown');
                }
        }
+       
+       if ( !isset($GLOBALS['phpgw_info']['server']['tz_offset']) )
+       {
+               $tzone = 'UTC';
+       }
+       else
+       {
+               $tzone = 'Etc/GMT' . 
$GLOBALS['phpgw_info']['server']['tz_offset'];
+       }
+       
+       date_default_timezone_set($tzone);

Modified: core/trunk/phpgwapi/inc/class.db.inc.php
===================================================================
--- core/trunk/phpgwapi/inc/class.db.inc.php    2008-11-10 01:23:38 UTC (rev 
18986)
+++ core/trunk/phpgwapi/inc/class.db.inc.php    2008-11-10 01:29:39 UTC (rev 
18987)
@@ -162,15 +162,13 @@
                */
                private function new_adodb()
                {
-                       $type = $this->Type;
-                       if ( $type == 'mysql' )
+                       $this->connect();
+                       
+                       if ( $this->adodb )
                        {
-                               $type = 'mysqlt';
+                               // would be good if one day we just use 
ADODB_FETCH_ASSOC
+                               $this->adodb->SetFetchMode(ADODB_FETCH_BOTH);
                        }
-                       $this->adodb = newADOConnection($type);
-                       $this->connect();
-                        // would be good if one day we just use 
ADODB_FETCH_ASSOC
-                       $this->adodb->SetFetchMode(ADODB_FETCH_BOTH);
                }
 
                /**
@@ -202,7 +200,7 @@
                {
                        return $this->Query_ID;
                }
-
+               
                /**
                * Open a connection to a database
                *
@@ -210,6 +208,8 @@
                * @param string $Host database host to connect to (optional)
                * @param string $User name of database user (optional)
                * @param string $Password password for database user (optional)
+               * 
+               * @return boolean did we connect?
                */
                public function connect($Database = null, $Host = null, $User = 
null, $Password = null)
                {
@@ -232,8 +232,27 @@
                        {
                                $this->Password = $Password;
                        }
+                       
+                       switch ( $this->Type )
+                       {
+                               case 'mysql':
+                                       $type = 'mysqlt';
+                                       break;
 
-                       return @$this->adodb->connect($this->Host, $this->User, 
$this->Password, $this->Database);
+                               default:
+                                       $type = $this->Type;
+                       }
+                       
+                       $this->adodb = newADOConnection($type);
+                       if ( 
isset($GLOBALS['phpgw_info']['server']['db_persistent'])
+                               && 
$GLOBALS['phpgw_info']['server']['db_persistent'] )
+                       {
+                               @$this->adodb->PConnect($this->Host, 
$this->User, $this->Password, $this->Database);
+                               return (bool) $this->adodb;
+                       }
+
+                       @$this->adodb->Connect($this->Host, $this->User, 
$this->Password, $this->Database);
+                       return (bool) $this->adodb;
                }
 
                /**
@@ -287,17 +306,6 @@
                }
 
                /**
-               * Execute a query with limited result set
-               * @param integer $start Row to start from
-               * @deprecated
-               * @see limit_query()
-               */
-               public function limit($start)
-               {
-                       die('where is the sql string?');
-               }
-
-               /**
                * Discard the current query result
                */
                public function free()
@@ -346,6 +354,7 @@
                * @param integer $line the line method was called from - use 
__LINE__
                * @param string $file the file method was called from - use 
__FILE__
                * @param integer $num_rows number of rows to return (optional), 
if unset will use 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
+               * 
                * @return integer current query id if sucesful and null if fails
                */
                public function limit_query($Query_String, $offset = -1, $line 
= '', $file = '', $num_rows = -1)
@@ -364,12 +373,11 @@
                        if(!$this->resultSet && $this->Halt_On_Error == 'yes')
                        {
                                trigger_error("$Query_String\n" . 
$this->adodb->ErrorMsg(), E_USER_ERROR);
+                               return false;
                        }
-                       else
-                       {
-                               $this->delayPointer = true;
-                               return true;
-                       }
+                       
+                       $this->delayPointer = true;
+                       return true;
                }
                
                /**
@@ -456,45 +464,47 @@
                        switch ( $GLOBALS['phpgw_info']['server']['db_type'] )
                        {
                                case 'postgres':
-                               $params = explode('.',$this->adodb->pgVersion);
-
-                               if ($params[0] < 8 || ($params[0] == 8 && 
$params[1] ==0))
-                               {
-                                       $oid = 
pg_getlastoid($this->adodb->_resultid);
-                                       if ($oid == -1)
+                                       $params = 
explode('.',$this->adodb->pgVersion);
+       
+                                       if ($params[0] < 8 || ($params[0] == 8 
&& $params[1] ==0))
                                        {
+                                               $oid = 
pg_getlastoid($this->adodb->_resultid);
+                                               if ($oid == -1)
+                                               {
+                                                       return -1;
+                                               }
+       
+                                               $result = 
@pg_Exec($this->adodb->_connectionID, "select $field from $table where 
oid=$oid");
+                                       }
+                                       else
+                                       {
+                                               $result = 
@pg_Exec($this->adodb->_connectionID, "select lastval()");
+                                       }
+       
+                                       if (!$result)
+                                       {
                                                return -1;
                                        }
+       
+                                       $Record = @pg_fetch_array($result, 0);
+       
+                                       @pg_freeresult($result);
+                                       if (!is_array($Record)) /* OID not 
found? */
+                                       {
+                                               return -1;
+                                       }
+                                       return $Record[0];
+                                       break;
 
-                                       $result = 
@pg_Exec($this->adodb->_connectionID, "select $field from $table where 
oid=$oid");
-                               }
-                               else
-                               {
-                                       $result = 
@pg_Exec($this->adodb->_connectionID, "select lastval()");
-                               }
-
-                               if (!$result)
-                               {
-                                       return -1;
-                               }
-
-                               $Record = @pg_fetch_array($result, 0);
-
-                               @pg_freeresult($result);
-                               if (!is_array($Record)) /* OID not found? */
-                               {
-                                       return -1;
-                               }
-                               return $Record[0];
-                                       break;
                                case 'mssql':
                                        /*  MSSQL uses a query to retrieve the 
last
                                         *  identity on the connection, so 
table and field are ignored here as well.
                                         */
                                        if(!isset($table) || $table == '' || 
!isset($field) || $field == '')
                                        {
-                                       return -1;
-                       }
+                                               return -1;
+                                       }
+                                       
                                        $result = @mssql_query("select 
@@identity", $this->adodb->_queryID);
                                        if(!$result)
                                        {
@@ -502,10 +512,11 @@
                                        }
                                        return mssql_result($result, 0, 0);
                                        break;
+
                                default:
-                       return $this->adodb->Insert_ID($table, $field);
+                                       return $this->adodb->Insert_ID($table, 
$field);
+                       }
                }
-               }
 
                /**
                * Lock a table
@@ -682,8 +693,8 @@
                                                return 
$this->resultSet->fields[$name];
                                        }
                                }
-                               return '';
                        }
+                       return '';
                }
 
                /**
@@ -706,7 +717,6 @@
                */
                public function nextid($seq_name)
                {
-                       //echo "depi: nextid";
                }
 
                /**
@@ -718,11 +728,6 @@
                */  
                public function metadata($table = '',$full = false)
                {
-                       if($this->debug)
-                       {
-                               //echo "depi: metadata";
-                       }
-                       
                        if(!$this->adodb->IsConnected())
                        {
                                $this->connect();
@@ -782,18 +787,6 @@
                }
 
                /**
-               * Error handler
-               *
-               * @param string $msg error message
-               * @param int $line line of calling method/function (optional)
-               * @param string $file file of calling method/function (optional)
-               */
-               public function halt($msg, $line = '', $file = '')
-               {
-                       $this->adodb->RollbackTrans();
-               }
-               
-               /**
                * Get a list of table names in the current database
                *
                * @return array list of the tables
@@ -833,7 +826,7 @@
                * @returns bool was the new db created?
                */
                public function create_database($adminname = '', $adminpasswd = 
'')
-               {
+               {                       
                        //THIS IS CALLED BY SETUP DON'T KILL IT!
                        if ( $this->adodb->IsConnected() )
                        {
@@ -841,34 +834,59 @@
                        }
 
                        $this->adodb = 
newADOConnection($GLOBALS['phpgw_info']['server']['db_type']);
-                       $this->adodb->NConnect($this->Host, $adminname, 
$adminpasswd);
+                       if ( $adminpasswd )
+                       {
+                               $this->adodb->NConnect($this->Host, $adminname, 
$adminpasswd);
+                       }
+                       else
+                       {
+                               // this is insecure, but some people don't have 
an admin password set
+                               $this->adodb->NConnect($this->Host, $adminname);
+                       }
                        
                        if ( !$this->adodb->IsConnected() )
                        {
                                echo 'Connection FAILED<br />';
-                               return False;
+                               return false;
                        }
+                       
+                       $db = $this->db_addslashes($this->Database);
 
                        //create the db
-                       $this->adodb->Execute("CREATE DATABASE 
{$this->Database}");
+                       $this->adodb->query("CREATE DATABASE {$db}");
+                       
+                       $server = 'localhost';
+                       if ( $this->Host != 'localhost' )
+                       {
+                               $server = 
$this->db_addslashes(phpgw::get_var('SERVER_NAME', 'string', 'SERVER'));
+                       }
+                       
+                       $user = $this->db_addslashes($this->User);
+                       $pass = $this->db_addslashes($this->Password);
+
                
                        //Grant rights on the db
-                       switch ($GLOBALS['phpgw_info']['server']['db_type'])
+                       switch ($this->Type)
                        {
                                case 'mysql':
-                                       $this->adodb->Execute("GRANT ALL ON 
{$this->Database}.*"
-                                                       . " TO 
{$this->address@hidden'SERVER_NAME']}"
-                                                       . " IDENTIFIED BY 
'{$this->Password}'");
+                                       $this->adodb->Execute("GRANT ALL ON 
{$db}.*"
+                                                       . " TO 
'{$user}'@'{$server}'"
+                                                       . " IDENTIFIED BY 
'{$pass}'");
+                                       break;
+
                                default:
                                        //do nothing
                        }
+                       
                        $this->adodb->Disconnect();
-                       return True;
+                       return true;
                }
+
                /**
                * Get the correct date format for DATE field for a particular 
RDBMS
                *
                * @internal the string is compatiable with PHP's date()
+               * 
                * @return string the date format string
                */
                public static function date_format()
@@ -876,16 +894,16 @@
                        static $date_format = null;
                        if ( is_null($date_format) )
                        {
-                               
switch($GLOBALS['phpgw_info']['server']['db_type'])
+                               switch ( 
$GLOBALS['phpgw_info']['server']['db_type'] )
                                {
-                                       case 'mssql':
-                                               $date_format            = 'M d 
Y';
-                                               break;
                                        case 'mysql':
                                        case 'pgsql':
                                        case 'postgres':
                                        default:
                                                $date_format            = 
'Y-m-d';
+                                               break;
+                                       case 'mssql':
+                                               $date_format            = 'M d 
Y';
                                }
                        }
                        return $date_format;
@@ -926,11 +944,6 @@
                */
                public function prepare_sql_statement($query)
                {
-                       //echo "depi";
-                       if (($query == '') || (!$this->connect()))
-                       {
-                               return false;
-                       }
                        return false;
                }
 
@@ -944,10 +957,6 @@
                 */
                public function query_prepared_statement($result_id, 
$parameters_array)
                {
-                       if ((!$this->connect()) || (!$result_id))
-                       {
-                               return false;
-                       }
                        return false;
                }  
 

Modified: core/trunk/phpgwapi/inc/class.sessions.inc.php
===================================================================
--- core/trunk/phpgwapi/inc/class.sessions.inc.php      2008-11-10 01:23:38 UTC 
(rev 18986)
+++ core/trunk/phpgwapi/inc/class.sessions.inc.php      2008-11-10 01:29:39 UTC 
(rev 18987)
@@ -456,7 +456,7 @@
                        if(!isset($this->_history_id))
                        {
                                $this->_history_id = md5($this->_login . 
time());
-                               $history = $this->appsession('history', 
'phpgwapi');
+                               $history = (array) $this->appsession('history', 
'phpgwapi');
 
                                if(count($history) >= 
$GLOBALS['phpgw_info']['server']['max_history'])
                                {

Modified: core/trunk/phpgwapi/inc/class.setup.inc.php
===================================================================
--- core/trunk/phpgwapi/inc/class.setup.inc.php 2008-11-10 01:23:38 UTC (rev 
18986)
+++ core/trunk/phpgwapi/inc/class.setup.inc.php 2008-11-10 01:29:39 UTC (rev 
18987)
@@ -91,7 +91,7 @@
                 */
                function auth($auth_type='Config')
                {
-                       $remoteip     = $_SERVER['REMOTE_ADDR'];
+                       $remote_ip     = $_SERVER['REMOTE_ADDR'];
 
                        $FormLogout   = phpgw::get_var('FormLogout');
                        $ConfigLogin  = phpgw::get_var('ConfigLogin',   
'string', 'POST');
@@ -104,12 +104,10 @@
                        $HeaderPW     = phpgw::get_var('HeaderPW');
                        $ConfigLang   = phpgw::get_var('ConfigLang');
 
-                       /*
-                       if(!empty($remoteip) && !$this->checkip($remoteip))
+                       if( $remote_ip && !$this->checkip($remote_ip) )
                        {
-                               return False;
+                               return false;
                        }
-                       */
 
                        /* 6 cases:
                                1. Logging into header admin
@@ -220,60 +218,65 @@
                                
$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] = '';
                                return False;
                        }
+                       
+                       return false;
                }
 
-               function checkip($remoteip='')
+               function checkip($remoteip = '')
                {
-                       $allowed_ips = 
split(',',$GLOBALS['phpgw_info']['server']['setup_acl']);
-                       if(is_array($allowed_ips))
+                       if ( 
!isset($GLOBALS['phpgw_info']['server']['setup_acl']) )
                        {
-                               $foundip = False;
-                               while(list(,$value) = @each($allowed_ips))
+                               return true;
+                       }
+                       
+                       $allowed_ips = split(',', 
$GLOBALS['phpgw_info']['server']['setup_acl']);
+                       if(!is_array($allowed_ips))
+                       {
+                               return true;
+                       }
+
+                       foreach ( $allowed_ips as $value )
+                       {
+                               $test = explode('.', $value);
+                               if(count($test) < 3)
                                {
-                                       $test = split("\.",$value);
-                                       if(count($test) < 3)
-                                       {
-                                               $value .= ".0.0";
-                                               $tmp = split("\.",$remoteip);
-                                               $tmp[2] = 0;
-                                               $tmp[3] = 0;
-                                               $testremoteip = join('.',$tmp);
-                                       }
-                                       elseif(count($test) < 4)
-                                       {
-                                               $value .= ".0";
-                                               $tmp = split("\.",$remoteip);
-                                               $tmp[3] = 0;
-                                               $testremoteip = join('.',$tmp);
-                                       }
-                                       elseif(count($test) == 4 &&
-                                               intval($test[3]) == 0)
-                                       {
-                                               $tmp = split("\.",$remoteip);
-                                               $tmp[3] = 0;
-                                               $testremoteip = join('.',$tmp);
-                                       }
-                                       else
-                                       {
-                                               $testremoteip = $remoteip;
-                                       }
+                                       $value .= '.0.0';
+                                       $tmp = explode('.', $remoteip);
+                                       $tmp[2] = 0;
+                                       $tmp[3] = 0;
+                                       $testremoteip = implode('.', $tmp);
+                               }
+                               elseif(count($test) < 4)
+                               {
+                                       $value .= '.0';
+                                       $tmp = explode('.', $remoteip);
+                                       $tmp[3] = 0;
+                                       $testremoteip = implode('.',$tmp);
+                               }
+                               elseif(count($test) == 4 &&
+                                       intval($test[3]) == 0)
+                               {
+                                       $tmp = explode('.', $remoteip);
+                                       $tmp[3] = 0;
+                                       $testremoteip = implode('.', $tmp);
+                               }
+                               else
+                               {
+                                       $testremoteip = $remoteip;
+                               }
 
-                                       //echo '<br>testing: ' . $testremoteip 
. ' compared to ' . $value;
+                               //echo '<br>testing: ' . $testremoteip . ' 
compared to ' . $value;
 
-                                       if($testremoteip == $value)
-                                       {
-                                               //echo ' - PASSED!';
-                                               $foundip = True;
-                                       }
-                               }
-                               if(!$foundip)
+                               if ( $testremoteip == $value )
                                {
-                                       
$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = '';
-                                       
$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] = lang('Invalid IP address');
-                                       return False;
+                                       //echo ' - PASSED!';
+                                       return true;
                                }
                        }
-                       return True;
+
+                       $GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = '';
+                       $GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] = 
lang('Invalid IP address');
+                       return false;
                }
 
                /**
@@ -304,7 +307,7 @@
                {
                        $tables = Array();
                        $tablenames = $this->db->table_names();
-                       foreach($tablenames as $key => $val)
+                       foreach($tablenames as $val)
                        {
                                $tables[] = $val;
                        }
@@ -381,6 +384,8 @@
 
                        // hack to make phpgwapi_applications::name2id to work 
properly
                        unset($GLOBALS['phpgw_info']['apps']);
+                       
+                       return true;
                }
 
                /**
@@ -391,16 +396,16 @@
                 */
                function app_registered($appname)
                {
-                       $setup_info = $GLOBALS['setup_info'];
-
                        if(!$appname)
                        {
                                return False;
                        }
+                       
+                       $debug = isset($GLOBALS['DEBUG']) && $GLOBALS['DEBUG'];
 
-                       if ( isset($GLOBALS['DEBUG']) && $GLOBALS['DEBUG'] )
+                       if ( $debug )
                        {
-                               echo '<br>app_registered(): checking ' . 
$appname . ', table: ' . $appstbl;
+                               echo "<br>\napp_registered(): checking 
{$appname}";
                                // _debug_array($setup_info[$appname]);
                        }
 
@@ -408,13 +413,14 @@
                        $this->db->next_record();
                        if($this->db->f(0))
                        {
-                               if(@$GLOBALS['DEBUG'])
+                               if( $debug ) 
                                {
                                        echo '... app previously registered.';
                                }
                                return True;
                        }
-                       if(@$GLOBALS['DEBUG'])
+                       
+                       if( $debug )
                        {
                                echo '... app not registered';
                        }
@@ -433,7 +439,7 @@
 
                        if(!$appname)
                        {
-                               return False;
+                               return false;
                        }
 
                        
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && 
($setup_info['phpgwapi']['currentver'] != ''))
@@ -455,7 +461,7 @@
                        $this->db->next_record();
                        if(!$this->db->f(0))
                        {
-                               return False;
+                               return false;
                        }
 
                        if($setup_info[$appname]['version'])
@@ -479,6 +485,7 @@
 
                                $this->db->query($sql,__LINE__,__FILE__);
                        }
+                       return true;
                }
 
                /**
@@ -527,11 +534,12 @@
                                return false;
                        }
                        $appname = $this->db->db_addslashes($appname);
-                       $setup_info =& $GLOBALS['setup_info'];
 
                        //echo 'DELETING application: ' . $appname;
                        $this->db->query("DELETE FROM phpgw_applications WHERE 
app_name='{$appname}'",__LINE__,__FILE__);
                        $this->clear_session_cache();
+                       
+                       return true;
                }
 
                /**
@@ -574,23 +582,19 @@
                 */
                function deregister_hooks($appname)
                {
-                       if(isset($setup_info['phpgwapi']['currentver']) && 
$this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5'))
-                       {
-                               /* No phpgw_hooks table yet. */
-                               return False;
-                       }
-
                        if(!$appname)
                        {
-                               return False;
+                               return false;
                        }
                        
                        //echo "DELETING hooks for: " . 
$setup_info[$appname]['name'];
                        if (!is_object($this->hooks))
                        {
-                               $this->hooks = 
createObject('phpgwapi.hooks',$this->db);
+                               $this->hooks = createObject('phpgwapi.hooks', 
$this->db);
                        }
                        $this->hooks->register_hooks($appname);
+                       
+                       return true;
                }
 
                /**
@@ -785,15 +789,6 @@
 
                function get_hooks_table_name()
                {
-                       
-                       if ( 
isset($GLOBALS['setup_info']['phpgwapi']['currentver']) 
-                               && 
$this->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], 
'0.9.8pre5') 
-                               && 
($GLOBALS['setup_info']['phpgwapi']['currentver'] != ''))
-                       {
-                               /* No phpgw_hooks table yet. */
-                               return False;
-                       }
                        return 'phpgw_hooks';
                }
-}
-?>
+}
\ No newline at end of file

Modified: core/trunk/phpgwapi/inc/functions.inc.php
===================================================================
--- core/trunk/phpgwapi/inc/functions.inc.php   2008-11-10 01:23:38 UTC (rev 
18986)
+++ core/trunk/phpgwapi/inc/functions.inc.php   2008-11-10 01:29:39 UTC (rev 
18987)
@@ -376,6 +376,7 @@
                $GLOBALS['phpgw_info']['server']['cache_phpgw_info'] = 
stripslashes($GLOBALS['phpgw']->db->f('config_value'));
        }
 
+       /* This is dead - kept to see if needs porting - skwashd nov08
        $cache_query = "SELECT content from phpgw_app_sessions WHERE"
                ." sessionid = '0' AND loginid = '0' and app = 'phpgwapi' AND 
location = 'config'";
 
@@ -409,6 +410,7 @@
        }
        unset($cache_query);
        unset($server_info_cache);
+       */
 
        // In the case we use a fall back (mode Half remote_user)
        if(isset($GLOBALS['phpgw_remote_user']) && 
!empty($GLOBALS['phpgw_remote_user']))

Modified: core/trunk/phpgwapi/templates/base/images/down_nm.png
===================================================================
--- core/trunk/phpgwapi/templates/base/images/down_nm.png       2008-11-10 
01:23:38 UTC (rev 18986)
+++ core/trunk/phpgwapi/templates/base/images/down_nm.png       2008-11-10 
01:29:39 UTC (rev 18987)
@@ -1,4 +1,4 @@
-\x89PNG
+\x89PNG
 
 
 IHDRVu\\xE7bKGD\xFF\xFF\xFF\xA0\xBD\xA7\x93     
pHYs\xD2\xDD~\xFCSIDATx\x9Cc<p\xE0)\x80\x89$\xD5\xE4h`d``\xF8\xCFŸ\x87(\xC5\xDB\xF6\xB3028p\x80\xF1\xDB\xA2ÝDHL1\>MȊQ4`ӄ\xAECL.\xC5X5\xE0S\x8CS>@\xB2\xF64"\x9C<address@hidden
\ No newline at end of file

Modified: core/trunk/phpgwapi/templates/base/images/stock_add.png
===================================================================
--- core/trunk/phpgwapi/templates/base/images/stock_add.png     2008-11-10 
01:23:38 UTC (rev 18986)
+++ core/trunk/phpgwapi/templates/base/images/stock_add.png     2008-11-10 
01:29:39 UTC (rev 18987)
@@ -1,4 +1,4 @@
-\x89PNG
+\x89PNG
 
 
 
IHDR\xE0w=\xF8bKGD\xFF\xFF\xFF\xA0\xBD\xA7\x93\xE1IDATx\xDAՕ\xCFNQ\xC63\xAD\xC1RAD6\xF5X\xB2!\xEC
       \xEE\xF5\\xFA

Modified: core/trunk/phpgwapi/templates/base/images/stock_cancel.png
===================================================================
--- core/trunk/phpgwapi/templates/base/images/stock_cancel.png  2008-11-10 
01:23:38 UTC (rev 18986)
+++ core/trunk/phpgwapi/templates/base/images/stock_cancel.png  2008-11-10 
01:29:39 UTC (rev 18987)
@@ -1,4 +1,4 @@
-\x89PNG
+\x89PNG
 
 
 
IHDR\xF3\xFFabKGD\xFF\xFF\xFF\xA0\xBD\xA7\x93\xE9IDATxڝ\x93Kh\u\x87\xBF\xFB\xBF\xF7N\xE6Ν;\x934\xB1L
 
f*t\xA11V\x9B\xA6\x92(\xC1"\xAD\x88Z\xDDAD\xC8N\xA2\x88\xC6RRpS7\x8A\xB8\xB4\xE2\xA6"\x82!\xB15\x8D\xA9v\xC6\xF1\xD1Fg2\x93y8\x99\xFB~\xB9\x90\x91*v\xA1\xBF\xD59\x9C\xF3\xFD8\xE7\xC0\x91\xF9S\xBA\xE2\x98B\x8F\xE3x\x9B\xFF\xAAt:=l\xE8\xB6\xF8P\xB6\xDF3
c\xE1f}\x9A\xA6\x9DB\xE4UU\xFD^UՑ\xBF

Modified: core/trunk/phpgwapi/templates/base/images/stock_close.png
===================================================================
--- core/trunk/phpgwapi/templates/base/images/stock_close.png   2008-11-10 
01:23:38 UTC (rev 18986)
+++ core/trunk/phpgwapi/templates/base/images/stock_close.png   2008-11-10 
01:29:39 UTC (rev 18987)
@@ -1,4 +1,4 @@
-\x89PNG
+\x89PNG
 
 
 
IHDR\xB5\xFA7\xEAgAMA\xB1\x8F\xFCabKGD\xFF\x87\x8F̿
       pHYsd_\x91tIME\xD21\xD3,\xBB\x9A{IDATxڵ\x8F\xB1
Modified: core/trunk/phpgwapi/templates/base/images/stock_no.png
===================================================================
--- core/trunk/phpgwapi/templates/base/images/stock_no.png      2008-11-10 
01:23:38 UTC (rev 18986)
+++ core/trunk/phpgwapi/templates/base/images/stock_no.png      2008-11-10 
01:29:39 UTC (rev 18987)
@@ -1,4 +1,4 @@
-\x89PNG
+\x89PNG
 
 
 IHDR\x8D\x89
Modified: core/trunk/phpgwapi/templates/base/images/stock_ok.png
===================================================================
--- core/trunk/phpgwapi/templates/base/images/stock_ok.png      2008-11-10 
01:23:38 UTC (rev 18986)
+++ core/trunk/phpgwapi/templates/base/images/stock_ok.png      2008-11-10 
01:29:39 UTC (rev 18987)
@@ -1,4 +1,4 @@
-\x89PNG
+\x89PNG
 
 
 IHDR\x8D\x89
Modified: core/trunk/phpgwapi/templates/base/images/stock_remove.png
===================================================================
--- core/trunk/phpgwapi/templates/base/images/stock_remove.png  2008-11-10 
01:23:38 UTC (rev 18986)
+++ core/trunk/phpgwapi/templates/base/images/stock_remove.png  2008-11-10 
01:29:39 UTC (rev 18987)
@@ -1,4 +1,4 @@
-\x89PNG
+\x89PNG
 
 
 
IHDR\xE0w=\xF8bKGD\xFF\xFF\xFF\xA0\xBD\xA7\x93\xD8IDATx\xDA\xEDӽJA\x86\xE1g\xC3\x94E\x854V"ށ\xA5\xF7`\x91\xC2\xCA\xCE\xF0z\xBC\x8A\xA9\xB5

Modified: core/trunk/phpgwapi/templates/base/images/stock_view-fields.png
===================================================================
--- core/trunk/phpgwapi/templates/base/images/stock_view-fields.png     
2008-11-10 01:23:38 UTC (rev 18986)
+++ core/trunk/phpgwapi/templates/base/images/stock_view-fields.png     
2008-11-10 01:29:39 UTC (rev 18987)
@@ -1,4 +1,4 @@
-\x89PNG
+\x89PNG
 
 
 
IHDR!\x8F-bKGD\xFF\xFF\xFF\xA0\xBD\xA7\x93\xAEIDATx\xDA핿Ka\xC7?\xB9\xBB\x846A\xD4\xA5\x9A-\x84jc\x95Rk\xC7*785Sh\x85\xB4(1s\xC1A\xFC3Y\x9A\xE2$\x9D\xA2\xA0K'K\x85\xA8D3(\x81\x80\xD4\\xBC\xE8\xBD]ޔD\x93\xA8T\xE8\xD2x\xEF\xEE\xF9\xF1\xFD~\xDF\xE7\x9E\xFE\xAF\xBDl\xF7\xF4\xB5UĈ

Modified: core/trunk/phpgwapi/templates/base/images/stock_yes.png
===================================================================
--- core/trunk/phpgwapi/templates/base/images/stock_yes.png     2008-11-10 
01:23:38 UTC (rev 18986)
+++ core/trunk/phpgwapi/templates/base/images/stock_yes.png     2008-11-10 
01:29:39 UTC (rev 18987)
@@ -1,4 +1,4 @@
-\x89PNG
+\x89PNG
 
 
 IHDR\x8D\x89
Modified: core/trunk/setup/accounts.php
===================================================================
--- core/trunk/setup/accounts.php       2008-11-10 01:23:38 UTC (rev 18986)
+++ core/trunk/setup/accounts.php       2008-11-10 01:29:39 UTC (rev 18987)
@@ -272,12 +272,18 @@
 
                        $groups = array($defaultgroupid, $admingroupid);
 
-                       $accountid = add_account($admin_acct, 'u', $groups, 
array('admin'));
+                       try
+                       {
+                               $accountid = add_account($admin_acct, 'u', 
$groups, array('admin'));
+                               
$GLOBALS['phpgw_setup']->db->transaction_commit();
 
-                       $GLOBALS['phpgw_setup']->db->transaction_commit();
-
-                       Header('Location: index.php');
-                       exit;
+                               Header('Location: index.php');
+                               exit;
+                       }
+                       catch (Exception $e )
+                       {
+                               $errors[] = $e->getMessage();
+                       }
                }
        }
        

Modified: core/trunk/setup/config.php
===================================================================
--- core/trunk/setup/config.php 2008-11-10 01:23:38 UTC (rev 18986)
+++ core/trunk/setup/config.php 2008-11-10 01:29:39 UTC (rev 18987)
@@ -82,38 +82,50 @@
        $GLOBALS['phpgw_setup']->loaddb();
 
        // Guessing default values.
-       $GLOBALS['current_config']['hostname']  = $_SERVER['HTTP_HOST'];
+       $current_config['hostname']  = $_SERVER['SERVER_NAME'];
        // files-dir is not longer allowed in document root, for security 
reasons !!!
-       $GLOBALS['current_config']['files_dir'] = '/outside/webserver/docroot';
+       $current_config['files_dir'] = '/outside/webserver/docroot';
 
        if( @is_dir('/tmp') )
        {
-               $GLOBALS['current_config']['temp_dir'] = '/tmp';
+               $current_config['temp_dir'] = '/tmp';
        }
        elseif( @is_dir('C:\\TEMP') )
        {
-               $GLOBALS['current_config']['temp_dir'] = 'C:\\TEMP';
+               $current_config['temp_dir'] = 'C:\\TEMP';
        }
        else
        {
-               $GLOBALS['current_config']['temp_dir'] = '/path/to/temp/dir';
+               $current_config['temp_dir'] = '/path/to/temp/dir';
        }
        // guessing the phpGW url
        $parts = explode('/',$_SERVER['PHP_SELF']);
-       unset($parts[count($parts)-1]); // config.php
-       unset($parts[count($parts)-1]); // setup
-       $GLOBALS['current_config']['webserver_url'] = implode('/',$parts);
+       array_pop($parts); // config.php
+       array_pop($parts); // setup
+       if ( count((array) $parts) > 1)
+       {
+               $current_config['webserver_url'] = implode('/',$parts);
+       }
+       else
+       {
+               $http = 'http';
+               if ( isset($_SERVER['HTTPS']) )
+               {
+                       $http .= 's';
+               }
+               $current_config['webserver_url'] = 
"{$http}://{$_SERVER['HTTP_HOST']}";
+       }
 
        // Add some sane defaults for accounts
-       $GLOBALS['current_config']['account_min_id'] = 1000;
-       $GLOBALS['current_config']['account_max_id'] = 65535;
-       $GLOBALS['current_config']['group_min_id'] = 500;
-       $GLOBALS['current_config']['group_max_id'] = 999;
-       $GLOBALS['current_config']['ldap_account_home'] = '/noexistant';
-       $GLOBALS['current_config']['ldap_account_shell'] = '/bin/false';
-       $GLOBALS['current_config']['ldap_host'] = 'localhost';
+       $current_config['account_min_id'] = 1000;
+       $current_config['account_max_id'] = 65535;
+       $current_config['group_min_id'] = 500;
+       $current_config['group_max_id'] = 999;
+       $current_config['ldap_account_home'] = '/noexistant';
+       $current_config['ldap_account_shell'] = '/bin/false';
+       $current_config['ldap_host'] = 'localhost';
        
-       $GLOBALS['current_config']['encryptkey'] = md5(time() . 
$_SERVER['HTTP_HOST']); // random enough
+       $current_config['encryptkey'] = md5(time() . $_SERVER['HTTP_HOST']); // 
random enough
 
 
        $setup_info = $GLOBALS['phpgw_setup']->detection->get_db_versions();
@@ -136,8 +148,6 @@
                                break;
                }
 
-               print_debug('TZ_OFFSET', $newsettings['tz_offset']);
-
                $GLOBALS['phpgw_setup']->db->transaction_begin();
                
                foreach( $newsettings as $setting => $value ) 
@@ -148,7 +158,7 @@
 
                        /* Don't erase passwords, since we also do not print 
them below */
                        if ( $value 
-                               || (!preg_match('/passwd/', $setting) && 
!preg_match('/password/', $setting) && !preg_match('/root_pw/', $setting)) )
+                               || (!preg_match('/(passwd|password|root_pw)/', 
$setting)) )
                        {
                                $GLOBALS['phpgw_setup']->db->query("DELETE FROM 
phpgw_config WHERE config_name='{$setting}'", __LINE__, __FILE__);
                        }
@@ -195,7 +205,7 @@
        $GLOBALS['phpgw_setup']->db->query('SELECT * FROM phpgw_config');
        while($GLOBALS['phpgw_setup']->db->next_record())
        {
-               
$GLOBALS['current_config'][$GLOBALS['phpgw_setup']->db->f('config_name')] = 
$GLOBALS['phpgw_setup']->db->f('config_value');
+               $current_config[$GLOBALS['phpgw_setup']->db->f('config_name')] 
= $GLOBALS['phpgw_setup']->db->f('config_value');
        }
        
        // are we here because of an error: files-dir in docroot
@@ -205,7 +215,7 @@
 
                foreach($_POST['newsettings'] as $key => $val)
                {
-                       $GLOBALS['current_config'][$key] = $val;
+                       $current_config[$key] = $val;
                }
        }
 
@@ -251,15 +261,16 @@
                                $setup_tpl->set_var($value, lang($newval));
                                break;
                        case 'value':
-                               $newval = ereg_replace(' ','_',$newval);
+                               $newval = preg_replace('/ /','_',$newval);
                                /* Don't show passwords in the form */
-                               if(ereg('passwd',$value) || 
ereg('password',$value) || ereg('root_pw',$value))
+                               if ( !isset($current_config[$newval])
+                                       || 
preg_match('/(passwd|password|root_pw)/', $value) )
                                {
-                                       $setup_tpl->set_var($value,'');
+                                       $setup_tpl->set_var($value, '');
                                }
                                else
                                {
-                                       
$setup_tpl->set_var($value,@$current_config[$newval]);
+                                       $setup_tpl->set_var($value, 
$current_config[$newval]);
                                }
                                break;
                        case 'selected':

Modified: core/trunk/setup/inc/hook_config.inc.php
===================================================================
--- core/trunk/setup/inc/hook_config.inc.php    2008-11-10 01:23:38 UTC (rev 
18986)
+++ core/trunk/setup/inc/hook_config.inc.php    2008-11-10 01:29:39 UTC (rev 
18987)
@@ -161,10 +161,36 @@
        * @param none
        * @return string HTML select box
        */
-       function cookie_domain()
+       function cookie_domain($config)
        {
-               // TODO : Make it do something intelligent
-               $cookie_domain='<option 
value="request_fqdn">request_fqdn</option>';
-               return $cookie_domain;
+               $current = 'request_fqdn';
+               if ( isset($config['cookie_domain']))
+               {
+                       $current = $config['cookie_domain'];
+               }
+               
+               $options = array('request_fqdn' => lang('Fully Qualified Domain 
of Request'));
+               
+               $domain = '';
+               
+               $parts = explode('.', phpgw::get_var('SERVER_NAME', 'string', 
'SERVER'));
+               for ( $i = count($parts) -1; $i >= 0; --$i )
+               {
+                       $domain .= ".{$parts[$i]}";
+                       $options[$domain] = $domain;
+               }
+               
+               $out = '';
+               foreach ( $options as $key => $option )
+               {
+                       $selected = '';
+                       if ( $key == $current )
+                       {
+                               $selected = ' selected';
+                       }
+                       
+                       $out .= "<option 
value=\"{$key}\"{$selected}>$option</option>\n";
+               }
+               return $out;
        }
        
\ No newline at end of file

Modified: core/trunk/setup/manageheader.php
===================================================================
--- core/trunk/setup/manageheader.php   2008-11-10 01:23:38 UTC (rev 18986)
+++ core/trunk/setup/manageheader.php   2008-11-10 01:29:39 UTC (rev 18987)
@@ -25,7 +25,7 @@
        $GLOBALS['phpgw_info']['server']['header_admin_password'] = '';
        $GLOBALS['phpgw_info']['server']['sessions_type'] = 'php';
        $GLOBALS['phpgw_info']['server']['db_persistent'] = false;
-       $GLOBALS['phpgw_info']['server']['mcrypt_enabled'] = 
extension_loaded('mcrypt');
+       $GLOBALS['phpgw_info']['server']['mcrypt_enabled'] = false;
        $GLOBALS['phpgw_info']['server']['versions']['mcrypt'] = '';
        $GLOBALS['phpgw_info']['server']['domain_from_host'] = false;
        $GLOBALS['phpgw_info']['server']['show_domain_selectbox'] = false;
@@ -285,6 +285,7 @@
                        {
                                $detected .= '<li class="warn">' . lang('No 
Microsoft SQL Server support found. Disabling') . "</li>\n";
                        }
+                       /* We don't currently support oracle
                        if (extension_loaded('oci8'))
                        {
                                $detected .= '<li>' . lang('You appear to have 
Oracle V8 (OCI) support enabled') . "</li>\n";
@@ -302,6 +303,7 @@
                                        $detected .= '<li class="warn">' . 
lang('No Oracle-DB support found. Disabling') . "</li>\n";
                                }
                        }
+                       */
 
                        /* Not currently supported
                        if (extension_loaded('odbc') || 
function_exists('odbc_connect'))
@@ -353,14 +355,26 @@
                        {
                                $detected .= '<li class="warn">' . lang('No 
IMAP support found. Email functions will be disabled') . "</li>\n";
                        }
+                       
+                       if(extension_loaded('mcrypt') || 
function_exists('mcrypt_list_modes'))
+                       {
+                               $detected .= '<li>' . lang('You appear to have 
mcrypt support enabled') . "</li>\n";
+                               
$GLOBALS['phpgw_info']['server']['mcrypt_enabled'] = true;
+                       }
+                       else
+                       {
+                               $detected .= '<li class="warn">' . lang('No 
mcrypt support found. Some sensitive data may be store as plain text') . 
"</li>\n";
+                       }
+                       
                        if(extension_loaded('shmop') || 
function_exists('shmop_open'))
                        {
-                               $detected .= '<li>' . lang('You appear to have 
SHMOP support enabled') . "</li>\n";
+                               $detected .= '<li>' . lang('You appear to have 
shared memory support enabled') . "</li>\n";
                        }
                        else
                        {
                                $detected .= '<li class="warn">' . lang('No 
SHMOP support found. Install or enable php-shmop if you want to use shared 
memory') . "</li>\n";
                        }
+                       
                        if( extension_loaded('xsl') && 
class_exists('XSLTProcessor') )
                        {
                                $detected .= '<li>' . lang('You appear to have 
XML/XSLT support enabled') . "</li>\n";

Modified: core/trunk/setup/templates/base/head.tpl
===================================================================
--- core/trunk/setup/templates/base/head.tpl    2008-11-10 01:23:38 UTC (rev 
18986)
+++ core/trunk/setup/templates/base/head.tpl    2008-11-10 01:29:39 UTC (rev 
18987)
@@ -89,8 +89,9 @@
 
                        #analysis li
                        {
-                               background-color: #cdeb8b;
-                               border: 1px solid #008c00;
+                               border: 1px solid #4f8a10;
+                       background-color: #dff2bf;
+                       color: #4f8a10;
                                margin: 2px;
                                padding: 3px;
                        }
@@ -209,14 +210,16 @@
                        /* Extra qualifiers are used here to override 
definitions above */
                        .err, #analysis li.err
                        {
-                               border: 1px solid #f00;
-                               color: #f00;
+                               background-color: #ffbaba;
+                               border-color: #d8000c;
+                               color: #d8000c;
                        }
 
                        .warn, #analysis li.warn
                        {
-                               background-color: #ff8;
-                               border-color: #fc0;
+                               background-color: #fefeb3;
+                               border-color: #9f600;
+                               color: #9f6000;  
                        }
                -->
                </style>






reply via email to

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