xref: /dokuwiki/inc/actions.php (revision 7e8500eea1e53b1de0e0f70400664afa442cd08d)
1<?php
2/**
3 * DokuWiki Actions
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Andreas Gohr <andi@splitbrain.org>
7 */
8
9if(!defined('DOKU_INC')) die('meh.');
10
11/**
12 * Call the needed action handlers
13 *
14 * @author Andreas Gohr <andi@splitbrain.org>
15 * @triggers ACTION_ACT_PREPROCESS
16 * @triggers ACTION_HEADERS_SEND
17 */
18function act_dispatch(){
19    global $ACT;
20    global $ID;
21    global $INFO;
22    global $QUERY;
23    /* @var Input $INPUT */
24    global $INPUT;
25    global $lang;
26    global $conf;
27
28    $preact = $ACT;
29
30    // give plugins an opportunity to process the action
31    $evt = new Doku_Event('ACTION_ACT_PREPROCESS',$ACT);
32    if ($evt->advise_before()) {
33
34        //sanitize $ACT
35        $ACT = act_validate($ACT);
36
37        //check if searchword was given - else just show
38        $s = cleanID($QUERY);
39        if($ACT == 'search' && empty($s)){
40            $ACT = 'show';
41        }
42
43        //login stuff
44        if(in_array($ACT,array('login','logout'))){
45            $ACT = act_auth($ACT);
46        }
47
48        //check if user is asking to (un)subscribe a page
49        if($ACT == 'subscribe') {
50            try {
51                $ACT = act_subscription($ACT);
52            } catch (Exception $e) {
53                msg($e->getMessage(), -1);
54            }
55        }
56
57        //display some info
58        if($ACT == 'check'){
59            check();
60            $ACT = 'show';
61        }
62
63        //check permissions
64        $ACT = act_permcheck($ACT);
65
66        //sitemap
67        if ($ACT == 'sitemap'){
68            act_sitemap($ACT);
69        }
70
71        //recent changes
72        if ($ACT == 'recent'){
73            $show_changes = $INPUT->str('show_changes');
74            if (!empty($show_changes)) {
75                set_doku_pref('show_changes', $show_changes);
76            }
77        }
78
79        //diff
80        if ($ACT == 'diff'){
81            $difftype = $INPUT->str('difftype');
82            if (!empty($difftype)) {
83                set_doku_pref('difftype', $difftype);
84            }
85        }
86
87        //register
88        if($ACT == 'register' && $INPUT->post->bool('save') && register()){
89            $ACT = 'login';
90        }
91
92        if ($ACT == 'resendpwd' && act_resendpwd()) {
93            $ACT = 'login';
94        }
95
96        // user profile changes
97        if (in_array($ACT, array('profile','profile_delete'))) {
98            if(!$INPUT->server->str('REMOTE_USER')) {
99                $ACT = 'login';
100            } else {
101                switch ($ACT) {
102                    case 'profile' :
103                        if(updateprofile()) {
104                            msg($lang['profchanged'],1);
105                            $ACT = 'show';
106                        }
107                        break;
108                    case 'profile_delete' :
109                        if(auth_deleteprofile()){
110                            msg($lang['profdeleted'],1);
111                            $ACT = 'show';
112                        } else {
113                            $ACT = 'profile';
114                        }
115                        break;
116                }
117            }
118        }
119
120        //revert
121        if($ACT == 'revert'){
122            if(checkSecurityToken()){
123                $ACT = act_revert($ACT);
124            }else{
125                $ACT = 'show';
126            }
127        }
128
129        //save
130        if($ACT == 'save'){
131            if(checkSecurityToken()){
132                $ACT = act_save($ACT);
133            }else{
134                $ACT = 'preview';
135            }
136        }
137
138        //cancel conflicting edit
139        if($ACT == 'cancel')
140            $ACT = 'show';
141
142        //draft deletion
143        if($ACT == 'draftdel')
144            $ACT = act_draftdel($ACT);
145
146        //draft saving on preview
147        if($ACT == 'preview')
148            $ACT = act_draftsave($ACT);
149
150        //edit
151        if(in_array($ACT, array('edit', 'preview', 'recover'))) {
152            $ACT = act_edit($ACT);
153        }else{
154            unlock($ID); //try to unlock
155        }
156
157        //handle export
158        if(substr($ACT,0,7) == 'export_')
159            $ACT = act_export($ACT);
160
161        //handle admin tasks
162        if($ACT == 'admin'){
163            // retrieve admin plugin name from $_REQUEST['page']
164            if (($page = $INPUT->str('page', '', true)) != '') {
165                $pluginlist = plugin_list('admin');
166                if (in_array($page, $pluginlist)) {
167                    // attempt to load the plugin
168
169                    if (($plugin = plugin_load('admin',$page)) !== null){
170                        /** @var DokuWiki_Admin_Plugin $plugin */
171                        if($plugin->forAdminOnly() && !$INFO['isadmin']){
172                            // a manager tried to load a plugin that's for admins only
173                            $INPUT->remove('page');
174                            msg('For admins only',-1);
175                        }else{
176                            $plugin->handle();
177                        }
178                    }
179                }
180            }
181        }
182
183        // check permissions again - the action may have changed
184        $ACT = act_permcheck($ACT);
185    }  // end event ACTION_ACT_PREPROCESS default action
186    $evt->advise_after();
187    // Make sure plugs can handle 'denied'
188    if($conf['send404'] && $ACT == 'denied') {
189        http_status(403);
190    }
191    unset($evt);
192
193    // when action 'show', the intial not 'show' and POST, do a redirect
194    if($ACT == 'show' && $preact != 'show' && strtolower($INPUT->server->str('REQUEST_METHOD')) == 'post'){
195        act_redirect($ID,$preact);
196    }
197
198    global $INFO;
199    global $conf;
200    global $license;
201
202    //call template FIXME: all needed vars available?
203    $headers[] = 'Content-Type: text/html; charset=utf-8';
204    trigger_event('ACTION_HEADERS_SEND',$headers,'act_sendheaders');
205
206    include(template('main.php'));
207    // output for the commands is now handled in inc/templates.php
208    // in function tpl_content()
209}
210
211/**
212 * Send the given headers using header()
213 *
214 * @param array $headers The headers that shall be sent
215 */
216function act_sendheaders($headers) {
217    foreach ($headers as $hdr) header($hdr);
218}
219
220/**
221 * Sanitize the action command
222 *
223 * @author Andreas Gohr <andi@splitbrain.org>
224 *
225 * @param array|string $act
226 * @return string
227 */
228function act_clean($act){
229    // check if the action was given as array key
230    if(is_array($act)){
231        list($act) = array_keys($act);
232    }
233
234    //remove all bad chars
235    $act = strtolower($act);
236    $act = preg_replace('/[^1-9a-z_]+/','',$act);
237
238    if($act == 'export_html') $act = 'export_xhtml';
239    if($act == 'export_htmlbody') $act = 'export_xhtmlbody';
240
241    if($act === '') $act = 'show';
242    return $act;
243}
244
245/**
246 * Sanitize and validate action commands.
247 *
248 * Add all allowed commands here.
249 *
250 * @author Andreas Gohr <andi@splitbrain.org>
251 *
252 * @param array|string $act
253 * @return string
254 */
255function act_validate($act) {
256    global $conf;
257    global $INFO;
258
259    $act = act_clean($act);
260
261    // check if action is disabled
262    if(!actionOK($act)){
263        msg('Command disabled: '.htmlspecialchars($act),-1);
264        return 'show';
265    }
266
267    //disable all acl related commands if ACL is disabled
268    if(!$conf['useacl'] && in_array($act,array('login','logout','register','admin',
269                    'subscribe','unsubscribe','profile','revert',
270                    'resendpwd','profile_delete'))){
271        msg('Command unavailable: '.htmlspecialchars($act),-1);
272        return 'show';
273    }
274
275    //is there really a draft?
276    if($act == 'draft' && !file_exists($INFO['draft'])) return 'edit';
277
278    if(!in_array($act,array('login','logout','register','save','cancel','edit','draft',
279                    'preview','search','show','check','index','revisions',
280                    'diff','recent','backlink','admin','subscribe','revert',
281                    'unsubscribe','profile','profile_delete','resendpwd','recover',
282                    'draftdel','sitemap','media')) && substr($act,0,7) != 'export_' ) {
283        msg('Command unknown: '.htmlspecialchars($act),-1);
284        return 'show';
285    }
286    return $act;
287}
288
289/**
290 * Run permissionchecks
291 *
292 * @author Andreas Gohr <andi@splitbrain.org>
293 *
294 * @param string $act action command
295 * @return string action command
296 */
297function act_permcheck($act){
298    global $INFO;
299
300    if(in_array($act,array('save','preview','edit','recover'))){
301        if($INFO['exists']){
302            if($act == 'edit'){
303                //the edit function will check again and do a source show
304                //when no AUTH_EDIT available
305                $permneed = AUTH_READ;
306            }else{
307                $permneed = AUTH_EDIT;
308            }
309        }else{
310            $permneed = AUTH_CREATE;
311        }
312    }elseif(in_array($act,array('login','search','recent','profile','profile_delete','index', 'sitemap'))){
313        $permneed = AUTH_NONE;
314    }elseif($act == 'revert'){
315        $permneed = AUTH_ADMIN;
316        if($INFO['ismanager']) $permneed = AUTH_EDIT;
317    }elseif($act == 'register'){
318        $permneed = AUTH_NONE;
319    }elseif($act == 'resendpwd'){
320        $permneed = AUTH_NONE;
321    }elseif($act == 'admin'){
322        if($INFO['ismanager']){
323            // if the manager has the needed permissions for a certain admin
324            // action is checked later
325            $permneed = AUTH_READ;
326        }else{
327            $permneed = AUTH_ADMIN;
328        }
329    }else{
330        $permneed = AUTH_READ;
331    }
332    if($INFO['perm'] >= $permneed) return $act;
333
334    return 'denied';
335}
336
337/**
338 * Handle 'draftdel'
339 *
340 * Deletes the draft for the current page and user
341 *
342 * @param string $act action command
343 * @return string action command
344 */
345function act_draftdel($act){
346    global $INFO;
347    @unlink($INFO['draft']);
348    $INFO['draft'] = null;
349    return 'show';
350}
351
352/**
353 * Saves a draft on preview
354 *
355 * @todo this currently duplicates code from ajax.php :-/
356 *
357 * @param string $act action command
358 * @return string action command
359 */
360function act_draftsave($act){
361    global $INFO;
362    global $ID;
363    global $INPUT;
364    global $conf;
365    if($conf['usedraft'] && $INPUT->post->has('wikitext')) {
366        $draft = array('id'     => $ID,
367                'prefix' => substr($INPUT->post->str('prefix'), 0, -1),
368                'text'   => $INPUT->post->str('wikitext'),
369                'suffix' => $INPUT->post->str('suffix'),
370                'date'   => $INPUT->post->int('date'),
371                'client' => $INFO['client'],
372                );
373        $cname = getCacheName($draft['client'].$ID,'.draft');
374        if(io_saveFile($cname,serialize($draft))){
375            $INFO['draft'] = $cname;
376        }
377    }
378    return $act;
379}
380
381/**
382 * Handle 'save'
383 *
384 * Checks for spam and conflicts and saves the page.
385 * Does a redirect to show the page afterwards or
386 * returns a new action.
387 *
388 * @author Andreas Gohr <andi@splitbrain.org>
389 *
390 * @param string $act action command
391 * @return string action command
392 */
393function act_save($act){
394    global $ID;
395    global $DATE;
396    global $PRE;
397    global $TEXT;
398    global $SUF;
399    global $SUM;
400    global $lang;
401    global $INFO;
402    global $INPUT;
403
404    //spam check
405    if(checkwordblock()) {
406        msg($lang['wordblock'], -1);
407        return 'edit';
408    }
409    //conflict check
410    if($DATE != 0 && $INFO['meta']['date']['modified'] > $DATE )
411        return 'conflict';
412
413    //save it
414    saveWikiText($ID,con($PRE,$TEXT,$SUF,true),$SUM,$INPUT->bool('minor')); //use pretty mode for con
415    //unlock it
416    unlock($ID);
417
418    //delete draft
419    act_draftdel($act);
420    session_write_close();
421
422    // when done, show page
423    return 'show';
424}
425
426/**
427 * Revert to a certain revision
428 *
429 * @author Andreas Gohr <andi@splitbrain.org>
430 *
431 * @param string $act action command
432 * @return string action command
433 */
434function act_revert($act){
435    global $ID;
436    global $REV;
437    global $lang;
438    /* @var Input $INPUT */
439    global $INPUT;
440    // FIXME $INFO['writable'] currently refers to the attic version
441    // global $INFO;
442    // if (!$INFO['writable']) {
443    //     return 'show';
444    // }
445
446    // when no revision is given, delete current one
447    // FIXME this feature is not exposed in the GUI currently
448    $text = '';
449    $sum  = $lang['deleted'];
450    if($REV){
451        $text = rawWiki($ID,$REV);
452        if(!$text) return 'show'; //something went wrong
453        $sum = sprintf($lang['restored'], dformat($REV));
454    }
455
456    // spam check
457
458    if (checkwordblock($text)) {
459        msg($lang['wordblock'], -1);
460        return 'edit';
461    }
462
463    saveWikiText($ID,$text,$sum,false);
464    msg($sum,1);
465
466    //delete any draft
467    act_draftdel($act);
468    session_write_close();
469
470    // when done, show current page
471    $INPUT->server->set('REQUEST_METHOD','post'); //should force a redirect
472    $REV = '';
473    return 'show';
474}
475
476/**
477 * Do a redirect after receiving post data
478 *
479 * Tries to add the section id as hash mark after section editing
480 *
481 * @param string $id page id
482 * @param string $preact action command before redirect
483 */
484function act_redirect($id,$preact){
485    global $PRE;
486    global $TEXT;
487
488    $opts = array(
489            'id'       => $id,
490            'preact'   => $preact
491            );
492    //get section name when coming from section edit
493    if($PRE && preg_match('/^\s*==+([^=\n]+)/',$TEXT,$match)){
494        $check = false; //Byref
495        $opts['fragment'] = sectionID($match[0], $check);
496    }
497
498    trigger_event('ACTION_SHOW_REDIRECT',$opts,'act_redirect_execute');
499}
500
501/**
502 * Execute the redirect
503 *
504 * @param array $opts id and fragment for the redirect and the preact
505 */
506function act_redirect_execute($opts){
507    $go = wl($opts['id'],'',true);
508    if(isset($opts['fragment'])) $go .= '#'.$opts['fragment'];
509
510    //show it
511    send_redirect($go);
512}
513
514/**
515 * Handle 'login', 'logout'
516 *
517 * @author Andreas Gohr <andi@splitbrain.org>
518 *
519 * @param string $act action command
520 * @return string action command
521 */
522function act_auth($act){
523    global $ID;
524    global $INFO;
525    /* @var Input $INPUT */
526    global $INPUT;
527
528    //already logged in?
529    if($INPUT->server->has('REMOTE_USER') && $act=='login'){
530        return 'show';
531    }
532
533    //handle logout
534    if($act=='logout'){
535        $lockedby = checklock($ID); //page still locked?
536        if($lockedby == $INPUT->server->str('REMOTE_USER')){
537            unlock($ID); //try to unlock
538        }
539
540        // do the logout stuff
541        auth_logoff();
542
543        // rebuild info array
544        $INFO = pageinfo();
545
546        act_redirect($ID,'login');
547    }
548
549    return $act;
550}
551
552/**
553 * Handle 'edit', 'preview', 'recover'
554 *
555 * @author Andreas Gohr <andi@splitbrain.org>
556 *
557 * @param string $act action command
558 * @return string action command
559 */
560function act_edit($act){
561    global $ID;
562    global $INFO;
563
564    global $TEXT;
565    global $RANGE;
566    global $PRE;
567    global $SUF;
568    global $REV;
569    global $SUM;
570    global $lang;
571    global $DATE;
572
573    if (!isset($TEXT)) {
574        if ($INFO['exists']) {
575            if ($RANGE) {
576                list($PRE,$TEXT,$SUF) = rawWikiSlices($RANGE,$ID,$REV);
577            } else {
578                $TEXT = rawWiki($ID,$REV);
579            }
580        } else {
581            $TEXT = pageTemplate($ID);
582        }
583    }
584
585    //set summary default
586    if(!$SUM){
587        if($REV){
588            $SUM = sprintf($lang['restored'], dformat($REV));
589        }elseif(!$INFO['exists']){
590            $SUM = $lang['created'];
591        }
592    }
593
594    // Use the date of the newest revision, not of the revision we edit
595    // This is used for conflict detection
596    if(!$DATE) $DATE = @filemtime(wikiFN($ID));
597
598    //check if locked by anyone - if not lock for my self
599    //do not lock when the user can't edit anyway
600    if ($INFO['writable']) {
601        $lockedby = checklock($ID);
602        if($lockedby) return 'locked';
603
604        lock($ID);
605    }
606
607    return $act;
608}
609
610/**
611 * Export a wiki page for various formats
612 *
613 * Triggers ACTION_EXPORT_POSTPROCESS
614 *
615 *  Event data:
616 *    data['id']      -- page id
617 *    data['mode']    -- requested export mode
618 *    data['headers'] -- export headers
619 *    data['output']  -- export output
620 *
621 * @author Andreas Gohr <andi@splitbrain.org>
622 * @author Michael Klier <chi@chimeric.de>
623 *
624 * @param string $act action command
625 * @return string action command
626 */
627function act_export($act){
628    global $ID;
629    global $REV;
630    global $conf;
631    global $lang;
632
633    $pre = '';
634    $post = '';
635    $headers = array();
636
637    // search engines: never cache exported docs! (Google only currently)
638    $headers['X-Robots-Tag'] = 'noindex';
639
640    $mode = substr($act,7);
641    switch($mode) {
642        case 'raw':
643            $headers['Content-Type'] = 'text/plain; charset=utf-8';
644            $headers['Content-Disposition'] = 'attachment; filename='.noNS($ID).'.txt';
645            $output = rawWiki($ID,$REV);
646            break;
647        case 'xhtml':
648            $pre .= '<!DOCTYPE html>' . DOKU_LF;
649            $pre .= '<html lang="'.$conf['lang'].'" dir="'.$lang['direction'].'">' . DOKU_LF;
650            $pre .= '<head>' . DOKU_LF;
651            $pre .= '  <meta charset="utf-8" />' . DOKU_LF;
652            $pre .= '  <title>'.$ID.'</title>' . DOKU_LF;
653
654            // get metaheaders
655            ob_start();
656            tpl_metaheaders();
657            $pre .= ob_get_clean();
658
659            $pre .= '</head>' . DOKU_LF;
660            $pre .= '<body>' . DOKU_LF;
661            $pre .= '<div class="dokuwiki export">' . DOKU_LF;
662
663            // get toc
664            $pre .= tpl_toc(true);
665
666            $headers['Content-Type'] = 'text/html; charset=utf-8';
667            $output = p_wiki_xhtml($ID,$REV,false);
668
669            $post .= '</div>' . DOKU_LF;
670            $post .= '</body>' . DOKU_LF;
671            $post .= '</html>' . DOKU_LF;
672            break;
673        case 'xhtmlbody':
674            $headers['Content-Type'] = 'text/html; charset=utf-8';
675            $output = p_wiki_xhtml($ID,$REV,false);
676            break;
677        default:
678            $output = p_cached_output(wikiFN($ID,$REV), $mode);
679            $headers = p_get_metadata($ID,"format $mode");
680            break;
681    }
682
683    // prepare event data
684    $data = array();
685    $data['id'] = $ID;
686    $data['mode'] = $mode;
687    $data['headers'] = $headers;
688    $data['output'] =& $output;
689
690    trigger_event('ACTION_EXPORT_POSTPROCESS', $data);
691
692    if(!empty($data['output'])){
693        if(is_array($data['headers'])) foreach($data['headers'] as $key => $val){
694            header("$key: $val");
695        }
696        print $pre.$data['output'].$post;
697        exit;
698    }
699    return 'show';
700}
701
702/**
703 * Handle sitemap delivery
704 *
705 * @author Michael Hamann <michael@content-space.de>
706 *
707 * @param string $act action command
708 */
709function act_sitemap($act) {
710    global $conf;
711
712    if ($conf['sitemap'] < 1 || !is_numeric($conf['sitemap'])) {
713        http_status(404);
714        print "Sitemap generation is disabled.";
715        exit;
716    }
717
718    $sitemap = Sitemapper::getFilePath();
719    if (Sitemapper::sitemapIsCompressed()) {
720        $mime = 'application/x-gzip';
721    }else{
722        $mime = 'application/xml; charset=utf-8';
723    }
724
725    // Check if sitemap file exists, otherwise create it
726    if (!is_readable($sitemap)) {
727        Sitemapper::generate();
728    }
729
730    if (is_readable($sitemap)) {
731        // Send headers
732        header('Content-Type: '.$mime);
733        header('Content-Disposition: attachment; filename='.utf8_basename($sitemap));
734
735        http_conditionalRequest(filemtime($sitemap));
736
737        // Send file
738        //use x-sendfile header to pass the delivery to compatible webservers
739        http_sendfile($sitemap);
740
741        readfile($sitemap);
742        exit;
743    }
744
745    http_status(500);
746    print "Could not read the sitemap file - bad permissions?";
747    exit;
748}
749
750/**
751 * Handle page 'subscribe'
752 *
753 * Throws exception on error.
754 *
755 * @author Adrian Lang <lang@cosmocode.de>
756 *
757 * @param string $act action command
758 * @return string action command
759 * @throws Exception if (un)subscribing fails
760 */
761function act_subscription($act){
762    global $lang;
763    global $INFO;
764    global $ID;
765    /* @var Input $INPUT */
766    global $INPUT;
767
768    // subcriptions work for logged in users only
769    if(!$INPUT->server->str('REMOTE_USER')) return 'show';
770
771    // get and preprocess data.
772    $params = array();
773    foreach(array('target', 'style', 'action') as $param) {
774        if ($INPUT->has("sub_$param")) {
775            $params[$param] = $INPUT->str("sub_$param");
776        }
777    }
778
779    // any action given? if not just return and show the subscription page
780    if(empty($params['action']) || !checkSecurityToken()) return $act;
781
782    // Handle POST data, may throw exception.
783    trigger_event('ACTION_HANDLE_SUBSCRIBE', $params, 'subscription_handle_post');
784
785    $target = $params['target'];
786    $style  = $params['style'];
787    $action = $params['action'];
788
789    // Perform action.
790    $sub = new Subscription();
791    if($action == 'unsubscribe'){
792        $ok = $sub->remove($target, $INPUT->server->str('REMOTE_USER'), $style);
793    }else{
794        $ok = $sub->add($target, $INPUT->server->str('REMOTE_USER'), $style);
795    }
796
797    if($ok) {
798        msg(sprintf($lang["subscr_{$action}_success"], hsc($INFO['userinfo']['name']),
799                    prettyprint_id($target)), 1);
800        act_redirect($ID, $act);
801    } else {
802        throw new Exception(sprintf($lang["subscr_{$action}_error"],
803                                    hsc($INFO['userinfo']['name']),
804                                    prettyprint_id($target)));
805    }
806
807    // Assure that we have valid data if act_redirect somehow fails.
808    $INFO['subscribed'] = $sub->user_subscription();
809    return 'show';
810}
811
812/**
813 * Validate POST data
814 *
815 * Validates POST data for a subscribe or unsubscribe request. This is the
816 * default action for the event ACTION_HANDLE_SUBSCRIBE.
817 *
818 * @author Adrian Lang <lang@cosmocode.de>
819 *
820 * @param array &$params the parameters: target, style and action
821 * @throws Exception
822 */
823function subscription_handle_post(&$params) {
824    global $INFO;
825    global $lang;
826    /* @var Input $INPUT */
827    global $INPUT;
828
829    // Get and validate parameters.
830    if (!isset($params['target'])) {
831        throw new Exception('no subscription target given');
832    }
833    $target = $params['target'];
834    $valid_styles = array('every', 'digest');
835    if (substr($target, -1, 1) === ':') {
836        // Allow “list” subscribe style since the target is a namespace.
837        $valid_styles[] = 'list';
838    }
839    $style  = valid_input_set('style', $valid_styles, $params,
840                              'invalid subscription style given');
841    $action = valid_input_set('action', array('subscribe', 'unsubscribe'),
842                              $params, 'invalid subscription action given');
843
844    // Check other conditions.
845    if ($action === 'subscribe') {
846        if ($INFO['userinfo']['mail'] === '') {
847            throw new Exception($lang['subscr_subscribe_noaddress']);
848        }
849    } elseif ($action === 'unsubscribe') {
850        $is = false;
851        foreach($INFO['subscribed'] as $subscr) {
852            if ($subscr['target'] === $target) {
853                $is = true;
854            }
855        }
856        if ($is === false) {
857            throw new Exception(sprintf($lang['subscr_not_subscribed'],
858                                        $INPUT->server->str('REMOTE_USER'),
859                                        prettyprint_id($target)));
860        }
861        // subscription_set deletes a subscription if style = null.
862        $style = null;
863    }
864
865    $params = compact('target', 'style', 'action');
866}
867
868//Setup VIM: ex: et ts=2 :
869