Skip to content

Commit

Permalink
improve auto security for php vars
Browse files Browse the repository at this point in the history
  • Loading branch information
h2lsoft committed Sep 11, 2015
1 parent 3d599b2 commit 38ba7a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions library/php/TPLN/TPLN.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ function tpln_auto_security($value, $urldecode_before=false, $sanitize=true, $st


// naughty scripting
$value = preg_replace('#(alert|cmd|passthru|eval|shell_exec|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#si',
'\\1\\2(\\3)',
$value);
$value = preg_replace('#(alert|cmd|passthru|eval|shell_exec|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#i',
'[XSS-PROTECT:\\1] (\\3)', $value);

// never allowed
$_never_allowed_str = array('document.cookie', 'document.write', '.parentNode', '.innerHTML', 'window.location', '-moz-binding');
Expand Down
7 changes: 4 additions & 3 deletions nuts/_inc/Page.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,14 @@ public function write()
$url_tmp = @parse_url($_SERVER['REQUEST_URI']);
if(!$url_tmp)$this->error404();

if(isset($url_tmp['query']))
parse_str($url_tmp['query'], $_GET);
// if(isset($url_tmp['query']))
// parse_str($url_tmp['query'], $_GET);

// get information page
$port = ($_SERVER['SERVER_PORT'] == 80) ? '' : ':'.$_SERVER['SERVER_PORT'];
$url = 'http'.((!empty($_SERVER['HTTPS'])) ? 's' : '').'://'.$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
$url = str_replace(':443', '', $url);


// no query string for control
$url = explode('?', $url);
Expand All @@ -395,7 +397,6 @@ public function write()
$curl = explode('/', $curl);



// homepage ?
$this->isHome = false;
if(count($curl) == 0 || $curl[0] == '' || $curl[0] == 'index.php')
Expand Down

0 comments on commit 38ba7a4

Please sign in to comment.