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); 3224bb549bSchris if ($evt->advise_before()) { 33c2e830f2Schris 34af182434Sandi //sanitize $ACT 3562baad0fSMartin Doucha $ACT = act_validate($ACT); 36af182434Sandi 37b8957367SBenjamin Gilbert //check if searchword was given - else just show 380868021bSAndreas Gohr $s = cleanID($QUERY); 390868021bSAndreas Gohr if($ACT == 'search' && empty($s)){ 40b8957367SBenjamin Gilbert $ACT = 'show'; 41b8957367SBenjamin Gilbert } 42b8957367SBenjamin Gilbert 43b8957367SBenjamin Gilbert //login stuff 441b2a85e8SAndreas Gohr if(in_array($ACT,array('login','logout'))){ 45b8957367SBenjamin Gilbert $ACT = act_auth($ACT); 461b2a85e8SAndreas Gohr } 47b8957367SBenjamin Gilbert 481380fc45SAndreas Gohr //check if user is asking to (un)subscribe a page 495b75cd1fSAdrian Lang if($ACT == 'subscribe') { 505b75cd1fSAdrian Lang try { 511380fc45SAndreas Gohr $ACT = act_subscription($ACT); 525b75cd1fSAdrian Lang } catch (Exception $e) { 535b75cd1fSAdrian Lang msg($e->getMessage(), -1); 545b75cd1fSAdrian Lang } 555b75cd1fSAdrian Lang } 5652b0dd67SGuy Brand 575381a7eeSElan Ruusamäe //display some info 584064e2d3SRobin Getz if($ACT == 'check'){ 594064e2d3SRobin Getz check(); 604064e2d3SRobin Getz $ACT = 'show'; 614064e2d3SRobin Getz } 624064e2d3SRobin Getz 636b13307fSandi //check permissions 646b13307fSandi $ACT = act_permcheck($ACT); 656b13307fSandi 66c4f79b71SMichael Hamann //sitemap 67eae17177SMichael Hamann if ($ACT == 'sitemap'){ 68c8b076b1SMichael Hamann act_sitemap($ACT); 69eae17177SMichael Hamann } 70c4f79b71SMichael Hamann 713c94d07bSAnika Henke //recent changes 723c94d07bSAnika Henke if ($ACT == 'recent'){ 733c94d07bSAnika Henke $show_changes = $INPUT->str('show_changes'); 743c94d07bSAnika Henke if (!empty($show_changes)) { 753c94d07bSAnika Henke set_doku_pref('show_changes', $show_changes); 763c94d07bSAnika Henke } 773c94d07bSAnika Henke } 783c94d07bSAnika Henke 793c94d07bSAnika Henke //diff 803c94d07bSAnika Henke if ($ACT == 'diff'){ 813c94d07bSAnika Henke $difftype = $INPUT->str('difftype'); 823c94d07bSAnika Henke if (!empty($difftype)) { 833c94d07bSAnika Henke set_doku_pref('difftype', $difftype); 843c94d07bSAnika Henke } 853c94d07bSAnika Henke } 863c94d07bSAnika Henke 87b8957367SBenjamin Gilbert //register 88eea0f0d0SAndreas Gohr if($ACT == 'register' && $INPUT->post->bool('save') && register()){ 89b8957367SBenjamin Gilbert $ACT = 'login'; 90b8957367SBenjamin Gilbert } 916b13307fSandi 928b06d178Schris if ($ACT == 'resendpwd' && act_resendpwd()) { 938b06d178Schris $ACT = 'login'; 948b06d178Schris } 958b06d178Schris 962a7abf2dSChristopher Smith // user profile changes 972a7abf2dSChristopher Smith if (in_array($ACT, array('profile','profile_delete'))) { 98585bf44eSChristopher Smith if(!$INPUT->server->str('REMOTE_USER')) { 9925b2a98cSMichael Klier $ACT = 'login'; 10025b2a98cSMichael Klier } else { 1012a7abf2dSChristopher Smith switch ($ACT) { 1022a7abf2dSChristopher Smith case 'profile' : 10325b2a98cSMichael Klier if(updateprofile()) { 1044cb79657SMatthias Grimm msg($lang['profchanged'],1); 1054cb79657SMatthias Grimm $ACT = 'show'; 1068b06d178Schris } 1072a7abf2dSChristopher Smith break; 1082a7abf2dSChristopher Smith case 'profile_delete' : 1092a7abf2dSChristopher Smith if(auth_deleteprofile()){ 1102a7abf2dSChristopher Smith msg($lang['profdeleted'],1); 1112a7abf2dSChristopher Smith $ACT = 'show'; 1122a7abf2dSChristopher Smith } else { 1132a7abf2dSChristopher Smith $ACT = 'profile'; 1142a7abf2dSChristopher Smith } 1152a7abf2dSChristopher Smith break; 1162a7abf2dSChristopher Smith } 11725b2a98cSMichael Klier } 11825b2a98cSMichael Klier } 1198b06d178Schris 1201246e016SAndreas Gohr //revert 1211246e016SAndreas Gohr if($ACT == 'revert'){ 1221246e016SAndreas Gohr if(checkSecurityToken()){ 1231246e016SAndreas Gohr $ACT = act_revert($ACT); 1241246e016SAndreas Gohr }else{ 1251246e016SAndreas Gohr $ACT = 'show'; 1261246e016SAndreas Gohr } 1271246e016SAndreas Gohr } 1281246e016SAndreas Gohr 1296b13307fSandi //save 1301b2a85e8SAndreas Gohr if($ACT == 'save'){ 1311b2a85e8SAndreas Gohr if(checkSecurityToken()){ 1326b13307fSandi $ACT = act_save($ACT); 1331b2a85e8SAndreas Gohr }else{ 1348071beaaSAndreas Gohr $ACT = 'preview'; 1351b2a85e8SAndreas Gohr } 1361b2a85e8SAndreas Gohr } 1376b13307fSandi 138067c5d22SBen Coburn //cancel conflicting edit 139067c5d22SBen Coburn if($ACT == 'cancel') 140067c5d22SBen Coburn $ACT = 'show'; 141067c5d22SBen Coburn 142ee4c4a1bSAndreas Gohr //draft deletion 143ee4c4a1bSAndreas Gohr if($ACT == 'draftdel') 144ee4c4a1bSAndreas Gohr $ACT = act_draftdel($ACT); 145ee4c4a1bSAndreas Gohr 146ee4c4a1bSAndreas Gohr //draft saving on preview 147ee4c4a1bSAndreas Gohr if($ACT == 'preview') 148ee4c4a1bSAndreas Gohr $ACT = act_draftsave($ACT); 149ee4c4a1bSAndreas Gohr 1506b13307fSandi //edit 151c9d5430bSAdrian Lang if(in_array($ACT, array('edit', 'preview', 'recover'))) { 152af182434Sandi $ACT = act_edit($ACT); 1536b13307fSandi }else{ 1546b13307fSandi unlock($ID); //try to unlock 1556b13307fSandi } 1566b13307fSandi 1576b13307fSandi //handle export 158ac83b9d8Sandi if(substr($ACT,0,7) == 'export_') 1596b13307fSandi $ACT = act_export($ACT); 1606b13307fSandi 161c19fe9c0Sandi //handle admin tasks 162c19fe9c0Sandi if($ACT == 'admin'){ 16311e2ce22Schris // retrieve admin plugin name from $_REQUEST['page'] 16490f1b7bdSTom N Harris if (($page = $INPUT->str('page', '', true)) != '') { 165*a61966c5SChristopher Smith /** @var $plugin DokuWiki_Admin_Plugin */ 166*a61966c5SChristopher Smith if ($plugin = plugin_getRequestAdminPlugin()){ 16711e2ce22Schris $plugin->handle(); 16811e2ce22Schris } 16911e2ce22Schris } 170c19fe9c0Sandi } 1715f312bacSAndreas Gohr 1725f312bacSAndreas Gohr // check permissions again - the action may have changed 1735f312bacSAndreas Gohr $ACT = act_permcheck($ACT); 17424bb549bSchris } // end event ACTION_ACT_PREPROCESS default action 17524bb549bSchris $evt->advise_after(); 17685dcda20SRobin Getz // Make sure plugs can handle 'denied' 17785dcda20SRobin Getz if($conf['send404'] && $ACT == 'denied') { 1789d2e1be6SAndreas Gohr http_status(403); 17985dcda20SRobin Getz } 18024bb549bSchris unset($evt); 181c19fe9c0Sandi 18246c0ed74SMichael Hamann // when action 'show', the intial not 'show' and POST, do a redirect 183585bf44eSChristopher Smith if($ACT == 'show' && $preact != 'show' && strtolower($INPUT->server->str('REQUEST_METHOD')) == 'post'){ 18469cd1e27SAndreas Gohr act_redirect($ID,$preact); 18569cd1e27SAndreas Gohr } 1865f312bacSAndreas Gohr 187c346111aSAdrian Lang global $INFO; 188c346111aSAdrian Lang global $conf; 189c346111aSAdrian Lang global $license; 190c346111aSAdrian Lang 1916b13307fSandi //call template FIXME: all needed vars available? 1921cc82e5cSGerrit Uitslag $headers = array(); 193f63a2007Schris $headers[] = 'Content-Type: text/html; charset=utf-8'; 194746855cfSBen Coburn trigger_event('ACTION_HEADERS_SEND',$headers,'act_sendheaders'); 195f63a2007Schris 1965a892029SAndreas Gohr include(template('main.php')); 197c19fe9c0Sandi // output for the commands is now handled in inc/templates.php 198c19fe9c0Sandi // in function tpl_content() 1996b13307fSandi} 2006b13307fSandi 201c8b076b1SMichael Hamann/** 202c8b076b1SMichael Hamann * Send the given headers using header() 203c8b076b1SMichael Hamann * 204c8b076b1SMichael Hamann * @param array $headers The headers that shall be sent 205c8b076b1SMichael Hamann */ 206f63a2007Schrisfunction act_sendheaders($headers) { 207f63a2007Schris foreach ($headers as $hdr) header($hdr); 208f63a2007Schris} 209f63a2007Schris 2106b13307fSandi/** 211af182434Sandi * Sanitize the action command 212af182434Sandi * 213af182434Sandi * @author Andreas Gohr <andi@splitbrain.org> 21442ea7f44SGerrit Uitslag * 21542ea7f44SGerrit Uitslag * @param array|string $act 21642ea7f44SGerrit Uitslag * @return string 217af182434Sandi */ 218af182434Sandifunction act_clean($act){ 219ee4c4a1bSAndreas Gohr // check if the action was given as array key 220ee4c4a1bSAndreas Gohr if(is_array($act)){ 221ee4c4a1bSAndreas Gohr list($act) = array_keys($act); 222ee4c4a1bSAndreas Gohr } 223ee4c4a1bSAndreas Gohr 224ac83b9d8Sandi //remove all bad chars 225ac83b9d8Sandi $act = strtolower($act); 2262d5ccb39SAndreas Gohr $act = preg_replace('/[^1-9a-z_]+/','',$act); 227ac83b9d8Sandi 228ac83b9d8Sandi if($act == 'export_html') $act = 'export_xhtml'; 229cc2ae802SAndreas Gohr if($act == 'export_htmlbody') $act = 'export_xhtmlbody'; 230b146b32bSandi 231396c218fSAndreas Gohr if($act === '') $act = 'show'; 23262baad0fSMartin Doucha return $act; 23362baad0fSMartin Doucha} 23462baad0fSMartin Doucha 23562baad0fSMartin Doucha/** 23662baad0fSMartin Doucha * Sanitize and validate action commands. 23762baad0fSMartin Doucha * 23862baad0fSMartin Doucha * Add all allowed commands here. 23962baad0fSMartin Doucha * 24062baad0fSMartin Doucha * @author Andreas Gohr <andi@splitbrain.org> 24142ea7f44SGerrit Uitslag * 24242ea7f44SGerrit Uitslag * @param array|string $act 24342ea7f44SGerrit Uitslag * @return string 24462baad0fSMartin Doucha */ 24562baad0fSMartin Douchafunction act_validate($act) { 246daf0cdbaSMartin Doucha global $conf; 247daf0cdbaSMartin Doucha global $INFO; 248daf0cdbaSMartin Doucha 24962baad0fSMartin Doucha $act = act_clean($act); 250396c218fSAndreas Gohr 251409d7af7SAndreas Gohr // check if action is disabled 252409d7af7SAndreas Gohr if(!actionOK($act)){ 253409d7af7SAndreas Gohr msg('Command disabled: '.htmlspecialchars($act),-1); 254409d7af7SAndreas Gohr return 'show'; 255409d7af7SAndreas Gohr } 256409d7af7SAndreas Gohr 25760e6b550SAndreas Gohr //disable all acl related commands if ACL is disabled 25860e6b550SAndreas Gohr if(!$conf['useacl'] && in_array($act,array('login','logout','register','admin', 2591246e016SAndreas Gohr 'subscribe','unsubscribe','profile','revert', 2602a7abf2dSChristopher Smith 'resendpwd','profile_delete'))){ 26160e6b550SAndreas Gohr msg('Command unavailable: '.htmlspecialchars($act),-1); 26260e6b550SAndreas Gohr return 'show'; 26360e6b550SAndreas Gohr } 26460e6b550SAndreas Gohr 265c828a5d6SAndreas Gohr //is there really a draft? 266c828a5d6SAndreas Gohr if($act == 'draft' && !file_exists($INFO['draft'])) return 'edit'; 267c828a5d6SAndreas Gohr 268067c5d22SBen Coburn if(!in_array($act,array('login','logout','register','save','cancel','edit','draft', 269ac83b9d8Sandi 'preview','search','show','check','index','revisions', 2701246e016SAndreas Gohr 'diff','recent','backlink','admin','subscribe','revert', 2712a7abf2dSChristopher Smith 'unsubscribe','profile','profile_delete','resendpwd','recover', 272d5a9514cSAdrian Lang 'draftdel','sitemap','media')) && substr($act,0,7) != 'export_' ) { 273ee4c4a1bSAndreas Gohr msg('Command unknown: '.htmlspecialchars($act),-1); 274af182434Sandi return 'show'; 275af182434Sandi } 276af182434Sandi return $act; 277af182434Sandi} 278af182434Sandi 279af182434Sandi/** 2806b13307fSandi * Run permissionchecks 2816b13307fSandi * 2826b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 28342ea7f44SGerrit Uitslag * 28442ea7f44SGerrit Uitslag * @param string $act action command 28542ea7f44SGerrit Uitslag * @return string action command 2866b13307fSandi */ 2876b13307fSandifunction act_permcheck($act){ 288dbbc6aa7Sandi global $INFO; 289dbbc6aa7Sandi 290ee4c4a1bSAndreas Gohr if(in_array($act,array('save','preview','edit','recover'))){ 2916b13307fSandi if($INFO['exists']){ 292bdbc16bfSandi if($act == 'edit'){ 293bdbc16bfSandi //the edit function will check again and do a source show 294bdbc16bfSandi //when no AUTH_EDIT available 295bdbc16bfSandi $permneed = AUTH_READ; 296bdbc16bfSandi }else{ 2976b13307fSandi $permneed = AUTH_EDIT; 298bdbc16bfSandi } 2996b13307fSandi }else{ 3006b13307fSandi $permneed = AUTH_CREATE; 3016b13307fSandi } 3022a7abf2dSChristopher Smith }elseif(in_array($act,array('login','search','recent','profile','profile_delete','index', 'sitemap'))){ 3036b13307fSandi $permneed = AUTH_NONE; 3041246e016SAndreas Gohr }elseif($act == 'revert'){ 3051246e016SAndreas Gohr $permneed = AUTH_ADMIN; 3061246e016SAndreas Gohr if($INFO['ismanager']) $permneed = AUTH_EDIT; 3075e199953Smatthiasgrimm }elseif($act == 'register'){ 3085e199953Smatthiasgrimm $permneed = AUTH_NONE; 309ebd3d9ceSchris }elseif($act == 'resendpwd'){ 310ebd3d9ceSchris $permneed = AUTH_NONE; 311c19fe9c0Sandi }elseif($act == 'admin'){ 312f8cc712eSAndreas Gohr if($INFO['ismanager']){ 313f8cc712eSAndreas Gohr // if the manager has the needed permissions for a certain admin 314f8cc712eSAndreas Gohr // action is checked later 315f8cc712eSAndreas Gohr $permneed = AUTH_READ; 316f8cc712eSAndreas Gohr }else{ 317c19fe9c0Sandi $permneed = AUTH_ADMIN; 318f8cc712eSAndreas Gohr } 3196b13307fSandi }else{ 3206b13307fSandi $permneed = AUTH_READ; 3216b13307fSandi } 322dbbc6aa7Sandi if($INFO['perm'] >= $permneed) return $act; 323dbbc6aa7Sandi 3246b13307fSandi return 'denied'; 3256b13307fSandi} 3266b13307fSandi 3276b13307fSandi/** 328ee4c4a1bSAndreas Gohr * Handle 'draftdel' 329ee4c4a1bSAndreas Gohr * 330ee4c4a1bSAndreas Gohr * Deletes the draft for the current page and user 33142ea7f44SGerrit Uitslag * 33242ea7f44SGerrit Uitslag * @param string $act action command 33342ea7f44SGerrit Uitslag * @return string action command 334ee4c4a1bSAndreas Gohr */ 335ee4c4a1bSAndreas Gohrfunction act_draftdel($act){ 336ee4c4a1bSAndreas Gohr global $INFO; 337ee4c4a1bSAndreas Gohr @unlink($INFO['draft']); 338ee4c4a1bSAndreas Gohr $INFO['draft'] = null; 339ee4c4a1bSAndreas Gohr return 'show'; 340ee4c4a1bSAndreas Gohr} 341ee4c4a1bSAndreas Gohr 342ee4c4a1bSAndreas Gohr/** 343ee4c4a1bSAndreas Gohr * Saves a draft on preview 344ee4c4a1bSAndreas Gohr * 345ee4c4a1bSAndreas Gohr * @todo this currently duplicates code from ajax.php :-/ 34642ea7f44SGerrit Uitslag * 34742ea7f44SGerrit Uitslag * @param string $act action command 34842ea7f44SGerrit Uitslag * @return string action command 349ee4c4a1bSAndreas Gohr */ 350ee4c4a1bSAndreas Gohrfunction act_draftsave($act){ 351ee4c4a1bSAndreas Gohr global $INFO; 352ee4c4a1bSAndreas Gohr global $ID; 35390f1b7bdSTom N Harris global $INPUT; 354ee4c4a1bSAndreas Gohr global $conf; 35590f1b7bdSTom N Harris if($conf['usedraft'] && $INPUT->post->has('wikitext')) { 356ee4c4a1bSAndreas Gohr $draft = array('id' => $ID, 35790f1b7bdSTom N Harris 'prefix' => substr($INPUT->post->str('prefix'), 0, -1), 35890f1b7bdSTom N Harris 'text' => $INPUT->post->str('wikitext'), 35990f1b7bdSTom N Harris 'suffix' => $INPUT->post->str('suffix'), 36090f1b7bdSTom N Harris 'date' => $INPUT->post->int('date'), 361ee4c4a1bSAndreas Gohr 'client' => $INFO['client'], 362ee4c4a1bSAndreas Gohr ); 363ee4c4a1bSAndreas Gohr $cname = getCacheName($draft['client'].$ID,'.draft'); 364ee4c4a1bSAndreas Gohr if(io_saveFile($cname,serialize($draft))){ 365ee4c4a1bSAndreas Gohr $INFO['draft'] = $cname; 366ee4c4a1bSAndreas Gohr } 367ee4c4a1bSAndreas Gohr } 368ee4c4a1bSAndreas Gohr return $act; 369ee4c4a1bSAndreas Gohr} 370ee4c4a1bSAndreas Gohr 371ee4c4a1bSAndreas Gohr/** 3726b13307fSandi * Handle 'save' 3736b13307fSandi * 3746b13307fSandi * Checks for spam and conflicts and saves the page. 3756b13307fSandi * Does a redirect to show the page afterwards or 3766b13307fSandi * returns a new action. 3776b13307fSandi * 3786b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 37942ea7f44SGerrit Uitslag * 38042ea7f44SGerrit Uitslag * @param string $act action command 38142ea7f44SGerrit Uitslag * @return string action command 3826b13307fSandi */ 3836b13307fSandifunction act_save($act){ 3846b13307fSandi global $ID; 3856b13307fSandi global $DATE; 3866b13307fSandi global $PRE; 3876b13307fSandi global $TEXT; 3886b13307fSandi global $SUF; 3896b13307fSandi global $SUM; 3905a932e77SAdrian Lang global $lang; 3918d67c48aSAdrian Lang global $INFO; 39290f1b7bdSTom N Harris global $INPUT; 3936b13307fSandi 3946b13307fSandi //spam check 3955a932e77SAdrian Lang if(checkwordblock()) { 3965a932e77SAdrian Lang msg($lang['wordblock'], -1); 3975a932e77SAdrian Lang return 'edit'; 3985a932e77SAdrian Lang } 3998d67c48aSAdrian Lang //conflict check 4008d67c48aSAdrian Lang if($DATE != 0 && $INFO['meta']['date']['modified'] > $DATE ) 4016b13307fSandi return 'conflict'; 4026b13307fSandi 4036b13307fSandi //save it 404e0c26282SGerrit Uitslag saveWikiText($ID,con($PRE,$TEXT,$SUF,true),$SUM,$INPUT->bool('minor')); //use pretty mode for con 4056b13307fSandi //unlock it 4066b13307fSandi unlock($ID); 4076b13307fSandi 408ee4c4a1bSAndreas Gohr //delete draft 409ee4c4a1bSAndreas Gohr act_draftdel($act); 41069cd1e27SAndreas Gohr session_write_close(); 411ee4c4a1bSAndreas Gohr 41269cd1e27SAndreas Gohr // when done, show page 41369cd1e27SAndreas Gohr return 'show'; 41469cd1e27SAndreas Gohr} 415f951a474SAndreas Gohr 41614a122deSAndreas Gohr/** 4171246e016SAndreas Gohr * Revert to a certain revision 4181246e016SAndreas Gohr * 4191246e016SAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 42042ea7f44SGerrit Uitslag * 42142ea7f44SGerrit Uitslag * @param string $act action command 42242ea7f44SGerrit Uitslag * @return string action command 4231246e016SAndreas Gohr */ 4241246e016SAndreas Gohrfunction act_revert($act){ 4251246e016SAndreas Gohr global $ID; 4261246e016SAndreas Gohr global $REV; 4271246e016SAndreas Gohr global $lang; 428585bf44eSChristopher Smith /* @var Input $INPUT */ 429585bf44eSChristopher Smith global $INPUT; 430de4d479aSAdrian Lang // FIXME $INFO['writable'] currently refers to the attic version 431de4d479aSAdrian Lang // global $INFO; 432de4d479aSAdrian Lang // if (!$INFO['writable']) { 433de4d479aSAdrian Lang // return 'show'; 434de4d479aSAdrian Lang // } 4351246e016SAndreas Gohr 4361246e016SAndreas Gohr // when no revision is given, delete current one 4371246e016SAndreas Gohr // FIXME this feature is not exposed in the GUI currently 4381246e016SAndreas Gohr $text = ''; 4391246e016SAndreas Gohr $sum = $lang['deleted']; 4401246e016SAndreas Gohr if($REV){ 4411246e016SAndreas Gohr $text = rawWiki($ID,$REV); 4421246e016SAndreas Gohr if(!$text) return 'show'; //something went wrong 443d6b9c7bfSlupo49 $sum = sprintf($lang['restored'], dformat($REV)); 4441246e016SAndreas Gohr } 4451246e016SAndreas Gohr 4461246e016SAndreas Gohr // spam check 4475a932e77SAdrian Lang 4485a932e77SAdrian Lang if (checkwordblock($text)) { 4495a932e77SAdrian Lang msg($lang['wordblock'], -1); 4505a932e77SAdrian Lang return 'edit'; 4515a932e77SAdrian Lang } 4521246e016SAndreas Gohr 4531246e016SAndreas Gohr saveWikiText($ID,$text,$sum,false); 4541246e016SAndreas Gohr msg($sum,1); 4551246e016SAndreas Gohr 4561246e016SAndreas Gohr //delete any draft 4571246e016SAndreas Gohr act_draftdel($act); 4581246e016SAndreas Gohr session_write_close(); 4591246e016SAndreas Gohr 4601246e016SAndreas Gohr // when done, show current page 461585bf44eSChristopher Smith $INPUT->server->set('REQUEST_METHOD','post'); //should force a redirect 4621246e016SAndreas Gohr $REV = ''; 4631246e016SAndreas Gohr return 'show'; 4641246e016SAndreas Gohr} 4651246e016SAndreas Gohr 4661246e016SAndreas Gohr/** 46714a122deSAndreas Gohr * Do a redirect after receiving post data 46814a122deSAndreas Gohr * 46914a122deSAndreas Gohr * Tries to add the section id as hash mark after section editing 47042ea7f44SGerrit Uitslag * 47142ea7f44SGerrit Uitslag * @param string $id page id 47242ea7f44SGerrit Uitslag * @param string $preact action command before redirect 47314a122deSAndreas Gohr */ 47469cd1e27SAndreas Gohrfunction act_redirect($id,$preact){ 47569cd1e27SAndreas Gohr global $PRE; 47669cd1e27SAndreas Gohr global $TEXT; 477f951a474SAndreas Gohr 47869cd1e27SAndreas Gohr $opts = array( 47969cd1e27SAndreas Gohr 'id' => $id, 48069cd1e27SAndreas Gohr 'preact' => $preact 48169cd1e27SAndreas Gohr ); 482c66972f2SAdrian Lang //get section name when coming from section edit 483c66972f2SAdrian Lang if($PRE && preg_match('/^\s*==+([^=\n]+)/',$TEXT,$match)){ 484c66972f2SAdrian Lang $check = false; //Byref 485c66972f2SAdrian Lang $opts['fragment'] = sectionID($match[0], $check); 486c66972f2SAdrian Lang } 487c66972f2SAdrian Lang 48869cd1e27SAndreas Gohr trigger_event('ACTION_SHOW_REDIRECT',$opts,'act_redirect_execute'); 48969cd1e27SAndreas Gohr} 49069cd1e27SAndreas Gohr 491c8b076b1SMichael Hamann/** 492c8b076b1SMichael Hamann * Execute the redirect 493c8b076b1SMichael Hamann * 49442ea7f44SGerrit Uitslag * @param array $opts id and fragment for the redirect and the preact 495c8b076b1SMichael Hamann */ 49669cd1e27SAndreas Gohrfunction act_redirect_execute($opts){ 49769cd1e27SAndreas Gohr $go = wl($opts['id'],'',true); 498c66972f2SAdrian Lang if(isset($opts['fragment'])) $go .= '#'.$opts['fragment']; 49969cd1e27SAndreas Gohr 5006b13307fSandi //show it 501af2408d5SAndreas Gohr send_redirect($go); 5026b13307fSandi} 5036b13307fSandi 5046b13307fSandi/** 505b8957367SBenjamin Gilbert * Handle 'login', 'logout' 5066b13307fSandi * 5076b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 50842ea7f44SGerrit Uitslag * 50942ea7f44SGerrit Uitslag * @param string $act action command 51042ea7f44SGerrit Uitslag * @return string action command 5116b13307fSandi */ 5126b13307fSandifunction act_auth($act){ 51308eda5bcSmatthiasgrimm global $ID; 5147cace34dSAndreas Gohr global $INFO; 515585bf44eSChristopher Smith /* @var Input $INPUT */ 516585bf44eSChristopher Smith global $INPUT; 51708eda5bcSmatthiasgrimm 5186b13307fSandi //already logged in? 519585bf44eSChristopher Smith if($INPUT->server->has('REMOTE_USER') && $act=='login'){ 520ca12ce46SAndreas Gohr return 'show'; 5212288dc06SGuy Brand } 5226b13307fSandi 5236b13307fSandi //handle logout 5246b13307fSandi if($act=='logout'){ 52508eda5bcSmatthiasgrimm $lockedby = checklock($ID); //page still locked? 526585bf44eSChristopher Smith if($lockedby == $INPUT->server->str('REMOTE_USER')){ 52708eda5bcSmatthiasgrimm unlock($ID); //try to unlock 528585bf44eSChristopher Smith } 52908eda5bcSmatthiasgrimm 5307cace34dSAndreas Gohr // do the logout stuff 5316b13307fSandi auth_logoff(); 5327cace34dSAndreas Gohr 5337cace34dSAndreas Gohr // rebuild info array 5347cace34dSAndreas Gohr $INFO = pageinfo(); 5357cace34dSAndreas Gohr 536e16eccb7SGuy Brand act_redirect($ID,'login'); 5376b13307fSandi } 5386b13307fSandi 5396b13307fSandi return $act; 5406b13307fSandi} 5416b13307fSandi 5426b13307fSandi/** 54345a99335SAdrian Lang * Handle 'edit', 'preview', 'recover' 5446b13307fSandi * 5456b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 54642ea7f44SGerrit Uitslag * 54742ea7f44SGerrit Uitslag * @param string $act action command 54842ea7f44SGerrit Uitslag * @return string action command 5496b13307fSandi */ 5506b13307fSandifunction act_edit($act){ 551cd409024Sjorda global $ID; 552ee4c4a1bSAndreas Gohr global $INFO; 553cd409024Sjorda 55445a99335SAdrian Lang global $TEXT; 55545a99335SAdrian Lang global $RANGE; 55645a99335SAdrian Lang global $PRE; 55745a99335SAdrian Lang global $SUF; 55845a99335SAdrian Lang global $REV; 55945a99335SAdrian Lang global $SUM; 56045a99335SAdrian Lang global $lang; 56145a99335SAdrian Lang global $DATE; 56245a99335SAdrian Lang 56345a99335SAdrian Lang if (!isset($TEXT)) { 56445a99335SAdrian Lang if ($INFO['exists']) { 56545a99335SAdrian Lang if ($RANGE) { 56645a99335SAdrian Lang list($PRE,$TEXT,$SUF) = rawWikiSlices($RANGE,$ID,$REV); 56745a99335SAdrian Lang } else { 56845a99335SAdrian Lang $TEXT = rawWiki($ID,$REV); 56945a99335SAdrian Lang } 57045a99335SAdrian Lang } else { 571fe17917eSAdrian Lang $TEXT = pageTemplate($ID); 57245a99335SAdrian Lang } 57345a99335SAdrian Lang } 57445a99335SAdrian Lang 57545a99335SAdrian Lang //set summary default 57645a99335SAdrian Lang if(!$SUM){ 57745a99335SAdrian Lang if($REV){ 5787656ee3bSlupo49 $SUM = sprintf($lang['restored'], dformat($REV)); 57945a99335SAdrian Lang }elseif(!$INFO['exists']){ 58045a99335SAdrian Lang $SUM = $lang['created']; 58145a99335SAdrian Lang } 58245a99335SAdrian Lang } 58345a99335SAdrian Lang 5848d67c48aSAdrian Lang // Use the date of the newest revision, not of the revision we edit 5858d67c48aSAdrian Lang // This is used for conflict detection 58678035fe8SAndreas Gohr if(!$DATE) $DATE = @filemtime(wikiFN($ID)); 58745a99335SAdrian Lang 5886b13307fSandi //check if locked by anyone - if not lock for my self 58931bc8f11SMichael Hamann //do not lock when the user can't edit anyway 59031bc8f11SMichael Hamann if ($INFO['writable']) { 5916b13307fSandi $lockedby = checklock($ID); 5926b13307fSandi if($lockedby) return 'locked'; 5936b13307fSandi 5946b13307fSandi lock($ID); 59531bc8f11SMichael Hamann } 59631bc8f11SMichael Hamann 5976b13307fSandi return $act; 5986b13307fSandi} 5996b13307fSandi 6006b13307fSandi/** 601f6dad9fdSMichael Klier * Export a wiki page for various formats 602f6dad9fdSMichael Klier * 603f6dad9fdSMichael Klier * Triggers ACTION_EXPORT_POSTPROCESS 604f6dad9fdSMichael Klier * 605f6dad9fdSMichael Klier * Event data: 606f6dad9fdSMichael Klier * data['id'] -- page id 607f6dad9fdSMichael Klier * data['mode'] -- requested export mode 608f6dad9fdSMichael Klier * data['headers'] -- export headers 609f6dad9fdSMichael Klier * data['output'] -- export output 6106b13307fSandi * 6116b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 612f6dad9fdSMichael Klier * @author Michael Klier <chi@chimeric.de> 61342ea7f44SGerrit Uitslag * 61442ea7f44SGerrit Uitslag * @param string $act action command 61542ea7f44SGerrit Uitslag * @return string action command 6166b13307fSandi */ 6176b13307fSandifunction act_export($act){ 6186b13307fSandi global $ID; 6196b13307fSandi global $REV; 62085f8705cSAnika Henke global $conf; 62185f8705cSAnika Henke global $lang; 6226b13307fSandi 623f6dad9fdSMichael Klier $pre = ''; 624f6dad9fdSMichael Klier $post = ''; 625f6dad9fdSMichael Klier $headers = array(); 626cc2ae802SAndreas Gohr 627f6dad9fdSMichael Klier // search engines: never cache exported docs! (Google only currently) 628f6dad9fdSMichael Klier $headers['X-Robots-Tag'] = 'noindex'; 629f6dad9fdSMichael Klier 630ac83b9d8Sandi $mode = substr($act,7); 631f6dad9fdSMichael Klier switch($mode) { 632f6dad9fdSMichael Klier case 'raw': 6335adfc5afSAnika Henke $headers['Content-Type'] = 'text/plain; charset=utf-8'; 63466b23ce9SAndreas Gohr $headers['Content-Disposition'] = 'attachment; filename='.noNS($ID).'.txt'; 635f6dad9fdSMichael Klier $output = rawWiki($ID,$REV); 636f6dad9fdSMichael Klier break; 637f6dad9fdSMichael Klier case 'xhtml': 638c8839c22SAnika Henke $pre .= '<!DOCTYPE html>' . DOKU_LF; 639c8839c22SAnika Henke $pre .= '<html lang="'.$conf['lang'].'" dir="'.$lang['direction'].'">' . DOKU_LF; 640f6dad9fdSMichael Klier $pre .= '<head>' . DOKU_LF; 641c8839c22SAnika Henke $pre .= ' <meta charset="utf-8" />' . DOKU_LF; 642f6dad9fdSMichael Klier $pre .= ' <title>'.$ID.'</title>' . DOKU_LF; 643f6dad9fdSMichael Klier 644f6dad9fdSMichael Klier // get metaheaders 645f6dad9fdSMichael Klier ob_start(); 646f6dad9fdSMichael Klier tpl_metaheaders(); 647f6dad9fdSMichael Klier $pre .= ob_get_clean(); 648f6dad9fdSMichael Klier 649f6dad9fdSMichael Klier $pre .= '</head>' . DOKU_LF; 650f6dad9fdSMichael Klier $pre .= '<body>' . DOKU_LF; 651f6dad9fdSMichael Klier $pre .= '<div class="dokuwiki export">' . DOKU_LF; 652f6dad9fdSMichael Klier 653f6dad9fdSMichael Klier // get toc 654f6dad9fdSMichael Klier $pre .= tpl_toc(true); 655f6dad9fdSMichael Klier 656f6dad9fdSMichael Klier $headers['Content-Type'] = 'text/html; charset=utf-8'; 657f6dad9fdSMichael Klier $output = p_wiki_xhtml($ID,$REV,false); 658f6dad9fdSMichael Klier 659f6dad9fdSMichael Klier $post .= '</div>' . DOKU_LF; 660f6dad9fdSMichael Klier $post .= '</body>' . DOKU_LF; 661f6dad9fdSMichael Klier $post .= '</html>' . DOKU_LF; 662f6dad9fdSMichael Klier break; 663f6dad9fdSMichael Klier case 'xhtmlbody': 664f6dad9fdSMichael Klier $headers['Content-Type'] = 'text/html; charset=utf-8'; 665f6dad9fdSMichael Klier $output = p_wiki_xhtml($ID,$REV,false); 666f6dad9fdSMichael Klier break; 667f6dad9fdSMichael Klier default: 668b814e978SGerrit Uitslag $output = p_cached_output(wikiFN($ID,$REV), $mode, $ID); 6699acedd40SAndreas Gohr $headers = p_get_metadata($ID,"format $mode"); 670f6dad9fdSMichael Klier break; 671f6dad9fdSMichael Klier } 672f6dad9fdSMichael Klier 673f6dad9fdSMichael Klier // prepare event data 674f6dad9fdSMichael Klier $data = array(); 675f6dad9fdSMichael Klier $data['id'] = $ID; 676f6dad9fdSMichael Klier $data['mode'] = $mode; 677f6dad9fdSMichael Klier $data['headers'] = $headers; 678f6dad9fdSMichael Klier $data['output'] =& $output; 679f6dad9fdSMichael Klier 680f6dad9fdSMichael Klier trigger_event('ACTION_EXPORT_POSTPROCESS', $data); 681f6dad9fdSMichael Klier 682f6dad9fdSMichael Klier if(!empty($data['output'])){ 683f6dad9fdSMichael Klier if(is_array($data['headers'])) foreach($data['headers'] as $key => $val){ 68485767031SAndreas Gohr header("$key: $val"); 68585767031SAndreas Gohr } 686f6dad9fdSMichael Klier print $pre.$data['output'].$post; 6876b13307fSandi exit; 6886b13307fSandi } 6896b13307fSandi return 'show'; 6906b13307fSandi} 691340756e4Sandi 692b158d625SSteven Danz/** 693c4f79b71SMichael Hamann * Handle sitemap delivery 694c4f79b71SMichael Hamann * 695c4f79b71SMichael Hamann * @author Michael Hamann <michael@content-space.de> 69642ea7f44SGerrit Uitslag * 69742ea7f44SGerrit Uitslag * @param string $act action command 698c4f79b71SMichael Hamann */ 699c4f79b71SMichael Hamannfunction act_sitemap($act) { 700c4f79b71SMichael Hamann global $conf; 701c4f79b71SMichael Hamann 702eae17177SMichael Hamann if ($conf['sitemap'] < 1 || !is_numeric($conf['sitemap'])) { 7039d2e1be6SAndreas Gohr http_status(404); 704c4f79b71SMichael Hamann print "Sitemap generation is disabled."; 705c4f79b71SMichael Hamann exit; 706c4f79b71SMichael Hamann } 707c4f79b71SMichael Hamann 708eae17177SMichael Hamann $sitemap = Sitemapper::getFilePath(); 70965f6e7d6SMichael Hamann if (Sitemapper::sitemapIsCompressed()) { 710c4f79b71SMichael Hamann $mime = 'application/x-gzip'; 711c4f79b71SMichael Hamann }else{ 712c4f79b71SMichael Hamann $mime = 'application/xml; charset=utf-8'; 713c4f79b71SMichael Hamann } 714c4f79b71SMichael Hamann 715c4f79b71SMichael Hamann // Check if sitemap file exists, otherwise create it 716c4f79b71SMichael Hamann if (!is_readable($sitemap)) { 7172897eb23SMichael Hamann Sitemapper::generate(); 718c4f79b71SMichael Hamann } 719c4f79b71SMichael Hamann 720c4f79b71SMichael Hamann if (is_readable($sitemap)) { 721c4f79b71SMichael Hamann // Send headers 722c4f79b71SMichael Hamann header('Content-Type: '.$mime); 7233009a773SAndreas Gohr header('Content-Disposition: attachment; filename='.utf8_basename($sitemap)); 724c4f79b71SMichael Hamann 725eae17177SMichael Hamann http_conditionalRequest(filemtime($sitemap)); 726eae17177SMichael Hamann 727c4f79b71SMichael Hamann // Send file 728c4f79b71SMichael Hamann //use x-sendfile header to pass the delivery to compatible webservers 72940e0b444SDominik Eckelmann http_sendfile($sitemap); 730c4f79b71SMichael Hamann 731eae17177SMichael Hamann readfile($sitemap); 732c4f79b71SMichael Hamann exit; 733c4f79b71SMichael Hamann } 734c4f79b71SMichael Hamann 7359d2e1be6SAndreas Gohr http_status(500); 736eae17177SMichael Hamann print "Could not read the sitemap file - bad permissions?"; 737c4f79b71SMichael Hamann exit; 738c4f79b71SMichael Hamann} 739c4f79b71SMichael Hamann 740c4f79b71SMichael Hamann/** 7415b75cd1fSAdrian Lang * Handle page 'subscribe' 742b158d625SSteven Danz * 7435b75cd1fSAdrian Lang * Throws exception on error. 7445b75cd1fSAdrian Lang * 7455b75cd1fSAdrian Lang * @author Adrian Lang <lang@cosmocode.de> 74642ea7f44SGerrit Uitslag * 74742ea7f44SGerrit Uitslag * @param string $act action command 74842ea7f44SGerrit Uitslag * @return string action command 74942ea7f44SGerrit Uitslag * @throws Exception if (un)subscribing fails 750b158d625SSteven Danz */ 7511380fc45SAndreas Gohrfunction act_subscription($act){ 752056c2049SAndreas Gohr global $lang; 753056c2049SAndreas Gohr global $INFO; 754056c2049SAndreas Gohr global $ID; 755585bf44eSChristopher Smith /* @var Input $INPUT */ 75690f1b7bdSTom N Harris global $INPUT; 75752b0dd67SGuy Brand 7589fa341d0SAndreas Gohr // subcriptions work for logged in users only 759585bf44eSChristopher Smith if(!$INPUT->server->str('REMOTE_USER')) return 'show'; 7609fa341d0SAndreas Gohr 761056c2049SAndreas Gohr // get and preprocess data. 7628881fcc9SAdrian Lang $params = array(); 7638881fcc9SAdrian Lang foreach(array('target', 'style', 'action') as $param) { 76490f1b7bdSTom N Harris if ($INPUT->has("sub_$param")) { 76590f1b7bdSTom N Harris $params[$param] = $INPUT->str("sub_$param"); 7668881fcc9SAdrian Lang } 7678881fcc9SAdrian Lang } 7688881fcc9SAdrian Lang 769056c2049SAndreas Gohr // any action given? if not just return and show the subscription page 7700e80bb5eSChristopher Smith if(empty($params['action']) || !checkSecurityToken()) return $act; 771056c2049SAndreas Gohr 7728881fcc9SAdrian Lang // Handle POST data, may throw exception. 7738881fcc9SAdrian Lang trigger_event('ACTION_HANDLE_SUBSCRIBE', $params, 'subscription_handle_post'); 7748881fcc9SAdrian Lang 7758881fcc9SAdrian Lang $target = $params['target']; 7768881fcc9SAdrian Lang $style = $params['style']; 7778881fcc9SAdrian Lang $action = $params['action']; 7788881fcc9SAdrian Lang 7798881fcc9SAdrian Lang // Perform action. 780a0519fdaSAndreas Gohr $sub = new Subscription(); 781a0519fdaSAndreas Gohr if($action == 'unsubscribe'){ 782585bf44eSChristopher Smith $ok = $sub->remove($target, $INPUT->server->str('REMOTE_USER'), $style); 783a0519fdaSAndreas Gohr }else{ 784585bf44eSChristopher Smith $ok = $sub->add($target, $INPUT->server->str('REMOTE_USER'), $style); 785a0519fdaSAndreas Gohr } 786a0519fdaSAndreas Gohr 787a0519fdaSAndreas Gohr if($ok) { 788a0519fdaSAndreas Gohr msg(sprintf($lang["subscr_{$action}_success"], hsc($INFO['userinfo']['name']), 789a0519fdaSAndreas Gohr prettyprint_id($target)), 1); 790a0519fdaSAndreas Gohr act_redirect($ID, $act); 791a0519fdaSAndreas Gohr } else { 7928881fcc9SAdrian Lang throw new Exception(sprintf($lang["subscr_{$action}_error"], 7938881fcc9SAdrian Lang hsc($INFO['userinfo']['name']), 7948881fcc9SAdrian Lang prettyprint_id($target))); 7958881fcc9SAdrian Lang } 796cb3f9dbaSAdrian Lang 797cb3f9dbaSAdrian Lang // Assure that we have valid data if act_redirect somehow fails. 798a0519fdaSAndreas Gohr $INFO['subscribed'] = $sub->user_subscription(); 799cb3f9dbaSAdrian Lang return 'show'; 8008881fcc9SAdrian Lang} 8018881fcc9SAdrian Lang 8028881fcc9SAdrian Lang/** 8038881fcc9SAdrian Lang * Validate POST data 8048881fcc9SAdrian Lang * 8058881fcc9SAdrian Lang * Validates POST data for a subscribe or unsubscribe request. This is the 8068881fcc9SAdrian Lang * default action for the event ACTION_HANDLE_SUBSCRIBE. 8078881fcc9SAdrian Lang * 8088881fcc9SAdrian Lang * @author Adrian Lang <lang@cosmocode.de> 80942ea7f44SGerrit Uitslag * 81042ea7f44SGerrit Uitslag * @param array &$params the parameters: target, style and action 81142ea7f44SGerrit Uitslag * @throws Exception 8128881fcc9SAdrian Lang */ 8137a9add1cSAdrian Langfunction subscription_handle_post(&$params) { 8148881fcc9SAdrian Lang global $INFO; 8158881fcc9SAdrian Lang global $lang; 816585bf44eSChristopher Smith /* @var Input $INPUT */ 817585bf44eSChristopher Smith global $INPUT; 8188881fcc9SAdrian Lang 8195b75cd1fSAdrian Lang // Get and validate parameters. 8208881fcc9SAdrian Lang if (!isset($params['target'])) { 82115741132SAndreas Gohr throw new Exception('no subscription target given'); 8225b75cd1fSAdrian Lang } 8238881fcc9SAdrian Lang $target = $params['target']; 8245b75cd1fSAdrian Lang $valid_styles = array('every', 'digest'); 8255b75cd1fSAdrian Lang if (substr($target, -1, 1) === ':') { 8265b75cd1fSAdrian Lang // Allow “list” subscribe style since the target is a namespace. 8275b75cd1fSAdrian Lang $valid_styles[] = 'list'; 8285b75cd1fSAdrian Lang } 8298881fcc9SAdrian Lang $style = valid_input_set('style', $valid_styles, $params, 83015741132SAndreas Gohr 'invalid subscription style given'); 8318881fcc9SAdrian Lang $action = valid_input_set('action', array('subscribe', 'unsubscribe'), 83215741132SAndreas Gohr $params, 'invalid subscription action given'); 833613964ecSGuy Brand 8345b75cd1fSAdrian Lang // Check other conditions. 8355b75cd1fSAdrian Lang if ($action === 'subscribe') { 8365b75cd1fSAdrian Lang if ($INFO['userinfo']['mail'] === '') { 8375b75cd1fSAdrian Lang throw new Exception($lang['subscr_subscribe_noaddress']); 83852b0dd67SGuy Brand } 8395b75cd1fSAdrian Lang } elseif ($action === 'unsubscribe') { 8405b75cd1fSAdrian Lang $is = false; 8415b75cd1fSAdrian Lang foreach($INFO['subscribed'] as $subscr) { 8425b75cd1fSAdrian Lang if ($subscr['target'] === $target) { 8435b75cd1fSAdrian Lang $is = true; 84452b0dd67SGuy Brand } 84552b0dd67SGuy Brand } 8465b75cd1fSAdrian Lang if ($is === false) { 84715741132SAndreas Gohr throw new Exception(sprintf($lang['subscr_not_subscribed'], 848585bf44eSChristopher Smith $INPUT->server->str('REMOTE_USER'), 8495b75cd1fSAdrian Lang prettyprint_id($target))); 8505b75cd1fSAdrian Lang } 8515b75cd1fSAdrian Lang // subscription_set deletes a subscription if style = null. 8525b75cd1fSAdrian Lang $style = null; 85352b0dd67SGuy Brand } 85452b0dd67SGuy Brand 85516c665d9SAndreas Gohr $params = compact('target', 'style', 'action'); 85652b0dd67SGuy Brand} 85752b0dd67SGuy Brand 858e3776c06SMichael Hamann//Setup VIM: ex: et ts=2 : 859