~ubuntu-branches/ubuntu/utopic/phpldapadmin/utopic

« back to all changes in this revision

Viewing changes to lib/xmlTemplates.php

  • Committer: Package Import Robot
  • Author(s): Andrew Mitchell
  • Date: 2012-02-28 00:09:09 UTC
  • mfrom: (1.1.10) (3.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20120228000909-p7bjlnxihxajde58
Tags: 1.2.2-2ubuntu1
* Merge from Debian testing.  Remaining changes:
  - Merged call to dh_install to install debian/additional-templates/*
  - added groupOfNames.xml
  - Adds php_value memory_limit 32M to the apache.conf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
                                                'type'=>'info','special'=>true));
58
58
 
59
59
                                        $changed = true;
60
 
                                        eval(sprintf('$this->templates[$index] = new %s($this->server_id,$template->getName(false),$template->getFileName(),$template->getType(),$index);',$class['name']));
 
60
                                        $this->templates[$index] = new $class['name']($this->server_id,$template->getName(false),$template->getFileName(),$template->getType(),$index);
61
61
                                }
62
62
                        }
63
63
 
87
87
                                        if (! in_array($filename,$this->getTemplateFiles())) {
88
88
                                                $templatename = preg_replace('/.xml$/','',$file);
89
89
        
90
 
                                                eval(sprintf('$this->templates[$index] = new %s($this->server_id,$templatename,$filename,$type,$index);',$class['name']));
 
90
                                                $this->templates[$index] = new $class['name']($this->server_id,$templatename,$filename,$type,$index);
91
91
                                                $index++;
92
92
 
93
93
                                                $changed = true;
129
129
 
130
130
                                        # Store the template
131
131
                                        $templatename = preg_replace('/.xml$/','',$file);
132
 
                                        eval(sprintf('$this->templates[$counter] = new %s($this->server_id,$templatename,$filename,$type,$counter);',$class['name']));
 
132
                                        $this->templates[$counter] = new $class['name']($this->server_id,$templatename,$filename,$type,$counter);
133
133
                                        $counter++;
134
134
                                }
135
135
                        }
198
198
 
199
199
                                # Clone this, as we'll disable some templates, as a result of the container being requested.
200
200
                                $template = clone $details;
201
 
                                if (! is_null($container) && ($regexp = $template->getRegExp()) && (! @preg_match('/'.$regexp.'/i',$container)))
 
201
                                if (! is_null($container) && ($regexp = $template->getRegExp()) && (! @preg_match('/'.$regexp.'/i',$container))) {
202
202
                                        $template->setInvalid(_('This template is not valid in this container'),true);
203
203
 
 
204
                                        if ($_SESSION[APPCONFIG]->getValue('appearance','hide_template_regexp'))
 
205
                                                $template->setInvisible();
 
206
                                }
 
207
 
204
208
                                if ($template->isVisible() && (! $disabled || ! $template->isAdminDisabled()))
205
209
                                        if (is_null($type) || (! is_null($type) && $template->isType($type)))
206
210
                                                array_push($result,$template);
226
230
                                return clone $template;
227
231
 
228
232
                # If we get here, the template ID didnt exist, so return a blank template, which be interpreted as the default template
229
 
                eval(sprintf('$object = new %s($this->server_id,null,null,"default");',$class['name']));
 
233
                $object = new $class['name']($this->server_id,null,null,'default');
230
234
                return $object;
231
235
        }
232
236
 
433
437
                # Initialise the Attribute Factory.
434
438
                $attribute_factory = new AttributeFactory();
435
439
 
 
440
                if (preg_match('/;/',$name))
 
441
                        system_message(array(
 
442
                                'title'=>'phpLDAPadmin doesnt support RFC3866.',
 
443
                                'body'=>sprintf('%s {%s} (%s)','PLA might not do what you expect...',$name,(is_array($value) ? serialize($value) : $value)),
 
444
                                'type'=>'warn'));
 
445
 
436
446
                # If there isnt a schema item for this attribute
437
447
                $attribute = $attribute_factory->newAttribute($name,$value,$server->getIndex(),$source);
438
448
 
440
450
 
441
451
                if (is_null($attrid))
442
452
                        array_push($this->attributes,$attribute);
443
 
                else
444
 
                        debug_dump_backtrace(sprintf('There was a request to add an attribute (%s), but it was already defined? (%s)',$attrid,__METHOD__),true);
445
 
 
446
 
                if ($this->getID() == 'none')
447
 
                        usort($this->attributes,'sortAttrs');
448
453
 
449
454
                return $attribute;
450
455
        }