------------------------------------------------------------
revno: 1074
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Sun 2012-02-05 00:36:18 +0100
message:
config class adapted to work with upgrader
modified:
libs/config.php
--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk
Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'libs/config.php'
--- libs/config.php 2012-02-04 22:50:56 +0000
+++ libs/config.php 2012-02-04 23:36:18 +0000
@@ -197,23 +197,33 @@
}
//else, obtain list of values for for setting.
- $values = $db->get_results (
+ $sql=
"SELECT config_value, config_selector" .
" FROM aiki_configs" .
" WHERE config_name='" . addslashes($setting) . "'" .
- " ORDER BY config_important DESC,config_weight DESC");
-
+ " ORDER BY config_important DESC,config_weight DESC";
+
+ // if any value is valid only seek first.
+ // note: apps that don't have site/view/language use this way.
+ if ( $selector=="*" || $selector=="*/*/*" ){
+ $value = $db->get_var($sql);
+ if ( is_null($value) ) {
+ return $default;
+ }
+ $ret= unserialize($value);
+ $config[$setting]= $ret;
+ return $ret;
+ }
+
+ // firt obtain all values
+ $values = $db->get_results($sql);
list($site,$view,$language)= $this->selector($selector);
// and filter the first that match selector
if (is_array($values)) {
foreach ($values as $value) {
if ($aiki->match_pair($value->config_selector, $site, $view, $language)) {
- if ( preg_match ('/^(N;)|([asidbO]:)/', $value->config_value) ) {
- $ret= unserialize($value->config_value);
- } else {
- $ret= $value->config_value;
- }
+ $ret= unserialize($value->config_value);
$config[$setting]= $ret;
return $ret;
}
_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help : https://help.launchpad.net/ListHelp