i found the BUG (unaproved news shown for Gests)

Report bugs and errors in this forum.

i found the BUG (unaproved news shown for Gests)

Postby samiro » Thu Jul 02, 2009 1:04 pm

the problem: the articles that saved as "unapproved" or "saved as draft" showen to gust...
the bug: when including the code - to view more than 1 category. The problem papers...

When including the articles like this:
Code: Select all
<?PHP
$number= '10';
$static = 'true';
$category = '1';
$template = 'Header';
include("/hsphere/local/home/samiro/bwoman.co.il/articles/news/show_news.php");
?>

everything work fine

But when include the code like this:
Code: Select all
<?PHP
$number= '10';
$static = 'true';
$category = '1,2,3,4,5,6,9';
$template = 'Header';
include("/hsphere/local/home/samiro/bwoman.co.il/articles/news/show_news.php");
?>

the problem appears... if the article published in one of these categories (2,3,4,5,6,9) not (1) and everyone (even gusts) can see the article even if it saved as "unapproved" or "saved as draft"

HELPPPPP

what can I do to fix it?
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Postby samiro » Sat Jan 02, 2010 3:08 pm

pleaseeeeeeeeeeeee
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Postby mark99 » Mon Jan 04, 2010 2:50 pm

Can confirm this as a bug, not sure how to fix though, hope somebody else has an idea.
mark99
 
Posts: 123
Joined: Mon Feb 09, 2009 6:01 pm

Postby Chaser » Tue Jan 05, 2010 4:14 pm

open inc/show.news.php and replace
Code: Select all
   if ($allow_categories[0] != ''){


with this
Code: Select all
   if ($allow_categories[0] != '' and $hidden = 0){
User avatar
Chaser
 
Posts: 72
Joined: Tue Feb 17, 2009 7:26 pm

Postby Ramon » Mon Jan 11, 2010 12:28 am

That won't ever work...

I think you mean

Code: Select all
      if ($allow_categories[0] != '' and $hidden == 0){
Image
Ramon
 
Posts: 599
Joined: Wed Oct 12, 2005 8:51 pm
Location: Hoogeveen, NL

Postby DarkSlim » Mon Jan 11, 2010 9:14 am

If anyone can check the fix and confirm that it is working
I'll add this fix to the Index :)
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby D72 » Thu Jan 14, 2010 10:44 am

Ramon wrote:That won't ever work...

I think you mean

Code: Select all
      if ($allow_categories[0] != '' and $hidden == 0){


Hey man, you're back!?
Just for fun or for some reasons?
Gelukkig nieuwjaar kerel!
User avatar
D72
 
Posts: 336
Joined: Thu Feb 22, 2007 12:05 am
Location: NL

Postby Chaser » Fri Jan 15, 2010 1:36 pm

Ramon wrote:That won't ever work...

I think you mean

Code: Select all
      if ($allow_categories[0] != '' and $hidden == 0){


No, it's tested and works. Yours doesn't work.

I think you mean
Code: Select all
      if ($allow_categories[0] != '' and $hidden == '0'){
User avatar
Chaser
 
Posts: 72
Joined: Tue Feb 17, 2009 7:26 pm

Postby samiro » Wed Mar 03, 2010 12:01 pm

so
witch one we need to try ?!

edit:
i try them all.. this one:
if ($allow_categories[0] != '' and $hidden == '0'){

show also news that are without category
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Postby samiro » Wed Mar 03, 2010 1:58 pm

User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Postby Chaser » Fri Mar 05, 2010 11:31 pm

samiro wrote:maybe this one make the bug ?
http://forums.cutenewsru.com/viewtopic. ... aklocation


No, i don't think so. This function is for smilies.
User avatar
Chaser
 
Posts: 72
Joined: Tue Feb 17, 2009 7:26 pm

Postby samiro » Sun Mar 21, 2010 10:18 pm

Chaser wrote:open inc/show.news.php and replace
Code: Select all
   if ($allow_categories[0] != ''){


with this
Code: Select all
   if ($allow_categories[0] != '' and $hidden = 0){


OMG
THANK YOUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Postby samiro » Mon Mar 22, 2010 10:06 am

Sorry - my mistake
Although this is the bug fix
But did new bug
Suddenly, the script ignores the categories - it displays Latest News - No matter what value there is in the category...

($ category = '2 ') or ($ category = '3 ') or ($ category = '2,4,5,6 ')
it dosnt matter - it just display Latest News...
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Postby samiro » Mon Mar 22, 2010 12:14 pm

User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Re: i found the BUG (unaproved news shown for Gests)

Postby DarkSlim » Sat Sep 10, 2011 1:21 pm

I don't know if it will help but instead of:

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.'%';
            }
         }
      }



I'm using:

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 another thing, in the begining of the file instead of:

Code: Select all
if (!$is_logged_in or ($is_logged_in and $member['level'] > 2)){
      ...
   }


* the three points (...) are for that code that's between the brackets (don't sure what was there in the original)

I'm using just:

Code: Select all
$where[] = 'hidden = 0';
      $where[] = 'and';

(Without the if)

If it still won't work for you there's another place, I just don't remember 100% where it was
and what's the original code to replace but I think it start like that:

Code: Select all
foreach($allow_categories as $single_cat){
         $where[] = 'category =~ %'.$single_cat.'%';
                    ....


Add:

Code: Select all
$where[] = 'and';
$where[] = 'hidden = 0';
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL


Return to Bugs and errors



Who is online

Users browsing this forum: No registered users and 2 guests

cron