--- mambo/branches/4.6/includes/core.classes.php 2008/02/28 03:14:33 1627
+++ mambo/branches/4.6/includes/core.classes.php 2008/05/14 11:32:45 1699
@@ -336,20 +336,18 @@
fclose($f);
eval($code);
-
- /*if (isset($_SERVER['DOCUMENT_ROOT']) AND strlen($_SERVER['DOCUMENT_ROOT'])) {
- $docroot = str_replace('\\', '/', str_replace('\\\\', '\\', $_SERVER['DOCUMENT_ROOT']));
+ $origin = array_pop(debug_backtrace());
+ // Find the PHP script at the start, with a fix for Windows slashes
+ $absolutepath = str_replace('\\', '/', $origin['file']);
+ $localpath = $_SERVER['PHP_SELF'];
+ $userdir= '';
+ if (strpos($localpath,'~') !== false){
+ $userdir = substr($localpath, 0, strpos(substr($localpath,1),'/')+1);
+ $localpath = substr($localpath,strpos(substr($localpath,1),'/')+1);
}
- else {*/
- // Find information about where execution started
- $origin = array_pop(debug_backtrace());
- // Find the PHP script at the start, with a fix for Windows slashes
- $absolutepath = str_replace('\\', '/', $origin['file']);
- $localpath = $_SERVER['PHP_SELF'];
- $docroot = substr($absolutepath,0,strpos($absolutepath,$localpath));
- /*}*/
+ $docroot = substr($absolutepath,0,strpos($absolutepath,$localpath));
$mamboroot = str_replace('\\', '/', rtrim($this->rootPath, '\/'));
- $this->subdirectory = substr($mamboroot, strlen($docroot));
+ $this->subdirectory = $userdir . substr($mamboroot, strlen($docroot));
$scheme = isset($_SERVER['HTTP_SCHEME']) ? $_SERVER['HTTP_SCHEME'] : ((isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS'] != 'off')) ? 'https' : 'http');
if (isset($_SERVER['HTTP_HOST'])) {
@@ -1458,6 +1456,49 @@
return null;
}
+ function getSectionItemId($sectionid, $gbs = 1){
+ static $__sectionsItemds;
+
+ if (isset($__sectionsItemids[$sectionid])) return $__sectionsItemids[$sectionid];
+
+ $_Itemid = null;
+ if ($_Itemid == null ) {
+ // Search in sections
+ $_Itemid = $this->getIDByTypeCid ('content_section', $sectionid);
+ }
+ if ($_Itemid == null ) {
+ // Search in sections
+ $_Itemid = $this->getIDByTypeCid ('content_blog_section', $sectionid);
+ }
+
+ if ($_Itemid == null && $gbs) {
+ // Search in global blog section
+ $_Itemid = $this->getIDByTypeCid('content_blog_section', 0);
+ }
+ if ($_Itemid != null) $__sectionsItemids[$sectionid] = $_Itemid;
+ return $_Itemid;
+ }
+
+ function getCategoryItemId($catid){
+ static $__categoriesItemids;
+
+ if (isset($__categoriesItemids[$catid])) return $__categoriesItemids[$catid];
+
+ $_Itemid = null;
+ if ($_Itemid == null) {
+ // Search in blog categories
+ $_Itemid = $this->getIDByTypeCid ('content_blog_category', $catid);
+ }
+ if ($_Itemid == null) {
+ // Search in categories
+ $_Itemid = $this->getIDByTypeCid ('content_category', $catid);
+ }
+
+ if ($_Itemid != null) $__categoriesItemids[$catid] = $_Itemid;
+
+ return $_Itemid;
+ }
+
/**
* Enter description here...
*
@@ -2676,7 +2717,8 @@
$head['favicon'] = "getFavIcon()."\" />";
if (mamboCore::get('mosConfig_sef')) {
- $head['base'] = "";
+ $baseHref = sefRelToAbs('index.php?'.mosGetParam ($_SERVER,"QUERY_STRING",""));
+ $head['base'] = "";
}
foreach($head as $key=>$value)
@@ -2766,9 +2808,12 @@
/**
* @return object A function cache object
*/
- function &getCache( $group='' ) {
+ function &getCache( $group='', $plugin = 'Function' ) {
+ if (!in_array($plugin,array('Function','Output'))){
+ die('Cache plugin not available');
+ }
$mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path');
- require_once($mosConfig_absolute_path.'/includes/Cache/Lite/Function.php');
+ require_once($mosConfig_absolute_path.'/includes/Cache/Lite/'.$plugin.'.php');
$path = mamboCore::get('mosConfig_cachepath');
$caching = mamboCore::get('mosConfig_caching');
$time = mamboCore::get('mosConfig_cachetime');
@@ -2778,7 +2823,8 @@
'defaultGroup' => $group,
'lifeTime' => $time
);
- $cache =& new Cache_Lite_Function( $options );
+ $className = 'Cache_Lite_'.$plugin;
+ $cache =& new $className( $options );
return $cache;
}
/**