symfony condition syntax for on/off mail to sender by checkbox in frontend - typo3

Before the update to TYPO3 9.5 I used the following condition syntax in setup.typoscript to enable sending an email to the sender using a checkbox in the frontend form:
[globalString = GP:tx_powermail_pi1|field|emailanabsender|0 = ]
plugin.tx_powermail.settings.setup.sender.enable = 0
[else]
plugin.tx_powermail.settings.setup.sender.enable = 1
[global]
What should the symfony condition syntax look like for this purpose?
According to my logic, the following should work, but it does not:
[traverse(request.getParsedBody(), 'tx_powermail_pi1/field/emailanabsender/0')]
plugin.tx_powermail.settings.setup.sender.enable = 1
[else]
plugin.tx_powermail.settings.setup.sender.enable = 0
[global]
Can anyone help me with this?

I got It.
The correct syntax for TYPO3 >= 9 is:
[traverse(request.getParsedBody(), 'tx_powermail_pi1/field/emailanabsender/0') == '']
plugin.tx_powermail.settings.setup.sender.enable = 0
[else]
plugin.tx_powermail.settings.setup.sender.enable = 1
[global]
The docs says: "In case the path is not found in the array, an empty string is returned."
Data from the POST request can be read with request.getParsedBody(), and
if the checkbox is unchecked, then it's missing in the POST-request.

What about this:
[traverse(request.getQueryParams(), 'tx_powermail_pi1/field/emailanansender/0') > 0]

Related

RealUrl conflict on multidomain pages with the same name

I get a conflict in EXT:realUrl because of a page with the same name in both domains.
domain.com/contact.html
mobile.domain.com/contact.html
I got this setup:
The realurl configuration in PHP both with their own rootpage_id:
['EXTCONF']['realurl']['_DEFAULT']
['EXTCONF']['realurl']['mobile.domain.com']
TypoScript:
config.baseURL = http://mobile.domain.com/
config.tx_realurl_enable = 1
config.typolinkCheckRootline = 1
config.typolinkEnableLinksAcrossDomains = 1
config.typolinkLinkAccessRestrictedPages = NONE
config.prefixLocalAnchors = all
config.content_from_pid_allowOutsideDomain = 1
Is there something missing in my configuration?
What could I do to solve the conflict?
When you have following steps
Step 1
$TYPO3_CONF_VARS['EXTCONF']['realurl']['mobile.example.com'] =
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'];
$TYPO3_CONF_VARS['EXTCONF']['realurl']['mobile.example.com']['pagePath']['rootpage_id'] = 999;
Step 2
Add Domain Entries on the rootpages
Step 3
Add setup condition
[globalString = IENV:HTTP_HOST=www.example.com]
config.baseURL = http://www.example.com/
[end]
Step 4
Clear all caches (realUrl caches inkl.)
Greetings

TYPO3 version 6 to version 8 compatibility issues

While upgrading typo3 version 6 to 8.7.3 getting this database error...
An exception occurred while executing 'SELECT `pid` FROM `sys_template` WHERE (root = 1 AND deleted = 0 AND hidden = 0 AND starttime <= :starttime AND (endtime = 0 OR endtime > :endtime)) AND ((`sys_template`.`deleted` = 0) AND (`sys_template`.`hidden` = 0) AND (`sys_template`.`starttime` <= 1500543000) AND ((`sys_template`.`endtime` = 0) OR (`sys_template`.`endtime` > 1500543000)))': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':starttime AND (endtime = 0 OR endtime > :endtime)) AND ((`sys_template`.`delete' at line 1
Please review the screen shot.
DB Configuration variables have changed from TYPO3 v7 to v8 ^^
It is not
$GLOBALS['TYPO3_CONF_VARS']['DB']['database']
$GLOBALS['TYPO3_CONF_VARS']['DB']['host']
$GLOBALS['TYPO3_CONF_VARS']['DB']['username']
$GLOBALS['TYPO3_CONF_VARS']['DB']['password']
anymore, but
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host']
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname']
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user']
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password']
This is especially the case, when configuring additional Environments via AdditionalConfiguration.php

Railstutorial Chapter 9 User index test raised a failure after modify pagination

