Thursday, February 5, 2015

prestashop upload image: undefined error

my latest update on cpanel, were installing modsecurity with extra vendor from owasp.
it seems that 1 rule have caused prestashop to unable to upload image to product through the admin control panel. The rule effecting the upload is:


rules/REQUEST-20-PROTOCOL-ENFORCEMENT.conf 
For example, these rules block GET requests with a body.
Basically it means it stop all post data if the url contains GET querystring...

hope it help you guys. You may disable this rule in the vendor - edit and off this line.

Friday, December 12, 2014

calling .net dll from asp classic

Prerequisites:
tested on visual studio pro 2013 and windows 8 / 2012

First, create a new vb / c# project com class component.
Then go to project properties,
Application tab > assembly information > Check Make Assembly com visible
Compile tab
Check Register for com interop
(makesure to sign your app, otherwise you cant register with gac)
Signing tab > Sign the assembly > Create a password

Okay, now to solution explorer on the right side,
Right click on solution and add item
Common items > Code > Com Class

Declare your class with method required,
Remember this class will be visible from outside.


When done building your project,
Go to Build > Build [your projectname]

goto start, find for visual studio tools
run VS2013 x64 Native Tools Command Prompt
(please take note that this is x64 environment).
So we need to run regasm and gacutil from x64 tools, not the default 32bits

Then cd \yourprojectpath\yourclass\bin\Debug\
regasm yourfile.dll
(need to sign assembly)

gacutil -i yourfile.dll


Then you may check if your registry is registered by calling
regedit
HKLocal Machine > Software > Classes > YourProjectname.YourObject

okay, then restart iis. and test your dll in asp:
<%
dim foo
set foo = Server.CreateObject("YourProjectname.YourObject")

dim pass
pass = "abA2356!"

if foo.ValidatePassword(pass) then
Response.Write "all ok!"
else
    response.Write "not ok!"
end if
%>

other references:
http://forums.iis.net/t/1183338.aspx?Calling+NET+DLL+from+classic+ASP

Thursday, October 23, 2014

fixing poodle vulnerabilities on cpanel services

This guide will help to disable ssl2 and ssl3 support.

/var/cpanel/conf/cpsrvd/ssl_socket_args
SSL_cipher_list=ALL:!ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP
SSL_version=TLSv1

#SSLProtocol ALL -SSLv2 -SSLv3

restart service
/etc/init.d/cpanel restart

test
openssl s_client -connect example.com:2087 -ssl3

should get error
CONNECTED(00000003)
44604:error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure:/SourceCache/OpenSSL098/OpenSSL098-52/src/ssl/s3_pkt.c:1125:SSL alert number 40
44604:error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshake failure:/SourceCache/OpenSSL098/OpenSSL098-52/src/ssl/s3_pkt.c:546:

openssl s_client -connect example.com:2087 -tls1

note:
do not add -SSLv3 to SSL_cipher_list as it will disable tls as well.

Tuesday, October 21, 2014

laravel saving child model

Took me hours to finally figure this out.

When calling child has_many, calling method seems to return the association / querybuilder,
but calling attribute seems to return the collection.

so save the child record,

$object->childs()->save($child)

to get list of collection of childs, calling:

foreach($object->childs as $child)

Friday, September 12, 2014

overriding spree javascripts

to overwrite spree javascripts, such as spree.js.coffee.erb,

first , enable assets path in config/application.rb

add:
config.assets.paths << "#{Rails.root}/assets"

Next, copy the assets file to the same directory path as the assets on spree.
eg.
spree / core / app / assets / javascripts / spree.js.coffee.erb
to:
assets/javascripts/spree.js.coffee.erb

Then run this on server, if its in production mode:
bundle exec rake tmp:clear

then restart the server,
thin restart, or what ever server you are using. you may stop and start.


if you need to add more file, you may edit:
vendor/assets/javascripts/spree/frontend (or backend) / all.js

hope it helps :)

Sunday, August 24, 2014

Marionette CompositeView appendHTML changed to attachHtml

another latest marionette change

Marionette compositeView changed itemView to childView!

it was changed, and nobody was notified,
not that i could google until i found its not working...

terrible community update