[Tutos-commits] SF.net SVN: tutos:[570] trunk/php
Projects / CRM / PLM / Calendar / Tasks / SCRUM / Test / Inventory
Brought to you by:
gokohnert
From: <gok...@us...> - 2012-04-19 14:11:48
|
Revision: 570 http://tutos.svn.sourceforge.net/tutos/?rev=570&view=rev Author: gokohnert Date: 2012-04-19 14:11:42 +0000 (Thu, 19 Apr 2012) Log Message: ----------- fix Modified Paths: -------------- trunk/php/db/db_mysqli.pinc trunk/php/ldap/ldap.pinc trunk/php/ldap/ldap_overview.php trunk/php/ldap/ldap_show.php Modified: trunk/php/db/db_mysqli.pinc =================================================================== --- trunk/php/db/db_mysqli.pinc 2012-04-19 08:18:32 UTC (rev 569) +++ trunk/php/db/db_mysqli.pinc 2012-04-19 14:11:42 UTC (rev 570) @@ -198,7 +198,13 @@ $result = $this->conn->query($query); $this->lastquery = $query; + if ($tutos['sqldebug']) { + error_log($query."\r\n",3,$tutos[errlog].'.sql'); + } if ( ! $result) { + if ($tutos['sqldebug']) { + error_log('## '.$this->error()."\r\n",3,$tutos[errlog].'.sql'); + } if ($showerror == 1) { Fatal_Error("Exec ". $this ."|". $this->error(),$query); } else { @@ -208,9 +214,6 @@ } $this->lasterror = ""; $r->rs = &$result; - if ($tutos['sqldebug']) { - error_log($query."\r\n",3,$tutos[errlog].'.sql'); - } return $r; } Modified: trunk/php/ldap/ldap.pinc =================================================================== --- trunk/php/ldap/ldap.pinc 2012-04-19 08:18:32 UTC (rev 569) +++ trunk/php/ldap/ldap.pinc 2012-04-19 14:11:42 UTC (rev 570) @@ -22,7 +22,7 @@ /** * constructor */ - function ldap(&$dbconn) { + function ldap(tutos_db $dbconn) { global $tutos,$table; $this->init($dbconn); @@ -40,7 +40,7 @@ * @param Object $r a result set object * @param int $pos a index in the resultset */ - function read_result (&$r, $pos ) { + function read_result (result $r, $pos ) { global $g_hash; $this->key = $r->get($pos, 'ldap_dn'); @@ -316,7 +316,7 @@ $uri = ""; $desc = ""; foreach(explode(" ",$u) as $f) { - if (eregi("^http",$f)) { + if (preg_match("#^http#i",$f)) { $uri = $f; } else { $desc .= $f." "; @@ -585,4 +585,4 @@ return $r; } } -?> +?> \ No newline at end of file Modified: trunk/php/ldap/ldap_overview.php =================================================================== --- trunk/php/ldap/ldap_overview.php 2012-04-19 08:18:32 UTC (rev 569) +++ trunk/php/ldap/ldap_overview.php 2012-04-19 14:11:42 UTC (rev 570) @@ -45,7 +45,7 @@ $justthese = array( "cn","c","o","ou","mail","*"); // Search surname entry - $sr = ldap_search($this->obj->ds,$this->obj->basedn,$this->filter,$justthese,0,40,20,LDAP_DEREF_ALWAYS); + $sr = ldap_search($this->obj->ds,$this->obj->basedn,$this->filter,$justthese,0,0,20,LDAP_DEREF_ALWAYS); $r .= "|".$this->obj->basedn ."|". $this->filter ."<br />"; if (!$sr) { return $this->error($this->obj->error()); @@ -202,11 +202,11 @@ $r .= "<td>\n"; $sep = ""; if ( isset($info[$i]["telephonenumber"][0]) ) { - $r .= $sep . handle('phone',$this,myentities($info[$i]["telephonenumber"][0])); + $r .= $sep . handle('phone',myentities($info[$i]["telephonenumber"][0]),myentities($info[$i]["telephonenumber"][0])); $sep = "<br />\n"; } if ( isset($info[$i]["mobile"][0]) ) { - $r .= $sep . handle('phone',$this,myentities($info[$i]["mobile"][0])); + $r .= $sep . handle('phone',myentities($info[$i]["mobile"][0]),myentities($info[$i]["mobile"][0])); $sep = "<br />\n"; } $r .= " </td>\n"; @@ -214,9 +214,9 @@ if ( $ashow['fax'] == 1 ) { $r .= "<td>\n"; if ( isset($info[$i]["faxnumber"][0]) ) { - $r .= handle('fax',$this,$info[$i]["faxnumber"][0]); + $r .= handle('fax',$info[$i]["faxnumber"][0],$info[$i]["faxnumber"][0]); } else if ( isset($info[$i]["facsimiletelephonenumber"][0]) ) { - $r .= handle('fax',$this,$info[$i]["facsimiletelephonenumber"][0]); + $r .= handle('fax',$info[$i]["facsimiletelephonenumber"][0],$info[$i]["facsimiletelephonenumber"][0]); } $r .= " </td>\n"; } @@ -266,7 +266,7 @@ $this->dbconn->Begin("WORK"); foreach ($_GET['mark'] as $key => $val) { $adr = $l->import($val); - if ($adr != -1) { + if (is_object($adr) && ($adr->id != -1) ) { $msg .= "synced : ". $adr->getFullName() ."<br />"; } } Modified: trunk/php/ldap/ldap_show.php =================================================================== --- trunk/php/ldap/ldap_show.php 2012-04-19 08:18:32 UTC (rev 569) +++ trunk/php/ldap/ldap_show.php 2012-04-19 14:11:42 UTC (rev 570) @@ -2,8 +2,8 @@ /** * Copyright 1999 - 2009 by Gero Kohnert * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the * Free Software Foundation; version 2 of the License. * * SVN Info $Id$ @@ -35,6 +35,7 @@ global $lang,$tutos; $r = ''; + $binfo = 0; if ( ! $this->obj->connect() ) { $r .= $this->error($lang['LDAP_Err001']); return $r; @@ -50,7 +51,7 @@ } else { $sr = ldap_search($this->obj->ds,$this->obj->basedn,"(&(". $this->filter.")(objectClass=*))",$this->attribs,0,40,10,LDAP_DEREF_ALWAYS); } -#$sr = ldap_search($this->obj->ds,$this->obj->basedn,"(". $this->filter.")",$this->attribs,0,40,10,LDAP_DEREF_ALWAYS); + #$sr = ldap_search($this->obj->ds,$this->obj->basedn,"(". $this->filter.")",$this->attribs,0,40,10,LDAP_DEREF_ALWAYS); if (!$sr) { $r .= $this->error($this->obj->error()); return; @@ -64,7 +65,7 @@ $r .= "<tr><th colspan=\"2\">". $this->obj->getFullName() ."</th></tr>\n"; $x = ldap_first_entry($this->obj->ds,$sr); while ($x != false ) { - $y = ldap_first_attribute($this->obj->ds,$x,$info); + $y = ldap_first_attribute($this->obj->ds,$x,$binfo); while ($y) { $d = ldap_get_values_len($this->obj->ds,$x,$y); $r .= "<tr>\n"; @@ -72,28 +73,28 @@ $r .= "<td>\n"; if ( isset($d['count']) ) { for ($k = 0;$k < $d['count'];$k++) { - if ( eregi("certificate",$y) ) { + if ( preg_match("#certificate#i",$y) ) { // TODO make some cool OPSENSSL Stuff here $r .= "<br /><pre>skipped (". strlen($d[$k]) ." Bytes)</pre><br />"; } else if ( $y == "jpegPhoto" ) { $r .= "<br /><pre>skipped (". strlen($d[$k]) ." Bytes)</pre><br />"; - } else if (eregi("facsimile",$y)){ + } else if (preg_match("#facsimile#i",$y)){ $r .= handle('fax',$y,$this->obj->decode($d[$k])); - } else if (eregi("telephone",$y)){ + } else if (preg_match("#telephone#i",$y)){ $r .= handle('phone',$y,$this->obj->decode($d[$k])); - } else if (eregi("mobile",$y)){ + } else if (preg_match("#mobile#i",$y)){ $r .= handle('phone',$y,$this->obj->decode($d[$k])); - } else if (eregi("mail",$y)){ + } else if (preg_match("#mail#i",$y)){ $r .= AsEmail($d[$k],$d[$k],$d[$k]); - } else if (eregi("postalAddress",$y)){ - $r .= eregi_replace("[$]","<br />",$d[$k]); - } else if (eregi("street",$y)){ - $r .= eregi_replace("[$]","<br />",$d[$k]); - } else if (eregi("uri",$y)){ + } else if (preg_match("#postalAddress#i",$y)){ + $r .= preg_replace("#[$]#i","<br />",$d[$k]); + } else if (preg_match("#street#i",$y)){ + $r .= preg_replace("#[$]#i","<br />",$d[$k]); + } else if (preg_match("#uri#i",$y)){ $desc = ""; $uri = ""; foreach(explode(" ",$d[$k]) as $f) { - if (eregi("^http",$f)) { + if (preg_match("#^http#i",$f)) { $uri = $f; } else { $desc .= $f." "; @@ -109,7 +110,7 @@ } $r .= "</td>"; $r .= "</tr>\n"; - $y = ldap_next_attribute($this->obj->ds,$x,$info); + $y = ldap_next_attribute($this->obj->ds,$x,$binfo); } $x = @ldap_next_entry($this->obj->ds,$x); if ($x != false) { @@ -119,12 +120,12 @@ $r .= $this->DataTableEnd(); $r .= "<form name=\"ldap_adr_ins\" action=\"ldap_import.php\" method=\"post\">"; - if ( !is_object($this->adr) ) { + if ( !is_object($this->refadr) ) { $r .= $lang['LDAPNotSynced']; $r .= " <input type=\"submit\" value=\"". $lang['LDAPImport']."\">"; } else { - $r .= $this->adr->getLink(); - $this->addHidden("adr_id",$this->adr->id); + $r .= $this->refadr->getLink(); + $this->addHidden("adr_id",$this->refadr->id); $r .= " <input type=\"submit\" value=\"". $lang['LDAPUpdate']."\">"; } $this->addHidden("key",$this->filter); @@ -136,14 +137,16 @@ $this->obj->close(); return $r; } + /** * prepare */ Function prepare() { - global $lang,$tutos; + global $lang,$tutos,$msg; - $this->name = $lang['LDAPDetail']; - $this->obj = new ldap($this->dbconn); + $this->name = $lang['LDAPDetail']; + $this->obj = new ldap($this->dbconn); + $this->refadr = null; if ( isset($_GET['sv']) ) { // remember this @@ -161,8 +164,8 @@ $this->keyname = $tutos['ldap:'.$this->obj->host.':'.$this->obj->port]['uniquekey']; if ( isset($_GET['key']) ) { $this->filter = $_GET['key']; - $this->adr = $this->obj->getData($_GET['key']); // Search for this person in TUTOS database entries + $this->refadr = $this->obj->getData($this->filter); } if (isset($_GET['attribs']) ) { $this->attribs =$_GET['attribs']; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |