Conditions | 4 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | protected function savedraft() { |
||
32 | global $INFO; |
||
33 | global $ID; |
||
34 | global $INPUT; |
||
35 | global $conf; |
||
36 | |||
37 | if(!$conf['usedraft']) return; |
||
38 | if(!$INPUT->post->has('wikitext')) return; |
||
39 | |||
40 | // ensure environment (safeguard when used via AJAX) |
||
41 | assert(isset($INFO['client']), 'INFO.client should have been set'); |
||
42 | assert(isset($ID), 'ID should have been set'); |
||
43 | |||
44 | $draft = array( |
||
45 | 'id' => $ID, |
||
46 | 'prefix' => substr($INPUT->post->str('prefix'), 0, -1), |
||
47 | 'text' => $INPUT->post->str('wikitext'), |
||
48 | 'suffix' => $INPUT->post->str('suffix'), |
||
49 | 'date' => $INPUT->post->int('date'), |
||
50 | 'client' => $INFO['client'], |
||
51 | ); |
||
52 | $cname = getCacheName($draft['client'] . $ID, '.draft'); |
||
53 | if(io_saveFile($cname, serialize($draft))) { |
||
54 | $INFO['draft'] = $cname; |
||
55 | } |
||
56 | } |
||
57 | |||
59 |