I'm just curious how its happen
After try to reduce number of user per page in pagination to 10 (default is 30 that I think is too long). My index test raised a failure just like this
1) Failure:
UsersIndexTest#test_index_as_admin_including_pagination_and_delete_links
[/home/ubuntu/workspace/contoh/test/integration/users_index_test.rb:17]:
Expected at least 1 element matching "a[href="/users/338193910"]", found 0..
Expected 0 to be >= 1.
What i've changed is just the pagination parameter Listing 9.42
#users = User.paginate(page: params[:page],:per_page => 10)
in app/controllers/users_controller.rb
and here is the line 17-20 in /users_index_test.rb
assert_select 'a[href=?]', user_path(user), text: user.name
unless user == #admin
assert_select 'a[href=?]', user_path(user), text: 'delete',
method: :delete
I had the same problem because I changed this
in my app/controllers/users_controller.rb:
def index
#users = User.paginate(page: params[:page])
end
to
def index
#users = User.paginate(page: params[:page], per_page: 10)
end
Now i got the same error with the users_index_test
After some browsing and reading this article I came up with the following solution:
In the test/integration/users_index_test.rb I changed:
first_page_of_users = User.paginate(page: 1)
to
first_page_of_users = User.paginate(page: 1, per_page: 10)
The test is now successfull :)
After trying some configuration
I've found that put the per_page parameter in global parameter is the solution
So, i put it in app/controller/application_controller.rb this line
WillPaginate.per_page = 10

Wildcard search issue sphinx

I'm getting the following error while trying a wildcard(*) enabled search in Sphinx 2.0.6
index products: syntax error, unexpected $undefined near '*'
My search term is iphone 4s*
It's using the products index as defined below.
index users
{
enable_star = 1
docinfo = extern
morphology = stem_en
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
ignore_chars = U+0021..U+002F,U+003A..U+003F,U+0060
charset_type = utf-8
html_strip = 0
source = gdgt_user
path = /var/lib/sphinxsearch/data/gdgt/users
min_infix_len = 3
min_word_len = 3
}
index products : users
{
enable_star = 1
min_infix_len = 1
min_word_len = 1
source = gdgt_products
path = /var/lib/sphinxsearch/data/gdgt/products
}
I am using the php api that can be found in the source tar ball.
I am able to see the error when using search CLI.
search -c app/config/sphinx.compiled.conf -i products -e "ipho*"
Sphinx 2.0.6-id64-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file 'app/config/sphinx.compiled.conf'...
index 'products': search error: .
My php code looks like
$client = new SphinxClient();
$client->SetServer($serverIp, $serverPort);
$client->SetMaxQueryTime(5000);
$client->SetSortMode(SPH_SORT_RELEVANCE);
$client->SetMatchMode(SPH_MATCH_EXTENDED);
$res = $client->query('ipho*', 'products');
var_dump($res, $client->getLastError(), $client->getLastWarning());
The issue is that star(*) for wildcard is also in your ignore_chars (U+002A).
Update it to:
ignore_chars = U+0021..U+0029,U+002B..U+002F,U+003A..U+003F,U+0060

Can't change dates in tt_news archive when not logged in

A college of mine has set up a page with tt_news single, list and archive.
He has an archive list in a sidebar on all these pages and it lists the years from each news as it should.
I can click on each year and view the news from that year fine when logged in.
But when I log out the date is not changed. It stays at what date was first clicked when the "SHOW ARCHIVED" setting was set.
The url changes but the page doesn't...
I have:
tt_news v2.5.2
Typo3 v4.5.4
CoolURI v1.0.26
CoolUri conf: http://pastebin.com/9xTmVyPn
tt_news typoscript:
plugin.tt_news {
templateFile = fileadmin/templates/ext/blog.html
displayArchivedInLatest = 1
datetimeMinutesToArchive = 1
enableArchiveDate = 0
# page with archive list
archiveTypoLink.parameter = 286
# page with single view
singlePid = 285
# page with list view
backPid = 284
# page with db entries
pid_list = 35
displaySingle.date_stdWrap.strftime = %e:e %B %Y
displayList.date_stdWrap.strftime = %e:e %B %Y
pageBrowser {
tableParams >
}
summary {
wordWrap = 105 | ... | 1
}
imgMaxWidth = 600
}
Perhaps you have an caching issue? Just test it via www.example.com/your/url/?no_cache=1 If that works if you are not logged in, you have an caching issue.