安装了ldap_sync 等 查看模块时为什么出现大量的php代码?
我安装了ldap_server, ldap_auth, ldap_sync,ldap_lib等模块, 然后点击ldap_sync(或者其它ldap模块), 会出现大量的PHP代码, 这是什么原因啊?*/ require_once(t3lib_extmgm::extPath('ldap_server','class.tx_ldapserver.php')); class tx_ldapsync { /** * * * @return void */ function init($folderIDs = '', $serverIDs = '', $mode = 'simulate') { $this->mode = $mode; $this->statistics[$mode] = array(); // init the ldapServer object getting the relevant ldap server record // and establishing a ldap connection object $this->ldapServer = t3lib_div::makeInstance('tx_ldapserver'); if(is_array($this->ldapServer->server = $this->ldapServer->initLDAP($folderIDs, $serverIDs))) { if($this->writeDevLog) { t3lib_div::devLog('LDAP server available ('.$this->ldapServer->server['servername'].'). Line 43', 'ldap_sync'); } } else { if($this->writeDevLog) { t3lib_div::devLog('No LDAP server available.', 'ldap_sync'); } return 'NO LDAP SERVER available'; } } /** * * * @return void */ function sync($table = '') { // parse configuration $conf = $this->ldapServer->getConf($this->ldapServer->server['config'], 'LDAP_SYNC'); if(is_array($conf)) { reset($conf); while(list($name,$tableConf) = each($conf)) { $this->syncTable($tableConf); } } else { $this->statistics['error'][] = 'No active LDAP_SYNC in: '.$this->ldapServer->server['config']; } } /** * * * @return void */ function syncTable($conf) { $uids = array(); $GLOBALS['LDAP_CONNECT']->setBaseDN($conf['basedn']); $GLOBALS['LDAP_CONNECT']->search($conf['filter']); while($data = $GLOBALS['LDAP_CONNECT']->fetch()) { $data['dn'] = $GLOBALS['LDAP_CONNECT']->getDN(); $record = $this->ldapServer->transferData($data,$conf,$conf['pid'],$this->mode); if($record['__STATUS__'] == 'new') { $this->statistics[$this->mode][$conf['table']]['new'][] = $record; if($record['uid'] != '__NEW__' ) { $uids[] = $record['uid']; } } else { $this->statistics[$this->mode][$conf['table']]['updated'][] = $record; $uids[] = $record['uid']; } } if(count($uids) && $conf['handleNotFound']) { $this->handleNotFound($uids, $conf); } } /** * * * @return void */ function handleNotFound($uids, $conf) { // no matter what we do. We want to do it to the same set of records // => hence: where parameter is the same for all $where = $conf['table'].".pid = '".$conf['pid']."' AND ".$conf['table'].".uid NOT IN (".implode($uids,',').") AND ".$conf['table'].".".$conf['uniqueField']; if($conf['handleNotFound.']['identField']) { $identField = ','.$conf['table'].'.'.$conf['handleNotFound.']['identField']; } if($this->mode == 'simulate') { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($conf['table'].'.uid,'.$conf['table'].'.pid'.$identField,$conf['table'],$where); if($res) { while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if($conf['handleNotFound.']['delete']) { $this->statistics[$this->mode][$conf['table']]['deleted'][] = $row; } else{ if($conf['handleNotFound.']['markHidden'] && $conf['handleNotFound.']['hiddenField']) { $this->statistics[$this->mode][$conf['table']]['markedHidden'][] = $row; } if($conf['handleNotFound.']['markDeleted'] && $conf['handleNotFound.']['deletedField']) { $this->statistics[$this->mode][$conf['table']]['markedDeleted'][] = $row; } } } } } else { if($conf['handleNotFound.']['delete']) { $res = $GLOBALS['TYPO3_DB']->exec_DELETEquery($conf['table'],$where); } else { if($conf['handleNotFound.']['markHidden'] && $conf['handleNotFound.']['hiddenField']) { $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($conf['table'],$where,array($conf['handleNotFound.']['hiddenField'] => 1)); } if($conf['handleNotFound.']['markDeleted'] && $conf['handleNotFound.']['deletedField']) { $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($conf['table'],$where,array($conf['handleNotFound.']['deletedField'] => 1)); } } } } /** * * * @return void */ function processStatistics($file = '') { if($file) { $content = ''; } else { if(is_array($this->statistics['error'])) { $content.= implode($this->statistics['error'],'
'); } $statistics = $this->statistics[$this->mode]; reset($statistics); while(list($k,$v) = each($statistics)) { $content.= $this->statTableHead($k); $content.= $this->statTableSpacer(); $content.= $this->statTableContent($v['new'], 'New records'); $content.= $this->statTableSpacer(); $content.= $this->statTableContent($v['updated'], 'Updated records'); $content.= $this->statTableSpacer(); $content.= $this->statTableContent($v['deleted'], 'Deleted records'); $content.= $this->statTableSpacer(); $content.= $this->statTableContent($v['markedHidden'], 'Marked hidden records'); $content.= $this->statTableSpacer(); $content.= $this->statTableContent($v['markedDeleted'], 'Marked deleted records'); $content.= $this->statTableSpacer(); } } return $content; } /** * * * @return void */ function statTableHead($table) { if($this->mode == 'simulate') { $content.= '
Simulation Mode
'; } $content.= ' '.$table.'
'; return $content; } /** * * * @return void */ function statTableContent($data, $mode) { $out = ' '.$mode.'
'; if(is_array($data)) { while(list(,$v) = each($data)) { $content = ' uid: '.$v['uid'].'
'; if($mode == 'New records') { $content.= ' pid: '.$v['pid'].'
'; } unset($v['uid']); unset($v['pid']); unset($v['__STATUS__']); if(is_array($v)) { reset($v); while(list($kk,$vv) = each($v)) { $content.= ' '.$kk.': '.$vv.'
'; } } $out.= ' '.$content.'
'; } } return ' '.$out.'
'; } /** * * * @return void */ function statTableSpacer() { return '
'; } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS['XCLASS']['ext/ldap_sync/class.tx_ldapsync.php']) { include_once($TYPO3_CONF_VARS['XCLASS']['ext/ldap_sync/class.tx_ldapsync.php']); } ?>
赞一个
真不错,赞一个,继续努力啊-------------------------
Chongqing news:chongqing,There is wow gold of sale; you can buy really cheap wow gold here.Buy professional power leveling services, wow powerleveling,warcraft gold,World Of Warcraft Power Leveling help !
页:
[1]