fixed FS#184 - property cache now returns correct values
Dieser Commit ist enthalten in:
Ursprung
2aa2c3c090
Commit
fb1cf905c9
2 geänderte Dateien mit 45 neuen und 19 gelöschten Zeilen
|
@ -167,8 +167,8 @@ class PropertyCollection extends ItemCollection
|
||||||
$type = Contenido_Security::escapeDB($type, null);
|
$type = Contenido_Security::escapeDB($type, null);
|
||||||
$name = Contenido_Security::escapeDB($name, null);
|
$name = Contenido_Security::escapeDB($name, null);
|
||||||
|
|
||||||
if($mValue = cPropertyCache::getProp($itemtype, $itemid, $type, $name) !== FALSE) {
|
if($mValue = cPropertyCache::getProp($itemtype, $itemid, $type, $name)) {
|
||||||
return $mValue;
|
return (string) $mValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->client)) {
|
if (isset($this->client)) {
|
||||||
|
@ -182,7 +182,7 @@ class PropertyCollection extends ItemCollection
|
||||||
return (Contenido_Security::unescapeDB($item->get('value')));
|
return (Contenido_Security::unescapeDB($item->get('value')));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $default;
|
//return $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -473,29 +473,56 @@ class PropertyItem extends Item
|
||||||
|
|
||||||
class cPropertyCache {
|
class cPropertyCache {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property cache array
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
public static $_aEntries;
|
public static $_aEntries;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add item to cache
|
||||||
|
*
|
||||||
|
* @param object $oEntry
|
||||||
|
*/
|
||||||
public static function addProp($oEntry) {
|
public static function addProp($oEntry) {
|
||||||
|
if(!is_array(self::$_aEntries)) {
|
||||||
|
self::$_aEntries = array();
|
||||||
|
}
|
||||||
$aData = $oEntry->toArray();
|
$aData = $oEntry->toArray();
|
||||||
|
|
||||||
self::$_aEntries[$aData['idproperty']] = $aData;
|
self::$_aEntries[$aData['idproperty']] = $aData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete item from cache
|
||||||
|
*
|
||||||
|
* @param int $iId id of prperty
|
||||||
|
*/
|
||||||
public static function deleteProp($iId) {
|
public static function deleteProp($iId) {
|
||||||
if(isset(self::$_aEntries[$iId]) && is_array(self::$_aEntries[$iId])) {
|
if(isset(self::$_aEntries[$iId]) && is_array(self::$_aEntries[$iId])) {
|
||||||
unset(self::$_aEntries[$iId]);
|
unset(self::$_aEntries[$iId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get property from cache
|
||||||
|
*
|
||||||
|
* @param string $itemtype
|
||||||
|
* @param int $itemid
|
||||||
|
* @param string $type
|
||||||
|
* @param string $name
|
||||||
|
* @return string|boolean string of entry or false
|
||||||
|
*/
|
||||||
public static function getProp($itemtype, $itemid, $type, $name) {
|
public static function getProp($itemtype, $itemid, $type, $name) {
|
||||||
if(!is_array(self::$_aEntries)) {
|
if(!is_array(self::$_aEntries) || empty(self::$_aEntries)) {
|
||||||
self::$_aEntries = array();
|
return false;
|
||||||
}
|
}
|
||||||
foreach (self::$_aEntries as $id => $entry) {
|
foreach (self::$_aEntries as $id => $entry) {
|
||||||
if ($entry['itemtype'] == $itemtype && $entry['itemid'] == $itemid && $entry['type'] == $type && $entry['name'] == $name) {
|
if ($entry['itemtype'] == $itemtype && $entry['itemid'] == $itemid && $entry['type'] == $type && $entry['name'] == $name) {
|
||||||
return Contenido_Security::unescapeDB($entry['value']);
|
return (string) $entry['value'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -136,15 +136,15 @@ if (!$perm->have_perm_area_action($area)) {
|
||||||
$notification->displayNotification("warning", i18n("You changed the client path. You might need to copy the frontend to the new location"));
|
$notification->displayNotification("warning", i18n("You changed the client path. You might need to copy the frontend to the new location"));
|
||||||
}
|
}
|
||||||
$sql = "UPDATE
|
$sql = "UPDATE
|
||||||
" . $cfg["tab"]["clients"] . "
|
" . $cfg["tab"]["clients"] . "
|
||||||
SET
|
SET
|
||||||
name = '" . Contenido_Security::escapeDB($clientname, $db) . "',
|
name = '" . Contenido_Security::escapeDB($clientname, $db) . "',
|
||||||
frontendpath = '" . Contenido_Security::escapeDB($frontendpath, $db) . "',
|
frontendpath = '" . Contenido_Security::escapeDB($frontendpath, $db) . "',
|
||||||
htmlpath = '" . Contenido_Security::escapeDB($htmlpath, $db) . "',
|
htmlpath = '" . Contenido_Security::escapeDB($htmlpath, $db) . "',
|
||||||
errsite_cat = '" . Contenido_Security::toInteger($errsite_cat) . "',
|
errsite_cat = '" . Contenido_Security::toInteger($errsite_cat) . "',
|
||||||
errsite_art = '" . Contenido_Security::toInteger($errsite_art) . "'
|
errsite_art = '" . Contenido_Security::toInteger($errsite_art) . "'
|
||||||
WHERE
|
WHERE
|
||||||
idclient = '" . Contenido_Security::toInteger($idclient) . "'";
|
idclient = '" . Contenido_Security::toInteger($idclient) . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
|
@ -304,10 +304,9 @@ if (!$perm->have_perm_area_action($area)) {
|
||||||
|
|
||||||
$cApiClient = new cApiClient;
|
$cApiClient = new cApiClient;
|
||||||
$cApiClient->loadByPrimaryKey($idclient);
|
$cApiClient->loadByPrimaryKey($idclient);
|
||||||
var_dump($cApiClient->getProperty("generator", "xhtml"));
|
if ($cApiClient->getProperty("generator", "xhtml") == 'true') {
|
||||||
if ($cApiClient->getProperty("generator", "xhtml") === TRUE) {
|
|
||||||
$oXHTMLSelect->setDefault("xhtml");
|
$oXHTMLSelect->setDefault("xhtml");
|
||||||
} else if ($cApiClient->getProperty("generator", "html5") === TRUE) {
|
} else if ($cApiClient->getProperty("generator", "html5") == 'true') {
|
||||||
$oXHTMLSelect->setDefault("html5");
|
$oXHTMLSelect->setDefault("html5");
|
||||||
} else {
|
} else {
|
||||||
$oXHTMLSelect->setDefault("html");
|
$oXHTMLSelect->setDefault("html");
|
||||||
|
|
Laden …
In neuem Issue referenzieren