Re: Multi-Language Support for EZ-Pages
This is complete LOG:
[18-Mar-2017 16:40:06 Europe/Prague] Request URI: /eshop155/test-001-ezp-1.html, IP address: 31.47.97.52
#1 trigger_error() called at [/hosting/www/domain.com/www/web/includes/classes/db/mysql/query_factory.php:167]
#2 queryFactory->show_error() called at [/hosting/www/domain.com/www/web/includes/classes/db/mysql/query_factory.php:139]
#3 queryFactory->set_error() called at [/hosting/www/domain.com/www/web/includes/classes/db/mysql/query_factory.php:266]
#4 queryFactory->Execute() called at [/hosting/www/domain.com/www/web/includes/modules/pages/page/header_php.php:49]
#5 require(/hosting/www/domain.com/www/web/includes/modules/pages/page/header_php.php) called at [/hosting/www//domain.com/www/web/index.php:36]
[18-Mar-2017 16:40:06 Europe/Prague] PHP Fatal error: 1064: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 'int)1
AND et.languages_id = '5'
AND e.pages_id = etpages_id ' at line 3 :: SELECT e.*, et.*
FROM ezpages e, ezpages_content et
WHERE e.pages_id = (int)1
AND et.languages_id = '5'
AND e.pages_id = etpages_id AND (e.status_toc > 0 OR e.status_header > 0 OR e.status_sidebox > 0 OR e.status_footer > 0) ==> (as called by) /hosting/www/domain.com/www/web/includes/modules/pages/page/header_php.php on line 49 <== in /hosting/www/domain.com/www/web/includes/classes/db/mysql/query_factory.php on line 167
Re: Multi-Language Support for EZ-Pages
See this page for the corrected code. I will upload a new version to the downloads asap.
Quote:
Originally Posted by
DarkMen
This is complete LOG:
[18-Mar-2017 16:40:06 Europe/Prague] Request URI: /eshop155/test-001-ezp-1.html, IP address: 31.47.97.52
#1 trigger_error() called at [/hosting/www/domain.com/www/web/includes/classes/db/mysql/query_factory.php:167]
#2 queryFactory->show_error() called at [/hosting/www/domain.com/www/web/includes/classes/db/mysql/query_factory.php:139]
#3 queryFactory->set_error() called at [/hosting/www/domain.com/www/web/includes/classes/db/mysql/query_factory.php:266]
#4 queryFactory->Execute() called at [/hosting/www/domain.com/www/web/includes/modules/pages/page/header_php.php:49]
#5 require(/hosting/www/domain.com/www/web/includes/modules/pages/page/header_php.php) called at [/hosting/www//domain.com/www/web/index.php:36]
[18-Mar-2017 16:40:06 Europe/Prague] PHP Fatal error: 1064: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 'int)1
AND et.languages_id = '5'
AND e.pages_id = etpages_id ' at line 3 :: SELECT e.*, et.*
FROM ezpages e, ezpages_content et
WHERE e.pages_id = (int)1
AND et.languages_id = '5'
AND e.pages_id = etpages_id AND (e.status_toc > 0 OR e.status_header > 0 OR e.status_sidebox > 0 OR e.status_footer > 0) ==> (as called by) /hosting/www/domain.com/www/web/includes/modules/pages/page/header_php.php on line 49 <== in /hosting/www/domain.com/www/web/includes/classes/db/mysql/query_factory.php on line 167
Re: Multi-Language Support for EZ-Pages
@Design75, isn't there an additional change required? Lines 29-37 of the file you referenced currently read:
Code:
/* BOF Multilingual EZ Pages 1 of 3 */
$sql = "SELECT e.*, et.*
FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et
WHERE e.pages_id = " . (int)$ezpage_id . "
AND et.languages_id = '" . (int)$_SESSION['languages_id'] . "'
AND e.pages_id = " . et.pages_id;
// comment the following line to allow access to pages which don't have a status switch set to Yes:
$sql .= " AND (e.status_toc > 0 OR e.status_header > 0 OR e.status_sidebox > 0 OR e.status_footer > 0)";
/* EOF Multilingual EZ Pages 1 of 3 */
and should be changed, I think, as follows to prevent the log that @DarkMen identified:
Code:
/* BOF Multilingual EZ Pages 1 of 3 */
$sql = "SELECT e.*, et.*
FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et
WHERE e.pages_id = " . (int)$ezpage_id . "
AND et.languages_id = '" . (int)$_SESSION['languages_id'] . "'
AND e.pages_id = et.pages_id";
// comment the following line to allow access to pages which don't have a status switch set to Yes:
$sql .= " AND (e.status_toc > 0 OR e.status_header > 0 OR e.status_sidebox > 0 OR e.status_footer > 0)";
/* EOF Multilingual EZ Pages 1 of 3 */
Re: Multi-Language Support for EZ-Pages
I think so, there must be some other change for to function properly. I tried to change code as LAT9 write and system now don't write
"WARNING: An Error occurred, please refresh the page and try again." error now there the page is opened, but there is no text for
the the EZ page.
Does anybody know?
Quote:
Originally Posted by
lat9
@Design75, isn't there an additional change required? Lines 29-37 of the file you referenced currently read:
Code:
/* BOF Multilingual EZ Pages 1 of 3 */
$sql = "SELECT e.*, et.*
FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et
WHERE e.pages_id = " . (int)$ezpage_id . "
AND et.languages_id = '" . (int)$_SESSION['languages_id'] . "'
AND e.pages_id = " . et.pages_id;
// comment the following line to allow access to pages which don't have a status switch set to Yes:
$sql .= " AND (e.status_toc > 0 OR e.status_header > 0 OR e.status_sidebox > 0 OR e.status_footer > 0)";
/* EOF Multilingual EZ Pages 1 of 3 */
and should be changed, I think, as follows to prevent the log that @DarkMen identified:
Code:
/* BOF Multilingual EZ Pages 1 of 3 */
$sql = "SELECT e.*, et.*
FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et
WHERE e.pages_id = " . (int)$ezpage_id . "
AND et.languages_id = '" . (int)$_SESSION['languages_id'] . "'
AND e.pages_id = et.pages_id";
// comment the following line to allow access to pages which don't have a status switch set to Yes:
$sql .= " AND (e.status_toc > 0 OR e.status_header > 0 OR e.status_sidebox > 0 OR e.status_footer > 0)";
/* EOF Multilingual EZ Pages 1 of 3 */
Re: Multi-Language Support for EZ-Pages
Quote:
Originally Posted by
DarkMen
I think so, there must be some other change for to function properly. I tried to change code as LAT9 write and system now don't write
"WARNING: An Error occurred, please refresh the page and try again." error now there the page is opened, but there is no text for
the the EZ page.
Does anybody know?
What is the condition of status for any of the options for that or any of your ez-pages? Ie. Table of contents, header, sidebox, or footer. Which if any are enabled?
Re: Multi-Language Support for EZ-Pages
This fixes it for me, I had the same trouble:
- Last line fixed as above
- 3rd line fixed in red
Code:
$sql = "SELECT e.*, et.*
FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et
WHERE e.pages_id = '" . (int)$ezpage_id . "'
AND et.languages_id = '" . (int)$_SESSION['languages_id'] . "'
AND e.pages_id = et.pages_id";
Re: Multi-Language Support for EZ-Pages
FWIW, you shouldn't need (and don't want) those single quotes around the ez_pages_id (assuming it's still an int(11) database type). That is, instead of
$sql = "SELECT e.*, et.* FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et WHERE e.pages_id = '" .(int)$ezpage_id. "' AND et.languages_id = '" . (int)$_SESSION['languages_id'] . "' AND e.pages_id = et.pages_id";
the code should read:
$sql = "SELECT e.*, et.* FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et WHERE e.pages_id = " .(int)$ezpage_id. " AND et.languages_id = '" . (int)$_SESSION['languages_id'] . "' AND e.pages_id = et.pages_id";
Re: Multi-Language Support for EZ-Pages
Hello lat9,
Thanks for the correction, I tested and indeed that works just as well( aside: I tried to find out what the dot notation means here, but without success. I understand that if the variable is an integer then quotes are not required (field = int_value), but how is the languages_id part different, if it is also cast into an int? I tested, and there the single quotes do not seem to be required either. So the total query is then:
Code:
$sql = "SELECT e.*, et.*
FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et
WHERE e.pages_id = ' . (int)$ezpage_id . "
AND et.languages_id = ' . (int)$_SESSION['languages_id'] . "
AND e.pages_id = et.pages_id";
Is that consistent and correct?
Re: Multi-Language Support for EZ-Pages
Addition: removal of single quotes can then be done similarly in line 7 of the pages_order_query around (int)$_SESSION['languages_id'] .
Re: Multi-Language Support for EZ-Pages
Quote:
Originally Posted by
gernot
Hello lat9,
Thanks for the correction, I tested and indeed that works just as well( aside: I tried to find out what the dot notation means here, but without success. I understand that if the variable is an integer then quotes are not required (field = int_value), but how is the languages_id part different, if it is also cast into an int? I tested, and there the single quotes do not seem to be required either. So the total query is then:
Code:
$sql = "SELECT e.*, et.*
FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et
WHERE e.pages_id = ' . (int)$ezpage_id . "
AND et.languages_id = ' . (int)$_SESSION['languages_id'] . "
AND e.pages_id = et.pages_id";
Is that consistent and correct?
Actually, you've got single-quotes (highlighted above) that should be a double-quote (or a debug-log will be generated):
Code:
$sql = "SELECT e.*, et.*
FROM " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et
WHERE e.pages_id = " . (int)$ezpage_id . "
AND et.languages_id = ". (int)$_SESSION['languages_id'] . "
AND e.pages_id = et.pages_id";