public function test_str() { $_REQUEST = $this->data; $_POST = $this->data; $_GET = $this->data; $_GET['get'] = 1; $_POST['post'] = 1; $INPUT = new Input(); $this->assertSame('foo', $INPUT->str('string')); $this->assertSame('', $INPUT->str('none')); $this->assertSame('', $INPUT->str('empty')); $this->assertSame('foo', $INPUT->str('none', 'foo')); $this->assertSame('', $INPUT->str('empty', 'foo')); $this->assertSame('foo', $INPUT->str('empty', 'foo', true)); $this->assertSame(false, $INPUT->str('get', false)); $this->assertSame(false, $INPUT->str('post', false)); $this->assertSame('foo', $INPUT->post->str('string')); $this->assertSame('', $INPUT->post->str('none')); $this->assertSame('', $INPUT->post->str('empty')); $this->assertSame('foo', $INPUT->post->str('none', 'foo')); $this->assertSame('', $INPUT->post->str('empty', 'foo')); $this->assertSame('foo', $INPUT->post->str('empty', 'foo', true)); $this->assertSame(false, $INPUT->post->str('get', false)); $this->assertSame('1', $INPUT->post->str('post', false)); $this->assertSame('foo', $INPUT->get->str('string')); $this->assertSame('', $INPUT->get->str('none')); $this->assertSame('', $INPUT->get->str('empty')); $this->assertSame('foo', $INPUT->get->str('none', 'foo')); $this->assertSame('', $INPUT->get->str('empty', 'foo')); $this->assertSame('foo', $INPUT->get->str('empty', 'foo', true)); $this->assertSame(false, $INPUT->get->str('post', false)); $this->assertSame('1', $INPUT->get->str('get', false)); $this->assertSame('', $INPUT->str('array')); }
if (!defined('DOKU_DISABLE_GZIP_OUTPUT')) { define('DOKU_DISABLE_GZIP_OUTPUT', 1); } require_once DOKU_INC . 'inc/init.php'; session_write_close(); //close session require_once DOKU_INC . 'inc/fetch.functions.php'; if (defined('SIMPLE_TEST')) { $INPUT = new Input(); } // BEGIN main $mimetypes = getMimeTypes(); //get input $MEDIA = stripctl(getID('media', false)); // no cleaning except control chars - maybe external $CACHE = calc_cache($INPUT->str('cache')); $WIDTH = $INPUT->int('w'); $HEIGHT = $INPUT->int('h'); $REV =& $INPUT->ref('rev'); //sanitize revision $REV = preg_replace('/[^0-9]/', '', $REV); list($EXT, $MIME, $DL) = mimetype($MEDIA, false); if ($EXT === false) { $EXT = 'unknown'; $MIME = 'application/octet-stream'; $DL = true; } // check for permissions, preconditions and cache external files list($STATUS, $STATUSMESSAGE) = checkFileStatus($MEDIA, $FILE, $REV, $WIDTH, $HEIGHT); // prepare data for plugin events $data = array('media' => $MEDIA, 'file' => $FILE, 'orig' => $FILE, 'mime' => $MIME, 'download' => $DL, 'cache' => $CACHE, 'ext' => $EXT, 'width' => $WIDTH, 'height' => $HEIGHT, 'status' => $STATUS, 'statusmessage' => $STATUSMESSAGE, 'ispublic' => media_ispublic($MEDIA));
<?php define("DOKU_INC", realpath(dirname(__FILE__) . '/../../../../') . '/'); define("DOKU_PLUGIN", DOKU_INC . 'lib/plugins/'); define("PAGES", DOKU_INC . 'data/pages/'); define("FCKEDITOR", DOKU_PLUGIN . 'ckgedit/fckeditor/editor/'); define('CONNECTOR', FCKEDITOR . 'filemanager/connectors/php/'); require_once CONNECTOR . 'check_acl.php'; require_once DOKU_INC . 'inc/Input.class.php'; require_once CONNECTOR . 'SafeFN.class.php'; global $dwfck_conf; global $Dwfck_conf_values; $INPUT = new Input(); $page = $INPUT->str('dw_id'); $page = ltrim($page, ':'); $dwfck_conf = doku_config_values(); // needed for cleanID $Dwfck_conf_values = $dwfck_conf; $page = str_replace(':', '/', $page); $page = dwiki_encodeFN($page); if (!empty($Dwfck_conf_values['ckg_savedir'])) { $path = $Dwfck_conf_values['ckg_savedir'] . '/pages/' . $page . '.txt'; } else { $path = PAGES . $page . '.txt'; } $resp = ""; $headers = array(); $lines = file($path); foreach ($lines as $line) { if (preg_match('/^=+([^=]+)=+\\s*$/', $line, $matches)) { $suffix_anchor = "";