splitbrain /
dokuwiki
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace dokuwiki\Action; |
||
| 4 | |||
| 5 | use dokuwiki\Action\Exception\ActionAbort; |
||
| 6 | use dokuwiki\Action\Exception\ActionException; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class Save |
||
| 10 | * |
||
| 11 | * Save at the end of an edit session |
||
| 12 | * |
||
| 13 | * @package dokuwiki\Action |
||
| 14 | */ |
||
| 15 | class Save extends AbstractAction { |
||
| 16 | |||
| 17 | /** @inheritdoc */ |
||
| 18 | function minimumPermission() { |
||
|
0 ignored issues
–
show
|
|||
| 19 | global $INFO; |
||
| 20 | if($INFO['exists']) { |
||
| 21 | return AUTH_EDIT; |
||
| 22 | } else { |
||
| 23 | return AUTH_CREATE; |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | /** @inheritdoc */ |
||
| 28 | public function preProcess() { |
||
| 29 | if(!checkSecurityToken()) throw new ActionException('preview'); |
||
| 30 | |||
| 31 | global $ID; |
||
| 32 | global $DATE; |
||
| 33 | global $PRE; |
||
| 34 | global $TEXT; |
||
| 35 | global $SUF; |
||
| 36 | global $SUM; |
||
| 37 | global $lang; |
||
| 38 | global $INFO; |
||
| 39 | global $INPUT; |
||
| 40 | |||
| 41 | //spam check |
||
| 42 | if(checkwordblock()) { |
||
| 43 | msg($lang['wordblock'], -1); |
||
| 44 | throw new ActionException('edit'); |
||
| 45 | } |
||
| 46 | //conflict check |
||
| 47 | if($DATE != 0 && $INFO['meta']['date']['modified'] > $DATE) { |
||
| 48 | throw new ActionException('conflict'); |
||
| 49 | } |
||
| 50 | |||
| 51 | //save it |
||
| 52 | saveWikiText($ID, con($PRE, $TEXT, $SUF, true), $SUM, $INPUT->bool('minor')); //use pretty mode for con |
||
| 53 | //unlock it |
||
| 54 | unlock($ID); |
||
| 55 | |||
| 56 | //delete draft |
||
| 57 | act_draftdel('fixme'); // FIXME replace this utility function |
||
| 58 | //session_write_close(); // FIXME close session higher up |
||
| 59 | |||
| 60 | // when done, show page |
||
| 61 | throw new ActionAbort(); |
||
| 62 | } |
||
| 63 | |||
| 64 | } |
||
| 65 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.