Hello I am using elfinder in my laravel application. I am not able to disable delete option from elfinder. Any help is hugely appreciated.
Here is my config file:
<?php
return array(
'dir' => ['assets/uploads/news_upload'],
'disks' => [
],
'route' => [
'prefix' => 'elfinder',
'middleware' => array('web', 'auth'), //Set to null to disable middleware filter
],
'access' => 'Barryvdh\Elfinder\Elfinder::checkAccess',
'roots' => null,
'options' => array(),
'root_options' => array(
),
);
?>
I am not able to disable delete option.
I got the solution after 3 hour of research. And yes it is so simple, just put this code in your config file. Hope this answer will help somebody some day.
'root_options' => array(
'defaults' => array('read' => true, 'write' => true,'locked'=>true),
),
Related
I have a problem with payment integration to my laravel project. It is a GOPAY REST API.
It should by default set request headers with Accept, Content-type and Authorization where the token is stored. Problem is that it doesnt set my request headers. I used the same thing in a normal script which included the SDK and it worked correctly. However in my laravel project it just doesnt work. The SDK uses Curl to set headers and i think there is somewhere the problem.
I also didnt find any similar problem, and i definitely didnt google anyone who integrated GoPay into Laravel.
Pay method in my controller
//minimal configuration
$gopay = GoPay\payments([
'goid' => '8583340073',
'clientId' => '1162442589',
'clientSecret' => 'eDxNQ3ru',
'isProductionMode' => false,
'scope' => GoPay\Definition\TokenScope::ALL,
'language' => GoPay\Definition\Language::CZECH],
['logger' => new GoPay\Http\Log\PrintHttpRequest()]);
$response = $gopay->createPayment([
'payer' => [
'default_payment_instrument' => PaymentInstrument::BANK_ACCOUNT,
'allowed_payment_instruments' => [PaymentInstrument::BANK_ACCOUNT],
'default_swift' => BankSwiftCode::FIO_BANKA,
'allowed_swifts' => [BankSwiftCode::FIO_BANKA, BankSwiftCode::MBANK],
'contact' => [
'first_name' => 'Zbynek',
'last_name' => 'Zak',
'email' => 'test#test.cz',
'phone_number' => '+420777456123',
'city' => 'C.Budejovice',
'street' => 'Plana 67',
'postal_code' => '373 01',
'country_code' => 'CZE',
],
],
'target' => ['type' => 'ACCOUNT', 'goid' => '8583340073'],
'currency' => Currency::CZECH_CROWNS,
'order_number' => '001',
'order_description' => 'pojisteni01',
'items' => [
['name' => 'item01', 'amount' => 50],
['name' => 'item02', 'amount' => 100],
],
'recurrence' => [
'recurrence_cycle' => Recurrence::DAILY,
'recurrence_period' => "7",
'recurrence_date_to' => '2016-12-31'
],
'additional_params' => [
array('name' => 'invoicenumber', 'value' => '2015001003')
],
'callback' => [
'return_url' => 'http://www.hume.cz/public',
'notification_url' => 'http://www.hume.cz/public'
]
]);
I think that somehow laravel changes the headers and doesnt allow the SDK to do it. If you know anything please help me. If you need any extra information, please just ask.
Thank you very much!!
There is a package for handling GoPay payments with Laravel. Install, update config with your credentials and start using GoPay facade to createPayment or another function from official SDK.
I have eshop in production with this my own package and everything works fine.
https://github.com/hazestudio/laravel-gopay-sdk
i just started working with ZF2 ...
i want to initialize cache and session in config file and be able too use it in the application ( every where ) either using service manager or ... i have been searching Google for hours with no lock ... couldn't find anything useful in the documentations and ...
i tried this in module.config.php(Application module):
'service_manager' => array(
'factories' => array(
'cache' => '\Zend\Cache\StorageFactory',
),
),
'cache' => array(
'storage' => array(
'adapter' => 'Filesystem',
'options' => array(
'cache_dir' => __DIR__ . '/../../../data/cache'
),
),
'plugins' => array('WriteControl', 'IgnoreUserAbort'),
'options' => array(
'removeOnFailure' => true,
'exitOnAbort' => true,
'ttl' => 100
),
),
i got this error : While attempting to create cache(alias: cache) an invalid factory was registered for this instance type.
so whats the valid factory ?
so any one can help me out here ?
tanks...
Use a closure as factory instead because Zend\Cache\StorageFactory doesn't implement Zend\ServiceManager\FactoryInterface
'service_manager' => array(
'factories' => array(
'cache' => function () {
return Zend\Cache\StorageFactory::factory(array(
'storage' => array(
'adapter' => 'Filesystem',
'options' => array(
'cache_dir' => __DIR__ . '/../../../data/cache',
'ttl' => 100
),
),
'plugins' => array(
'IgnoreUserAbort' => array(
'exitOnAbort' => true
),
),
));
},
),
)
Btw. clean up your cache configuration and where you get the plugin in WriteControl and the option removeOnFailure from?
I've come to this topic from Google with the same error name but definitely different reason. Error could be caused by file not found error. If you get this error, check your config record
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
and be sure that needed file (mapper in my case) is located in the directory according to upper rules.
Could use some help. I have a drupal6 install that im having trouble with in terms of caching for authenticated users. Boost is handling the none authenticated caching very well. With my current setup, sessions cannot be created at all, when attempting to login the result is "You are not authorized to view this page". Memcache and apc are installed on the server and working according to phpinfo. Here is my current setup (without cacherouter):
include_once('./sites/all/modules/memcache/memcache.inc');
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['session_inc'] = './sites/all/modules/memcache/memcache-session.inc';
$conf['memcache_servers'] = array(
'127.0.0.1:11211' => 'default',
'127.0.0.1:11212' => 'block',
'127.0.0.1:11213' => 'content',
'127.0.0.1:11214' => 'filter',
'127.0.0.1:11215' => 'form',
'127.0.0.1:11216' => 'menu',
'127.0.0.1:11217' => 'page',
'127.0.0.1:11218' => 'update',
'127.0.0.1:11219' => 'views',
'127.0.0.1:11221' => 'session',
'127.0.0.1:11222' => 'users'
);
$conf['memcache_bins'] = array(
'cache' => 'default',
'cache_block' => 'block',
'cache_content' => 'content',
'cache_filter' => 'filter',
'cache_form' => 'form',
'cache_menu' => 'menu',
'cache_page' => 'page',
'cache_update' => 'update',
'cache_views' => 'views',
'session' => 'session',
'users' => 'users'
);
Before this setup, I was using cacherouter with authcache and had apc as the engine. Users could log in, but there was no actual caching happening for authenticated users. I have been reading everything I could find on this to get it going, doing various test and changing configurations, but without success. Here was the previous setup:
$conf['cacherouter'] = array(
'default' => array(
'engine' => 'apc',
'server' => array('127.0.0.1:11211'),
'shared' => TRUE,
'prefix' => '',
'path' => 'storage_bin/filecache',
'static' => FALSE
),
);
$conf['cache_inc'] = './sites/all/modules/authcache/authcache.inc';
$conf['memcache_servers'] = array(
'127.0.0.1:11211' => 'default',
'127.0.0.1:11212' => 'block',
'127.0.0.1:11213' => 'content',
'127.0.0.1:11214' => 'filter',
'127.0.0.1:11215' => 'form',
'127.0.0.1:11216' => 'menu',
'127.0.0.1:11217' => 'page',
'127.0.0.1:11218' => 'update',
'127.0.0.1:11219' => 'views'
);
$conf['memcache_bins'] = array(
'cache' => 'default',
'cache_block' => 'block',
'cache_content' => 'content',
'cache_filter' => 'filter',
'cache_form' => 'form',
'cache_menu' => 'menu',
'cache_page' => 'page',
'cache_update' => 'update',
'cache_views' => 'views'
);
The site is visible at www.thewildside.com. Any help on this would be greatly appreciated.
If anyone else runs into this, my solution was to ditch cacherouter (did not perform as expected), authcache(too beta), and boost (simply to avoid hitting apache at all for cached pages)… proceeding with Memcache API (the drupal module), memcache (the caching system), apc and varnish (3.0). Memcache API allows me to cache both to RAM via memcache and to the drupal db as backup in case memcache is not available (via memcache.db.inc). Benchmark to determine how much RAM to use for each cache component. I can also keep session info in memcache, but I have not noticed a great performance gain with this, so you may choose not to include memcache-session.inc. Create memcache instances for each drupal cache db (or use one default instance). Setup a cache bin for each instance you've created, and throw in reverse proxy settings and default ttl. Here is my whats in my setting.php file;
$conf = array(
'cache_inc' => './sites/all/modules/memcache/memcache.db.inc',
'memcache_key_prefix' => 'ws',
'session_inc' => './sites/all/modules/memcache/memcache-session.inc',
'memcache_servers' => array(
'unix:///var/run/memcached/memcached_wildside.sock' => 'default',
'unix:///var/run/memcached/memcached_wildside_apachesolr.sock' => 'apachesolr',
'unix:///var/run/memcached/memcached_wildside_block.sock' => 'block',
'unix:///var/run/memcached/memcached_wildside_content.sock' => 'content',
'unix:///var/run/memcached/memcached_wildside_filter.sock' => 'filter',
'unix:///var/run/memcached/memcached_wildside_form.sock' => 'form',
'unix:///var/run/memcached/memcached_wildside_media_youtube_status.sock' => 'media_youtube_status',
'unix:///var/run/memcached/memcached_wildside_menu.sock' => 'menu',
'unix:///var/run/memcached/memcached_wildside_objects.sock' => 'objects',
'unix:///var/run/memcached/memcached_wildside_page.sock' => 'page',
'unix:///var/run/memcached/memcached_wildside_path.sock' => 'path',
'unix:///var/run/memcached/memcached_wildside_rules.sock' => 'rules',
'unix:///var/run/memcached/memcached_wildside_update.sock' => 'update',
'unix:///var/run/memcached/memcached_wildside_views.sock' => 'views',
'unix:///var/run/memcached/memcached_wildside_views_data.sock' => 'views_data',
'unix:///var/run/memcached/memcached_wildside_session.sock' => 'session',
'unix:///var/run/memcached/memcached_wildside_users.sock' => 'users'),
'memcache_bins' => array(
'cache' => 'default',
'cache_apachesolr' => 'apachesolr',
'cache_block' => 'block',
'cache_content' => 'content',
'cache_filter' => 'filter',
'cache_form' => 'form',
'cache_media_youtube_status' => 'media_youtube_status',
'cache_menu' => 'menu',
'cache_objects' => 'objects',
'cache_page' => 'page',
'cache_path' => 'path',
'cache_rules' => 'rules',
'cache_update' => 'update',
'cache_views' => 'views',
'cache_views_data' => 'views_data',
'session' => 'session',
'users' => 'users'),
);
$conf['https'] = TRUE;
$conf['mimedetect_magic'] = '/usr/share/file/magic';
$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = array('127.0.0.1');
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])){
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$_SERVER['HTTPS']='on';
}else{
$_SERVER['HTTPS']='';
}
}
/* 1 day cache lifetime = 86400 */
$conf['cache_lifetime'] = 86400;
$conf['page_cache_maximum_age'] = 86400;
When setting up Varnish's config file (.vcl), just be sure that the syntax you use corresponds to the version of varnish you have installed.
I am creating a multi lingual application using ZF2.. and cannot determine how to add a part URL which will form the base of each URL regardless of modules.
http://localhost/en/us/application/index/index/
I totally understand how to configure /[:namespace[/:controller[/:action]]] using DI
http://localhost/application/index/index/
http://localhost/guestbook/index/index/
http://localhost/forum/index/index/
What I do not understand is how to configure a Part route which will be the base for all routes.. In ZF1 I used Route Chaining to achieve this..
So I need to configure a Part route of /[:lang[/:locale]] which applies site wide and then let the module configure /[:namespace[/:controller[/:action]]] or any other route necessary..
http://localhost/en/us/application/index/index/
http://localhost/zh/cn/application/index/index/
http://localhost/en/uk/forum/index/index/
I think what you are looking for is the child_routes configuration key. Take a look at how ZfcUser configures it's routing (here): it creates a base Literal route (/user) and then chains the sub-routes (/user/login, etc) onto it via the child_routes array.
I think something like this will do the trick for you:
'router' => array(
'routes' => array(
'myapp' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:lang[/:locale]]',
'defaults' => array(
'lang' => 'en',
'locale' => 'us',
),
),
'may_terminate' => false,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'controller' => 'index',
'action' => 'index',
),
),
),
),
),
),
Then in your controller you could do this to get the lang and locale:
$this->params()->fromRoute('lang');
$this->params()->fromRoute('locale');
I'm working on a module (a simple cms) with Kohana 3.2 and i'm getting this exception "Error reading session data."
I'm using native session and the funny thing is if i set a "default" group database connection the error isn't showed... (i'm using a custom connection group and i've set this database connection group to the user,role and user_token models).
here's my config file
auth.php
return array(
'driver' => 'orm',
'hash_method' => 'sha256',
'hash_key' => 'just a test 1',
'lifetime' => 1209600,
'session_type' => 'native',
'session_key' => 'just a test 2',
// Username/password combinations for the Auth File driver
'users' => array(
// 'luca' => 'e12afe0d3ead3d36191d86229d27057d96d9f2e063fe6f3e86699aaab5310d42'
// 'admin' => 'b3154acf3a344170077d11bdb5fff31532f679a1919e716a02',
),
);
session.php
return array(
'native' => array(
'name' => 'session_native',
'lifetime' => 43200,
),
'cookie' => array(
'name' => 'session_cookie',
'encrypted' => TRUE,
'lifetime' => 43200,
),
'database' => array(
'name' => 'session_database',
'encrypted' => TRUE,
'lifetime' => 43200,
'group' => Pencil::db_group(),
'table' => 'sessions',
'columns' => array(
'session_id' => 'session_id',
'last_active' => 'last_active',
'contents' => 'contents'
),
'gc' => 500,
),
);
You set encrypted to true, so you need an encrypt key. In your config/encrypt.php add this:
<?php
return array(
'default' => array(
'key' => 'MY_RANDOM_KEY_I_MADE_UP_ALL_BY_MYSELF',
),
);
I would keep session_key set to 'auth_user' instead of your random key as well. I think key in that circumstance is not the same as a hash key.
Check your logs in application/logs to see if anything else is missing.