From: <tr...@us...> - 2012-12-10 13:44:19
|
Revision: 10347 http://sourceforge.net/p/xoops/svn/10347 Author: trabis Date: 2012-12-10 13:44:16 +0000 (Mon, 10 Dec 2012) Log Message: ----------- Temp fix for installation Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/common.inc.php XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/functions.php XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/makedata.php XoopsCore/branches/2.6.x/2.6.0/htdocs/mainfile.php XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/Xoops/Cache/File.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/common.inc.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/common.inc.php 2012-12-10 04:48:14 UTC (rev 10346) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/common.inc.php 2012-12-10 13:44:16 UTC (rev 10347) @@ -40,7 +40,7 @@ include_once dirname(dirname(dirname(__FILE__))) . '/mainfile.php'; if (!defined("XOOPS_ROOT_PATH")) { define("XOOPS_ROOT_PATH", str_replace("\\", "/", realpath('../'))); - define("XOOPS_PATH", ""); //just to avoid errors in XoopsLoad class + define("XOOPS_PATH", XOOPS_ROOT_PATH . '/xoops_lib'); //just to avoid errors in XoopsLoad class define("XOOPS_VAR_PATH", ""); define("XOOPS_URL", ""); } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/functions.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/functions.php 2012-12-10 04:48:14 UTC (rev 10346) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/functions.php 2012-12-10 13:44:16 UTC (rev 10347) @@ -37,7 +37,8 @@ } $member_handler = $xoops->getHandlerMember(); /* @var $user XoopsUser */ - $user = array_pop($member_handler->getUsers(new Criteria('uname', $uname))); + $users = $member_handler->getUsers(new Criteria('uname', $uname)); + $user = array_pop($users); if ($hash_login != md5($user->getVar('pass') . XOOPS_DB_NAME . XOOPS_DB_PASS . XOOPS_DB_PREFIX)) { return false; } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/makedata.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/makedata.php 2012-12-10 04:48:14 UTC (rev 10346) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/install/include/makedata.php 2012-12-10 13:44:16 UTC (rev 10347) @@ -43,6 +43,7 @@ function make_data(XoopsDatabaseManager $dbm, $adminname, $adminpass, $adminmail, $language, $gruops) { + $root = dirname(dirname(dirname(__FILE__))); // $xoopsDB =& Database::getInstance(); // $dbm = new db_manager; $tables = array(); @@ -76,40 +77,40 @@ $time = time(); $dbm->insert('tplset', " VALUES (1, 'default', 'XOOPS Default Template Set', '', " . $time . ")"); // system modules - if (file_exists('../modules/system/language/' . $language . '/modinfo.php')) { - include '../modules/system/language/' . $language . '/modinfo.php'; + if (file_exists($file = $root .'/modules/system/language/' . $language . '/modinfo.php')) { + include $file; } else { - include '../modules/system/language/english/modinfo.php'; + include $root . '/modules/system/language/english/modinfo.php'; $language = 'english'; } $modversion = array(); - include_once '../modules/system/xoops_version.php'; + include_once $root . '/modules/system/xoops_version.php'; $time = time(); // RMV-NOTIFY (updated for extra column in table) $dbm->insert("modules", " VALUES (1, '" . _MI_SYSTEM_NAME . "', " . ($modversion['version'] * 100) . ", " . $time . ", 0, 1, 'system', 0, 1, 0, 0, 0, 0)"); foreach ($modversion['templates'] as $tplfile) { // Main templates - if ($fp = fopen('../modules/system/templates/' . $tplfile['file'], 'r')) { + if ($fp = fopen($root . '/modules/system/templates/' . $tplfile['file'], 'r')) { $newtplid = $dbm->insert('tplfile', " VALUES (0, 1, 'system', 'default', '" . addslashes($tplfile['file']) . "', '" . addslashes($tplfile['description']) . "', " . $time . ", " . $time . ", 'module')"); // $newtplid = $xoopsDB->getInsertId(); - $tplsource = fread($fp, filesize('../modules/system/templates/' . $tplfile['file'])); + $tplsource = fread($fp, filesize($root . '/modules/system/templates/' . $tplfile['file'])); fclose($fp); $dbm->insert('tplsource', " (tpl_id, tpl_source) VALUES (" . $newtplid . ", '" . addslashes($tplsource) . "')"); } // Admin templates - if ($fp = fopen('../modules/system/templates/admin/' . $tplfile['file'], 'r')) { + if ($fp = fopen($root . '/modules/system/templates/admin/' . $tplfile['file'], 'r')) { $newtplid = $dbm->insert('tplfile', " VALUES (0, 1, 'system', 'default', '" . addslashes($tplfile['file']) . "', '" . addslashes($tplfile['description']) . "', " . $time . ", " . $time . ", 'admin')"); // $newtplid = $xoopsDB->getInsertId(); - $tplsource = fread($fp, filesize('../modules/system/templates/admin/' . $tplfile['file'])); + $tplsource = fread($fp, filesize($root . '/modules/system/templates/admin/' . $tplfile['file'])); fclose($fp); $dbm->insert('tplsource', " (tpl_id, tpl_source) VALUES (" . $newtplid . ", '" . addslashes($tplsource) . "')"); } } foreach ($modversion['blocks'] as $func_num => $newblock) { - if ($fp = fopen('../modules/system/templates/blocks/' . $newblock['template'], 'r')) { + if ($fp = fopen($root . '/modules/system/templates/blocks/' . $newblock['template'], 'r')) { if (in_array($newblock['template'], array('system_block_user.html', 'system_block_login.html', 'system_block_mainmenu.html'))) { $visible = 1; } else { @@ -121,7 +122,7 @@ // $newbid = $xoopsDB->getInsertId(); $newtplid = $dbm->insert('tplfile', " VALUES (0, " . $newbid . ", 'system', 'default', '" . addslashes($newblock['template']) . "', '" . addslashes($newblock['description']) . "', " . $time . ", " . $time . ", 'block')"); // $newtplid = $xoopsDB->getInsertId(); - $tplsource = fread($fp, filesize('../modules/system/templates/blocks/' . $newblock['template'])); + $tplsource = fread($fp, filesize($root . '/modules/system/templates/blocks/' . $newblock['template'])); fclose($fp); $dbm->insert('tplsource', " (tpl_id, tpl_source) VALUES (" . $newtplid . ", '" . addslashes($tplsource) . "')"); $dbm->insert("group_permission", " VALUES (0, " . $gruops['XOOPS_GROUP_ADMIN'] . ", " . $newbid . ", 1, 'block_read')"); @@ -280,8 +281,8 @@ $dbm->insert('config', " VALUES (134, 0, 1, 'redirect_message_ajax', '_MD_AM_CUSTOM_REDIRECT', '1', '_MD_AM_CUSTOM_REDIRECT_DESC', 'yesno', 'int', 12)"); - require_once '../class/xoopslists.php'; - $editors = XoopsLists::getDirListAsArray( '../class/xoopseditor' ); + require_once $root . '/class/xoopslists.php'; + $editors = XoopsLists::getDirListAsArray( $root . '/class/xoopseditor' ); $conf=35; foreach ( $editors as $dir ) { $dbm->insert('configoption', " VALUES (".$conf.", '".$dir."', '".$dir."', 126)"); @@ -295,17 +296,17 @@ $dbm->insert('configoption', " VALUES (".$conf.", '".$dir."', '".$dir."', 128)"); $conf++; } - $icons = XoopsLists::getDirListAsArray('../modules/system/images/icons'); + $icons = XoopsLists::getDirListAsArray($root . '/modules/system/images/icons'); foreach ( $icons as $dir ) { $dbm->insert('configoption', " VALUES (".$conf.", '".$dir."', '".$dir."', 98)"); $conf++; } - $breadcrumb = XoopsLists::getDirListAsArray('../modules/system/images/breadcrumb'); + $breadcrumb = XoopsLists::getDirListAsArray($root . '/modules/system/images/breadcrumb'); foreach ( $breadcrumb as $dir ) { $dbm->insert('configoption', " VALUES (".$conf.", '".$dir."', '".$dir."', 99)"); $conf++; } - $jqueryui = XoopsLists::getDirListAsArray('../modules/system/css/ui'); + $jqueryui = XoopsLists::getDirListAsArray($root . '/modules/system/css/ui'); foreach ( $jqueryui as $dir ) { $dbm->insert('configoption', " VALUES (".$conf.", '".$dir."', '".$dir."', 133)"); $conf++; Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/mainfile.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/mainfile.php 2012-12-10 04:48:14 UTC (rev 10346) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/mainfile.php 2012-12-10 13:44:16 UTC (rev 10347) @@ -17,6 +17,65 @@ * @version $Id$ */ -if (! defined('XOOPS_INSTALL')) { - header('Location: install/index.php'); +if (!defined("XOOPS_MAINFILE_INCLUDED")) { + define("XOOPS_MAINFILE_INCLUDED", 1); + + // XOOPS Physical Paths + + // Physical path to the XOOPS documents (served) directory WITHOUT trailing slash + define('XOOPS_ROOT_PATH', 'C:/wamp/www/xoops_2.6.0_new/htdocs'); + + // For forward compatibility + // Physical path to the XOOPS library directory WITHOUT trailing slash + define('XOOPS_PATH', 'C:/wamp/www/xoops_2.6.0_new/htdocs/xoops_lib'); + // Physical path to the XOOPS datafiles (writable) directory WITHOUT trailing slash + define('XOOPS_VAR_PATH', 'C:/wamp/www/xoops_2.6.0_new/htdocs/xoops_data'); + // Alias of XOOPS_PATH, for compatibility, temporary solution + define("XOOPS_TRUST_PATH", XOOPS_PATH); + + // URL Association for SSL and Protocol Compatibility + $http = 'http://'; + if (!empty($_SERVER['HTTPS'])) { + $http = ($_SERVER['HTTPS']=='on') ? 'https://' : 'http://'; + } + define('XOOPS_PROT', $http); + + // XOOPS Virtual Path (URL) + // Virtual path to your main XOOPS directory WITHOUT trailing slash + // Example: define('XOOPS_URL', 'http://localhost/xoops_2.6.0_new/htdocs'); + define('XOOPS_URL', 'http://localhost/xoops_2.6.0_new/htdocs'); + + // Shall be handled later, don't forget! + define("XOOPS_CHECK_PATH", 0); + // Protect against external scripts execution if safe mode is not enabled + if (XOOPS_CHECK_PATH && !@ini_get("safe_mode")) { + if (function_exists("debug_backtrace")) { + $xoopsScriptPath = debug_backtrace(); + if (!count($xoopsScriptPath)) { + die("XOOPS path check: this file cannot be requested directly"); + } + $xoopsScriptPath = $xoopsScriptPath[0]["file"]; + } else { + $xoopsScriptPath = isset($_SERVER["PATH_TRANSLATED"]) ? $_SERVER["PATH_TRANSLATED"] : $_SERVER["SCRIPT_FILENAME"]; + } + if (DIRECTORY_SEPARATOR != "/") { + // IIS6 may double the \ chars + $xoopsScriptPath = str_replace(strpos($xoopsScriptPath, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, "/", $xoopsScriptPath); + } + if (strcasecmp(substr($xoopsScriptPath, 0, strlen(XOOPS_ROOT_PATH)), str_replace(DIRECTORY_SEPARATOR, "/", XOOPS_ROOT_PATH))) { + exit("XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run."); + } + } + + // Secure file + require XOOPS_VAR_PATH . '/data/secure.php'; + + define('XOOPS_GROUP_ADMIN', '1'); + define('XOOPS_GROUP_USERS', '2'); + define('XOOPS_GROUP_ANONYMOUS', '3'); + + if (!isset($xoopsOption["nocommon"]) && XOOPS_ROOT_PATH != "") { + include XOOPS_ROOT_PATH."/include/common.php"; + } + } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/Xoops/Cache/File.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/Xoops/Cache/File.php 2012-12-10 04:48:14 UTC (rev 10346) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/Xoops/Cache/File.php 2012-12-10 13:44:16 UTC (rev 10347) @@ -94,14 +94,14 @@ ); parent::init($settings); - if (DS === '\\') { + if (DIRECTORY_SEPARATOR === '\\') { $this->settings['isWindows'] = true; } - if (substr($this->settings['path'], -1) !== DS) { - $this->settings['path'] .= DS; + if (substr($this->settings['path'], -1) !== DIRECTORY_SEPARATOR) { + $this->settings['path'] .= DIRECTORY_SEPARATOR; } if (!empty($this->_groupPrefix)) { - $this->_groupPrefix = str_replace('_', DS, $this->_groupPrefix); + $this->_groupPrefix = str_replace('_', DIRECTORY_SEPARATOR, $this->_groupPrefix); } return $this->_active(); } @@ -408,7 +408,7 @@ $directoryIterator = new RecursiveDirectoryIterator($this->settings['path']); $contents = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::CHILD_FIRST); foreach ($contents as $object) { - $containsGroup = strpos($object->getPathName(), DS . $group . DS) !== false; + $containsGroup = strpos($object->getPathName(), DIRECTORY_SEPARATOR . $group . DIRECTORY_SEPARATOR) !== false; if ($object->isFile() && $containsGroup) { unlink($object->getPathName()); } |