Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / inc / networking.class.php @ b67d8923

Historique | Voir | Annoter | Télécharger (17,8 ko)

1
<?php
2
/*
3
 * @version $Id: networking.class.php 7763 2009-01-06 18:44:50Z moyo $
4
 -------------------------------------------------------------------------
5
 GLPI - Gestionnaire Libre de Parc Informatique
6
 Copyright (C) 2003-2009 by the INDEPNET Development Team.
7

8
 http://indepnet.net/   http://glpi-project.org
9
 -------------------------------------------------------------------------
10

11
 LICENSE
12

13
 This file is part of GLPI.
14

15
 GLPI is free software; you can redistribute it and/or modify
16
 it under the terms of the GNU General Public License as published by
17
 the Free Software Foundation; either version 2 of the License, or
18
 (at your option) any later version.
19

20
 GLPI is distributed in the hope that it will be useful,
21
 but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 GNU General Public License for more details.
24

25
 You should have received a copy of the GNU General Public License
26
 along with GLPI; if not, write to the Free Software
27
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
 --------------------------------------------------------------------------
29
 */
30

    
31
// ----------------------------------------------------------------------
32
// Original Author of file:
33
// Purpose of file:
34
// ----------------------------------------------------------------------
35

    
36
if (!defined('GLPI_ROOT')){
37
        die("Sorry. You can't access directly to this file");
38
        }
