Skip to content

Commit

Permalink
Merge pull request #96 from nukeviet/develop
Browse files Browse the repository at this point in the history
Update from NukeViet 203/02/2015
  • Loading branch information
Hồ Ngọc Triển committed Feb 3, 2015
2 parents 2b2cd9a + fea5cad commit 933b51a
Show file tree
Hide file tree
Showing 74 changed files with 3,206 additions and 1,335 deletions.
11 changes: 7 additions & 4 deletions admin/settings/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,13 @@

foreach( $site_mods as $mod => $row )
{
$xtpl->assign( 'MODE_VALUE', $mod );
$xtpl->assign( 'MODE_SELECTED', ( $mod == $array_config_global['rewrite_op_mod'] ) ? "selected='selected'" : "" );
$xtpl->assign( 'MODE_NAME', $row['custom_title'] );
$xtpl->parse( 'main.system.rewrite_optional.rewrite_op_mod' );
if( $row['module_file'] != 'page' )
{
$xtpl->assign( 'MODE_VALUE', $mod );
$xtpl->assign( 'MODE_SELECTED', ( $mod == $array_config_global['rewrite_op_mod'] ) ? "selected='selected'" : "" );
$xtpl->assign( 'MODE_NAME', $row['custom_title'] );
$xtpl->parse( 'main.system.rewrite_optional.rewrite_op_mod' );
}
}

$xtpl->parse( 'main.system.rewrite_optional' );
Expand Down
8 changes: 4 additions & 4 deletions admin/upload/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
else
{
$urlfile = trim( $nv_Request->get_string( 'fileurl', 'post' ) );
$urlfile = rawurldecode( trim( $nv_Request->get_string( 'fileurl', 'post' ) ) );
$upload_info = $upload->save_urlfile( $urlfile, NV_ROOTDIR . '/' . $path, false, $global_config['nv_auto_resize'] );
}

Expand Down Expand Up @@ -181,7 +181,7 @@
$info['userid'] = $admin_info['userid'];

$newalt = $nv_Request->get_title( 'filealt', 'post', '', true );

if( empty( $newalt ) )
{
$newalt = preg_replace( '/(.*)(\.[a-zA-Z0-9]+)$/', '\1', $upload_info['basename'] );
Expand All @@ -195,9 +195,9 @@
$sth->bindParam( ':newalt', $newalt, PDO::PARAM_STR );
$sth->execute();
}

nv_insert_logs( NV_LANG_DATA, $module_name, $lang_module['upload_file'], $path . '/' . $upload_info['basename'], $admin_info['userid'] );

if( $editor == 'ckeditor' )
{
echo "<script type=\"text/javascript\">window.parent.CKEDITOR.tools.callFunction(" . $CKEditorFuncNum . ", '" . NV_BASE_SITEURL . $path . "/" . $upload_info['basename'] . "', '');</script>";
Expand Down
8 changes: 5 additions & 3 deletions includes/class/upload.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,10 @@ private function verify_image( $file )
$txt = file_get_contents( $file );
if( $txt === false ) return false;

if( preg_match( "#&\#x([0-9a-f]+);#i", $txt ) ) return false;
elseif( preg_match( '#&\#([0-9]+);#i', $txt ) ) return false;
elseif( preg_match( "#([a-z]*)=([\`\'\"]*)script:#iU", $txt ) ) return false;
//if( preg_match( "#&\#x([0-9a-f]+);#i", $txt ) ) return false;
//elseif( preg_match( '#&\#([0-9]+);#i', $txt ) ) return false;
//else
if( preg_match( "#([a-z]*)=([\`\'\"]*)script:#iU", $txt ) ) return false;
elseif( preg_match( "#([a-z]*)=([\`\'\"]*)javascript:#iU", $txt ) ) return false;
elseif( preg_match( "#([a-z]*)=([\'\"]*)vbscript:#iU", $txt ) ) return false;
elseif( preg_match( "#(<[^>]+)style=([\`\'\"]*).*expression\([^>]*>#iU", $txt ) ) return false;
Expand Down Expand Up @@ -678,6 +679,7 @@ private function string_to_filename( $word )
$word = strtr( $word, $utf8_lookup['romanize'] );
}

$word = rawurldecode( $word );
$word = preg_replace( '/[^a-z0-9\.\-\_ ]/i', '', $word );
$word = preg_replace( '/^\W+|\W+$/', '', $word );
$word = preg_replace( '/[ ]+/', '-', $word );
Expand Down
3 changes: 2 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
{
$home = 0;
$module_name = $nv_Request->get_string( NV_NAME_VARIABLE, 'post,get' );

if( empty( $module_name ) )
{
$module_name = $global_config['rewrite_op_mod'];
Expand All @@ -62,6 +62,7 @@
{
$home = 1;
$module_name = $global_config['site_home_module'];
$meta_property['og:title'] = $global_config['site_name'];
}

if( preg_match( $global_config['check_module'], $module_name ) )
Expand Down
Loading

0 comments on commit 933b51a

Please sign in to comment.