Commit 463fc2b8 authored by Alan Garcia's avatar Alan Garcia
Browse files

Variables deviennent magiques

parent 9b240ebd
......@@ -133,6 +133,18 @@ foreach( $variables->variables_list_name() as $varname => $varcomment) { ?>
<br/>
<?php } // if $member_id && $fqdn_id ?>
<hr/>
<h3><?php __("Magical values");?></h3>
<?php __("Those var are automatically replaced by the value indicated"); ?>
<ul>
<?php
foreach ($variables->replace_array as $vrepk => $vrepvalue) {
echo "<li><code>$vrepk</code> => $vrepvalue</li>";
}
?>
</ul>
<script type="text/javascript">
$(document).ready(function()
......
......@@ -36,6 +36,14 @@
class m_variables {
var $strata_order = array('DEFAULT','GLOBAL','FQDN_CREATOR','FQDN','CREATOR','MEMBER','DOMAIN');
var $cache_variable_list = false;
var $replace_array = array();
function m_variables() {
global $L_FQDN;
$this->replace_array = array(
"%%FQDN%%"=> $L_FQDN,
);
}
// used by get_impersonated to merge array. Son value overwrite father's value
private function variable_merge($father, $son) {
......@@ -135,6 +143,14 @@ class m_variables {
} //foreach
// Replace needed vars
foreach ($variables as $vv => $hh) {
if (!isset($hh['value'])) {
continue;
}
$variables[$vv]['value'] = strtr($hh['value'], $this->replace_array );
}
if ($var && isset($variables[$var])) {
return $variables[$var];
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment