Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Forums / Cotonti / Extensions / Support / Pagesiblings gives an sql error

#1 2014-01-26 15:26

I am trying to use pagesiblings on my new website but as soon as I install it and want to view a page I keep getting this error:


2014-01-26 15:22
SQL error 42S22: Column not found: 1054 Unknown column 'page_' in 'order clause'
#0  cot_diefatal(SQL error 42S22: Column not found: 1054 Unknown column 'page_' in 'order clause') called at [D:\Dropbox\Xampp\htdocs\default_sienna_clean_install_clean_db\system\database.php:576]
#1  CotDB->query(SELECT * FROM cot_pages WHERE page_cat = ? ORDER BY page_ , Array ([0] => news)) called at [D:\Dropbox\Xampp\htdocs\default_sienna_clean_install_clean_db\plugins\pagesiblings\pagesiblings.php:14]
#2  include(D:\Dropbox\Xampp\htdocs\default_sienna_clean_install_clean_db\plugins\pagesiblings\pagesiblings.php) called at [D:\Dropbox\Xampp\htdocs\default_sienna_clean_install_clean_db\modules\page\inc\page.main.php:279]
#3  require_once(D:\Dropbox\Xampp\htdocs\default_sienna_clean_install_clean_db\modules\page\inc\page.main.php) called at [D:\Dropbox\Xampp\htdocs\default_sienna_clean_install_clean_db\modules\page\page.php:43]
#4  require_once(D:\Dropbox\Xampp\htdocs\default_sienna_clean_install_clean_db\modules\page\page.php) called at [D:\Dropbox\Xampp\htdocs\default_sienna_clean_install_clean_db\index.php:126]


I made different attempt to see if I could fix it but if I change something at least the sql error dissapears but than I recieve a syntax error cause it expects a string.
I searched around and I found some site which was referring to the $sort allowing sql injection cause it did not santatize. I figured sine the issue seems to be with the $sort part something has changes since this plugin was first written. But looking at other plugins I can not discover how to change it so it works again. I made some tries with "explode" which I saw used in other plugins without luck.

Since pagesiblings is working on this website I hope the fix can maybe shared?
I got the plugin from github.

I tried with 0.9.14 and with 0.9.16 (this is a clean install!) and both give that error.

<img src="" alt="green-sea-battalion-uniforms-version-03-" />

This post was edited by foxhound (2014-01-26 15:34, 6 years ago)
#2 2014-01-26 15:50

Replace line 10 and 11 in pagesiblings.php with:

$sort = 'page_'.$cfg['page']['cat_'.$pag['page_cat']]['order'];
$way = $cfg['page']['cat_'.$pag['page_cat']]['way'];


#3 2014-01-26 16:43

Thanks very much Twiebie, that works perfectly! :)

<img src="" alt="green-sea-battalion-uniforms-version-03-" />