10Syaroslav@ivinco.com<?php 20Syaroslav@ivinco.com/** 30Syaroslav@ivinco.com * XML feed export 40Syaroslav@ivinco.com * 50Syaroslav@ivinco.com * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 60Syaroslav@ivinco.com * @author Andreas Gohr <andi@splitbrain.org> 70Syaroslav@ivinco.com */ 80Syaroslav@ivinco.com 90Syaroslav@ivinco.com 100Syaroslav@ivinco.com/* Initialization */ 110Syaroslav@ivinco.com 121Syaroslav@ivinco.comif(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../../'); 130Syaroslav@ivinco.comif(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 140Syaroslav@ivinco.com 150Syaroslav@ivinco.comrequire_once(DOKU_INC.'inc/init.php'); 160Syaroslav@ivinco.comrequire_once(DOKU_INC.'inc/common.php'); 170Syaroslav@ivinco.comrequire_once(DOKU_INC.'inc/events.php'); 180Syaroslav@ivinco.comrequire_once(DOKU_INC.'inc/parserutils.php'); 190Syaroslav@ivinco.comrequire_once(DOKU_INC.'inc/feedcreator.class.php'); 200Syaroslav@ivinco.comrequire_once(DOKU_INC.'inc/auth.php'); 210Syaroslav@ivinco.comrequire_once(DOKU_INC.'inc/pageutils.php'); 220Syaroslav@ivinco.comrequire_once(DOKU_INC.'inc/search.php'); 234Syaroslav@ivinco.comrequire_once(DOKU_INC.'inc/parser/parser.php'); 244Syaroslav@ivinco.com 250Syaroslav@ivinco.com 260Syaroslav@ivinco.comrequire_once(DOKU_PLUGIN.'sphinxsearch/PageMapper.php'); 27*6Syaroslav@ivinco.comrequire_once(DOKU_PLUGIN.'sphinxsearch/functions.php'); 280Syaroslav@ivinco.com 291Syaroslav@ivinco.comif (!file_exists(DOKU_INC.$conf['savedir']."/sphinxsearch/")){ 301Syaroslav@ivinco.com mkdir(DOKU_INC.$conf['savedir']."/sphinxsearch/"); 311Syaroslav@ivinco.com} 321Syaroslav@ivinco.com 330Syaroslav@ivinco.com$pagesList = getPagesList(); 340Syaroslav@ivinco.com 350Syaroslav@ivinco.comecho '<?xml version="1.0" encoding="utf-8"?> 360Syaroslav@ivinco.com<sphinx:docset> 370Syaroslav@ivinco.com 380Syaroslav@ivinco.com<sphinx:schema> 390Syaroslav@ivinco.com<sphinx:field name="title"/> 400Syaroslav@ivinco.com<sphinx:field name="body"/> 410Syaroslav@ivinco.com<sphinx:field name="categories"/> 424Syaroslav@ivinco.com<sphinx:field name="level"/> 430Syaroslav@ivinco.com<sphinx:field name="modified"/> 440Syaroslav@ivinco.com<sphinx:field name="creator"/> 454Syaroslav@ivinco.com<sphinx:attr name="level" type="int" bits="8" default="1"/> 460Syaroslav@ivinco.com</sphinx:schema> 470Syaroslav@ivinco.com'; 480Syaroslav@ivinco.com 490Syaroslav@ivinco.com$pageMapper = new PageMapper(); 500Syaroslav@ivinco.com 510Syaroslav@ivinco.comforeach($pagesList as $row){ 520Syaroslav@ivinco.com $dokuPageId = $row['id']; 530Syaroslav@ivinco.com //get meta data 544Syaroslav@ivinco.com $metadata = p_get_metadata($dokuPageId); 554Syaroslav@ivinco.com $sections = getDocumentsByHeadings($dokuPageId, $metadata); 564Syaroslav@ivinco.com if (!empty($sections)){ 574Syaroslav@ivinco.com foreach($sections as $hid => $section){ 584Syaroslav@ivinco.com //parse meta data for headers, abstract, date, authors 594Syaroslav@ivinco.com $data = array(); 604Syaroslav@ivinco.com $data['id'] = crc32($dokuPageId.$hid); 614Syaroslav@ivinco.com $data['categories'] = getCategories($dokuPageId) . '#' . $hid; 624Syaroslav@ivinco.com $data['level'] = $section['level']; 634Syaroslav@ivinco.com $data['modified'] = $metadata['date']['modified']; 644Syaroslav@ivinco.com $data['creator'] = $metadata['creator']; 654Syaroslav@ivinco.com $data['title'] = strip_tags($section['title']); 664Syaroslav@ivinco.com $data['body'] = strip_tags(p_render('xhtml',p_get_instructions($section['section']),$info)); 670Syaroslav@ivinco.com 684Syaroslav@ivinco.com echo formatXml($data)."\n"; 694Syaroslav@ivinco.com $pageMapper->add($dokuPageId, $section['title'], $hid); 704Syaroslav@ivinco.com } 714Syaroslav@ivinco.com } else { 724Syaroslav@ivinco.com //parse meta data for headers, abstract, date, authors 734Syaroslav@ivinco.com $data = array(); 744Syaroslav@ivinco.com $data['id'] = crc32($dokuPageId); 754Syaroslav@ivinco.com $data['categories'] = getCategories($dokuPageId); 764Syaroslav@ivinco.com $data['level'] = 1; 774Syaroslav@ivinco.com $data['modified'] = $metadata['date']['modified']; 784Syaroslav@ivinco.com $data['creator'] = $metadata['creator']; 794Syaroslav@ivinco.com $data['title'] = strip_tags($metadata['title']); 804Syaroslav@ivinco.com $data['body'] = strip_tags(p_wiki_xhtml($dokuPageId,$metadata['date']['modified'],false)); 810Syaroslav@ivinco.com 824Syaroslav@ivinco.com echo formatXml($data)."\n"; 834Syaroslav@ivinco.com $pageMapper->add($dokuPageId, $metadata['title']); 844Syaroslav@ivinco.com } 850Syaroslav@ivinco.com} 860Syaroslav@ivinco.com 870Syaroslav@ivinco.comecho '</sphinx:docset>'; 880Syaroslav@ivinco.com 890Syaroslav@ivinco.com 900Syaroslav@ivinco.com 910Syaroslav@ivinco.com 920Syaroslav@ivinco.com 930Syaroslav@ivinco.com/** 940Syaroslav@ivinco.com * Array 950Syaroslav@ivinco.com( 960Syaroslav@ivinco.com [date] => Array 970Syaroslav@ivinco.com ( 980Syaroslav@ivinco.com [created] => 1239181434 990Syaroslav@ivinco.com [modified] => 1239202933 1000Syaroslav@ivinco.com ) 1010Syaroslav@ivinco.com 1020Syaroslav@ivinco.com [creator] => Sergey Nikolaev 1030Syaroslav@ivinco.com [last_change] => Array 1040Syaroslav@ivinco.com ( 1050Syaroslav@ivinco.com [date] => 1239202933 1060Syaroslav@ivinco.com [ip] => 85.118.229.162 1070Syaroslav@ivinco.com [type] => E 1080Syaroslav@ivinco.com [id] => cal:minutes:boardreader:200904:20090408 1090Syaroslav@ivinco.com [user] => snikolaev 1100Syaroslav@ivinco.com [sum] => 1110Syaroslav@ivinco.com [extra] => 1120Syaroslav@ivinco.com ) 1130Syaroslav@ivinco.com 1140Syaroslav@ivinco.com [contributor] => Array 1150Syaroslav@ivinco.com ( 1160Syaroslav@ivinco.com [snikolaev] => Sergey Nikolaev 1170Syaroslav@ivinco.com ) 1180Syaroslav@ivinco.com 1190Syaroslav@ivinco.com [title] => BoardReader call of Apr 8 2009 1200Syaroslav@ivinco.com [description] => Array 1210Syaroslav@ivinco.com ( 1220Syaroslav@ivinco.com [tableofcontents] => Array 1230Syaroslav@ivinco.com ( 1240Syaroslav@ivinco.com [0] => Array 1250Syaroslav@ivinco.com ( 1260Syaroslav@ivinco.com [hid] => boardreader_call_of_apr_8_2009 1270Syaroslav@ivinco.com [title] => BoardReader call of Apr 8 2009 1280Syaroslav@ivinco.com [type] => ul 1290Syaroslav@ivinco.com [level] => 1 1300Syaroslav@ivinco.com ) 1310Syaroslav@ivinco.com 1320Syaroslav@ivinco.com [1] => Array 1330Syaroslav@ivinco.com ( 1340Syaroslav@ivinco.com [hid] => sergey 1350Syaroslav@ivinco.com [title] => Sergey 1360Syaroslav@ivinco.com [type] => ul 1370Syaroslav@ivinco.com [level] => 2 1380Syaroslav@ivinco.com ) 1390Syaroslav@ivinco.com 1400Syaroslav@ivinco.com [2] => Array 1410Syaroslav@ivinco.com ( 1420Syaroslav@ivinco.com [hid] => slava 1430Syaroslav@ivinco.com [title] => Slava 1440Syaroslav@ivinco.com [type] => ul 1450Syaroslav@ivinco.com [level] => 2 1460Syaroslav@ivinco.com ) 1470Syaroslav@ivinco.com 1480Syaroslav@ivinco.com [3] => Array 1490Syaroslav@ivinco.com ( 1500Syaroslav@ivinco.com [hid] => roman 1510Syaroslav@ivinco.com [title] => Roman 1520Syaroslav@ivinco.com [type] => ul 1530Syaroslav@ivinco.com [level] => 2 1540Syaroslav@ivinco.com ) 1550Syaroslav@ivinco.com 1560Syaroslav@ivinco.com [4] => Array 1570Syaroslav@ivinco.com ( 1580Syaroslav@ivinco.com [hid] => nikita 1590Syaroslav@ivinco.com [title] => Nikita 1600Syaroslav@ivinco.com [type] => ul 1610Syaroslav@ivinco.com [level] => 2 1620Syaroslav@ivinco.com ) 1630Syaroslav@ivinco.com 1640Syaroslav@ivinco.com [5] => Array 1650Syaroslav@ivinco.com ( 1660Syaroslav@ivinco.com [hid] => discussion 1670Syaroslav@ivinco.com [title] => Discussion 1680Syaroslav@ivinco.com [type] => ul 1690Syaroslav@ivinco.com [level] => 2 1700Syaroslav@ivinco.com ) 1710Syaroslav@ivinco.com 1720Syaroslav@ivinco.com ) 1730Syaroslav@ivinco.com 1740Syaroslav@ivinco.com [abstract] => Participants: Mindaugas, Sergey, Slava, Roman, Nikita 1750Syaroslav@ivinco.com 1760Syaroslav@ivinco.comDuration: 23 min 1770Syaroslav@ivinco.com 1780Syaroslav@ivinco.comSergey 1790Syaroslav@ivinco.com 1800Syaroslav@ivinco.comStatus: 1810Syaroslav@ivinco.com 1820Syaroslav@ivinco.com * published Roman's changes 1830Syaroslav@ivinco.com * started reviewing Slava's changes 1840Syaroslav@ivinco.com 1850Syaroslav@ivinco.com 1860Syaroslav@ivinco.comPlans: 1870Syaroslav@ivinco.com 1880Syaroslav@ivinco.com * start altering (singature field) 1890Syaroslav@ivinco.com * select server error handling 1900Syaroslav@ivinco.com * publish Slava's and Roman's changes 1910Syaroslav@ivinco.com ) 1920Syaroslav@ivinco.com 1930Syaroslav@ivinco.com [internal] => Array 1940Syaroslav@ivinco.com ( 1950Syaroslav@ivinco.com [cache] => 1 1960Syaroslav@ivinco.com [toc] => 1 1970Syaroslav@ivinco.com ) 1980Syaroslav@ivinco.com 1990Syaroslav@ivinco.com) 2000Syaroslav@ivinco.com 2010Syaroslav@ivinco.com */ 2020Syaroslav@ivinco.com 203