/*if (reset($allow_categories)){
$where[] = 'and';
$where[] = 'category =~ %'.(count($allow_categories) > 1 ? '['.join('|', $allow_categories).']' : join('', $allow_categories)).'%';
foreach ($allow_categories as $k => $v){
for ($i = 0; $i < 10; $i++){
if (!in_array($v.$i, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$v.$i.'%';
}
if (!in_array($i.$v, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$i.$v.'%';
}
}
}
}*/
if ($allow_categories[0] != ''){
foreach ($allow_categories as $k => $v){
for ($i = 0; $i < 10; $i++){
if (!in_array($v.$i, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$v.$i.'%';
}
if (!in_array($i.$v, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$i.$v.'%';
}
}
}
$where[] = 'and';
foreach($allow_categories as $single_cat){
$where[] = 'category =~ %'.$single_cat.'%';
$where[] = 'or';
}
unset($where[count($where)-1]);
}if (reset($allow_categories)){
$where[] = 'and';
$where[] = 'category =~ %'.(count($allow_categories) > 1 ? '['.join('|', $allow_categories).']' : join('', $allow_categories)).'%';
foreach ($allow_categories as $k => $v){
for ($i = 0; $i < 10; $i++){
if (!in_array($v.$i, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$v.$i.'%';
}
if (!in_array($i.$v, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$i.$v.'%';
}
}
}
}
/* if ($allow_categories[0] != ''){
foreach ($allow_categories as $k => $v){
for ($i = 0; $i < 10; $i++){
if (!in_array($v.$i, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$v.$i.'%';
}
if (!in_array($i.$v, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$i.$v.'%';
}
}
}
$where[] = 'and';
foreach($allow_categories as $single_cat){
$where[] = 'category =~ %'.$single_cat.'%';
$where[] = 'or';
}
unset($where[count($where)-1]);
}
*/but which surprises me!?!
why don't you make Cutenews 2.5.4 also in such a way in orginal file from!??
that cost me 6 to grant
Moe wrote:Hmm its getting weirder and weider.
I found a code of you on the following page
http://english.cutenews.ru/forum/viewto ... categor%2A
but i did it the other way.
i replaced
- Code: Select all
if ($allow_categories[0] != ''){
foreach ($allow_categories as $k => $v){
for ($i = 0; $i < 10; $i++){
if (!in_array($v.$i, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$v.$i.'%';
}
if (!in_array($i.$v, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$i.$v.'%';
}
}
}
$where[] = 'and';
foreach($allow_categories as $single_cat){
$where[] = 'category =~ %'.$single_cat.'%';
$where[] = 'or';
}
unset($where[count($where)-1]);
}
with this
- Code: Select all
if (reset($allow_categories)){
$where[] = 'and';
$where[] = 'category =~ %'.(count($allow_categories) > 1 ? '['.join('|', $allow_categories).']' : join('', $allow_categories)).'%';
foreach ($allow_categories as $k => $v){
for ($i = 0; $i < 10; $i++){
if (!in_array($v.$i, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$v.$i.'%';
}
if (!in_array($i.$v, $allow_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$i.$v.'%';
}
}
}
}
and... surprise... everything is working correctly![]()
Unfortunately im a php-newbie. so how could this be???
By the way, thanks FI-DD for taking time trying to solve my problem
Users browsing this forum: No registered users and 0 guests