splitbrain /
dokuwiki
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | use dokuwiki\Extension\Event; |
||
| 4 | |||
| 5 | if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../'); |
||
| 6 | define('DOKU_MEDIAMANAGER',1); |
||
| 7 | |||
| 8 | // for multi uploader: |
||
| 9 | @ini_set('session.use_only_cookies',0); |
||
| 10 | |||
| 11 | require_once(DOKU_INC.'inc/init.php'); |
||
| 12 | |||
| 13 | global $INPUT; |
||
| 14 | global $lang; |
||
| 15 | global $conf; |
||
| 16 | // handle passed message |
||
| 17 | if($INPUT->str('msg1')) msg(hsc($INPUT->str('msg1')),1); |
||
| 18 | if($INPUT->str('err')) msg(hsc($INPUT->str('err')),-1); |
||
| 19 | |||
| 20 | global $DEL; |
||
| 21 | // get namespace to display (either direct or from deletion order) |
||
| 22 | if($INPUT->str('delete')){ |
||
| 23 | $DEL = cleanID($INPUT->str('delete')); |
||
| 24 | $IMG = $DEL; |
||
| 25 | $NS = getNS($DEL); |
||
| 26 | }elseif($INPUT->str('edit')){ |
||
| 27 | $IMG = cleanID($INPUT->str('edit')); |
||
| 28 | $NS = getNS($IMG); |
||
| 29 | }elseif($INPUT->str('img')){ |
||
| 30 | $IMG = cleanID($INPUT->str('img')); |
||
| 31 | $NS = getNS($IMG); |
||
| 32 | }else{ |
||
| 33 | $NS = cleanID($INPUT->str('ns')); |
||
| 34 | $IMG = null; |
||
| 35 | } |
||
| 36 | |||
| 37 | global $INFO, $JSINFO; |
||
| 38 | $INFO = !empty($INFO) ? array_merge($INFO, mediainfo()) : mediainfo(); |
||
| 39 | $JSINFO['id'] = ''; |
||
| 40 | $JSINFO['namespace'] = ''; |
||
| 41 | $AUTH = $INFO['perm']; // shortcut for historical reasons |
||
| 42 | |||
| 43 | $tmp = array(); |
||
| 44 | Event::createAndTrigger('MEDIAMANAGER_STARTED', $tmp); |
||
| 45 | session_write_close(); //close session |
||
| 46 | |||
| 47 | // do not display the manager if user does not have read access |
||
| 48 | if($AUTH < AUTH_READ && !$fullscreen) { |
||
| 49 | http_status(403); |
||
| 50 | die($lang['accessdenied']); |
||
| 51 | } |
||
| 52 | |||
| 53 | // handle flash upload |
||
| 54 | if(isset($_FILES['Filedata'])){ |
||
| 55 | $_FILES['upload'] =& $_FILES['Filedata']; |
||
| 56 | $JUMPTO = media_upload($NS,$AUTH); |
||
|
0 ignored issues
–
show
Security
Bug
introduced
by
Loading history...
|
|||
| 57 | if($JUMPTO == false){ |
||
|
0 ignored issues
–
show
|
|||
| 58 | http_status(400); |
||
| 59 | echo 'Upload failed'; |
||
| 60 | } |
||
| 61 | echo 'ok'; |
||
| 62 | exit; |
||
| 63 | } |
||
| 64 | |||
| 65 | // give info on PHP caught upload errors |
||
| 66 | if(!empty($_FILES['upload']['error'])){ |
||
| 67 | switch($_FILES['upload']['error']){ |
||
| 68 | case 1: |
||
| 69 | case 2: |
||
| 70 | msg(sprintf($lang['uploadsize'], |
||
| 71 | filesize_h(php_to_byte(ini_get('upload_max_filesize')))),-1); |
||
| 72 | break; |
||
| 73 | default: |
||
| 74 | msg($lang['uploadfail'].' ('.$_FILES['upload']['error'].')',-1); |
||
| 75 | } |
||
| 76 | unset($_FILES['upload']); |
||
| 77 | } |
||
| 78 | |||
| 79 | // handle upload |
||
| 80 | if(!empty($_FILES['upload']['tmp_name'])){ |
||
| 81 | $JUMPTO = media_upload($NS,$AUTH); |
||
|
0 ignored issues
–
show
|
|||
| 82 | if($JUMPTO) $NS = getNS($JUMPTO); |
||
|
0 ignored issues
–
show
The expression
$JUMPTO of type false|string is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== false instead.
In PHP, under loose comparison (like For '' == false // true
'' == null // true
'ab' == false // false
'ab' == null // false
// It is often better to use strict comparison
'' === false // false
'' === null // false
Loading history...
|
|||
| 83 | } |
||
| 84 | |||
| 85 | // handle meta saving |
||
| 86 | if($IMG && @array_key_exists('save', $INPUT->arr('do'))){ |
||
|
0 ignored issues
–
show
The expression
$IMG of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.
In PHP, under loose comparison (like For '' == false // true
'' == null // true
'ab' == false // false
'ab' == null // false
// It is often better to use strict comparison
'' === false // false
'' === null // false
Loading history...
|
|||
| 87 | $JUMPTO = media_metasave($IMG,$AUTH,$INPUT->arr('meta')); |
||
| 88 | } |
||
| 89 | |||
| 90 | if($IMG && ($INPUT->str('mediado') == 'save' || @array_key_exists('save', $INPUT->arr('mediado')))) { |
||
|
0 ignored issues
–
show
The expression
$IMG of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.
In PHP, under loose comparison (like For '' == false // true
'' == null // true
'ab' == false // false
'ab' == null // false
// It is often better to use strict comparison
'' === false // false
'' === null // false
Loading history...
|
|||
| 91 | $JUMPTO = media_metasave($IMG,$AUTH,$INPUT->arr('meta')); |
||
| 92 | } |
||
| 93 | |||
| 94 | if ($INPUT->int('rev') && $conf['mediarevisions']) $REV = $INPUT->int('rev'); |
||
| 95 | |||
| 96 | if($INPUT->str('mediado') == 'restore' && $conf['mediarevisions']){ |
||
| 97 | $JUMPTO = media_restore($INPUT->str('image'), $REV, $AUTH); |
||
| 98 | } |
||
| 99 | |||
| 100 | // handle deletion |
||
| 101 | if($DEL) { |
||
| 102 | $res = 0; |
||
| 103 | if(checkSecurityToken()) { |
||
| 104 | $res = media_delete($DEL,$AUTH); |
||
| 105 | } |
||
| 106 | if ($res & DOKU_MEDIA_DELETED) { |
||
| 107 | $msg = sprintf($lang['deletesucc'], noNS($DEL)); |
||
| 108 | if ($res & DOKU_MEDIA_EMPTY_NS && !$fullscreen) { |
||
| 109 | // current namespace was removed. redirecting to root ns passing msg along |
||
| 110 | send_redirect(DOKU_URL.'lib/exe/mediamanager.php?msg1='. |
||
| 111 | rawurlencode($msg).'&edid='.$INPUT->str('edid')); |
||
| 112 | } |
||
| 113 | msg($msg,1); |
||
| 114 | } elseif ($res & DOKU_MEDIA_INUSE) { |
||
| 115 | if(!$conf['refshow']) { |
||
| 116 | msg(sprintf($lang['mediainuse'],noNS($DEL)),0); |
||
| 117 | } |
||
| 118 | } else { |
||
| 119 | msg(sprintf($lang['deletefail'],noNS($DEL)),-1); |
||
| 120 | } |
||
| 121 | } |
||
| 122 | // finished - start output |
||
| 123 | |||
| 124 | if (!$fullscreen) { |
||
| 125 | header('Content-Type: text/html; charset=utf-8'); |
||
| 126 | include(template('mediamanager.php')); |
||
| 127 | } |
||
| 128 | |||
| 129 | /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ |
||
| 130 |