16b13307fSandi<?php 26b13307fSandi/** 36b13307fSandi * DokuWiki Actions 46b13307fSandi * 56b13307fSandi * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 66b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 76b13307fSandi */ 86b13307fSandi 9fa8adffeSAndreas Gohrif(!defined('DOKU_INC')) die('meh.'); 10af182434Sandi 116b13307fSandi/** 126b13307fSandi * Call the needed action handlers 136b13307fSandi * 146b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 15c9570649SAndreas Gohr * @triggers ACTION_ACT_PREPROCESS 16c9570649SAndreas Gohr * @triggers ACTION_HEADERS_SEND 176b13307fSandi */ 186b13307fSandifunction act_dispatch(){ 196b13307fSandi global $ACT; 206b13307fSandi global $ID; 2124ea6500SAndreas Gohr global $INFO; 226b13307fSandi global $QUERY; 23585bf44eSChristopher Smith /* @var Input $INPUT */ 2490f1b7bdSTom N Harris global $INPUT; 256b13307fSandi global $lang; 2685dcda20SRobin Getz global $conf; 276b13307fSandi 2869cd1e27SAndreas Gohr $preact = $ACT; 2969cd1e27SAndreas Gohr 30c2e830f2Schris // give plugins an opportunity to process the action 3124bb549bSchris $evt = new Doku_Event('ACTION_ACT_PREPROCESS',$ACT); 32*844aec66SMichael Große 33*844aec66SMichael Große $headers = array(); 3424bb549bSchris if ($evt->advise_before()) { 35c2e830f2Schris 36af182434Sandi //sanitize $ACT 3762baad0fSMartin Doucha $ACT = act_validate($ACT); 38af182434Sandi 39b8957367SBenjamin Gilbert //check if searchword was given - else just show 400868021bSAndreas Gohr $s = cleanID($QUERY); 410868021bSAndreas Gohr if($ACT == 'search' && empty($s)){ 42b8957367SBenjamin Gilbert $ACT = 'show'; 43b8957367SBenjamin Gilbert } 44b8957367SBenjamin Gilbert 45b8957367SBenjamin Gilbert //login stuff 461b2a85e8SAndreas Gohr if(in_array($ACT,array('login','logout'))){ 47b8957367SBenjamin Gilbert $ACT = act_auth($ACT); 481b2a85e8SAndreas Gohr } 49b8957367SBenjamin Gilbert 501380fc45SAndreas Gohr //check if user is asking to (un)subscribe a page 515b75cd1fSAdrian Lang if($ACT == 'subscribe') { 525b75cd1fSAdrian Lang try { 531380fc45SAndreas Gohr $ACT = act_subscription($ACT); 545b75cd1fSAdrian Lang } catch (Exception $e) { 555b75cd1fSAdrian Lang msg($e->getMessage(), -1); 565b75cd1fSAdrian Lang } 575b75cd1fSAdrian Lang } 5852b0dd67SGuy Brand 595381a7eeSElan Ruusamäe //display some info 604064e2d3SRobin Getz if($ACT == 'check'){ 614064e2d3SRobin Getz check(); 624064e2d3SRobin Getz $ACT = 'show'; 634064e2d3SRobin Getz } 644064e2d3SRobin Getz 656b13307fSandi //check permissions 666b13307fSandi $ACT = act_permcheck($ACT); 676b13307fSandi 68c4f79b71SMichael Hamann //sitemap 69eae17177SMichael Hamann if ($ACT == 'sitemap'){ 70c8b076b1SMichael Hamann act_sitemap($ACT); 71eae17177SMichael Hamann } 72c4f79b71SMichael Hamann 733c94d07bSAnika Henke //recent changes 743c94d07bSAnika Henke if ($ACT == 'recent'){ 753c94d07bSAnika Henke $show_changes = $INPUT->str('show_changes'); 763c94d07bSAnika Henke if (!empty($show_changes)) { 773c94d07bSAnika Henke set_doku_pref('show_changes', $show_changes); 783c94d07bSAnika Henke } 793c94d07bSAnika Henke } 803c94d07bSAnika Henke 813c94d07bSAnika Henke //diff 823c94d07bSAnika Henke if ($ACT == 'diff'){ 833c94d07bSAnika Henke $difftype = $INPUT->str('difftype'); 843c94d07bSAnika Henke if (!empty($difftype)) { 853c94d07bSAnika Henke set_doku_pref('difftype', $difftype); 863c94d07bSAnika Henke } 873c94d07bSAnika Henke } 883c94d07bSAnika Henke 89b8957367SBenjamin Gilbert //register 90eea0f0d0SAndreas Gohr if($ACT == 'register' && $INPUT->post->bool('save') && register()){ 91b8957367SBenjamin Gilbert $ACT = 'login'; 92b8957367SBenjamin Gilbert } 936b13307fSandi 948b06d178Schris if ($ACT == 'resendpwd' && act_resendpwd()) { 958b06d178Schris $ACT = 'login'; 968b06d178Schris } 978b06d178Schris 982a7abf2dSChristopher Smith // user profile changes 992a7abf2dSChristopher Smith if (in_array($ACT, array('profile','profile_delete'))) { 100585bf44eSChristopher Smith if(!$INPUT->server->str('REMOTE_USER')) { 10125b2a98cSMichael Klier $ACT = 'login'; 10225b2a98cSMichael Klier } else { 1032a7abf2dSChristopher Smith switch ($ACT) { 1042a7abf2dSChristopher Smith case 'profile' : 10525b2a98cSMichael Klier if(updateprofile()) { 1064cb79657SMatthias Grimm msg($lang['profchanged'],1); 1074cb79657SMatthias Grimm $ACT = 'show'; 1088b06d178Schris } 1092a7abf2dSChristopher Smith break; 1102a7abf2dSChristopher Smith case 'profile_delete' : 1112a7abf2dSChristopher Smith if(auth_deleteprofile()){ 1122a7abf2dSChristopher Smith msg($lang['profdeleted'],1); 1132a7abf2dSChristopher Smith $ACT = 'show'; 1142a7abf2dSChristopher Smith } else { 1152a7abf2dSChristopher Smith $ACT = 'profile'; 1162a7abf2dSChristopher Smith } 1172a7abf2dSChristopher Smith break; 1182a7abf2dSChristopher Smith } 11925b2a98cSMichael Klier } 12025b2a98cSMichael Klier } 1218b06d178Schris 1221246e016SAndreas Gohr //revert 1231246e016SAndreas Gohr if($ACT == 'revert'){ 1241246e016SAndreas Gohr if(checkSecurityToken()){ 1251246e016SAndreas Gohr $ACT = act_revert($ACT); 1261246e016SAndreas Gohr }else{ 1271246e016SAndreas Gohr $ACT = 'show'; 1281246e016SAndreas Gohr } 1291246e016SAndreas Gohr } 1301246e016SAndreas Gohr 1316b13307fSandi //save 1321b2a85e8SAndreas Gohr if($ACT == 'save'){ 1331b2a85e8SAndreas Gohr if(checkSecurityToken()){ 1346b13307fSandi $ACT = act_save($ACT); 1351b2a85e8SAndreas Gohr }else{ 1368071beaaSAndreas Gohr $ACT = 'preview'; 1371b2a85e8SAndreas Gohr } 1381b2a85e8SAndreas Gohr } 1396b13307fSandi 140067c5d22SBen Coburn //cancel conflicting edit 141067c5d22SBen Coburn if($ACT == 'cancel') 142067c5d22SBen Coburn $ACT = 'show'; 143067c5d22SBen Coburn 144ee4c4a1bSAndreas Gohr //draft deletion 145ee4c4a1bSAndreas Gohr if($ACT == 'draftdel') 146ee4c4a1bSAndreas Gohr $ACT = act_draftdel($ACT); 147ee4c4a1bSAndreas Gohr 148ee4c4a1bSAndreas Gohr //draft saving on preview 149*844aec66SMichael Große if($ACT == 'preview') { 150*844aec66SMichael Große $headers[] = "X-XSS-Protection: 0"; 151ee4c4a1bSAndreas Gohr $ACT = act_draftsave($ACT); 152*844aec66SMichael Große } 153ee4c4a1bSAndreas Gohr 1546b13307fSandi //edit 155c9d5430bSAdrian Lang if(in_array($ACT, array('edit', 'preview', 'recover'))) { 156af182434Sandi $ACT = act_edit($ACT); 1576b13307fSandi }else{ 1586b13307fSandi unlock($ID); //try to unlock 1596b13307fSandi } 1606b13307fSandi 1616b13307fSandi //handle export 162ac83b9d8Sandi if(substr($ACT,0,7) == 'export_') 1636b13307fSandi $ACT = act_export($ACT); 1646b13307fSandi 165c19fe9c0Sandi //handle admin tasks 166c19fe9c0Sandi if($ACT == 'admin'){ 16711e2ce22Schris // retrieve admin plugin name from $_REQUEST['page'] 16890f1b7bdSTom N Harris if (($page = $INPUT->str('page', '', true)) != '') { 169a61966c5SChristopher Smith /** @var $plugin DokuWiki_Admin_Plugin */ 170a61966c5SChristopher Smith if ($plugin = plugin_getRequestAdminPlugin()){ 17111e2ce22Schris $plugin->handle(); 17211e2ce22Schris } 17311e2ce22Schris } 174c19fe9c0Sandi } 1755f312bacSAndreas Gohr 1765f312bacSAndreas Gohr // check permissions again - the action may have changed 1775f312bacSAndreas Gohr $ACT = act_permcheck($ACT); 17824bb549bSchris } // end event ACTION_ACT_PREPROCESS default action 17924bb549bSchris $evt->advise_after(); 18085dcda20SRobin Getz // Make sure plugs can handle 'denied' 18185dcda20SRobin Getz if($conf['send404'] && $ACT == 'denied') { 1829d2e1be6SAndreas Gohr http_status(403); 18385dcda20SRobin Getz } 18424bb549bSchris unset($evt); 185c19fe9c0Sandi 18646c0ed74SMichael Hamann // when action 'show', the intial not 'show' and POST, do a redirect 187585bf44eSChristopher Smith if($ACT == 'show' && $preact != 'show' && strtolower($INPUT->server->str('REQUEST_METHOD')) == 'post'){ 18869cd1e27SAndreas Gohr act_redirect($ID,$preact); 18969cd1e27SAndreas Gohr } 1905f312bacSAndreas Gohr 191c346111aSAdrian Lang global $INFO; 192c346111aSAdrian Lang global $conf; 193c346111aSAdrian Lang global $license; 194c346111aSAdrian Lang 1956b13307fSandi //call template FIXME: all needed vars available? 196f63a2007Schris $headers[] = 'Content-Type: text/html; charset=utf-8'; 197746855cfSBen Coburn trigger_event('ACTION_HEADERS_SEND',$headers,'act_sendheaders'); 198f63a2007Schris 1995a892029SAndreas Gohr include(template('main.php')); 200c19fe9c0Sandi // output for the commands is now handled in inc/templates.php 201c19fe9c0Sandi // in function tpl_content() 2026b13307fSandi} 2036b13307fSandi 204c8b076b1SMichael Hamann/** 205c8b076b1SMichael Hamann * Send the given headers using header() 206c8b076b1SMichael Hamann * 207c8b076b1SMichael Hamann * @param array $headers The headers that shall be sent 208c8b076b1SMichael Hamann */ 209f63a2007Schrisfunction act_sendheaders($headers) { 210f63a2007Schris foreach ($headers as $hdr) header($hdr); 211f63a2007Schris} 212f63a2007Schris 2136b13307fSandi/** 214af182434Sandi * Sanitize the action command 215af182434Sandi * 216af182434Sandi * @author Andreas Gohr <andi@splitbrain.org> 21742ea7f44SGerrit Uitslag * 21842ea7f44SGerrit Uitslag * @param array|string $act 21942ea7f44SGerrit Uitslag * @return string 220af182434Sandi */ 221af182434Sandifunction act_clean($act){ 222ee4c4a1bSAndreas Gohr // check if the action was given as array key 223ee4c4a1bSAndreas Gohr if(is_array($act)){ 224ee4c4a1bSAndreas Gohr list($act) = array_keys($act); 225ee4c4a1bSAndreas Gohr } 226ee4c4a1bSAndreas Gohr 227ac83b9d8Sandi //remove all bad chars 228ac83b9d8Sandi $act = strtolower($act); 2292d5ccb39SAndreas Gohr $act = preg_replace('/[^1-9a-z_]+/','',$act); 230ac83b9d8Sandi 231ac83b9d8Sandi if($act == 'export_html') $act = 'export_xhtml'; 232cc2ae802SAndreas Gohr if($act == 'export_htmlbody') $act = 'export_xhtmlbody'; 233b146b32bSandi 234396c218fSAndreas Gohr if($act === '') $act = 'show'; 23562baad0fSMartin Doucha return $act; 23662baad0fSMartin Doucha} 23762baad0fSMartin Doucha 23862baad0fSMartin Doucha/** 23962baad0fSMartin Doucha * Sanitize and validate action commands. 24062baad0fSMartin Doucha * 24162baad0fSMartin Doucha * Add all allowed commands here. 24262baad0fSMartin Doucha * 24362baad0fSMartin Doucha * @author Andreas Gohr <andi@splitbrain.org> 24442ea7f44SGerrit Uitslag * 24542ea7f44SGerrit Uitslag * @param array|string $act 24642ea7f44SGerrit Uitslag * @return string 24762baad0fSMartin Doucha */ 24862baad0fSMartin Douchafunction act_validate($act) { 249daf0cdbaSMartin Doucha global $conf; 250daf0cdbaSMartin Doucha global $INFO; 251daf0cdbaSMartin Doucha 25262baad0fSMartin Doucha $act = act_clean($act); 253396c218fSAndreas Gohr 254409d7af7SAndreas Gohr // check if action is disabled 255409d7af7SAndreas Gohr if(!actionOK($act)){ 256409d7af7SAndreas Gohr msg('Command disabled: '.htmlspecialchars($act),-1); 257409d7af7SAndreas Gohr return 'show'; 258409d7af7SAndreas Gohr } 259409d7af7SAndreas Gohr 26060e6b550SAndreas Gohr //disable all acl related commands if ACL is disabled 26160e6b550SAndreas Gohr if(!$conf['useacl'] && in_array($act,array('login','logout','register','admin', 2621246e016SAndreas Gohr 'subscribe','unsubscribe','profile','revert', 2632a7abf2dSChristopher Smith 'resendpwd','profile_delete'))){ 26460e6b550SAndreas Gohr msg('Command unavailable: '.htmlspecialchars($act),-1); 26560e6b550SAndreas Gohr return 'show'; 26660e6b550SAndreas Gohr } 26760e6b550SAndreas Gohr 268c828a5d6SAndreas Gohr //is there really a draft? 269c828a5d6SAndreas Gohr if($act == 'draft' && !file_exists($INFO['draft'])) return 'edit'; 270c828a5d6SAndreas Gohr 271067c5d22SBen Coburn if(!in_array($act,array('login','logout','register','save','cancel','edit','draft', 272ac83b9d8Sandi 'preview','search','show','check','index','revisions', 2731246e016SAndreas Gohr 'diff','recent','backlink','admin','subscribe','revert', 2742a7abf2dSChristopher Smith 'unsubscribe','profile','profile_delete','resendpwd','recover', 275d5a9514cSAdrian Lang 'draftdel','sitemap','media')) && substr($act,0,7) != 'export_' ) { 276ee4c4a1bSAndreas Gohr msg('Command unknown: '.htmlspecialchars($act),-1); 277af182434Sandi return 'show'; 278af182434Sandi } 279af182434Sandi return $act; 280af182434Sandi} 281af182434Sandi 282af182434Sandi/** 2836b13307fSandi * Run permissionchecks 2846b13307fSandi * 2856b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 28642ea7f44SGerrit Uitslag * 28742ea7f44SGerrit Uitslag * @param string $act action command 28842ea7f44SGerrit Uitslag * @return string action command 2896b13307fSandi */ 2906b13307fSandifunction act_permcheck($act){ 291dbbc6aa7Sandi global $INFO; 292dbbc6aa7Sandi 293ee4c4a1bSAndreas Gohr if(in_array($act,array('save','preview','edit','recover'))){ 2946b13307fSandi if($INFO['exists']){ 295bdbc16bfSandi if($act == 'edit'){ 296bdbc16bfSandi //the edit function will check again and do a source show 297bdbc16bfSandi //when no AUTH_EDIT available 298bdbc16bfSandi $permneed = AUTH_READ; 299bdbc16bfSandi }else{ 3006b13307fSandi $permneed = AUTH_EDIT; 301bdbc16bfSandi } 3026b13307fSandi }else{ 3036b13307fSandi $permneed = AUTH_CREATE; 3046b13307fSandi } 3052a7abf2dSChristopher Smith }elseif(in_array($act,array('login','search','recent','profile','profile_delete','index', 'sitemap'))){ 3066b13307fSandi $permneed = AUTH_NONE; 3071246e016SAndreas Gohr }elseif($act == 'revert'){ 3081246e016SAndreas Gohr $permneed = AUTH_ADMIN; 3091246e016SAndreas Gohr if($INFO['ismanager']) $permneed = AUTH_EDIT; 3105e199953Smatthiasgrimm }elseif($act == 'register'){ 3115e199953Smatthiasgrimm $permneed = AUTH_NONE; 312ebd3d9ceSchris }elseif($act == 'resendpwd'){ 313ebd3d9ceSchris $permneed = AUTH_NONE; 314c19fe9c0Sandi }elseif($act == 'admin'){ 315f8cc712eSAndreas Gohr if($INFO['ismanager']){ 316f8cc712eSAndreas Gohr // if the manager has the needed permissions for a certain admin 317f8cc712eSAndreas Gohr // action is checked later 318f8cc712eSAndreas Gohr $permneed = AUTH_READ; 319f8cc712eSAndreas Gohr }else{ 320c19fe9c0Sandi $permneed = AUTH_ADMIN; 321f8cc712eSAndreas Gohr } 3226b13307fSandi }else{ 3236b13307fSandi $permneed = AUTH_READ; 3246b13307fSandi } 325dbbc6aa7Sandi if($INFO['perm'] >= $permneed) return $act; 326dbbc6aa7Sandi 3276b13307fSandi return 'denied'; 3286b13307fSandi} 3296b13307fSandi 3306b13307fSandi/** 331ee4c4a1bSAndreas Gohr * Handle 'draftdel' 332ee4c4a1bSAndreas Gohr * 333ee4c4a1bSAndreas Gohr * Deletes the draft for the current page and user 33442ea7f44SGerrit Uitslag * 33542ea7f44SGerrit Uitslag * @param string $act action command 33642ea7f44SGerrit Uitslag * @return string action command 337ee4c4a1bSAndreas Gohr */ 338ee4c4a1bSAndreas Gohrfunction act_draftdel($act){ 339ee4c4a1bSAndreas Gohr global $INFO; 340ee4c4a1bSAndreas Gohr @unlink($INFO['draft']); 341ee4c4a1bSAndreas Gohr $INFO['draft'] = null; 342ee4c4a1bSAndreas Gohr return 'show'; 343ee4c4a1bSAndreas Gohr} 344ee4c4a1bSAndreas Gohr 345ee4c4a1bSAndreas Gohr/** 346ee4c4a1bSAndreas Gohr * Saves a draft on preview 347ee4c4a1bSAndreas Gohr * 348ee4c4a1bSAndreas Gohr * @todo this currently duplicates code from ajax.php :-/ 34942ea7f44SGerrit Uitslag * 35042ea7f44SGerrit Uitslag * @param string $act action command 35142ea7f44SGerrit Uitslag * @return string action command 352ee4c4a1bSAndreas Gohr */ 353ee4c4a1bSAndreas Gohrfunction act_draftsave($act){ 354ee4c4a1bSAndreas Gohr global $INFO; 355ee4c4a1bSAndreas Gohr global $ID; 35690f1b7bdSTom N Harris global $INPUT; 357ee4c4a1bSAndreas Gohr global $conf; 35890f1b7bdSTom N Harris if($conf['usedraft'] && $INPUT->post->has('wikitext')) { 359ee4c4a1bSAndreas Gohr $draft = array('id' => $ID, 36090f1b7bdSTom N Harris 'prefix' => substr($INPUT->post->str('prefix'), 0, -1), 36190f1b7bdSTom N Harris 'text' => $INPUT->post->str('wikitext'), 36290f1b7bdSTom N Harris 'suffix' => $INPUT->post->str('suffix'), 36390f1b7bdSTom N Harris 'date' => $INPUT->post->int('date'), 364ee4c4a1bSAndreas Gohr 'client' => $INFO['client'], 365ee4c4a1bSAndreas Gohr ); 366ee4c4a1bSAndreas Gohr $cname = getCacheName($draft['client'].$ID,'.draft'); 367ee4c4a1bSAndreas Gohr if(io_saveFile($cname,serialize($draft))){ 368ee4c4a1bSAndreas Gohr $INFO['draft'] = $cname; 369ee4c4a1bSAndreas Gohr } 370ee4c4a1bSAndreas Gohr } 371ee4c4a1bSAndreas Gohr return $act; 372ee4c4a1bSAndreas Gohr} 373ee4c4a1bSAndreas Gohr 374ee4c4a1bSAndreas Gohr/** 3756b13307fSandi * Handle 'save' 3766b13307fSandi * 3776b13307fSandi * Checks for spam and conflicts and saves the page. 3786b13307fSandi * Does a redirect to show the page afterwards or 3796b13307fSandi * returns a new action. 3806b13307fSandi * 3816b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 38242ea7f44SGerrit Uitslag * 38342ea7f44SGerrit Uitslag * @param string $act action command 38442ea7f44SGerrit Uitslag * @return string action command 3856b13307fSandi */ 3866b13307fSandifunction act_save($act){ 3876b13307fSandi global $ID; 3886b13307fSandi global $DATE; 3896b13307fSandi global $PRE; 3906b13307fSandi global $TEXT; 3916b13307fSandi global $SUF; 3926b13307fSandi global $SUM; 3935a932e77SAdrian Lang global $lang; 3948d67c48aSAdrian Lang global $INFO; 39590f1b7bdSTom N Harris global $INPUT; 3966b13307fSandi 3976b13307fSandi //spam check 3985a932e77SAdrian Lang if(checkwordblock()) { 3995a932e77SAdrian Lang msg($lang['wordblock'], -1); 4005a932e77SAdrian Lang return 'edit'; 4015a932e77SAdrian Lang } 4028d67c48aSAdrian Lang //conflict check 4038d67c48aSAdrian Lang if($DATE != 0 && $INFO['meta']['date']['modified'] > $DATE ) 4046b13307fSandi return 'conflict'; 4056b13307fSandi 4066b13307fSandi //save it 407e0c26282SGerrit Uitslag saveWikiText($ID,con($PRE,$TEXT,$SUF,true),$SUM,$INPUT->bool('minor')); //use pretty mode for con 4086b13307fSandi //unlock it 4096b13307fSandi unlock($ID); 4106b13307fSandi 411ee4c4a1bSAndreas Gohr //delete draft 412ee4c4a1bSAndreas Gohr act_draftdel($act); 41369cd1e27SAndreas Gohr session_write_close(); 414ee4c4a1bSAndreas Gohr 41569cd1e27SAndreas Gohr // when done, show page 41669cd1e27SAndreas Gohr return 'show'; 41769cd1e27SAndreas Gohr} 418f951a474SAndreas Gohr 41914a122deSAndreas Gohr/** 4201246e016SAndreas Gohr * Revert to a certain revision 4211246e016SAndreas Gohr * 4221246e016SAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 42342ea7f44SGerrit Uitslag * 42442ea7f44SGerrit Uitslag * @param string $act action command 42542ea7f44SGerrit Uitslag * @return string action command 4261246e016SAndreas Gohr */ 4271246e016SAndreas Gohrfunction act_revert($act){ 4281246e016SAndreas Gohr global $ID; 4291246e016SAndreas Gohr global $REV; 4301246e016SAndreas Gohr global $lang; 431585bf44eSChristopher Smith /* @var Input $INPUT */ 432585bf44eSChristopher Smith global $INPUT; 433de4d479aSAdrian Lang // FIXME $INFO['writable'] currently refers to the attic version 434de4d479aSAdrian Lang // global $INFO; 435de4d479aSAdrian Lang // if (!$INFO['writable']) { 436de4d479aSAdrian Lang // return 'show'; 437de4d479aSAdrian Lang // } 4381246e016SAndreas Gohr 4391246e016SAndreas Gohr // when no revision is given, delete current one 4401246e016SAndreas Gohr // FIXME this feature is not exposed in the GUI currently 4411246e016SAndreas Gohr $text = ''; 4421246e016SAndreas Gohr $sum = $lang['deleted']; 4431246e016SAndreas Gohr if($REV){ 4441246e016SAndreas Gohr $text = rawWiki($ID,$REV); 4451246e016SAndreas Gohr if(!$text) return 'show'; //something went wrong 446d6b9c7bfSlupo49 $sum = sprintf($lang['restored'], dformat($REV)); 4471246e016SAndreas Gohr } 4481246e016SAndreas Gohr 4491246e016SAndreas Gohr // spam check 4505a932e77SAdrian Lang 4515a932e77SAdrian Lang if (checkwordblock($text)) { 4525a932e77SAdrian Lang msg($lang['wordblock'], -1); 4535a932e77SAdrian Lang return 'edit'; 4545a932e77SAdrian Lang } 4551246e016SAndreas Gohr 4561246e016SAndreas Gohr saveWikiText($ID,$text,$sum,false); 4571246e016SAndreas Gohr msg($sum,1); 4581246e016SAndreas Gohr 4591246e016SAndreas Gohr //delete any draft 4601246e016SAndreas Gohr act_draftdel($act); 4611246e016SAndreas Gohr session_write_close(); 4621246e016SAndreas Gohr 4631246e016SAndreas Gohr // when done, show current page 464585bf44eSChristopher Smith $INPUT->server->set('REQUEST_METHOD','post'); //should force a redirect 4651246e016SAndreas Gohr $REV = ''; 4661246e016SAndreas Gohr return 'show'; 4671246e016SAndreas Gohr} 4681246e016SAndreas Gohr 4691246e016SAndreas Gohr/** 47014a122deSAndreas Gohr * Do a redirect after receiving post data 47114a122deSAndreas Gohr * 47214a122deSAndreas Gohr * Tries to add the section id as hash mark after section editing 47342ea7f44SGerrit Uitslag * 47442ea7f44SGerrit Uitslag * @param string $id page id 47542ea7f44SGerrit Uitslag * @param string $preact action command before redirect 47614a122deSAndreas Gohr */ 47769cd1e27SAndreas Gohrfunction act_redirect($id,$preact){ 47869cd1e27SAndreas Gohr global $PRE; 47969cd1e27SAndreas Gohr global $TEXT; 480f951a474SAndreas Gohr 48169cd1e27SAndreas Gohr $opts = array( 48269cd1e27SAndreas Gohr 'id' => $id, 48369cd1e27SAndreas Gohr 'preact' => $preact 48469cd1e27SAndreas Gohr ); 485c66972f2SAdrian Lang //get section name when coming from section edit 486c66972f2SAdrian Lang if($PRE && preg_match('/^\s*==+([^=\n]+)/',$TEXT,$match)){ 487c66972f2SAdrian Lang $check = false; //Byref 488c66972f2SAdrian Lang $opts['fragment'] = sectionID($match[0], $check); 489c66972f2SAdrian Lang } 490c66972f2SAdrian Lang 49169cd1e27SAndreas Gohr trigger_event('ACTION_SHOW_REDIRECT',$opts,'act_redirect_execute'); 49269cd1e27SAndreas Gohr} 49369cd1e27SAndreas Gohr 494c8b076b1SMichael Hamann/** 495c8b076b1SMichael Hamann * Execute the redirect 496c8b076b1SMichael Hamann * 49742ea7f44SGerrit Uitslag * @param array $opts id and fragment for the redirect and the preact 498c8b076b1SMichael Hamann */ 49969cd1e27SAndreas Gohrfunction act_redirect_execute($opts){ 50069cd1e27SAndreas Gohr $go = wl($opts['id'],'',true); 501c66972f2SAdrian Lang if(isset($opts['fragment'])) $go .= '#'.$opts['fragment']; 50269cd1e27SAndreas Gohr 5036b13307fSandi //show it 504af2408d5SAndreas Gohr send_redirect($go); 5056b13307fSandi} 5066b13307fSandi 5076b13307fSandi/** 508b8957367SBenjamin Gilbert * Handle 'login', 'logout' 5096b13307fSandi * 5106b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 51142ea7f44SGerrit Uitslag * 51242ea7f44SGerrit Uitslag * @param string $act action command 51342ea7f44SGerrit Uitslag * @return string action command 5146b13307fSandi */ 5156b13307fSandifunction act_auth($act){ 51608eda5bcSmatthiasgrimm global $ID; 5177cace34dSAndreas Gohr global $INFO; 518585bf44eSChristopher Smith /* @var Input $INPUT */ 519585bf44eSChristopher Smith global $INPUT; 52008eda5bcSmatthiasgrimm 5216b13307fSandi //already logged in? 522585bf44eSChristopher Smith if($INPUT->server->has('REMOTE_USER') && $act=='login'){ 523ca12ce46SAndreas Gohr return 'show'; 5242288dc06SGuy Brand } 5256b13307fSandi 5266b13307fSandi //handle logout 5276b13307fSandi if($act=='logout'){ 52808eda5bcSmatthiasgrimm $lockedby = checklock($ID); //page still locked? 529585bf44eSChristopher Smith if($lockedby == $INPUT->server->str('REMOTE_USER')){ 53008eda5bcSmatthiasgrimm unlock($ID); //try to unlock 531585bf44eSChristopher Smith } 53208eda5bcSmatthiasgrimm 5337cace34dSAndreas Gohr // do the logout stuff 5346b13307fSandi auth_logoff(); 5357cace34dSAndreas Gohr 5367cace34dSAndreas Gohr // rebuild info array 5377cace34dSAndreas Gohr $INFO = pageinfo(); 5387cace34dSAndreas Gohr 539e16eccb7SGuy Brand act_redirect($ID,'login'); 5406b13307fSandi } 5416b13307fSandi 5426b13307fSandi return $act; 5436b13307fSandi} 5446b13307fSandi 5456b13307fSandi/** 54645a99335SAdrian Lang * Handle 'edit', 'preview', 'recover' 5476b13307fSandi * 5486b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 54942ea7f44SGerrit Uitslag * 55042ea7f44SGerrit Uitslag * @param string $act action command 55142ea7f44SGerrit Uitslag * @return string action command 5526b13307fSandi */ 5536b13307fSandifunction act_edit($act){ 554cd409024Sjorda global $ID; 555ee4c4a1bSAndreas Gohr global $INFO; 556cd409024Sjorda 55745a99335SAdrian Lang global $TEXT; 55845a99335SAdrian Lang global $RANGE; 55945a99335SAdrian Lang global $PRE; 56045a99335SAdrian Lang global $SUF; 56145a99335SAdrian Lang global $REV; 56245a99335SAdrian Lang global $SUM; 56345a99335SAdrian Lang global $lang; 56445a99335SAdrian Lang global $DATE; 56545a99335SAdrian Lang 56645a99335SAdrian Lang if (!isset($TEXT)) { 56745a99335SAdrian Lang if ($INFO['exists']) { 56845a99335SAdrian Lang if ($RANGE) { 56945a99335SAdrian Lang list($PRE,$TEXT,$SUF) = rawWikiSlices($RANGE,$ID,$REV); 57045a99335SAdrian Lang } else { 57145a99335SAdrian Lang $TEXT = rawWiki($ID,$REV); 57245a99335SAdrian Lang } 57345a99335SAdrian Lang } else { 574fe17917eSAdrian Lang $TEXT = pageTemplate($ID); 57545a99335SAdrian Lang } 57645a99335SAdrian Lang } 57745a99335SAdrian Lang 57845a99335SAdrian Lang //set summary default 57945a99335SAdrian Lang if(!$SUM){ 58045a99335SAdrian Lang if($REV){ 5817656ee3bSlupo49 $SUM = sprintf($lang['restored'], dformat($REV)); 58245a99335SAdrian Lang }elseif(!$INFO['exists']){ 58345a99335SAdrian Lang $SUM = $lang['created']; 58445a99335SAdrian Lang } 58545a99335SAdrian Lang } 58645a99335SAdrian Lang 5878d67c48aSAdrian Lang // Use the date of the newest revision, not of the revision we edit 5888d67c48aSAdrian Lang // This is used for conflict detection 58978035fe8SAndreas Gohr if(!$DATE) $DATE = @filemtime(wikiFN($ID)); 59045a99335SAdrian Lang 5916b13307fSandi //check if locked by anyone - if not lock for my self 59231bc8f11SMichael Hamann //do not lock when the user can't edit anyway 59331bc8f11SMichael Hamann if ($INFO['writable']) { 5946b13307fSandi $lockedby = checklock($ID); 5956b13307fSandi if($lockedby) return 'locked'; 5966b13307fSandi 5976b13307fSandi lock($ID); 59831bc8f11SMichael Hamann } 59931bc8f11SMichael Hamann 6006b13307fSandi return $act; 6016b13307fSandi} 6026b13307fSandi 6036b13307fSandi/** 604f6dad9fdSMichael Klier * Export a wiki page for various formats 605f6dad9fdSMichael Klier * 606f6dad9fdSMichael Klier * Triggers ACTION_EXPORT_POSTPROCESS 607f6dad9fdSMichael Klier * 608f6dad9fdSMichael Klier * Event data: 609f6dad9fdSMichael Klier * data['id'] -- page id 610f6dad9fdSMichael Klier * data['mode'] -- requested export mode 611f6dad9fdSMichael Klier * data['headers'] -- export headers 612f6dad9fdSMichael Klier * data['output'] -- export output 6136b13307fSandi * 6146b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 615f6dad9fdSMichael Klier * @author Michael Klier <chi@chimeric.de> 61642ea7f44SGerrit Uitslag * 61742ea7f44SGerrit Uitslag * @param string $act action command 61842ea7f44SGerrit Uitslag * @return string action command 6196b13307fSandi */ 6206b13307fSandifunction act_export($act){ 6216b13307fSandi global $ID; 6226b13307fSandi global $REV; 62385f8705cSAnika Henke global $conf; 62485f8705cSAnika Henke global $lang; 6256b13307fSandi 626f6dad9fdSMichael Klier $pre = ''; 627f6dad9fdSMichael Klier $post = ''; 628f6dad9fdSMichael Klier $headers = array(); 629cc2ae802SAndreas Gohr 630f6dad9fdSMichael Klier // search engines: never cache exported docs! (Google only currently) 631f6dad9fdSMichael Klier $headers['X-Robots-Tag'] = 'noindex'; 632f6dad9fdSMichael Klier 633ac83b9d8Sandi $mode = substr($act,7); 634f6dad9fdSMichael Klier switch($mode) { 635f6dad9fdSMichael Klier case 'raw': 6365adfc5afSAnika Henke $headers['Content-Type'] = 'text/plain; charset=utf-8'; 63766b23ce9SAndreas Gohr $headers['Content-Disposition'] = 'attachment; filename='.noNS($ID).'.txt'; 638f6dad9fdSMichael Klier $output = rawWiki($ID,$REV); 639f6dad9fdSMichael Klier break; 640f6dad9fdSMichael Klier case 'xhtml': 641c8839c22SAnika Henke $pre .= '<!DOCTYPE html>' . DOKU_LF; 642c8839c22SAnika Henke $pre .= '<html lang="'.$conf['lang'].'" dir="'.$lang['direction'].'">' . DOKU_LF; 643f6dad9fdSMichael Klier $pre .= '<head>' . DOKU_LF; 644c8839c22SAnika Henke $pre .= ' <meta charset="utf-8" />' . DOKU_LF; 645f6dad9fdSMichael Klier $pre .= ' <title>'.$ID.'</title>' . DOKU_LF; 646f6dad9fdSMichael Klier 647f6dad9fdSMichael Klier // get metaheaders 648f6dad9fdSMichael Klier ob_start(); 649f6dad9fdSMichael Klier tpl_metaheaders(); 650f6dad9fdSMichael Klier $pre .= ob_get_clean(); 651f6dad9fdSMichael Klier 652f6dad9fdSMichael Klier $pre .= '</head>' . DOKU_LF; 653f6dad9fdSMichael Klier $pre .= '<body>' . DOKU_LF; 654f6dad9fdSMichael Klier $pre .= '<div class="dokuwiki export">' . DOKU_LF; 655f6dad9fdSMichael Klier 656f6dad9fdSMichael Klier // get toc 657f6dad9fdSMichael Klier $pre .= tpl_toc(true); 658f6dad9fdSMichael Klier 659f6dad9fdSMichael Klier $headers['Content-Type'] = 'text/html; charset=utf-8'; 660f6dad9fdSMichael Klier $output = p_wiki_xhtml($ID,$REV,false); 661f6dad9fdSMichael Klier 662f6dad9fdSMichael Klier $post .= '</div>' . DOKU_LF; 663f6dad9fdSMichael Klier $post .= '</body>' . DOKU_LF; 664f6dad9fdSMichael Klier $post .= '</html>' . DOKU_LF; 665f6dad9fdSMichael Klier break; 666f6dad9fdSMichael Klier case 'xhtmlbody': 667f6dad9fdSMichael Klier $headers['Content-Type'] = 'text/html; charset=utf-8'; 668f6dad9fdSMichael Klier $output = p_wiki_xhtml($ID,$REV,false); 669f6dad9fdSMichael Klier break; 670f6dad9fdSMichael Klier default: 671b814e978SGerrit Uitslag $output = p_cached_output(wikiFN($ID,$REV), $mode, $ID); 6729acedd40SAndreas Gohr $headers = p_get_metadata($ID,"format $mode"); 673f6dad9fdSMichael Klier break; 674f6dad9fdSMichael Klier } 675f6dad9fdSMichael Klier 676f6dad9fdSMichael Klier // prepare event data 677f6dad9fdSMichael Klier $data = array(); 678f6dad9fdSMichael Klier $data['id'] = $ID; 679f6dad9fdSMichael Klier $data['mode'] = $mode; 680f6dad9fdSMichael Klier $data['headers'] = $headers; 681f6dad9fdSMichael Klier $data['output'] =& $output; 682f6dad9fdSMichael Klier 683f6dad9fdSMichael Klier trigger_event('ACTION_EXPORT_POSTPROCESS', $data); 684f6dad9fdSMichael Klier 685f6dad9fdSMichael Klier if(!empty($data['output'])){ 686f6dad9fdSMichael Klier if(is_array($data['headers'])) foreach($data['headers'] as $key => $val){ 68785767031SAndreas Gohr header("$key: $val"); 68885767031SAndreas Gohr } 689f6dad9fdSMichael Klier print $pre.$data['output'].$post; 6906b13307fSandi exit; 6916b13307fSandi } 6926b13307fSandi return 'show'; 6936b13307fSandi} 694340756e4Sandi 695b158d625SSteven Danz/** 696c4f79b71SMichael Hamann * Handle sitemap delivery 697c4f79b71SMichael Hamann * 698c4f79b71SMichael Hamann * @author Michael Hamann <michael@content-space.de> 69942ea7f44SGerrit Uitslag * 70042ea7f44SGerrit Uitslag * @param string $act action command 701c4f79b71SMichael Hamann */ 702c4f79b71SMichael Hamannfunction act_sitemap($act) { 703c4f79b71SMichael Hamann global $conf; 704c4f79b71SMichael Hamann 705eae17177SMichael Hamann if ($conf['sitemap'] < 1 || !is_numeric($conf['sitemap'])) { 7069d2e1be6SAndreas Gohr http_status(404); 707c4f79b71SMichael Hamann print "Sitemap generation is disabled."; 708c4f79b71SMichael Hamann exit; 709c4f79b71SMichael Hamann } 710c4f79b71SMichael Hamann 711eae17177SMichael Hamann $sitemap = Sitemapper::getFilePath(); 71265f6e7d6SMichael Hamann if (Sitemapper::sitemapIsCompressed()) { 713c4f79b71SMichael Hamann $mime = 'application/x-gzip'; 714c4f79b71SMichael Hamann }else{ 715c4f79b71SMichael Hamann $mime = 'application/xml; charset=utf-8'; 716c4f79b71SMichael Hamann } 717c4f79b71SMichael Hamann 718c4f79b71SMichael Hamann // Check if sitemap file exists, otherwise create it 719c4f79b71SMichael Hamann if (!is_readable($sitemap)) { 7202897eb23SMichael Hamann Sitemapper::generate(); 721c4f79b71SMichael Hamann } 722c4f79b71SMichael Hamann 723c4f79b71SMichael Hamann if (is_readable($sitemap)) { 724c4f79b71SMichael Hamann // Send headers 725c4f79b71SMichael Hamann header('Content-Type: '.$mime); 7263009a773SAndreas Gohr header('Content-Disposition: attachment; filename='.utf8_basename($sitemap)); 727c4f79b71SMichael Hamann 728eae17177SMichael Hamann http_conditionalRequest(filemtime($sitemap)); 729eae17177SMichael Hamann 730c4f79b71SMichael Hamann // Send file 731c4f79b71SMichael Hamann //use x-sendfile header to pass the delivery to compatible webservers 73240e0b444SDominik Eckelmann http_sendfile($sitemap); 733c4f79b71SMichael Hamann 734eae17177SMichael Hamann readfile($sitemap); 735c4f79b71SMichael Hamann exit; 736c4f79b71SMichael Hamann } 737c4f79b71SMichael Hamann 7389d2e1be6SAndreas Gohr http_status(500); 739eae17177SMichael Hamann print "Could not read the sitemap file - bad permissions?"; 740c4f79b71SMichael Hamann exit; 741c4f79b71SMichael Hamann} 742c4f79b71SMichael Hamann 743c4f79b71SMichael Hamann/** 7445b75cd1fSAdrian Lang * Handle page 'subscribe' 745b158d625SSteven Danz * 7465b75cd1fSAdrian Lang * Throws exception on error. 7475b75cd1fSAdrian Lang * 7485b75cd1fSAdrian Lang * @author Adrian Lang <lang@cosmocode.de> 74942ea7f44SGerrit Uitslag * 75042ea7f44SGerrit Uitslag * @param string $act action command 75142ea7f44SGerrit Uitslag * @return string action command 75242ea7f44SGerrit Uitslag * @throws Exception if (un)subscribing fails 753b158d625SSteven Danz */ 7541380fc45SAndreas Gohrfunction act_subscription($act){ 755056c2049SAndreas Gohr global $lang; 756056c2049SAndreas Gohr global $INFO; 757056c2049SAndreas Gohr global $ID; 758585bf44eSChristopher Smith /* @var Input $INPUT */ 75990f1b7bdSTom N Harris global $INPUT; 76052b0dd67SGuy Brand 7619fa341d0SAndreas Gohr // subcriptions work for logged in users only 762585bf44eSChristopher Smith if(!$INPUT->server->str('REMOTE_USER')) return 'show'; 7639fa341d0SAndreas Gohr 764056c2049SAndreas Gohr // get and preprocess data. 7658881fcc9SAdrian Lang $params = array(); 7668881fcc9SAdrian Lang foreach(array('target', 'style', 'action') as $param) { 76790f1b7bdSTom N Harris if ($INPUT->has("sub_$param")) { 76890f1b7bdSTom N Harris $params[$param] = $INPUT->str("sub_$param"); 7698881fcc9SAdrian Lang } 7708881fcc9SAdrian Lang } 7718881fcc9SAdrian Lang 772056c2049SAndreas Gohr // any action given? if not just return and show the subscription page 7730e80bb5eSChristopher Smith if(empty($params['action']) || !checkSecurityToken()) return $act; 774056c2049SAndreas Gohr 7758881fcc9SAdrian Lang // Handle POST data, may throw exception. 7768881fcc9SAdrian Lang trigger_event('ACTION_HANDLE_SUBSCRIBE', $params, 'subscription_handle_post'); 7778881fcc9SAdrian Lang 7788881fcc9SAdrian Lang $target = $params['target']; 7798881fcc9SAdrian Lang $style = $params['style']; 7808881fcc9SAdrian Lang $action = $params['action']; 7818881fcc9SAdrian Lang 7828881fcc9SAdrian Lang // Perform action. 783a0519fdaSAndreas Gohr $sub = new Subscription(); 784a0519fdaSAndreas Gohr if($action == 'unsubscribe'){ 785585bf44eSChristopher Smith $ok = $sub->remove($target, $INPUT->server->str('REMOTE_USER'), $style); 786a0519fdaSAndreas Gohr }else{ 787585bf44eSChristopher Smith $ok = $sub->add($target, $INPUT->server->str('REMOTE_USER'), $style); 788a0519fdaSAndreas Gohr } 789a0519fdaSAndreas Gohr 790a0519fdaSAndreas Gohr if($ok) { 791a0519fdaSAndreas Gohr msg(sprintf($lang["subscr_{$action}_success"], hsc($INFO['userinfo']['name']), 792a0519fdaSAndreas Gohr prettyprint_id($target)), 1); 793a0519fdaSAndreas Gohr act_redirect($ID, $act); 794a0519fdaSAndreas Gohr } else { 7958881fcc9SAdrian Lang throw new Exception(sprintf($lang["subscr_{$action}_error"], 7968881fcc9SAdrian Lang hsc($INFO['userinfo']['name']), 7978881fcc9SAdrian Lang prettyprint_id($target))); 7988881fcc9SAdrian Lang } 799cb3f9dbaSAdrian Lang 800cb3f9dbaSAdrian Lang // Assure that we have valid data if act_redirect somehow fails. 801a0519fdaSAndreas Gohr $INFO['subscribed'] = $sub->user_subscription(); 802cb3f9dbaSAdrian Lang return 'show'; 8038881fcc9SAdrian Lang} 8048881fcc9SAdrian Lang 8058881fcc9SAdrian Lang/** 8068881fcc9SAdrian Lang * Validate POST data 8078881fcc9SAdrian Lang * 8088881fcc9SAdrian Lang * Validates POST data for a subscribe or unsubscribe request. This is the 8098881fcc9SAdrian Lang * default action for the event ACTION_HANDLE_SUBSCRIBE. 8108881fcc9SAdrian Lang * 8118881fcc9SAdrian Lang * @author Adrian Lang <lang@cosmocode.de> 81242ea7f44SGerrit Uitslag * 81342ea7f44SGerrit Uitslag * @param array &$params the parameters: target, style and action 81442ea7f44SGerrit Uitslag * @throws Exception 8158881fcc9SAdrian Lang */ 8167a9add1cSAdrian Langfunction subscription_handle_post(&$params) { 8178881fcc9SAdrian Lang global $INFO; 8188881fcc9SAdrian Lang global $lang; 819585bf44eSChristopher Smith /* @var Input $INPUT */ 820585bf44eSChristopher Smith global $INPUT; 8218881fcc9SAdrian Lang 8225b75cd1fSAdrian Lang // Get and validate parameters. 8238881fcc9SAdrian Lang if (!isset($params['target'])) { 82415741132SAndreas Gohr throw new Exception('no subscription target given'); 8255b75cd1fSAdrian Lang } 8268881fcc9SAdrian Lang $target = $params['target']; 8275b75cd1fSAdrian Lang $valid_styles = array('every', 'digest'); 8285b75cd1fSAdrian Lang if (substr($target, -1, 1) === ':') { 8295b75cd1fSAdrian Lang // Allow “list” subscribe style since the target is a namespace. 8305b75cd1fSAdrian Lang $valid_styles[] = 'list'; 8315b75cd1fSAdrian Lang } 8328881fcc9SAdrian Lang $style = valid_input_set('style', $valid_styles, $params, 83315741132SAndreas Gohr 'invalid subscription style given'); 8348881fcc9SAdrian Lang $action = valid_input_set('action', array('subscribe', 'unsubscribe'), 83515741132SAndreas Gohr $params, 'invalid subscription action given'); 836613964ecSGuy Brand 8375b75cd1fSAdrian Lang // Check other conditions. 8385b75cd1fSAdrian Lang if ($action === 'subscribe') { 8395b75cd1fSAdrian Lang if ($INFO['userinfo']['mail'] === '') { 8405b75cd1fSAdrian Lang throw new Exception($lang['subscr_subscribe_noaddress']); 84152b0dd67SGuy Brand } 8425b75cd1fSAdrian Lang } elseif ($action === 'unsubscribe') { 8435b75cd1fSAdrian Lang $is = false; 8445b75cd1fSAdrian Lang foreach($INFO['subscribed'] as $subscr) { 8455b75cd1fSAdrian Lang if ($subscr['target'] === $target) { 8465b75cd1fSAdrian Lang $is = true; 84752b0dd67SGuy Brand } 84852b0dd67SGuy Brand } 8495b75cd1fSAdrian Lang if ($is === false) { 85015741132SAndreas Gohr throw new Exception(sprintf($lang['subscr_not_subscribed'], 851585bf44eSChristopher Smith $INPUT->server->str('REMOTE_USER'), 8525b75cd1fSAdrian Lang prettyprint_id($target))); 8535b75cd1fSAdrian Lang } 8545b75cd1fSAdrian Lang // subscription_set deletes a subscription if style = null. 8555b75cd1fSAdrian Lang $style = null; 85652b0dd67SGuy Brand } 85752b0dd67SGuy Brand 85816c665d9SAndreas Gohr $params = compact('target', 'style', 'action'); 85952b0dd67SGuy Brand} 86052b0dd67SGuy Brand 861e3776c06SMichael Hamann//Setup VIM: ex: et ts=2 : 862