| Conditions | 6 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public static function verifyOption(&$phpKeystore, XenForo_DataWriter $dataWriter, $fieldName) |
||
| 23 | { |
||
| 24 | if (!$phpKeystore || !$phpKeystore['enabled']) { |
||
| 25 | // skip check if PHP keystore is not enabled |
||
| 26 | return true; |
||
| 27 | } |
||
| 28 | |||
| 29 | // check existence |
||
| 30 | if (pathinfo($phpKeystore['path'], PATHINFO_EXTENSION) != 'php' || |
||
| 31 | !file_exists(__DIR__ . '/../' . $phpKeystore['path']) |
||
| 32 | ) { |
||
| 33 | $dataWriter->error(new XenForo_Phrase('threemagw_invalid_keystorepath'), $fieldName); |
||
| 34 | return false; |
||
| 35 | } |
||
| 36 | |||
| 37 | // check whether it is writable |
||
| 38 | if (!is_writable(__DIR__ . '/../' . $phpKeystore['path'])) { |
||
| 39 | $dataWriter->error(new XenForo_Phrase('threemagw_not_writable_keystorefile'), $fieldName); |
||
| 40 | return false; |
||
| 41 | } |
||
| 42 | |||
| 43 | return true; |
||
| 44 | } |
||
| 45 | } |
||
| 46 |