diff options
| author | spiderr <spiderr@bitweaver.org> | 2021-06-02 15:23:00 -0400 |
|---|---|---|
| committer | spiderr <spiderr@bitweaver.org> | 2021-06-02 15:23:00 -0400 |
| commit | fd1712a4270a4349dc4e5d620e7779fcf7ed86cf (patch) | |
| tree | d691fb43e98908c110a8cc5726842d2f570cc134 /includes | |
| parent | 601603c697849f3c4f5ce07bc45fb20e0e80613a (diff) | |
| download | install-fd1712a4270a4349dc4e5d620e7779fcf7ed86cf.tar.gz install-fd1712a4270a4349dc4e5d620e7779fcf7ed86cf.tar.bz2 install-fd1712a4270a4349dc4e5d620e7779fcf7ed86cf.zip | |
clean up install for new includes/classes directory pathing
Diffstat (limited to 'includes')
| -rw-r--r-- | includes/classes/BitInstaller.php | 729 | ||||
| -rw-r--r-- | includes/create_config_inc.php | 256 | ||||
| -rw-r--r-- | includes/get_databases_inc.php | 68 | ||||
| -rw-r--r-- | includes/install_admin_inc.php | 80 | ||||
| -rw-r--r-- | includes/install_inc.php | 182 |
5 files changed, 1315 insertions, 0 deletions
diff --git a/includes/classes/BitInstaller.php b/includes/classes/BitInstaller.php new file mode 100644 index 0000000..7795403 --- /dev/null +++ b/includes/classes/BitInstaller.php @@ -0,0 +1,729 @@ +<?php +/** + * @version $Header$ + * @package install + */ + +/** + * @package install + */ +class BitInstaller extends BitSystem { + + /** + * mPackageUpgrades + * + * @var array + * @access public + */ + var $mPackageUpgrades = array(); + + /** + * mRequirements + * + * @var array + * @access public + */ + var $mRequirements = array(); + + /** + * Initiolize BitInstaller + * @access public + */ + function __construct() { + parent::__construct(); + $this->getWebServerUid(); + } + + /** + * loadAllUpgradeFiles load upgrade files from all packages that are installed + * + * @access public + * @return void + */ + function loadAllUpgradeFiles() { + foreach( array_keys( $this->mPackages ) as $pkg ) { + $this->loadUpgradeFiles( $pkg ); + } + } + + /** + * Minimal login just for install in case users tables have been modified + * + * @access public + * @return void + */ + function login( $pLogin, $pPassword, $pChallenge=NULL, $pResponse=NULL ) { + global $gBitUser; + + $isvalid = false; + + $loginCol = strpos( $pLogin, '@' ) ? 'email' : 'login'; + + if( $gBitUser->validate( $pLogin, $pPassword, $pChallenge, $pResponse ) ) { + $userInfo = $gBitUser->getUserInfo( array( $loginCol => $pLogin ) ); + + if( $userInfo['user_id'] != ANONYMOUS_USER_ID ) { + // User is valid and not due to change pass.. + $gBitUser->mUserId = $userInfo['user_id']; + $gBitUser->mInfo = $userInfo; + $gBitUser->loadPermissions( TRUE ); + + $sessionId = session_id(); + $gBitUser->sendSessionCookie( $sessionId ); + $gBitUser->updateSession( $sessionId ); + } + } + + return $gBitUser->isAdmin(); + } + + /** + * loadUpgradeFiles This will load all files in the dir <pckage>/admin/upgrades/<version>.php with a version greater than the one installed + * + * @param array $pPackage + * @access public + * @return void + */ + function loadUpgradeFiles( $pPackage ) { + if( !empty( $pPackage )) { + $dir = constant( strtoupper( $pPackage )."_PKG_PATH" )."admin/upgrades/"; + if( $this->isPackageActive( $pPackage ) && is_dir( $dir ) && $upDir = opendir( $dir )) { + while( FALSE !== ( $file = readdir( $upDir ))) { + if( is_file( $dir.$file )) { + $upVersion = str_replace( ".php", "", $file ); + // we only want to load files of versions that are greater than is installed + if( $this->validateVersion( $upVersion ) && version_compare( $this->getVersion( $pPackage ), $upVersion, '<' )) { + include_once( $dir.$file ); + } + } + } + } + } + } + + /** + * registerPackageUpgrade + * + * @param array $pParams Hash of information about upgrade + * @param string $pParams[package] Name of package that is upgrading + * @param string $pParams[version] Version of this upgrade + * @param string $pParams[description] Description of what the upgrade does + * @param string $pParams[post_upgrade] Textual note of stuff that needs to be observed after the upgrade + * @param array $pUpgradeHash Hash of update rules. See existing upgrades on how this works. + * @access public + * @return void + */ + function registerPackageUpgrade( $pParams, $pUpgradeHash = array() ) { + if( $this->verifyPackageUpgrade( $pParams )) { + $this->registerPackageVersion( $pParams['package'], $pParams['version'] ); + $this->mPackageUpgrades[$pParams['package']][$pParams['version']] = $pParams; + $this->mPackageUpgrades[$pParams['package']][$pParams['version']]['upgrade'] = $pUpgradeHash; + + // sort everything for a nice display + ksort( $this->mPackageUpgrades ); + uksort( $this->mPackageUpgrades[$pParams['package']], 'version_compare' ); + } + } + + /** + * verifyPackageUpgrade + * + * @param array $pParams Hash of information about upgrade + * @param string $pParams[package] Name of package that is upgrading + * @param string $pParams[version] Version of this upgrade + * @param string $pParams[description] Description of what the upgrade does + * @param string $pParams[post_upgrade] Textual note of stuff that needs to be observed after the upgrade + * @access public + * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure + */ + function verifyPackageUpgrade( &$pParams ) { + if( empty( $pParams['package'] )) { + $this->mErrors['package'] = "Please provide a valid package name."; + } else { + $pParams['package'] = strtolower( $pParams['package'] ); + } + + if( empty( $pParams['version'] ) || !$this->validateVersion( $pParams['version'] )) { + $this->mErrors['version'] = "Please provide a valid version number."; + } elseif( empty( $this->mErrors ) && !empty( $this->mPackageUpgrades[$pParams['package']][$pParams['version']] )) { + $this->mErrors['version'] = "Please make sure you use a unique version number to register your new database changes."; + } + + if( empty( $pParams['description'] )) { + $this->mErrors['description'] = "Please add a brief description of what this upgrade is all about."; + } + + // since this should only show up when devs are working, we'll simply display the output: + if( !empty( $this->mErrors )) { + vd( $this->mErrors ); + bt(); + } + + return( count( $this->mErrors ) == 0 ); + } + + /** + * registerUpgrade + * + * @param array $pPackage + * @param array $pUpgradeHash + * @access public + * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure + */ + function registerUpgrade( $pPackage, $pUpgradeHash ) { + $pPackage = strtolower( $pPackage ); // lower case for uniformity + if( !empty( $pUpgradeHash ) ) { + $this->mUpgrades[$pPackage] = $pUpgradeHash; + } + } + + /** + * display + * + * @param string $pTemplate + * @param string $pBrowserTitle + * @access public + * @return void + */ + function in_display( $pPackage, $pTemplate ) { + header( 'Content-Type: text/html; charset=utf-8' ); + if( ini_get( 'safe_mode' ) && ini_get( 'safe_mode_gid' )) { + umask( 0007 ); + } + // force the session to close *before* displaying. Why? Note this very important comment from http://us4.php.net/exec + session_write_close(); + + if( !empty( $pPackage ) ) { + $this->setBrowserTitle( $pPackage ); + } + global $gBitSmarty; + $gBitSmarty->verifyCompileDir(); + $gBitSmarty->display( $pTemplate ); + } + + /** + * isInstalled + * + * @access public + * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure + */ + function isInstalled( $pPackage = 'kernel' ) { + return( !empty( $this->mPackages[$pPackage]['installed'] )); + } + + /** + * getWebServerUid set global wwwuser and wwwgroup + * + * @access public + * @return void + */ + function getWebServerUid() { + global $wwwuser, $wwwgroup; + $wwwuser = $wwwgroup = ''; + + if( is_windows() ) { + $wwwuser = 'SYSTEM'; + $wwwgroup = 'SYSTEM'; + } + + if( function_exists( 'posix_getuid' )) { + $user = @posix_getpwuid( @posix_getuid() ); + $group = @posix_getpwuid( @posix_getgid() ); + $wwwuser = $user ? $user['name'] : false; + $wwwgroup = $group ? $group['name'] : false; + } + + if( !$wwwuser ) { + $wwwuser = 'nobody (or the user account the web server is running under)'; + } + + if( !$wwwgroup ) { + $wwwgroup = 'nobody (or the group account the web server is running under)'; + } + } + + /** + * getTablePrefix + * + * @access public + * @return database adjusted table prefix + */ + function getTablePrefix() { + global $gBitDbType; + $ret = BIT_DB_PREFIX; + // avoid errors in ADONewConnection() (wrong database driver etc...) + // strip out some schema stuff + switch( $gBitDbType ) { + case "sybase": + // avoid database change messages + ini_set('sybct.min_server_severity', '11'); + break; + case "oci8": + case "postgres": + // Do a little prep work for postgres, no break, cause we want default case too + if( preg_match( '/\./', $ret ) ) { + // Assume we want to dump in a schema, so set the search path and nuke the prefix here. + $schema = preg_replace( '/`/', '"', substr( $ret, 0, strpos( $ret, '.' )) ); + $quote = strpos( $schema, '"' ); + if( $quote !== 0 ) { + $schema = '"'.$schema; + } + // set scope to current schema + $result = $this->mDb->query( "SET search_path TO $schema" ); + // return everything after the prefix + $ret = substr( BIT_DB_PREFIX, strrpos( BIT_DB_PREFIX, '`' ) + 1 ); + } + break; + } + return $ret; + } + + /** + * upgradePackage + * + * @param array $pPackage + * @access public + * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure + */ + function upgradePackage( $pPackage ) { + if( !empty( $pPackage ) && !empty( $this->mUpgrades[$pPackage] )) { + return( $this->applyUpgrade( $pPackage, $this->mUpgrades[$pPackage] )); + } + } + + /** + * upgradePackageVersion + * + * @param array $pPackage + * @param array $pVersion + * @access public + * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure + */ + function upgradePackageVersions( $pPackage ) { + if( !empty( $pPackage ) && !empty( $this->mPackageUpgrades[$pPackage] )) { + // make sure everything is in the right order + uksort( $this->mPackageUpgrades[$pPackage], 'upgrade_version_sort' ); + + foreach( array_keys( $this->mPackageUpgrades[$pPackage] ) as $version ) { + // version we are upgrading from + $this->mPackageUpgrades[$pPackage][$version]['from_version'] = $this->getVersion( $pPackage ); + + // apply upgrade + $errors[$version] = $this->applyUpgrade( $pPackage, $this->mPackageUpgrades[$pPackage][$version]['upgrade'] ); + if( !empty( $errors[$version] )) { + return $errors; + } else { + // if the upgrade ended without incidence, we store the package version. + // this way any successfully applied upgrade can only be applied once. + $this->storeVersion( $pPackage, $version ); + } + } + } + + return NULL; + } + + /** + * applyUpgrade + * + * @param array $pPackage + * @param array $pUpgradeHash + * @access public + * @return empty array on success, array with errors on failure + */ + function applyUpgrade( $pPackage, $pUpgradeHash ) { + global $gBitDb, $gBitDbType; + $ret = array(); + + if( !empty( $pUpgradeHash ) && is_array( $pUpgradeHash )) { + // set table prefixes and handle special case of sequence prefixes + $schemaQuote = strrpos( BIT_DB_PREFIX, '`' ); + $sequencePrefix = ( $schemaQuote ? substr( BIT_DB_PREFIX, $schemaQuote + 1 ) : BIT_DB_PREFIX ); + $tablePrefix = $this->getTablePrefix(); + $dict = NewDataDictionary( $gBitDb->mDb ); + $failedcommands = array(); + + for( $i = 0; $i < count( $pUpgradeHash ); $i++ ) { + if( !is_array( $pUpgradeHash[$i] ) ) { + vd( "[$pPackage][$i] is NOT an array" ); + vd( $pUpgradeHash[$i] ); + bt(); + die; + } + + $type = key( $pUpgradeHash[$i] ); + $step = &$pUpgradeHash[$i][$type]; + + switch( $type ) { + case 'DATADICT': + for( $j = 0; $j < count( $step ); $j++ ) { + $dd = &$step[$j]; + switch( key( $dd ) ) { + case 'CREATE': + foreach( $dd as $create ) { + foreach( array_keys( $create ) as $tableName ) { + $completeTableName = $tablePrefix.$tableName; + $sql = $dict->CreateTableSQL( $completeTableName, $create[$tableName], 'REPLACE' ); + if( $sql && ( $dict->ExecuteSQLArray( $sql, FALSE ) > 0 ) ) { + } else { + $errors[] = 'Failed to create '.$completeTableName; + $failedcommands[] = implode( " ", $sql ); + } + } + } + break; + case 'ALTER': + foreach( $dd as $alter ) { + foreach( array_keys( $alter ) as $tableName ) { + $completeTableName = $tablePrefix.$tableName; + $this->mDb->convertQuery( $completeTableName ); + foreach( $alter[$tableName] as $from => $flds ) { + if( is_string( $flds )) { + $sql = $dict->ChangeTableSQL( $completeTableName, $flds ); + } else { + $sql = $dict->ChangeTableSQL( $completeTableName, array( $flds )); + } + + if( $sql ) { + for( $sqlIdx = 0; $sqlIdx < count( $sql ); $sqlIdx++ ) { + $this->mDb->convertQuery( $sqlFoo ); + } + } + + if( $sql && $dict->ExecuteSQLArray( $sql, FALSE ) > 0 ) { + } else { + $errors[] = 'Failed to alter '.$completeTableName.' -> '.$alter[$tableName]; + $failedcommands[] = implode( " ", $sql ); + } + } + } + } + break; + case 'RENAMETABLE': + foreach( $dd as $rename ) { + foreach( array_keys( $rename ) as $tableName ) { + $completeTableName = $tablePrefix.$tableName; + if( $sql = @$dict->RenameTableSQL( $completeTableName, $tablePrefix.$rename[$tableName] ) ) { + foreach( $sql AS $query ) { + $this->mDb->query( $query ); + } + } else { + $errors[] = 'Failed to rename table '.$completeTableName.'.'.$rename[$tableName][0].' to '.$rename[$tableName][1]; + $failedcommands[] = implode( " ", $sql ); + } + } + } + break; + case 'RENAMECOLUMN': + foreach( $dd as $rename ) { + foreach( array_keys( $rename ) as $tableName ) { + $completeTableName = $tablePrefix.$tableName; + foreach( $rename[$tableName] as $from => $flds ) { + // MySQL needs the fields string, others do not. + // see http://phplens.com/lens/adodb/docs-datadict.htm + $to = substr( $flds, 0, strpos( $flds, ' ') ); + if( $sql = @$dict->RenameColumnSQL( $completeTableName, $from, $to, $flds ) ) { + foreach( $sql AS $query ) { + $this->mDb->query( $query ); + } + } else { + $errors[] = 'Failed to rename column '.$completeTableName.'.'.$rename[$tableName][0].' to '.$rename[$tableName][1]; + $failedcommands[] = implode( " ", $sql ); + } + } + } + } + break; + case 'CREATESEQUENCE': + foreach( $dd as $create ) { + foreach( $create as $sequence ) { + $this->mDb->CreateSequence( $sequencePrefix.$sequence ); + } + } + break; + case 'RENAMESEQUENCE': + foreach( $dd as $rename ) { + foreach( $rename as $from => $to ) { + if( $gBitDbType != 'mysql' || $this->mDb->tableExists( $tablePrefix.$from ) ) { + if( $id = $this->mDb->GenID( $from ) ) { + $this->mDb->DropSequence( $sequencePrefix.$from ); + $this->mDb->CreateSequence( $sequencePrefix.$to, $id ); + } else { + $errors[] = 'Failed to rename sequence '.$sequencePrefix.$from.' to '.$sequencePrefix.$to; + $failedcommands[] = implode( " ", $sql ); + } + } else { + $this->mDb->CreateSequence( $sequencePrefix.$to, $pUpgradeHash['sequences'][$to]['start'] ); + } + } + } + break; + case 'DROPSEQUENCE': + foreach( $dd as $drop ) { + foreach( $drop as $sequence ) { + $this->mDb->DropSequence( $sequencePrefix.$sequence ); + } + } + break; + case 'DROPCOLUMN': + foreach( $dd as $drop ) { + foreach( array_keys( $drop ) as $tableName ) { + $completeTableName = $tablePrefix.$tableName; + foreach( $drop[$tableName] as $col ) { + if( $sql = $dict->DropColumnSQL( $completeTableName, $col ) ) { + foreach( $sql AS $query ) { + $this->mDb->query( $query ); + } + } else { + $errors[] = 'Failed to drop column '.$completeTableName; + $failedcommands[] = implode( " ", $sql ); + } + } + } + } + break; + case 'DROPTABLE': + foreach( $dd as $drop ) { + foreach( $drop as $tableName ) { + $completeTableName = $tablePrefix.$tableName; + $sql = $dict->DropTableSQL( $completeTableName ); + if( $sql && $dict->ExecuteSQLArray( $sql ) > 0 ) { + } else { + $errors[] = 'Failed to drop table '.$completeTableName; + $failedcommands[] = implode( " ", $sql ); + } + } + } + break; + case 'CREATEINDEX': + foreach( $dd as $indices ) { + foreach( array_keys( $indices ) as $index ) { + $completeTableName = $tablePrefix.$indices[$index][0]; + if( $sql = $dict->CreateIndexSQL( $index, $completeTableName, $indices[$index][1], $indices[$index][2] ) ) { + foreach( $sql AS $query ) { + $this->mDb->query( $query ); + } + } else { + $errors[] = 'Failed to create index '.$index; + $failedcommands[] = implode( " ", $sql ); + } + } + } + break; + } + } + if( !empty( $sql ) ) $sql = null; + break; + case 'QUERY': + uksort( $step, 'upgrade_query_sort' ); + foreach( array_keys( $step ) as $dbType ) { + if( $dbType == 'MYSQL' && preg_match( '/mysql/', $gBitDbType )) { + $sql = $step[$dbType]; + unset( $step['SQL92'] ); + } elseif( $dbType == 'PGSQL' && preg_match( '/postgres/', $gBitDbType )) { + $sql = $step[$dbType]; + unset( $step['SQL92'] ); + } elseif( $dbType == 'SQL92' && !empty( $step['SQL92'] )) { + $sql = $step[$dbType]; + } + + if( !empty( $sql ) ) { + foreach( $sql as $query ) { + if( !$result = $this->mDb->query( $query )) { + $errors[] = 'Failed to execute SQL query'; + $failedcommands[] = implode( " ", $sql ); + } + } + $sql = NULL; + } + } + break; + case 'PHP': + eval( $step ); + break; + case 'POST': + $postSql[] = $step; + break; + } + } + + // turn on features that are turned on + // legacy stuff + if( $this->isFeatureActive( 'feature_'.$pPackage )) { + $this->storeConfig( 'package_'.$pPackage, 'y', KERNEL_PKG_NAME ); + } + + if( !empty( $failedcommands )) { + $ret['errors'] = $errors; + $ret['failedcommands'] = $failedcommands; + } + } + + return $ret; + } + + /** + * identifyBlobs + * + * @param array $result + * @access public + * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure + */ + function identifyBlobs( $result ) { + $blobs = array(); + //echo "FieldCount: ".$result->FieldCount()."\n"; + for( $i = 0; $i < $result->FieldCount(); $i++ ) { + $field = $result->FetchField($i); + //echo $i."-".$field->name."-".$result->MetaType($field->type)."-".$field->max_length."\n"; + // check for blobs + if(( $result->MetaType( $field->type ) == 'B' ) || ( $result->MetaType( $field->type )=='X' && $field->max_length >= 16777215 )) + $blobs[] = $field->name; + } + return $blobs; + } + + /** + * convertBlobs enumerate blob fields and encoded + * + * @param string $gDb + * @param array $res + * @param array $blobs + * @access public + * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure + */ + function convertBlobs( $gDb, &$res, $blobs ) { + foreach( $blobs as $blob ) { + $res[$blob] = $gDb->dbByteEncode( $res[$blob] ); + } + } + + /** + * hasAdminBlock + * + * @access public + * @return TRUE on success, FALSE on failure + * @deprecated i think this isn't used any more + */ + function hasAdminBlock() { + deprecated( "i think this isn't used anymore." ); + global $gBitUser; + // Let's find out if we are have admin perm or a root user + $ret = TRUE; + if( empty( $gBitUser ) || $gBitUser->isAdmin() ) { + $ret = FALSE; + } else { + // let's try to load up user_id - if successful, we know we have one. + $rootUser = new BitPermUser( 1 ); + $rootUser->load(); + if( !$rootUser->isValid() ) { + $ret = FALSE; + } + } + return $ret; + } +} + +/** + * check_session_save_path + * + * @access public + * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure + */ +function check_session_save_path() { + global $errors; + if( ini_get( 'session.save_handler' ) == 'files' ) { + $save_path = ini_get( 'session.save_path' ); + + if( !is_dir( $save_path )) { + $errors .= "The directory '$save_path' does not exist or PHP is not allowed to access it (check session.save_path or open_basedir entries in php.ini).\n"; + } elseif( !bw_is_writeable( $save_path )) { + $errors .= "The directory '$save_path' is not writeable.\n"; + } + + if( $errors ) { + $save_path = tempdir(); + + if (is_dir($save_path) && bw_is_writeable($save_path)) { + ini_set('session.save_path', $save_path); + + $errors = ''; + } + } + } +} + +/** + * makeConnection + * + * @param string $gBitDbType + * @param string $gBitDbHost + * @param string $gBitDbUser + * @param string $gBitDbPassword + * @param string $gBitDbName + * @access public + * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure + */ +function makeConnection( $gBitDbType, $gBitDbHost, $gBitDbUser, $gBitDbPassword, $gBitDbName ) { + $gDb = &ADONewConnection( $gBitDbType ); + if( !$gDb->Connect( $gBitDbHost, $gBitDbUser, $gBitDbPassword, $gBitDbName )) { + echo $gDb->ErrorMsg()."\n"; + die; + } + global $gBitDbCaseSensitivity; + $gDb->mCaseSensitive = $gBitDbCaseSensitivity; + $gDb->SetFetchMode( ADODB_FETCH_ASSOC ); + return $gDb; +} + +/** + * upgrade_package_sort sort packages before they are upgraded + * + * @param string $a + * @param string $b + * @access public + * @return numeric sort direction + */ +function upgrade_package_sort( $a, $b ) { + global $gBitInstaller; + $aa = $gBitInstaller->mPackages[$a]; + $bb = $gBitInstaller->mPackages[$b]; + if(( $aa['required'] && $bb['required'] ) || ( !$aa['required'] && !$bb['required'] )) { + return 0; + } elseif( $aa['required'] && !$bb['required'] ) { + return -1; + } elseif( !$aa['required'] && $bb['required'] ) { + return 1; + } +} + +/** + * upgrade_version_sort sort upgrades based on version number + * + * @param string $a + * @param string $b + * @access public + * @return numeric sort direction + */ +function upgrade_version_sort( $a, $b ) { + return version_compare( $a, $b, '>' ); +} + +/** + * upgrade_query_sort sort queries that SQL92 queries are called last + * + * @param string $a + * @param string $b + * @access public + * @return numeric sort direction + */ +function upgrade_query_sort( $a, $b ) { + if( $a == 'SQL92' ) { + return 1; + } elseif( $b == 'SQL92' ) { + return -1; + } else { + return 0; + } +} + +?> diff --git a/includes/create_config_inc.php b/includes/create_config_inc.php new file mode 100644 index 0000000..9ae113c --- /dev/null +++ b/includes/create_config_inc.php @@ -0,0 +1,256 @@ +<?php +/** + * @version $Header$ + * @package install + * @subpackage functions + */ + +/** + * create_config + */ + +/** + * create configuration file + * + * @param string $pParamHash['gBitDbType'] + * @param string $pParamHash['gBitDbHost'] + * @param string $pParamHash['gBitDbUser'] + * @param string $pParamHash['gBitDbPassword'] + * @param string $pParamHash['gBitDbName'] + * @param numeric $pParamHash['gBitDbCaseSensitivity'] + * @param string $pParamHash['bit_db_prefix'] + * @param string $pParamHash['bit_root_url'] + * @param boolean $pParamHash['auto_bug_submit'] + * @param boolean $pParamHash['is_live'] + * @access public + * @return void + */ +function create_config( $pParamHash ) { + // assign values to their keys + extract( $pParamHash ); + + $bit_db_prefix = empty( $bit_db_prefix ) ? "" : $bit_db_prefix; + + $gBitDbType = addslashes( $gBitDbType ); + $gBitDbHost = addslashes( $gBitDbHost ); + $gBitDbUser = addslashes( $gBitDbUser ); + $gBitDbPassword = addslashes( $gBitDbPassword ); + $gBitDbName = addslashes( $gBitDbName ); + $bit_db_prefix = addslashes( $bit_db_prefix ); + + if( preg_match( '/\./', $bit_db_prefix ) ) { + if( $gBitDbType == 'mysql' ) { + $bit_db_prefix = preg_replace( '/[`.]/', '', $bit_db_prefix ); + } elseif( !preg_match( '/`\.`/', $bit_db_prefix ) ) { + $bit_db_prefix = preg_replace( '/\./', '`.`', $bit_db_prefix ); + } + } + + $config_file = empty( $_SERVER['CONFIG_INC'] ) ? '../config/kernel/config_inc.php' : $_SERVER['CONFIG_INC']; + if( !file_exists( dirname( dirname( $config_file ) ) ) ) { + mkdir( dirname( dirname( $config_file ) ) ); + } + if( !file_exists( dirname( $config_file ) ) ) { + mkdir( dirname( $config_file ) ); + } + + // We can't call clean_file_path here even though we would like to. + $config_file = ( strpos( $_SERVER["SERVER_SOFTWARE"],"IIS" ) ? str_replace( "/", "\\", $config_file ) : $config_file ); + + $fw = fopen( $config_file, 'w' ); + if( isset( $fw )) { + $filetowrite = "<?php +// Copyright (c) 2006, bitweaver.org +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. + +// The following line is required and should not be altered +global \$gBitDbType, \$gBitDbHost, \$gBitDbUser, \$gBitDbPassword, \$gBitDbName, \$gBitDbCaseSensitivity, \$smarty_force_compile, \$gDebug, \$gPreScan; + + + /******************************************************\ + *************** Database settings **************** + \******************************************************/ + +// You can choose between different Database abstraction layers. Currently we support: +// adodb ADODB +// this is the default setting and is bundled with bitweaver +// pear PEAR::DB +// when using this, you can even remove the util/adodb directory +\$gBitDbSystem = \"adodb\"; + + +// bitweaver can store its data in multiple different back-ends. Currently we +// support MySQL, MSSQL, Firebird, Sybase, PostgreSQL and Oracle. Enter the +// hostname where your database lives, and the username and password you use to +// connect to it. +// +// You must specify the name of a database that already exists. bitweaver will not +// create the database for you, because it's very difficult to do that in a +// reliable, database-neutral fashion. The user that you use should have the +// following permissions: +// +// SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP +// +// The possible database types that we support are: +// mysql Standard MySQL +// mysqli New MySQL driver +// sqlite SQLLite +// mssql MS-SQL (experimental) +// postgres PostgreSQL 7.x +// oci8po Oracle (9i and newer) +// firebird FireBird +// sybase Sybase +\$gBitDbType=\"$gBitDbType\"; + +// Hostname or IP for your database. +// Some examples: +// 'localhost' if you are running the database on the same machine as bitweaver +// If you use Oracle, insert your TNS Name here +// If you use SQLite, insert the path and filename to your database file +\$gBitDbHost=\"$gBitDbHost\"; + +// Database username +\$gBitDbUser=\"$gBitDbUser\"; + +// Database password +\$gBitDbPassword=\"$gBitDbPassword\"; + +// Database name +\$gBitDbName=\"$gBitDbName\"; + +// Database field case default +\$gBitDbCaseSensitivity=\"$gBitDbCaseSensitivity\"; + +// This prefix will be prepended to the begining of every table name to allow +// multiple independent installs to share a single database. By ending the prefix +// with a '.' (period) you can use a schema in systems that support it. Backticks +// '`' around the '.' are required if present. A schema example is: 'bit`.`' +define( 'BIT_DB_PREFIX', '$bit_db_prefix' ); + + + /******************************************************\ + *************** Environment Settings **************** + \******************************************************/ + +// Setting IS_LIVE to TRUE will let the application know that this site is a live +// production site and is not used for testing purposes. This will prevent any +// nasty error pages from appearing and will redirect the user to a 'nicer' error +// page. Errors should still show up in your error logs. Please use these when +// submitting bugs to http://sourceforge.net/tracker/?group_id=141358&atid=749176 +define( 'IS_LIVE', $is_live ); + + +// if you set AUTO_BUG_SUBMIT to TRUE bitweaver will automatically email the team +// with details regarding the error. Alternatively you can submit bugs to +// http://sourceforge.net/tracker/?group_id=141358&atid=749176 which will probably +// get processed faster since more people have access to these. +define( 'AUTO_BUG_SUBMIT', $auto_bug_submit ); + + +// This is the path from the server root to your bitweaver location. i.e. if you +// access bitweaver as 'http://MyServer.com/applications/new/wiki/index.php' you +// should enter '/applications/new/' +define( 'BIT_ROOT_URL', '$bit_root_url' ); + + +// Here you can set the valid base URI for your site. If you do not set this, we +// will automatically determine a working value. You can force the use of a +// specific URI here by putting something like: 'http://myfiles.example.com' +//define( 'BIT_ROOT_URI', 'http://myfiles.example.com' ); + + +// Add default STORAGE_HOST_URI for optionally splitting off storage files to +// separate host. This will allow you to serve thumbnails and other files from +// a different server to your web server. If this is not set, we will use +// BIT_ROOT_URI instead. Put something like: 'http://myfiles.example.com' +//define( 'STORAGE_HOST_URI', 'http://myfiles.example.com' ); + + +// This allows you to set a custom path to your PHP tmp directory - used for ADODB +// caching if active, and other stuff This is usually only needed in very +// restrictive hosting environments. +//\$gTempDir = '/path/to/private/directory'; + + +// \$gPreScan can be used to specify the order in which packages are scanned by +// the kernel. In the example provided below, the kernel package is processed +// first, followed by the users and liberty packages. Any packages not specified +// in \$gPreScan are processed in the traditional order +//\$gPreScan = array( 'kernel', 'storage', 'liberty', 'themes', 'users' ); + +// \$gThumbSizes defines the image thumbnail sizes that will be autogenerated when +// images are uploaded and processed. The example provided shows the default sizes +// that are used. You can add as many sizes as you want if you override the default. +/* +\$gThumbSizes = array( + 'extra-large' => array( 'width' => 1024, 'height' => 1024 ), + 'large' => array( 'width' => 800, 'height' => 800 ), + 'medium' => array( 'width' => 400, 'height' => 400 ), + 'small' => array( 'width' => 160, 'height' => 160 ), + 'avatar' => array( 'width' => 100, 'height' => 100 ), + 'icon' => array( 'width' => 48, 'height' => 48 ), +); +*/"; + + if( substr( PHP_OS, 0, 3 ) == 'WIN' ) { + $filetowrite .= " + + +// Insert the absolute path to your php magic database. This is required for +// us to check and verify the mime type of uploaded files. This setting is only +// required on windows machines. +//define( 'PHP_MAGIC_PATH', 'C:\\Program Files\\PHP\\extras\\magic.mime' );"; + } + + if( defined( 'ROLE_MODEL' )) { + $filetowrite .= " + +define( 'LIBERTY_DEFAULT_MIME_HANDLER', 'mimeflatdefault' );"; + } + + $filetowrite .= " + + + /******************************************************\ + *************** Debugging Options **************** + \******************************************************/ + +// If you wish to force compiling of every page, you can set the next setting to +// TRUE. this will, however, severly impact performance since every page that is +// generated is generated afresh and the cache is recreated every time. +\$smarty_force_compile = FALSE; + + +// Setting TEMPLATE_DEBUG = TRUE will output <!-- <called templates> --> in your +// templates, which will allow you to track all used templates in the HTML source +// of the page. This will also disable stripping of whitespace making it easier to +// read the templates. You will only see the effect of the strip changes by +// clearing out your cache or setting \$smarty_force_compile = TRUE; +// Note: be sure to set this to FALSE and clear out the cache once done since it +// will increase the page size by at least 10%. +//define( 'TEMPLATE_DEBUG', TRUE ); + +// If you want to go a step further with template debugging then this enables +// smarty's debugging console. A popup with a dump of all of the vars the +// template(s) have been passed. +\$smarty_debugging = FALSE; + + +// This statement will enable you to view all database queries made +//\$gDebug = TRUE; + + +// This will turn on ADODB performance monitoring and log all queries. This should +// not be enabled except when doing query analysis due to an overall performance +// drop. see kernel/admin/db_performance.php for statistics +//define( 'DB_PERFORMANCE_STATS', TRUE ); + +?>"; + fwrite( $fw, $filetowrite ); + fclose( $fw ); + } else { + print "UNABLE TO WRITE TO ".realpath( $config_file ); + } +} + +?> diff --git a/includes/get_databases_inc.php b/includes/get_databases_inc.php new file mode 100644 index 0000000..22f6310 --- /dev/null +++ b/includes/get_databases_inc.php @@ -0,0 +1,68 @@ +<?php +/** + * check what db servers are available and display them accordingly - only seems to work with *nix + * + * @package install + * @subpackage functions + */ +$gBitDbCaseSensitivity = TRUE; +$dbtodsn = array(); +if( function_exists( 'mysql_connect' ) ) { + $dbtodsn['mysql'] = 'MySQL'; +} +if( function_exists( 'mysqli_connect' ) ) { + $dbtodsn['mysqli'] = 'MySQLi'; +} +if( function_exists( 'pg_connect' ) ) { + $dbtodsn['postgres'] = 'PostgreSQL'; +} +if( function_exists( 'ocilogon' ) ) { + $dbtodsn['oci8po'] = 'Oracle 8.i'; + $gBitDbCaseSensitivity = FALSE; +} +if( function_exists( 'sybase_connect' ) ) { + $dbtodsn['sybase'] = 'Sybase'; +} +if( function_exists( 'mssql_connect' ) ) { + $dbtodsn['mssql'] = 'MS-SQL'; +} +if( function_exists( 'fbsql_connect' ) ) { + $dbtodsn['fbsql'] = 'FrontBase'; +} +if( function_exists( 'fbird_connect' ) ) { + $dbtodsn['firebird'] = 'Firebird'; + if ( !empty($_REQUEST['fbpath']) ) $fbpath = $_REQUEST['fbpath']; + if ( empty($fbpath) ) { + if ( is_windows() ) + $fbpath = 'c:\Program Files\Firebird\Firebird_2_1\bin\isql'; + else + $fbpath = '/opt/firebird/bin/isql'; + } + $gBitSmarty->assign( 'fbpath', $fbpath ); + if ( empty($gBitDbName) ) { $gBitDbName = 'bitweaver'; } + $gBitDbCaseSensitivity = FALSE; + if ( empty($gBitDbUser) ) { + $gBitDbUser = 'SYSDBA'; + $gBitDbPassword = 'masterkey'; + } +} +if( function_exists( 'sqlite_open' ) ) { + $dbtodsn['sqlite'] = 'SQLLite'; +} +$gBitSmarty->assignByRef('dbservers', $dbtodsn); + +$gBitSmarty->assign( 'gBitDbType', $gBitDbType ); +$gBitSmarty->assign( 'gBitDbHost', $gBitDbHost ); +$gBitSmarty->assign( 'gBitDbUser', $gBitDbUser ); +$gBitSmarty->assign( 'gBitDbPassword', $gBitDbPassword ); +$gBitSmarty->assign( 'gBitDbName', $gBitDbName ); +$gBitSmarty->assign( 'gBitDbCaseSensitivity', $gBitDbCaseSensitivity ); +$gBitSmarty->assign( 'db_prefix_bit', BIT_DB_PREFIX ); +$gBitSmarty->assign( 'bit_root_url', $bit_root_url ); +if( defined( 'AUTO_BUG_SUBMIT' ) ) { + $gBitSmarty->assign( 'auto_bug_submit', AUTO_BUG_SUBMIT ); +} + +$gBitSmarty->assign( 'gBitDbPassword_input', $gBitDbPassword ); +$gBitSmarty->assign( 'gBitDbPassword_print', preg_replace( '/./','•',$gBitDbPassword ) ); +?> diff --git a/includes/install_admin_inc.php b/includes/install_admin_inc.php new file mode 100644 index 0000000..392fe76 --- /dev/null +++ b/includes/install_admin_inc.php @@ -0,0 +1,80 @@ +<?php +/** + * @version $Header$ + * @package install + * @subpackage functions + */ + +// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. +// All Rights Reserved. See below for details and a complete list of authors. +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. + +// assign next step in installation process +$gBitSmarty->assign( 'next_step', $step ); + +if( !empty( $_REQUEST['admin_submit'] )) { + $mail = $errors = array(); + if( empty( $_REQUEST['login'] ) ) { + $errors['login'] = "You must specify an administrator name."; + } + if( empty( $_REQUEST['email'] ) ) { + $errors['email'] = "You must specify an email address."; + } else { + BitUser::verifyAnonEmail( $_REQUEST['email'], $errors ); + } + + if( $_REQUEST['password'] != $_REQUEST['pass_confirm'] ) { + $errors['password'] = "The passwords you entered do not match."; + $_REQUEST['password'] = ''; + } elseif( strlen( $_REQUEST['password'] ) < 4 ) { + $errors['password'] = "The administrator password has to be at least 4 characters."; + $_REQUEST['password'] = ''; + } + + if( empty( $errors )) { + $app = '_done'; + $gBitSmarty->assign( 'next_step', $step + 1 ); + $gBitSmarty->assign( 'pass_disp', preg_replace( '/./i','•',$_REQUEST['password'] ) ); + + // do a mailer check as well - we need to remove trailing options for the sendmail_path check + if( !empty( $_REQUEST['testemail'] )) { + if(( $mail_path = trim( preg_replace( "#\s+\-[a-zA-Z]+.*$#", "", ini_get( 'sendmail_path' )))) && is_file( $mail_path )) { + $to = $_REQUEST['email']; + $from = "bitweaver@".$_SERVER['SERVER_NAME']; + $subject = "bitweaver test email"; + $message = "Congratulations!\r\n". + "The email system on your server at ".$_SERVER['SERVER_NAME']." is working!\r\n\r\n". + "Thank you for trying bitweaver,\r\n". + "The bitweaver team.\r\n"; + $headers = "From: $from\r\n". + "Reply-To: $from\r\n". + "X-Mailer: PHP/".phpversion(); + + if( mail( $to, $subject, $message, $headers )) { + $mail['success'] = "We sent an email to <strong>$to</strong>."; + } else { + $mail['warning'] = "We have tried to send an email to <strong>$to</strong> and the mailing system on the server has not accepted the email."; + } + } else { + $mail['warning'] = "The email settings on your php server are not set up correctly. Please make sure to set a valid <strong>sendmail_path</strong> if you plan to send emails with bitweaver."; + } + } + } + + $_SESSION['real_name'] = $_REQUEST['real_name']; + $_SESSION['login'] = $_REQUEST['login']; + $_SESSION['password'] = $_REQUEST['password']; + $_SESSION['email'] = $_REQUEST['email']; + + $gBitSmarty->assign( 'mail', $mail ); + $gBitSmarty->assign( 'real_name', $_SESSION['real_name'] ); + $gBitSmarty->assign( 'login', $_SESSION['login'] ); + $gBitSmarty->assign( 'password', $_SESSION['password'] ); + $gBitSmarty->assign( 'pass_confirm', $_SESSION['password'] ); + $gBitSmarty->assign( 'email', $_SESSION['email'] ); + $gBitSmarty->assign( 'errors', $errors ); +} else { + $gBitSmarty->assign( 'user', ''); + $gBitSmarty->assign( 'email', 'admin@localhost'); +} +?> diff --git a/includes/install_inc.php b/includes/install_inc.php new file mode 100644 index 0000000..12706c3 --- /dev/null +++ b/includes/install_inc.php @@ -0,0 +1,182 @@ +<?php +/** + * @version $Header$ + * @package install + * @subpackage functions + */ + +// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. +// All Rights Reserved. See below for details and a complete list of authors. +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. + +/** + * set_menu function + */ +function set_menu( $pInstallFiles, $pStep ) { + global $gBitSmarty, $gBitUser, $gBitDbType, $done, $failedcommands, $app; + + // here we set up the menu + for( $done = 0; $done < $pStep; $done++ ) { + $pInstallFiles[$done]['state'] = 'complete'; + $pInstallFiles[$done]['icon'] = 'icon-ok'; + } + + // if the page is done, we can display the menu item as done and increase the progress bar + if( $failedcommands || !empty( $error ) ) { + $pInstallFiles[$pStep]['state'] = 'error'; + $pInstallFiles[$pStep]['icon'] = 'dialog-error'; + } elseif( !empty( $warning ) ) { + $pInstallFiles[$pStep]['state'] = 'warning'; + $pInstallFiles[$pStep]['icon'] = 'dialog-warning'; + } elseif( $app == "_done" ) { + $pInstallFiles[$pStep]['state'] = 'complete'; + $pInstallFiles[$pStep]['icon'] = 'icon-ok'; + $done++; + } else { + $pInstallFiles[$pStep]['state'] = 'current'; + $pInstallFiles[$pStep]['icon'] = 'media-playback-start'; + } + + foreach( $pInstallFiles as $key => $menu_step ) { + if( !isset( $menu_step['state'] ) ) { + if( !empty( $gBitDbType ) && $gBitUser->isAdmin() && !$_SESSION['first_install'] ) { + $pInstallFiles[$key]['state'] = 'complete'; + $pInstallFiles[$key]['icon'] = 'icon-ok'; + } else { + $pInstallFiles[$key]['state'] = 'uncompleted'; + $pInstallFiles[$key]['icon'] = 'spacer'; + } + } + } + + // assign all this work to the template + $gBitSmarty->assign( 'step', $pStep ); + $gBitSmarty->assign( 'menu_steps', $pInstallFiles ); + $gBitSmarty->assign( 'progress', ( ceil( 100 / ( count( $pInstallFiles ) ) * $done ) ) ); + + return $pInstallFiles; +} + +/** + * Global flag to indicate we are installing + */ +define( 'BIT_INSTALL', 'TRUE' ); +// Uncomment to switch to role team model ... +//define( 'ROLE_MODEL', 'TRUE' ); +global $gBitSmarty; + +// use relative path if no CONFIG_INC path specified - we know we are in installer here... +$config_file = empty($_SERVER['CONFIG_INC']) ? '../config/kernel/config_inc.php' : $_SERVER['CONFIG_INC']; +// We can't call clean_file_path here even though we would like to. +$config_file = (strpos($_SERVER["SERVER_SOFTWARE"],"IIS") ? str_replace( "/", "\\", $config_file) : $config_file); + +// DO THIS FIRST! Before we include any kernel stuff to avoid duplicate defines +if( isset( $_REQUEST['submit_db_info'] ) ) { + if ( $_REQUEST['db'] == "firebird" && empty( $gBitDbName ) ) { + { + // Should only be called when creating the datatabse + require_once("create_firebird_database.php"); + FirebirdCreateDB($_REQUEST['host'], $_REQUEST['user'], $_REQUEST['pass'], $_REQUEST['name'], $_REQUEST['fbpath']); + } + } + if ( empty( $gBitDbType ) ) { + $tmpHost = $_REQUEST['host']; + require_once( 'create_config_inc.php' ); + $createHash = array( + "gBitDbType" => $_REQUEST['db'], + "gBitDbHost" => $tmpHost, + "gBitDbUser" => $_REQUEST['user'], + "gBitDbPassword" => $_REQUEST['pass'], + "gBitDbName" => $_REQUEST['name'], + "gBitDbCaseSensitivity" => $_REQUEST['dbcase'], + "bit_db_prefix" => $_REQUEST['prefix'], + "bit_root_url" => $_REQUEST['baseurl'], + "auto_bug_submit" => !empty( $_REQUEST['auto_bug_submit'] ) ? 'TRUE' : 'FALSE', + "is_live" => !empty( $_REQUEST['is_live'] ) ? 'TRUE' : 'FALSE', + ); + create_config( $createHash ); + include( $config_file ); + } +} +require_once( '../kernel/includes/setup_inc.php' ); +require_once( INSTALL_PKG_CLASS_PATH.'BitInstaller.php' ); + +if ( defined( 'ROLE_MODEL' ) ) { + require_once( USERS_PKG_CLASS_PATH.'RoleUser.php' ); +} else { + require_once( USERS_PKG_CLASS_PATH.'BitUser.php' ); +} + +// set some preferences during installation +global $gBitInstaller, $gBitSystem, $gBitThemes; +$gBitInstaller = new BitInstaller(); + +// IF DB has not been created yet, then packages will not have been scanned yet. +// and even if they have been scanned, then they will only include active packages, +// not all packages. So we scan again here including all packages. +$gBitSystem->scanPackages( 'bit_setup_inc.php', TRUE, 'all', TRUE, TRUE ); + +$gBitInstaller->mPackages = $gBitSystem->mPackages; + +// we need this massive array available during install to work out if bitweaver has already been installed +// this array is so massive that it will kill system with too little memory allocated to php +$dbTables = $gBitInstaller->verifyInstalledPackages( 'all' ); + +// set prefs to display help during install +$gBitSystem->setConfig( 'site_online_help', 'y' ); +$gBitSystem->setConfig( 'site_form_help', 'y' ); +$gBitSystem->setConfig( 'site_help_popup', 'n' ); + +$commands = array(); +global $failedcommands; +$failedcommands = array(); +global $gBitLanguage; +$gBitLanguage->mLanguage = 'en'; + +// Empty SCRIPT_NAME and incorrect SCRIPT_NAME due to php-cgiwrap - wolff_borg +if( empty( $_SERVER['SCRIPT_NAME'] )) { + $_SERVER['SCRIPT_NAME'] = $_SERVER['SCRIPT_URL']; +} + +if( empty( $_REQUEST['baseurl'] )) { + $bit_root_url = substr( $_SERVER['SCRIPT_NAME'], 0, strpos( $_SERVER['SCRIPT_NAME'], 'install/' )); +} else { + $bit_root_url = BIT_ROOT_URL; +} + +global $gBitUser; + +if( !empty( $_POST['signin'] ) ) { + $gBitInstaller->login( $_REQUEST['user'], $_REQUEST['pass'] ); +} elseif( !empty( $_COOKIE[$gBitUser->getSiteCookieName()] ) && ( $gBitUser->mUserId = $gBitUser->getUserIdFromCookieHash( $_COOKIE[$gBitUser->getSiteCookieName()] ))) { + $userInfo = $gBitUser->getUserInfo( array( 'user_id' => $gBitUser->mUserId ) ); + + if( $userInfo['user_id'] != ANONYMOUS_USER_ID ) { + // User is valid and not due to change pass.. + $gBitUser->mInfo = $userInfo; + $gBitUser->loadPermissions( TRUE ); + } +} + +// if we came from anywhere appart from some installer page, nuke all settings in the _SESSION and set first_install FALSE +if( + ( !isset( $_SESSION['first_install'] ) + || $_SESSION['first_install'] != TRUE ) + || ( isset( $_SESSION['upgrade'] ) && $_SESSION['upgrade'] != TRUE ) + || !isset( $_SERVER['HTTP_REFERER'] ) + || isset( $_SERVER['HTTP_REFERER'] ) && ( + ( !strpos( $_SERVER['HTTP_REFERER'],'install/install.php' )) + && ( !strpos( $_SERVER['HTTP_REFERER'],'install/upgrade.php' )) + && ( !strpos( $_SERVER['HTTP_REFERER'],'install/migrate.php' )) + ) +) { + if( !$gBitUser->isAdmin() ) { + $_SESSION = NULL; + } + unset( $_SESSION['upgrade'] ); + $_SESSION['first_install'] = FALSE; +} + +// this is needed because some pages display some additional information during a first install +$gBitSmarty->assign( 'first_install', $_SESSION['first_install'] ); +?> |
