| Total Complexity | 102 |
| Total Lines | 559 |
| Duplicated Lines | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 2 |
Complex classes like action_plugin_dokusioc often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use action_plugin_dokusioc, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 79 | class action_plugin_dokusioc extends DokuWiki_Action_Plugin { |
||
| 80 | |||
| 81 | var $agentlink = 'http://eye48.com/go/dokusioc?v=0.1.2'; |
||
| 82 | |||
| 83 | |||
| 84 | /* -- Methods to manage plugin ------------------------------------------ */ |
||
| 85 | |||
| 86 | /** |
||
| 87 | * Register its handlers with the DokuWiki's event controller |
||
| 88 | */ |
||
| 89 | public function register(Doku_Event_Handler $controller) |
||
| 90 | { |
||
| 91 | //print_r(headers_list()); die(); |
||
| 92 | |||
| 93 | // test the requested action |
||
| 94 | $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'checkAction', $controller); |
||
| 95 | // pingthesemanticweb.com |
||
| 96 | if ($this->getConf('pingsw')) { |
||
| 97 | $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'pingService', $controller); |
||
| 98 | } |
||
| 99 | } |
||
| 100 | |||
| 101 | /* -- Event handlers ---------------------------------------------------- */ |
||
| 102 | |||
| 103 | public function checkAction($action, $controller) |
||
| 128 | } |
||
| 129 | } |
||
| 130 | /* |
||
| 131 | else |
||
| 132 | { |
||
| 133 | print_r(array($action->data, $INFO['perm'], defined('DOKU_MEDIADETAIL'), $INFO['exists'], getDwUserInfo($INFO['id'],$this), isHiddenPage($INFO['id']))); |
||
| 134 | die(); |
||
| 135 | } |
||
| 136 | */ |
||
| 137 | } |
||
| 138 | |||
| 139 | public function pingService($data, $controller) |
||
| 140 | { |
||
| 141 | // TODO: test acl |
||
| 142 | // TODO: write in message queue (?) |
||
| 143 | |||
| 144 | if ($data->data['preact'] == array('save'=>'Save') || $data->data['preact'] == 'save') |
||
| 145 | { |
||
| 146 | //die('http://pingthesemanticweb.com/rest/?url='.urlencode(getAbsUrl(wl($data->data['id'])))); |
||
| 147 | //$ping = fopen('http://pingthesemanticweb.com/rest/?url='.urlencode(getAbsUrl(wl($data->data['id']))),'r'); |
||
| 148 | // it must be a post, and it's the last revision |
||
| 149 | $ping = @fopen('http://pingthesemanticweb.com/rest/?url='.urlencode(normalizeUri(getAbsUrl(exportlink($data->data['id'], 'siocxml', array('type'=>'post'), false, '&')))), 'r'); |
||
| 150 | @fclose($ping); |
||
| 151 | } |
||
| 152 | } |
||
| 153 | |||
| 154 | /** |
||
| 155 | */ |
||
| 156 | public function createRdfLink($event = null, $param = null) |
||
| 157 | { |
||
| 158 | global $ID, $INFO, $conf; |
||
| 159 | |||
| 160 | // Test for hidden pages |
||
| 161 | |||
| 162 | if (isHiddenPage($ID)) { |
||
| 163 | return false; |
||
| 164 | } |
||
| 165 | |||
| 166 | // Get type of SIOC content |
||
| 167 | |||
| 168 | $sioc_type = $this->_getContenttype(); |
||
| 169 | |||
| 170 | // Test for valid types |
||
| 171 | |||
| 172 | if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) { |
||
| 173 | return false; |
||
| 174 | } |
||
| 175 | |||
| 176 | // Test for permission |
||
| 177 | |||
| 178 | if (!$INFO['perm']) { |
||
| 179 | // not enough rights to see the wiki page |
||
| 180 | return false; |
||
| 181 | } |
||
| 182 | |||
| 183 | $userinfo = getDwUserInfo($ID, $this); |
||
| 184 | |||
| 185 | // Create attributes for meta link |
||
| 186 | |||
| 187 | $metalink['type'] = 'application/rdf+xml'; |
||
| 188 | $metalink['rel'] = 'meta'; |
||
| 189 | |||
| 190 | switch ($sioc_type) |
||
| 191 | { |
||
| 192 | case 'container': |
||
| 193 | $title = htmlentities("Container '".(isset($INFO['meta']['title']) ? $INFO['meta']['title'] : $ID)."' (SIOC document as RDF/XML)"); |
||
| 194 | $queryAttr = array('type'=>'container'); |
||
| 195 | break; |
||
| 196 | |||
| 197 | case 'user': |
||
| 198 | $title = htmlentities("User account '".$userinfo['name']."' (SIOC document as RDF/XML)"); |
||
| 199 | $queryAttr = array('type'=>'user'); |
||
| 200 | break; |
||
| 201 | |||
| 202 | case 'post': |
||
| 203 | default: |
||
| 204 | $title = htmlentities("Article '".$INFO['meta']['title']."' (SIOC document as RDF/XML)"); |
||
| 205 | $queryAttr = array('type'=>'post'); |
||
| 206 | if (isset($_GET['rev']) && $_GET['rev'] == intval($_GET['rev'])) { |
||
| 207 | $queryAttr['rev'] = $_GET['rev']; |
||
| 208 | } |
||
| 209 | break; |
||
| 210 | } |
||
| 211 | |||
| 212 | $metalink['title'] = $title; |
||
| 213 | $metalink['href'] = normalizeUri(getAbsUrl(exportlink($ID, 'siocxml', $queryAttr, false, '&'))); |
||
| 214 | |||
| 215 | if ($event !== null) |
||
| 216 | { |
||
| 217 | $event->data['link'][] = $metalink; |
||
| 218 | |||
| 219 | // set canocial link for type URIs to prevent indexing double content |
||
| 220 | if ($_GET['type']) { |
||
| 221 | $event->data['link'][] = array('rel'=>'canonical', 'href'=>getAbsUrl(wl($ID))); |
||
| 222 | } |
||
| 223 | } |
||
| 224 | |||
| 225 | return $metalink; |
||
| 226 | } |
||
| 227 | |||
| 228 | /* -- public class methods ---------------------------------------------- */ |
||
| 229 | |||
| 230 | public function exportSioc() |
||
| 231 | { |
||
| 232 | global $ID, $INFO, $conf, $REV, $auth; |
||
| 233 | |||
| 234 | // Test for hidden pages |
||
| 235 | |||
| 236 | if (isHiddenPage($ID)) { |
||
| 237 | $this->_exit("HTTP/1.0 404 Not Found"); |
||
| 238 | } |
||
| 239 | |||
| 240 | // Get type of SIOC content |
||
| 241 | |||
| 242 | $sioc_type = $this->_getContenttype(); |
||
| 243 | |||
| 244 | // Test for valid types |
||
| 245 | |||
| 246 | if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) { |
||
| 247 | $this->_exit("HTTP/1.0 404 Not Found"); |
||
| 248 | } |
||
| 249 | |||
| 250 | // Test for permission |
||
| 251 | |||
| 252 | if (!$INFO['perm']) { |
||
| 253 | // not enough rights to see the wiki page |
||
| 254 | $this->_exit("HTTP/1.0 401 Unauthorized"); |
||
| 255 | } |
||
| 256 | |||
| 257 | // Forward to URI with explicit type attribut |
||
| 258 | if (!isset($_GET['type'])) { |
||
| 259 | header('Location:'.$_SERVER['REQUEST_URI'].'&type='.$sioc_type, true, 302); |
||
| 260 | } |
||
| 261 | |||
| 262 | // Include SIOC libs |
||
| 263 | |||
| 264 | require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'sioc_inc.php'); |
||
| 265 | require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'sioc_dokuwiki.php'); |
||
| 266 | |||
| 267 | // Create exporter |
||
| 268 | |||
| 269 | $rdf = new SIOCExporter(); |
||
| 270 | $rdf->_profile_url = normalizeUri(getAbsUrl(exportlink($ID, 'siocxml', array('type'=>$sioc_type), false, '&'))); |
||
| 271 | $rdf->setURLParameters('type', 'id', 'page', false); |
||
| 272 | |||
| 273 | // Create SIOC-RDF content |
||
| 274 | |||
| 275 | switch ($sioc_type) |
||
| 276 | { |
||
| 277 | case 'container': |
||
| 278 | $rdf = $this->_exportContainercontent($rdf); |
||
| 279 | break; |
||
| 280 | |||
| 281 | case 'user': |
||
| 282 | $rdf = $this->_exportUsercontent($rdf); |
||
| 283 | break; |
||
| 284 | |||
| 285 | case 'post': |
||
| 286 | default: |
||
| 287 | $rdf = $this->_exportPostcontent($rdf); |
||
| 288 | break; |
||
| 289 | } |
||
| 290 | |||
| 291 | // export |
||
| 292 | if ($this->getConf('noindx')) { |
||
| 293 | header("X-Robots-Tag: noindex", true); |
||
| 294 | } |
||
| 295 | $rdf->export(); |
||
| 296 | |||
| 297 | //print_r(headers_list()); die(); |
||
| 298 | die(); |
||
| 299 | } |
||
| 300 | |||
| 301 | public function isRdfXmlRequest() |
||
| 302 | { |
||
| 303 | // get accepted types |
||
| 304 | $http_accept = trim($_SERVER['HTTP_ACCEPT']); |
||
| 305 | |||
| 306 | // save accepted types in array |
||
| 307 | $accepted = explode(',', $http_accept); |
||
| 308 | |||
| 309 | /* |
||
| 310 | $debuginfo = implode(' // ', array(date('c',$_SERVER['REQUEST_TIME']), $_SERVER['HTTP_REFERER'], $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_HOST'], $_SERVER['HTTP_USER_AGENT'], $_SERVER['HTTP_ACCEPT'])); |
||
| 311 | global $conf; //print_r($conf); die(); |
||
| 312 | //die($debuginfo); |
||
| 313 | $debuglog = @fopen($conf['tmpdir'].DIRECTORY_SEPARATOR.'requests.log', 'ab'); |
||
| 314 | @fwrite($debuglog, $debuginfo."\n"); |
||
| 315 | @fclose($debuglog); |
||
| 316 | @chmod($conf['tmpdir'].DIRECTORY_SEPARATOR.'requests.log', 0777); |
||
| 317 | */ |
||
| 318 | |||
| 319 | // soft check, route to RDF when client requests it (don't check quality of request) |
||
| 320 | |||
| 321 | if ($this->getConf('softck') && strpos($_SERVER['HTTP_ACCEPT'], 'application/rdf+xml') !== false) |
||
| 322 | { |
||
| 323 | return true; |
||
| 324 | } |
||
| 325 | |||
| 326 | if (count($accepted) > 0) |
||
| 327 | { |
||
| 328 | // hard check, only serve RDF if it is requested first or equal to first type |
||
| 329 | |||
| 330 | // extract accepting ratio |
||
| 331 | $test_accept = array(); |
||
| 332 | foreach ($accepted as $format) |
||
| 333 | { |
||
| 334 | $formatspec = explode(';', $format); |
||
| 335 | $k = trim($formatspec[0]); |
||
| 336 | if (count($formatspec) == 2) |
||
| 337 | { |
||
| 338 | $test_accept[$k] = trim($formatspec[1]); |
||
| 339 | } else |
||
| 340 | { |
||
| 341 | $test_accept[$k] = 'q=1.0'; |
||
| 342 | } |
||
| 343 | } |
||
| 344 | |||
| 345 | // sort by ratio |
||
| 346 | arsort($test_accept); $accepted_order = array_keys($test_accept); |
||
| 347 | |||
| 348 | if ($accepted_order[0] == 'application/rdf+xml' || $test_accept['application/rdf+xml'] == 'q=1.0') |
||
| 349 | { |
||
| 350 | return true; |
||
| 351 | } |
||
| 352 | } |
||
| 353 | |||
| 354 | // print_r($accepted_order);print_r($test_accept);die(); |
||
| 355 | |||
| 356 | return false; |
||
| 357 | |||
| 358 | } |
||
| 359 | |||
| 360 | /* -- private helpers --------------------------------------------------- */ |
||
| 361 | |||
| 362 | private function _getContenttype() |
||
| 363 | { |
||
| 364 | global $ID, $conf; |
||
| 365 | |||
| 366 | // check for type if unknown |
||
| 367 | if (!$_GET['type']) |
||
| 368 | { |
||
| 369 | $userinfo = getDwUserInfo($ID, $this); |
||
| 370 | |||
| 371 | if ($userinfo) |
||
| 372 | { |
||
| 373 | $type = 'user'; |
||
| 374 | } elseif (isset($_GET['do']) && $_GET['do'] == 'index') |
||
| 375 | { |
||
| 376 | $type = 'container'; |
||
| 377 | } else |
||
| 378 | { |
||
| 379 | $type = 'post'; |
||
| 380 | } |
||
| 381 | |||
| 382 | } else |
||
| 383 | { |
||
| 384 | $type = $_GET['type']; |
||
| 385 | } |
||
| 386 | |||
| 387 | return $type; |
||
| 388 | |||
| 389 | } |
||
| 390 | |||
| 391 | private function _exportPostcontent($exporter) |
||
| 392 | { |
||
| 393 | global $ID, $INFO, $REV, $conf; |
||
| 394 | |||
| 395 | $exporter->setParameters('Article: '.$INFO['meta']['title'].($REV ? ' (rev '.$REV.')' : ''), |
||
| 396 | $this->_getDokuUrl(), |
||
| 397 | $this->_getDokuUrl().'doku.php?', |
||
| 398 | 'utf-8', |
||
| 399 | $this->agentlink |
||
| 400 | ); |
||
| 401 | |||
| 402 | // create user object |
||
| 403 | // $id, $uri, $name, $email, $homepage='', $foaf_uri='', $role=false, $nick='', $sioc_url='', $foaf_url='' |
||
| 404 | $dwuserpage_id = cleanID($this->getConf('userns')).($conf['useslash'] ? '/' : ':').$INFO['editor']; |
||
| 405 | /* |
||
| 406 | if ($INFO['editor'] && $this->getConf('userns')) |
||
| 407 | $pageuser = new SIOCUser($INFO['editor'], |
||
| 408 | normalizeUri(getAbsUrl(exportlink($dwuserpage_id, 'siocxml', array('type'=>'user'), false, '&'))), // user page |
||
| 409 | $INFO['meta']['contributor'][$INFO['editor']], |
||
| 410 | getDwUserInfo($dwuserpage_id,$this,'mail'), |
||
| 411 | '', // no homepage is saved for dokuwiki user |
||
| 412 | '#'.$INFO['editor'], // local uri |
||
| 413 | false, // no roles right now |
||
| 414 | '', // no nick name is saved for dokuwiki user |
||
| 415 | normalizeUri($exporter->siocURL('user', $dwuserpage_id)) |
||
| 416 | ); |
||
| 417 | */ |
||
| 418 | |||
| 419 | // create wiki page object |
||
| 420 | $wikipage = new SIOCDokuWikiArticle($ID, // id |
||
| 421 | normalizeUri($exporter->siocURL('post', $ID.($REV ? $exporter->_urlseparator.'rev'.$exporter->_urlequal.$REV : ''))), // url |
||
| 422 | $INFO['meta']['title'].($REV ? ' (rev '.$REV.')' : ''), // subject |
||
| 423 | rawWiki($ID, $REV) // body (content) |
||
| 424 | ); |
||
| 425 | /* encoded content */ $wikipage->addContentEncoded(p_cached_output(wikiFN($ID, $REV), 'xhtml')); |
||
| 426 | /* created */ if (isset($INFO['meta']['date']['created'])) { |
||
| 427 | $wikipage->addCreated(date('c', $INFO['meta']['date']['created'])); |
||
| 428 | } |
||
| 429 | /* or modified */ if (isset($INFO['meta']['date']['modified'])) { |
||
| 430 | $wikipage->addModified(date('c', $INFO['meta']['date']['modified'])); |
||
| 431 | } |
||
| 432 | /* creator/modifier */ if ($INFO['editor'] && $this->getConf('userns')) { |
||
| 433 | $wikipage->addCreator(array('foaf:maker'=>'#'.$INFO['editor'], 'sioc:modifier'=>$dwuserpage_id)); |
||
| 434 | } |
||
| 435 | /* is creator */ if (isset($INFO['meta']['date']['created'])) { |
||
| 436 | $wikipage->isCreator(); |
||
| 437 | } |
||
| 438 | /* intern wiki links */ $wikipage->addLinks($INFO['meta']['relation']['references']); |
||
| 439 | |||
| 440 | // contributors - only for last revision b/c of wrong meta data for older revisions |
||
| 441 | if (!$REV && $this->getConf('userns') && isset($INFO['meta']['contributor'])) |
||
| 442 | { |
||
| 443 | $cont_temp = array(); |
||
| 444 | $cont_ns = $this->getConf('userns').($conf['useslash'] ? '/' : ':'); |
||
| 445 | foreach ($INFO['meta']['contributor'] as $cont_id => $cont_name) { |
||
| 446 | $cont_temp[$cont_ns.$cont_id] = $cont_name; |
||
| 447 | } |
||
| 448 | $wikipage->addContributors($cont_temp); |
||
| 449 | } |
||
| 450 | |||
| 451 | // backlinks - only for last revision |
||
| 452 | if (!$REV) |
||
| 453 | { |
||
| 454 | require_once(DOKU_INC.'inc/fulltext.php'); |
||
|
1 ignored issue
–
show
|
|||
| 455 | $backlinks = ft_backlinks($ID); |
||
| 456 | if (count($backlinks) > 0) { |
||
| 457 | $wikipage->addBacklinks($backlinks); |
||
| 458 | } |
||
| 459 | } |
||
| 460 | |||
| 461 | // TODO: addLinksExtern |
||
| 462 | |||
| 463 | /* previous and next revision */ |
||
| 464 | $changelog = new PageChangeLog($ID); |
||
| 465 | $pagerevs = $changelog->getRevisions(0, $conf['recent'] + 1); |
||
| 466 | $prevrev = false; $nextrev = false; |
||
| 467 | if (!$REV) |
||
| 468 | { |
||
| 469 | // latest revision, previous rev is on top in array |
||
| 470 | $prevrev = 0; |
||
| 471 | } else |
||
| 472 | { |
||
| 473 | // other revision |
||
| 474 | $currentrev = array_search($REV, $pagerevs); |
||
| 475 | if ($currentrev !== false) |
||
| 476 | { |
||
| 477 | $prevrev = $currentrev + 1; |
||
| 478 | $nextrev = $currentrev - 1; |
||
| 479 | } |
||
| 480 | } |
||
| 481 | if ($prevrev !== false && $prevrev > -1 && page_exists($ID, $pagerevs[$prevrev])) { |
||
| 482 | /* previous revision*/ $wikipage->addVersionPrevious($pagerevs[$prevrev]); |
||
| 483 | } |
||
| 484 | if ($nextrev !== false && $nextrev > -1 && page_exists($ID, $pagerevs[$nextrev])) { |
||
| 485 | /* next revision*/ $wikipage->addVersionNext($pagerevs[$nextrev]); |
||
| 486 | } |
||
| 487 | |||
| 488 | /* latest revision */ if ($REV) { |
||
| 489 | $wikipage->addVersionLatest(); |
||
| 490 | } |
||
| 491 | // TODO: topics |
||
| 492 | /* has_container */ if ($INFO['namespace']) { |
||
| 493 | $wikipage->addContainer($INFO['namespace']); |
||
| 494 | } |
||
| 495 | /* has_space */ if ($this->getConf('owners')) { |
||
| 496 | $wikipage->addSite($this->getConf('owners')); |
||
| 497 | } |
||
| 498 | // TODO: dc:contributor / has_modifier |
||
| 499 | // TODO: attachment (e.g. pictures in that dwns) |
||
| 500 | |||
| 501 | // add wiki page to exporter |
||
| 502 | $exporter->addObject($wikipage); |
||
| 503 | //if ($INFO['editor'] && $this->getConf('userns')) $exporter->addObject($pageuser); |
||
| 504 | |||
| 505 | return $exporter; |
||
| 506 | |||
| 507 | } |
||
| 508 | |||
| 509 | private function _exportContainercontent($exporter) |
||
| 510 | { |
||
| 511 | global $ID, $INFO, $conf; |
||
| 512 | |||
| 513 | if ($ID == $conf['start']) |
||
| 514 | { |
||
| 515 | $title = $conf['title']; |
||
| 516 | } elseif (isset($INFO['meta']['title'])) |
||
| 517 | { |
||
| 518 | $title = $INFO['meta']['title']; |
||
| 519 | } else |
||
| 520 | { |
||
| 521 | $title = $ID; |
||
| 522 | } |
||
| 523 | |||
| 524 | |||
| 525 | $exporter->setParameters('Container: '.$title, |
||
| 526 | getAbsUrl(), |
||
| 527 | getAbsUrl().'doku.php?', |
||
| 528 | 'utf-8', |
||
| 529 | $this->agentlink |
||
| 530 | ); |
||
| 531 | |||
| 532 | // create container object |
||
| 533 | $wikicontainer = new SIOCDokuWikiContainer($ID, |
||
| 534 | normalizeUri($exporter->siocURL('container', $ID)) |
||
| 535 | ); |
||
| 536 | |||
| 537 | /* container is type=wiki */ if ($ID == $conf['start']) { |
||
| 538 | $wikicontainer->isWiki(); |
||
| 539 | } |
||
| 540 | /* sioc:name */ if ($INFO['exists']) { |
||
| 541 | $wikicontainer->addTitle($INFO['meta']['title']); |
||
| 542 | } |
||
| 543 | /* has_parent */ if ($INFO['namespace']) { |
||
| 544 | $wikicontainer->addParent($INFO['namespace']); |
||
| 545 | } |
||
| 546 | |||
| 547 | // search next level entries (posts, sub containers) in container |
||
| 548 | require_once(DOKU_INC.'inc/search.php'); |
||
|
1 ignored issue
–
show
|
|||
| 549 | $dir = utf8_encodeFN(str_replace(':', '/', $ID)); |
||
| 550 | $entries = array(); |
||
| 551 | $posts = array(); |
||
| 552 | $containers = array(); |
||
| 553 | search($entries, $conf['datadir'], 'search_index', array('ns' => $ID), $dir); |
||
| 554 | foreach ($entries as $entry) |
||
| 555 | { |
||
| 556 | if ($entry['type'] === 'f') |
||
| 557 | { |
||
| 558 | // wikisite |
||
| 559 | $posts[] = $entry; |
||
| 560 | } elseif ($entry['type'] === 'd') |
||
| 561 | { |
||
| 562 | // sub container |
||
| 563 | $containers[] = $entry; |
||
| 564 | } |
||
| 565 | } |
||
| 566 | |||
| 567 | // without sub content it can't be a container (so it does not exist as a container) |
||
| 568 | if (count($posts) + count($containers) == 0) { |
||
| 569 | $this->_exit("HTTP/1.0 404 Not Found"); |
||
| 570 | } |
||
| 571 | |||
| 572 | if (count($posts) > 0) { |
||
| 573 | $wikicontainer->addArticles($posts); |
||
| 574 | } |
||
| 575 | if (count($containers) > 0) { |
||
| 576 | $wikicontainer->addContainers($containers); |
||
| 577 | } |
||
| 578 | |||
| 579 | //print_r($containers);die(); |
||
| 580 | |||
| 581 | // add container to exporter |
||
| 582 | $exporter->addObject($wikicontainer); |
||
| 583 | |||
| 584 | return $exporter; |
||
| 585 | } |
||
| 586 | |||
| 587 | private function _exportUsercontent($exporter) |
||
| 588 | { |
||
| 589 | global $ID; |
||
| 590 | |||
| 591 | // get user info |
||
| 592 | $userinfo = getDwUserInfo($ID, $this); |
||
| 593 | |||
| 594 | // no userinfo means there is n user space or user does not exists |
||
| 595 | if ($userinfo === false) { |
||
| 596 | $this->_exit("HTTP/1.0 404 Not Found"); |
||
| 597 | } |
||
| 598 | |||
| 599 | $exporter->setParameters('Account: '.$userinfo['name'], |
||
| 600 | getAbsUrl(), |
||
| 601 | getAbsUrl().'doku.php?', |
||
| 602 | 'utf-8', |
||
| 603 | $this->agentlink |
||
| 604 | ); |
||
| 605 | // create user object |
||
| 606 | //print_r($userinfo); die(); |
||
| 607 | $wikiuser = new SIOCDokuWikiUser($ID, |
||
| 608 | normalizeUri($exporter->siocURL('user', $ID)), |
||
| 609 | $userid, |
||
| 610 | $userinfo['name'], |
||
| 611 | $userinfo['mail']); |
||
| 612 | /* TODO: avatar (using Gravatar) */ |
||
| 613 | /* TODO: creator_of */ |
||
| 614 | // add user to exporter |
||
| 615 | $exporter->addObject($wikiuser); |
||
| 616 | |||
| 617 | //print_r(headers_list());die(); |
||
| 618 | return $exporter; |
||
| 619 | } |
||
| 620 | |||
| 621 | private function _exit($headermsg) |
||
| 625 | } |
||
| 626 | |||
| 627 | private function _getDokuUrl($url = null) |
||
| 630 | } |
||
| 631 | |||
| 632 | private function _getDate($date, $date_alt = null) |
||
| 633 | { |
||
| 638 | } |
||
| 639 | |||
| 640 | } |
||
| 641 | |||
| 642 | if (!function_exists('getAbsUrl')) |
||
| 726 |