39

    
40

    
41
// CLASSES Networking
42

    
43

    
44
class Netdevice extends CommonDBTM {
45

    
46
        /**
47
         * Constructor
48
        **/
49
        function Netdevice () {
50
                $this->table="glpi_networking";
51
                $this->type=NETWORKING_TYPE;
52
                $this->dohistory=true;
53
        }
54

    
55

    
56
        function defineOnglets($withtemplate){
57
                global $LANG;
58

    
59
                $ong[1]=$LANG["title"][26];
60
                if (haveRight("contract_infocom","r")){
61
                        $ong[4]=$LANG["Menu"][26];
62
                }
63
                if (haveRight("document","r")){
64
                        $ong[5]=$LANG["Menu"][27];
65
                }
66

    
67
                if(empty($withtemplate)){
68
                        if (haveRight("show_all_ticket","1")){
69
                                $ong[6]=$LANG["title"][28];
70
                        }
71
                        if (haveRight("link","r")){
72
                                $ong[7]=$LANG["title"][34];
73
                        }
74
                        if (haveRight("notes","r")){
75
                                $ong[10]=$LANG["title"][37];
76
                        }
77
                        if (haveRight("reservation_central","r")){
78
                                $ong[11]=$LANG["Menu"][17];
79
                        }
80
                                
81

    
82
                        $ong[12]=$LANG["title"][38];
83
                }        
84
                return $ong;
85
        }
86

    
87
        function prepareInputForAdd($input) {
88

    
89
                if (isset($input["ID"])&&$input["ID"]>0){
90
                        $input["_oldID"]=$input["ID"];
91
                }
92
                unset($input['ID']);
93
                unset($input['withtemplate']);
94

    
95
                return $input;
96
        }
97

    
98
        function post_addItem($newID,$input) {
99
                global $DB;
100

    
101
                // Manage add from template
102
                if (isset($input["_oldID"])){
103
                        // ADD Infocoms
104
                        $ic= new Infocom();
105
                        if ($ic->getFromDBforDevice(NETWORKING_TYPE,$input["_oldID"])){
106
                                $ic->fields["FK_device"]=$newID;
107
                                unset ($ic->fields["ID"]);
108
                                if (isset($ic->fields["num_immo"])) {
109
                                        $ic->fields["num_immo"] = autoName($ic->fields["num_immo"], "num_immo", 1, INFOCOM_TYPE ,$input['FK_entities']);
110
                                }
111
                                $ic->addToDB();
112
                        }
113
        
114
                        // ADD Ports
115
                        $query="SELECT ID from glpi_networking_ports WHERE on_device='".$input["_oldID"]."' AND device_type='".NETWORKING_TYPE."';";
116
                        $result=$DB->query($query);
117
                        if ($DB->numrows($result)>0){
118
        
119
                                while ($data=$DB->fetch_array($result)){
120
                                        $np= new Netport();
121
                                        $np->getFromDB($data["ID"]);
122
                                        unset($np->fields["ID"]);
123
                                        unset($np->fields["ifaddr"]);
124
                                        unset($np->fields["ifmac"]);
125
                                        unset($np->fields["netpoint"]);
126
                                        $np->fields["on_device"]=$newID;
127
                                        $np->addToDB();
128
                                }
129
                        }
130
        
131
                        // ADD Contract                                
132
                        $query="SELECT FK_contract from glpi_contract_device WHERE FK_device='".$input["_oldID"]."' AND device_type='".NETWORKING_TYPE."';";
133
                        $result=$DB->query($query);
134
                        if ($DB->numrows($result)>0){
135
        
136
                                while ($data=$DB->fetch_array($result))
137
                                        addDeviceContract($data["FK_contract"],NETWORKING_TYPE,$newID);
138
                        }
139
        
140
                        // ADD Documents                        
141
                        $query="SELECT FK_doc from glpi_doc_device WHERE FK_device='".$input["_oldID"]."' AND device_type='".NETWORKING_TYPE."';";
142
                        $result=$DB->query($query);
143
                        if ($DB->numrows($result)>0){
144
        
145
                                while ($data=$DB->fetch_array($result))
146
                                        addDeviceDocument($data["FK_doc"],NETWORKING_TYPE,$newID);
147
                        }
148
                }
149

    
150
        }
151

    
152
        function pre_deleteItem($ID) {
153
                removeConnector($ID);        
154
                return true;
155
        }
156

    
157

    
158
        function cleanDBonPurge($ID) {
159
                global $DB,$CFG_GLPI;
160

    
161

    
162
                $job =new Job();
163
                $query = "SELECT * FROM glpi_tracking WHERE (computer = '$ID'  AND device_type='".NETWORKING_TYPE."')";
164
                $result = $DB->query($query);
165

    
166
                if ($DB->numrows($result))
167
                        while ($data=$DB->fetch_array($result)) {
168
                                if ($CFG_GLPI["keep_tracking_on_delete"]==1){
169
                                        $query = "UPDATE glpi_tracking SET computer = '0', device_type='0' WHERE ID='".$data["ID"]."';";
170
                                        $DB->query($query);
171
                                } else $job->delete(array("ID"=>$data["ID"]));
172
                        }
173

    
174
                $query = "SELECT ID FROM glpi_networking_ports WHERE (on_device = '$ID' AND device_type = '".NETWORKING_TYPE."')";
175
                $result = $DB->query($query);
176
                while ($data = $DB->fetch_array($result)){
177
                        $q = "DELETE FROM glpi_networking_wire WHERE (end1 = '".$data["ID"]."' OR end2 = '".$data["ID"]."')";
178
                        $result2 = $DB->query($q);                                
179
                }
180

    
181

    
182
                $query = "DELETE FROM glpi_networking_ports WHERE (on_device = '$ID' AND device_type = '".NETWORKING_TYPE."')";
183
                $result = $DB->query($query);
184

    
185
                $query = "DELETE FROM glpi_infocoms WHERE (FK_device = '$ID' AND device_type='".NETWORKING_TYPE."')";
186
                $result = $DB->query($query);
187

    
188
                $query = "DELETE FROM glpi_contract_device WHERE (FK_device = '$ID' AND device_type='".NETWORKING_TYPE."')";
189
                $result = $DB->query($query);
190

    
191
                $query="select * from glpi_reservation_item where (device_type='".NETWORKING_TYPE."' and id_device='$ID')";
192
                if ($result = $DB->query($query)) {
193
                        if ($DB->numrows($result)>0) {
194
                                $rr=new ReservationItem();
195
                                $rr->delete(array("ID"=>$DB->result($result,0,"ID")));
196
                        }
197
                }
198
        }
199

    
200
        /**
201
         * Print the networking form
202
         *
203
         *@param $target filename : where to go when done.
204
         *@param $ID Integer : Id of the item to print
205
         *@param $withtemplate integer template or basic item
206
         *
207
         *@return boolean item found
208
         **/
209
        function showForm ($target,$ID,$withtemplate='') {
210
                // Show device or blank form
211

    
212
                global $CFG_GLPI, $LANG;
213

    
214
                if (!haveRight("networking","r")) return false;
215

    
216
                $spotted = false;
217
                $use_cache=true;
218
                if((empty($ID) && $withtemplate == 1)||$ID==-1) {
219
                        $use_cache=false;
220
                        if($this->getEmpty()) $spotted = true;
221
                } else {
222
                        if($this->getFromDB($ID)&&haveAccessToEntity($this->fields["FK_entities"])) $spotted = true;
223
                }
224

    
225
                if($spotted) {
226

    
227
                        $this->showOnglets($ID, $withtemplate,$_SESSION['glpi_onglet']);
228

    
229
                        if(!empty($withtemplate) && $withtemplate == 2) {
230
                                $use_cache=false;
231
                                $template = "newcomp";
232
                                $datestring = $LANG["computers"][14].": ";
233
                                $date = convDateTime($_SESSION["glpi_currenttime"]);
234
                        } elseif(!empty($withtemplate) && $withtemplate == 1) { 
235
                                $use_cache=false;
236
                                $template = "newtemplate";
237
                                $datestring = $LANG["computers"][14].": ";
238
                                $date = convDateTime($_SESSION["glpi_currenttime"]);
239
                        } else {
240
                                $datestring = $LANG["common"][26].": ";
241
                                $date = convDateTime($this->fields["date_mod"]);
242
                                $template = false;
243
                        }
244

    
245

    
246
                        echo "<div class='center'><form name='form' method='post' action=\"$target\">\n";
247

    
248
                        if(strcmp($template,"newtemplate") === 0) {
249
                                echo "<input type=\"hidden\" name=\"is_template\" value=\"1\" />\n";
250
                        }
251

    
252
                        echo "<input type='hidden' name='FK_entities' value='".$this->fields["FK_entities"]."'>";
253

    
254
                        echo "<table  class='tab_cadre_fixe' cellpadding='2'>\n";
255

    
256
                        echo "<tr><th align='center' >\n";
257
                        if(!$template) {
258
                                echo $LANG["common"][2]." ".$this->fields["ID"];
259
                        }elseif (strcmp($template,"newcomp") === 0) {
260
                                echo $LANG["networking"][53].": ".$this->fields["tplname"];
261
                                echo "<input type='hidden' name='tplname' value='".$this->fields["tplname"]."'>";
262
                        }elseif (strcmp($template,"newtemplate") === 0) {
263
                                echo $LANG["common"][6].": ";
264
                                autocompletionTextField("tplname","glpi_networking","tplname",$this->fields["tplname"],20,$this->fields["FK_entities"]);
265
                        }
266
                        if (isMultiEntitiesMode()){
267
                                echo "&nbsp;(".getDropdownName("glpi_entities",$this->fields["FK_entities"]).")";
268
                        }
269

    
270
                        echo "</th><th  align='center'>".$datestring.$date;
271
                        if (!$template&&!empty($this->fields['tplname']))
272
                                echo "&nbsp;&nbsp;&nbsp;(".$LANG["common"][13].": ".$this->fields['tplname'].")";
273
                        echo "</th></tr>\n";
274

    
275
                        if (!$use_cache||!($CFG_GLPI["cache"]->start($ID."_".$_SESSION["glpilanguage"],"GLPI_".$this->type))) {
276
                                echo "<tr><td class='tab_bg_1' valign='top'>\n";
277
        
278
                                echo "<table cellpadding='1' cellspacing='0' border='0'>\n";
279
        
280
                                echo "<tr><td>".$LANG["common"][16].($template?"*":"").":        </td>\n";
281
                                echo "<td>";
282
                                $objectName = autoName($this->fields["name"], "name", ($template === "newcomp"), NETWORKING_TYPE,$this->fields["FK_entities"]);
283
                                autocompletionTextField("name","glpi_networking","name",$objectName,20,$this->fields["FK_entities"]);
284
                                echo "</td></tr>\n";
285
        
286
                                echo "<tr class='tab_bg_1'><td>".$LANG["common"][5].":         </td><td colspan='2'>\n";
287
                                dropdownValue("glpi_dropdown_manufacturer","FK_glpi_enterprise",$this->fields["FK_glpi_enterprise"]);
288
                                echo "</td></tr>\n";
289
        
290
                                echo "<tr><td>".$LANG["common"][15].":         </td><td>\n";
291
                                dropdownValue("glpi_dropdown_locations", "location", $this->fields["location"],1,$this->fields["FK_entities"]);
292
                                echo "</td></tr>\n";
293
        
294
                                echo "<tr class='tab_bg_1'><td>".$LANG["common"][10].":         </td><td colspan='2'>\n";
295
                                dropdownUsersID("tech_num", $this->fields["tech_num"],"interface",1,$this->fields["FK_entities"]);
296
                                echo "</td></tr>\n";
297
        
298
                                echo "<tr><td>".$LANG["common"][21].":        </td><td>\n";
299
                                autocompletionTextField("contact_num","glpi_networking","contact_num",$this->fields["contact_num"],20,$this->fields["FK_entities"]);
300
                                echo "</td></tr>\n";
301
        
302
                                echo "<tr><td>".$LANG["common"][18].":        </td><td>\n";
303
                                autocompletionTextField("contact","glpi_networking","contact",$this->fields["contact"],20,$this->fields["FK_entities"]);
304
                                echo "</td></tr>\n";
305
        
306
                                echo "<tr><td>".$LANG["common"][34].":         </td><td>";
307
                                dropdownAllUsers("FK_users", $this->fields["FK_users"],1,$this->fields["FK_entities"]);
308
                                echo "</td></tr>";
309
        
310
                                echo "<tr><td>".$LANG["common"][35].":         </td><td>";
311
                                dropdownValue("glpi_groups", "FK_groups", $this->fields["FK_groups"],1,$this->fields["FK_entities"]);
312
                                echo "</td></tr>";
313
        
314
                                
315
        
316
        
317
                                echo "<tr><td>".$LANG["state"][0].":</td><td>\n";
318
                                dropdownValue("glpi_dropdown_state", "state",$this->fields["state"]);
319
                                echo "</td></tr>\n";
320
        
321
        
322
                                echo "</table>\n";
323
        
324
                                echo "</td>\n";        
325
                                echo "<td class='tab_bg_1' valign='top'>\n";
326
        
327
                                echo "<table cellpadding='1' cellspacing='0' border='0'>\n";
328
        
329
                                echo "<tr><td>".$LANG["common"][17].":         </td><td>\n";
330
                                dropdownValue("glpi_type_networking", "type", $this->fields["type"]);
331
                                echo "</td></tr>\n";
332
        
333
                                echo "<tr><td>".$LANG["common"][22].":         </td><td>";
334
                                dropdownValue("glpi_dropdown_model_networking", "model", $this->fields["model"]);
335
                                echo "</td></tr>";
336
        
337
                                echo "<tr><td>".$LANG["networking"][49].":         </td><td>\n";
338
                                dropdownValue("glpi_dropdown_firmware", "firmware", $this->fields["firmware"]);
339
                                echo "</td></tr>\n";
340
        
341
                                echo "<tr><td>".$LANG["networking"][5].":        </td><td>\n";
342
                                autocompletionTextField("ram","glpi_networking","ram",$this->fields["ram"],20,$this->fields["FK_entities"]);
343
                                echo "</td></tr>\n";
344
        
345
                                echo "<tr><td>".$LANG["common"][19].":        </td><td>\n";
346
                                autocompletionTextField("serial","glpi_networking","serial",$this->fields["serial"],20,$this->fields["FK_entities"]);
347
                                echo "</td></tr>\n";
348
        
349
                                echo "<tr><td>".$LANG["common"][20].($template?"*":"").":</td><td>\n";
350
                                $objectName = autoName($this->fields["otherserial"], "otherserial", ($template === "newcomp"), NETWORKING_TYPE,$this->fields["FK_entities"]);
351
                                autocompletionTextField("otherserial","glpi_networking","otherserial",$objectName,20,$this->fields["FK_entities"]);
352
                                echo "</td></tr>\n";
353
        
354
                                echo "<tr><td>".$LANG["setup"][88].":         </td><td>\n";
355
                                dropdownValue("glpi_dropdown_network", "network", $this->fields["network"]);
356
                                echo "</td></tr>\n";
357
        
358
                                echo "<tr><td>".$LANG["setup"][89].":         </td><td>\n";
359
                                dropdownValue("glpi_dropdown_domain", "domain", $this->fields["domain"]);
360
                                echo "</td></tr>\n";
361
        
362
                                echo "<tr><td>".$LANG["networking"][14].":</td><td>\n";
363
                                autocompletionTextField("ifaddr","glpi_networking","ifaddr",$this->fields["ifaddr"],20,$this->fields["FK_entities"]);
364
                                echo "</td></tr>\n";
365
        
366
                                echo "<tr><td>".$LANG["networking"][15].":</td><td>\n";
367
                                autocompletionTextField("ifmac","glpi_networking","ifmac",$this->fields["ifmac"],20,$this->fields["FK_entities"]);
368
                                echo "</td></tr>\n";
369
        
370
                                echo "</table>\n";
371
        
372
                                echo "</td>\n";        
373
                                echo "</tr>\n";
374
                                echo "<tr>\n";
375
                                echo "<td class='tab_bg_1' valign='top' colspan='2'>\n";
376
        
377
                                echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td valign='top'>\n";
378
                                echo $LANG["common"][25].":        </td>\n";
379
                                echo "<td class='center'><textarea cols='35' rows='4' name='comments' >".$this->fields["comments"]."</textarea>\n";
380
                                echo "</td></tr></table>\n";
381
        
382
                                echo "</td>";
383
                                echo "</tr>\n";
384
                                if ($use_cache){
385
                                        $CFG_GLPI["cache"]->end();
386
                                }
387
                        }
388

    
389
                        if (haveRight("networking","w")) {
390
                                echo "<tr>\n";
391

    
392
                                if ($template) {
393

    
394
                                        if (empty($ID)||$withtemplate==2){
395
                                                echo "<td class='tab_bg_2' align='center' colspan='2'>\n";
396
                                                echo "<input type='hidden' name='ID' value=$ID>";
397
                                                echo "<input type='submit' name='add' value=\"".$LANG["buttons"][8]."\" class='submit'>";
398
                                                echo "</td>\n";
399
                                        } else {
400
                                                echo "<td class='tab_bg_2' align='center' colspan='2'>\n";
401
                                                echo "<input type='hidden' name='ID' value=$ID>";
402
                                                echo "<input type='submit' name='update' value=\"".$LANG["buttons"][7]."\" class='submit'>";
403
                                                echo "</td>\n";
404
                                        }
405

    
406
                                } else {
407

    
408
                                        echo "<td class='tab_bg_2' valign='top'>";
409
                                        echo "<input type='hidden' name='ID' value=\"$ID\">\n";
410
                                        echo "<div class='center'><input type='submit' name='update' value=\"".$LANG["buttons"][7]."\" class='submit'></div>";
411
                                        echo "<td class='tab_bg_2' valign='top'>\n";
412

    
413
                                        echo "<div class='center'>\n";
414
                                        if (!$this->fields["deleted"])
415
                                                echo "<input type='submit' name='delete' value=\"".$LANG["buttons"][6]."\" class='submit'>\n";
416
                                        else {
417
                                                echo "<input type='submit' name='restore' value=\"".$LANG["buttons"][21]."\" class='submit'>\n";
418

    
419
                                                echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' name='purge' value=\"".$LANG["buttons"][22]."\" class='submit'>\n";
420
                                        }
421
                                        echo "</div>\n";
422
                                        echo "</td>\n";
423
                                }
424
                                echo "</tr>\n";
425
                        }
426

    
427
                        echo "</table></form></div>\n";
428

    
429
                        return true;
430
                }
431
                else {
432
                        echo "<div class='center'><strong>".$LANG["common"][54]."</strong></div>";
433
                        return false;
434
                }
435

    
436
        }
437

    
438
}
439

    
440
/// Netport class
441
class Netport extends CommonDBTM {
442

    
443
        /// ID of the port connected to the current one
444
        var $contact_id                = 0;
445

    
446
        /// hardare data : name
447
        var $device_name        = "";
448
        /// hardare data : ID
449
        var $device_ID                = 0;
450
        /// hardare data : type
451
        var $device_type                = 0;
452
        /// hardare data : entity
453
        var $FK_entities                = -1;
454
        /// hardare data : location
455
        var $location                = -1;
456

    
457
        /**
458
         * Constructor
459
        **/
460
        function Netport () {
461
                $this->table="glpi_networking_ports";
462
                $this->type=-1;
463
        }
464

    
465
        function post_updateItem($input,$updates,$history=1){
466
                //$tomatch=array("netpoint","ifaddr","ifmac");
467
                // Only netpoint updates : ifaddr and ifmac may be different.
468
                $tomatch=array("netpoint");
469
                $updates=array_intersect($updates,$tomatch);
470
                if (count($updates)){
471
                        $save_ID=$this->fields["ID"];
472
                        $n=new Netwire;
473
                        if ($this->fields["ID"]=$n->getOppositeContact($save_ID)){
474
                                $this->updateInDB($updates);
475
                        }
476
                        $this->fields["ID"]=$save_ID;
477
                }
478
        }
479

    
480
        function prepareInputForUpdate($input) {
481
                // Is a preselected mac adress selected ?
482
                if (isset($input['pre_mac'])&&!empty($input['pre_mac'])){
483
                        $input['ifmac']=$input['pre_mac'];
484
                        unset($input['pre_mac']);
485
                }
486
                return $input;
487
        }
488

    
489

    
490
        function prepareInputForAdd($input) {
491
                if (isset($input["logical_number"])&&strlen($input["logical_number"])==0) unset($input["logical_number"]);
492
                //unset($input['search']);
493
                return $input;
494
        }
495

    
496
        function cleanDBonPurge($ID) {
497
                global $DB;
498

    
499
                $query = "DELETE FROM glpi_networking_wire WHERE (end1 = '$ID' OR end2 = '$ID')";
500
                $result = $DB->query($query);
501
        }
502

    
503
        // SPECIFIC FUNCTIONS
504

    
505
        /**
506
         * Retrieve data in the port of the item which belongs to
507
         *
508
         *@param $ID Integer : Id of the item to print
509
         *@param $type item type
510
         *
511
         *@return boolean item found
512
         **/
513
        function getDeviceData($ID,$type)
514
        {
515
                global $DB,$LINK_ID_TABLE;
516

    
517
                $table = $LINK_ID_TABLE[$type];
518

    
519
                $query = "SELECT * FROM $table WHERE (ID = '$ID')";
520
                if ($result=$DB->query($query))
521
                {
522
                        $data = $DB->fetch_array($result);
523
                        $this->device_name = $data["name"];
524
                        $this->deleted = $data["deleted"];
525
                        $this->FK_entities = $data["FK_entities"];
526
                        $this->location = $data["location"];
527
                        $this->device_ID = $ID;
528
                        $this->device_type = $type;
529
                        return true;
530
                }
531
                else 
532
                {
533
                        return false;
534
                }
535
        }
536

    
537
        /**
538
         * Get port opposite port ID if linked item
539
         * ID store in contact_id
540
         *@param $ID networking port ID
541
         *
542
         *@return boolean item found
543
         **/
544
        function getContact($ID) {
545

    
546
                $wire = new Netwire;
547
                if ($this->contact_id = $wire->getOppositeContact($ID)){
548
                        return true;
549
                }else{
550
                        return false;
551
                }
552
        }
553

    
554

    
555
}
556

    
557
/// Netwire class
558
class Netwire {
559

    
560
        /// ID of the netwire
561
        var $ID                = 0;
562
        /// first connected port ID
563
        var $end1        = 0;
564
        /// second connected port ID
565
        var $end2        = 0;
566

    
567
        /**
568
         * Get port opposite port ID 
569
         * 
570
         *@param $ID networking port ID
571
         *
572
         *@return integer ID of opposite port. false if not found
573
         **/
574
        function getOppositeContact ($ID){
575
                global $DB;
576
                $query = "SELECT * FROM glpi_networking_wire WHERE (end1 = '$ID' OR end2 = '$ID')";
577
                if ($result=$DB->query($query))
578
                {
579
                        $data = $DB->fetch_array($result);
580
                        if (is_array($data)){
581
                                $this->end1 = $data["end1"];
582
                                $this->end2 = $data["end2"];
583
                        }
584

    
585
                        if ($this->end1 == $ID){
586
                                return $this->end2;
587
                        } else if ($this->end2 == $ID){
588
                                return $this->end1;
589
                        } else {
590
                                return false;
591
                        }
592
                }
593
        }
594
}
595
?>
Redmine Appliance - Powered by TurnKey Linux