max_bodysize = 1024*5; // should be enough $http->max_bodysize_abort = false; $data = $http->get($new[1]); if(!$data){ msg(sprintf($this->getLang('httperror'),hsc($http->error),-1)); } // match values if(preg_match('/<.*?(rel=["\']openid.server["\']).*?>/i',$data,$match)){ if(preg_match('/href=["\'](.*?)["\']/i',$match[0],$match)){ $new[2] = $match[1]; } } if(preg_match('/<.*?(rel=["\']openid2.provider["\']).*?>/i',$data,$match)){ if(preg_match('/href=["\'](.*?)["\']/i',$match[0],$match)){ $new[3] = $match[1]; } } if(preg_match('/<.*?(http-equiv=["\']X-XRDS-Location["\']).*?>/i',$data,$match)){ if(preg_match('/content=["\'](.*?)["\']/i',$match[0],$match)){ $new[4] = $match[1]; } } if($http->resp_headers['x-xrds-location']){ $new[4] = $http->resp_headers['x-xrds-location']; } }else{ unset($new); } } // prepare new config file $data = "# OpenID Delegation Setup\n\n"; foreach($_REQUEST['oiddel'] as $line){ $line = array_map('trim',$line); if(!$line[0]) continue; // make sure OpenIDs and servers are given as full qualified URLs for($i=1; $i<5; $i++){ if($line[$i] && !preg_match('#^https?://#',$line[$i])){ $line[$i] = 'http://'.$line[$i]; } } $data .= join("\t",$line)."\n"; } // add new entry if($new){ $data .= join("\t",$new)."\n"; } //save it if(io_saveFile(DOKU_CONF.'openid-delegates.conf',$data)){ msg($this->getLang('saved'),1); } } /** * output appropriate html */ function html() { global $lang; echo $this->locale_xhtml('intro'); echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $delegates = confToHash(DOKU_CONF.'openid-delegates.conf'); ksort($delegates); $row = 0; foreach($delegates as $page => $delegate){ list($oid,$server,$provider,$xrds) = preg_split('/\s+/',$delegate,4); $oid = trim($oid); $server = trim($server); $provider = trim($provider); $xrds = trim($xrds); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $row++; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'.$this->getLang('page').''.$this->getLang('oid').''.$this->getLang('server').''.$this->getLang('provider').''.$this->getLang('xrds').'
'.$this->getLang('add').'
'; echo ''; echo '
'; echo '
'; } } //Setup VIM: ex: et ts=4 enc=utf-8 :