3
* Copyright (c) 2008 Zivios, LLC.
5
* This file is part of Zivios.
7
* Zivios is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* Zivios is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with Zivios. If not, see <http://www.gnu.org/licenses/>.
21
* @copyright Copyright (c) 2008 Zivios, LLC. (http://www.zivios.org)
22
* @license http://www.zivios.org/legal/license
23
* @version $Id: SchemaAttribute.php 908 2008-08-25 11:03:00Z fkhan $
27
class Ecl_Ldap_SchemaAttribute
29
private $origline,$emsolcschema;
30
public $prio,$name,$desc,$sup,$syntax,$equality,$substr,$singlevalue,$oidfamily,$oidvalue;
32
public function __construct($emsolcschema,$attribline='')
34
$this->origline = $attribline;
35
$this->emsolcschema = $emsolcschema;
36
Ecl_Log::debug("Schema Parser started with $attribline");
37
if ($attribline != '') {
42
public function setOid($family,$value=null)
45
$this->oidvalue = $this->emsolcschema->getMaxOidAttrib($family);
47
$this->oidvalue = $value;
50
$this->oidfamily = $family;
52
private function parseOid($oid)
54
$reversed = strrev($oid);
55
$oidtokenized = explode('.',$reversed,2);
56
$this->oidvalue=strrev($oidtokenized[0]);
57
$this->oidfamily=strrev($oidtokenized[1]);
59
private function parse()
61
$line = $this->origline;
63
preg_match_all("/^\{(\d+?)\}/",$line,$matches);
64
$this->prio = $matches[1][0];
65
preg_match_all("/\( ([\d\.]+?) /",$line,$matches);
66
$this->parseOid($matches[1][0]);
67
$this->name = Ecl_Util::magicParseValue($line,'NAME');
68
$this->desc = Ecl_Util::magicParseValue($line,'DESC');
69
$this->sup = Ecl_Util::magicParseValue($line,'SUP');
70
$this->syntax = Ecl_Util::magicParseValue($line,'SYNTAX');
71
$this->equality = Ecl_Util::magicParseValue($line,'EQUALITY');
72
$this->substr = Ecl_Util::magicParseValue($line,'SUBSTR');
73
$this->singlevalue = preg_match("/ SINGLE-VALUE /",$line);
74
Ecl_Log::debug("Read in Schema entry with prio: $this->prio OID: $this->oidfamily $this->oidvalue Name: $this->name \
75
Desc: $this->desc sup: $this->sup SYNTAX: $this->syntax EQUALITY: $this->equality \
76
substr: $this->substr Singlevalue=$this->singlevalue");
80
public function isValid()
82
// Stub function. Add validation here
85
public function render()
90
$oid = $this->oidfamily.'.'.$this->oidvalue;
91
Ecl_Log::debug("helo : $this->prio");
92
$str = '{'.$this->prio.'}';
93
Ecl_Log::debug("STR IS $str");
94
Ecl_Log::debug("hello");
95
if ($this->sup != '') {
97
$str .= "( $oid NAME '$this->name' DESC '$this->desc' SUP $this->sup )";
101
//$str = "SYNTAX $this->syntax";
102
$str .= '( '.$oid.' NAME \''.$this->name.'\' DESC \''.$this->desc.'\' EQUALITY '.$this->equality.' SUBSTR '.$this->substr.' SYNTAX '.$this->syntax;
103
if ($this->singlevalue) {
104
$str .= " SINGLE-VALUE ";
b'\\ No newline at end of file'