Skip to content

Commit

Permalink
Első comit teszt célokra.
Browse files Browse the repository at this point in the history
- Szerveroldali validáció módosítva ékezetes betűkre
- .htaccess rewire SEO célokra
- kliensoldali validáció csak bemutatni mint teszt, kizárólag a meta adatok felvitelénél megoldva.
- .gitignore ami végülis nem fontos de jó ha van
  • Loading branch information
Laca committed May 1, 2015
1 parent 65d56d1 commit 70d0f21
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
# Created by .ignore support plugin (hsz.mobi)
settings.php
.idea
media
31 changes: 31 additions & 0 deletions .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]
47 changes: 47 additions & 0 deletions assets/js/asset.form.js
Expand Up @@ -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;
}

});
} );
13 changes: 11 additions & 2 deletions bin/classes/abs.class.record.php
Expand Up @@ -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.' );
Expand Down
2 changes: 1 addition & 1 deletion bin/classes/class.routing.php
Expand Up @@ -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' );
}
}

Expand Down
20 changes: 10 additions & 10 deletions lib/mlib.validate.php
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion manager/modules/mcontent/views/edit.php
Expand Up @@ -251,7 +251,7 @@
<br />
<div class="panel panel-default">
<div class="panel-heading">Add meta</div>
<div class="panel-body">
<div class="panel-body" id="meta_panel">
<div class="form-group">
<label>Name</label>
<input type="text" name="meta_name" class="form-control input-sm" id="meta_name" value="" />
Expand All @@ -261,6 +261,8 @@
<input type="text" name="meta_value" class="form-control input-sm" id="meta_value" value="" />
</div>

<span id="FinalError" class="FinalError" style="none"></span>

<div class="form-group">
<button type="button" class="btn btn-primary" name="meta_add" id="meta_add" onclick="new MContent().add_meta();">Add</button>
</div>
Expand Down
14 changes: 14 additions & 0 deletions manager/templates/manager/css/mappiamo-manager.css
Expand Up @@ -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;
}

0 comments on commit 70d0f21

Please sign in to comment.