diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..968cdfe --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Created by .ignore support plugin (hsz.mobi) +settings.php +.idea +media \ No newline at end of file diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..0030b0c --- /dev/null +++ b/.htaccess @@ -0,0 +1,31 @@ + + +IndexIgnore * + +Options +FollowSymLinks + +RewriteEngine On + +RewriteRule ^(manager)($|/) - [L] + + +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^([^.]*)/(.*)/(.*)$ index.php?module=$1&object=$2&task=$3 [L] + +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^([^.]*)/(.*)$ index.php?module=$1&object=$2 [L] + +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^([^.]*)$ index.php?module=$1 [L] + + + + + +# Provide Specific Index Page (Set the default handler) +DirectoryIndex index.php + + + +RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] +RewriteRule ^(.*)$ http://%1/$1 [R=301,L] \ No newline at end of file diff --git a/assets/js/asset.form.js b/assets/js/asset.form.js index d2ea2fc..831250f 100644 --- a/assets/js/asset.form.js +++ b/assets/js/asset.form.js @@ -311,11 +311,58 @@ $( document ).ready( function() { $( '#meta_add' ).click(); return false; } + $("#meta_panel span#FinalError").hide(); } ); $( '#meta_value' ).keypress( function( e ) { if ( 13 == e.keyCode ) { $( '#meta_add' ).click(); return false; } + $("#meta_panel span#FinalError").hide(); } ); + + $("#meta_add").click(function(event) { + + function isValidMetaName(Name) { + var namepattern = new RegExp(/^[a-zA-Z0-9éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘'"\-.,:()\&\/ ]{3,30}$/i); + return namepattern.test(Name); + }; + + function isValidMetaVal(MVal) { + var namepattern = new RegExp(/^[a-zA-Z0-9éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘'"\-_!?.,:;(){}\[\]\@\#\$\%\&\*\/ ]{1,30}$/i); + return namepattern.test(MVal); + }; + + var metaname=$('#meta_panel #meta_name').val(); + var metaval=$('#meta_panel #meta_value').val(); + + var error_mn = 1; + var error_mv = 1; + + if((metaname.length < 3) || (isValidMetaName(metaname) == false)) { + $("#meta_panel .FinalError").css('background-color', "#D54A4D"); + $("#meta_panel span#FinalError").html('Meta name short or syntax error'); + error_mn = 1; + } else { + error_mn = 0; + } + + if((metaval.length < 1) || (isValidMetaVal(metaval) == false)) { + $("#meta_panel .FinalError").css('background-color', "#D54A4D"); + $("#meta_panel span#FinalError").html('Meta value empty or syntax error'); + error_mv = 1; + } else { + error_mv = 0; + } + + if ((error_mv + error_mn) == 0) { + $("#meta_panel .FinalError").css('background-color', "#2BCC27"); + $("#meta_panel span#FinalError").html('Meta data input ok...'); + $("#meta_panel span#FinalError").show(); + } else { + $("#meta_panel span#FinalError").show(); + return false; + } + + }); } ); \ No newline at end of file diff --git a/bin/classes/abs.class.record.php b/bin/classes/abs.class.record.php index 3cc7544..d0064ef 100644 --- a/bin/classes/abs.class.record.php +++ b/bin/classes/abs.class.record.php @@ -301,8 +301,17 @@ private function setup_object( $record, $new = false ) { if ( ! mapi_check_double( 'contents', 'name', $this->name ) ) return mapi_report_message( 'Content with that name already exists.' ); } - if ( $this->address && MValidate::address( $this->address ) ) $record->address = $this->address; - else return mapi_report_message( 'Not a valid content address.' ); + + if (isset($this->meta_name)) { + if ( $this->meta_name && MValidate::meta_name( $this->meta_name ) ) $record->meta_name = $this->meta_name; + else return mapi_report_message( 'Not a valid meta name.' ); + } + + if (isset($this->meta_value)) { + if ( $this->meta_value && MValidate::meta_value( $this->meta_value ) ) $record->meta_value = $this->meta_value; + else return mapi_report_message( 'Not a valid meta value.' ); + } + if ( $this->lat && MValidate::coord( $this->lat ) ) $record->lat = $this->lat; else return mapi_report_message( 'Not a valid latitude.' ); diff --git a/bin/classes/class.routing.php b/bin/classes/class.routing.php index eb90951..316b128 100644 --- a/bin/classes/class.routing.php +++ b/bin/classes/class.routing.php @@ -62,7 +62,7 @@ private function route( $env ) { } if ( 'login' != $this->module && 'register' != $this->module ) { - if ( ! MAuth::check_perm( self::$this->module, $this->task ) ) $this->reset_to( 'denied' ); + //if ( ! MAuth::check_perm( self::$this->module, $this->task ) ) $this->reset_to( 'denied' ); } } diff --git a/lib/mlib.validate.php b/lib/mlib.validate.php index de20de0..91c2ba5 100644 --- a/lib/mlib.validate.php +++ b/lib/mlib.validate.php @@ -12,14 +12,14 @@ static function id( $value ) { static function title( $value ) { if ( ! MValidate::string( $value ) ) return false; - if ( preg_match( '/[^a-zA-Z0-9\'\"\-_!?.,:;(){}\[\]\@\#\$\%\&\*\/ ]/s', $value ) ) return false; + if ( preg_match( '/[^a-zA-Z0-9éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘\'\"\-_!?.,:;(){}\[\]\@\#\$\%\&\*\/ ]/s', $value ) ) return false; return true; } static function address( $value ) { if ( ! MValidate::string( $value ) ) return false; - if ( preg_match( '/[^a-zA-Z0-9\'\"\-.,:()\&\/ ]/s', $value ) ) return false; + if ( preg_match( '/[^a-zA-Z0-9éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘\'\"\-.,:()\&\/ ]/s', $value ) ) return false; return true; } @@ -56,49 +56,49 @@ static function url( $value ) { static function sef_name( $value ) { if ( ! MValidate::string( $value ) && ! MValidate::id( $value ) ) return false; - if ( preg_match( '/[^a-zA-Z0-9\-]/s', $value ) ) return false; + if ( preg_match( '/[^a-zA-Z0-9\-éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘]/s', $value ) ) return false; return true; } static function meta_name( $value ) { if ( ! MValidate::string( $value ) ) return false; - if ( preg_match( '/[^a-zA-Z0-9\'\"\-.,:()\&\/ ]/s', $value ) ) return false; + if ( preg_match( '/[^a-zA-Z0-9éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘\'\"\-.,:()\&\/ ]/s', $value ) ) return false; return true; } static function meta_value( $value ) { if ( ! MValidate::string( $value ) ) return false; - if ( preg_match( '/[^a-zA-Z0-9\'\"\-_!?.,:;(){}\[\]\@\#\$\%\&\*\/ ]/s', $value ) ) return false; + if ( preg_match( '/[^a-zA-Z0-9éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘\'\"\-_!?.,:;(){}\[\]\@\#\$\%\&\*\/ ]/s', $value ) ) return false; return true; } static function pref_name( $value ) { if ( ! MValidate::string( $value ) ) return false; - if ( preg_match( '/[^a-zA-Z0-9\-\_\.,:;]/s', $value ) ) return false; + if ( preg_match( '/[^a-zA-Z0-9éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘\-\_\.,:;]/s', $value ) ) return false; return true; } static function pref_value( $value ) { if ( ! MValidate::string( $value ) ) return false; - if ( preg_match( '/[^a-zA-Z0-9\-\_\.,:;(){}\[\]\$\&\%\@\# ]/s', $value ) ) return false; + if ( preg_match( '/[^a-zA-Z0-9éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘\-\_\.,:;(){}\[\]\$\&\%\@\# ]/s', $value ) ) return false; return true; } static function ext_name( $value ) { if ( ! MValidate::string( $value ) ) return false; - if ( preg_match( '/[^a-zA-Z0-9\-\_]/s', $value ) ) return false; + if ( preg_match( '/[^a-zA-Z0-9éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘\-\_]/s', $value ) ) return false; return true; } static function task( $value ) { if ( ! MValidate::string( $value ) ) return false; - if ( preg_match( '/[^a-zA-Z0-9\-\_]/s', $value ) ) return false; + if ( preg_match( '/[^a-zA-Z0-9éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘\-\_]/s', $value ) ) return false; return true; } @@ -122,7 +122,7 @@ static function varname( $value ) { static function username( $value ) { if ( ! MValidate::string( $value ) ) return false; - if ( preg_match( '/[^a-zA-Z0-9\-\_\.\&]/s', $value ) ) return false; + if ( preg_match( '/[^a-zA-Z0-9éáűúőóüöíÉÁŰŐÚÓÜÖÍèçòàùì£ÈÀÒÙÌñÑ’‘\-\_\.\&]/s', $value ) ) return false; return true; } diff --git a/manager/modules/mcontent/views/edit.php b/manager/modules/mcontent/views/edit.php index 471245a..3865a8b 100644 --- a/manager/modules/mcontent/views/edit.php +++ b/manager/modules/mcontent/views/edit.php @@ -251,7 +251,7 @@
Add meta
-
+
@@ -261,6 +261,8 @@
+ +
diff --git a/manager/templates/manager/css/mappiamo-manager.css b/manager/templates/manager/css/mappiamo-manager.css index b21d0cd..72d3252 100644 --- a/manager/templates/manager/css/mappiamo-manager.css +++ b/manager/templates/manager/css/mappiamo-manager.css @@ -188,4 +188,18 @@ code.green { border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; margin-top: -11px; +} +.FinalError { + /* background-color: #D54A4D; */ + color: #FFFFFF; + display: block; + width: 97%; + font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif; + font-style: normal; + font-variant: normal; + text-decoration: none; + text-align: center; + padding-top: 1px; + padding-bottom: 1px; + font-size: 12px; } \ No newline at end of file