TinyPortal

Development => Support => Topic started by: ontap on October 05, 2005, 07:28:04 PM

Title: Preview Problem...
Post by: ontap on October 05, 2005, 07:28:04 PM
since the upgrade to v.0.7.4, ive noticed a problem when sending  private messages and with posting in topics/boards

when i click the "preview" button, it dosent show any preview of the pms or posts
and starts to fill up the error log, i think its only a problem for admins

smf/index.php?action=pm;sa=send2
Database Error: Unknown column 'Preview' in 'where clause'
File: smf\Sources\TPortal.php
Line: 111

smf/index.php?action=post2;start=705;board=19
Database Error: Unknown column 'Preview' in 'where clause'
File: smf\Sources\TPortal.php
Line: 122

Lines 111 & 112 Are


if(isset($_REQUEST['preview']) && $context['user']['is_admin']){
            $pre_id=$_REQUEST['preview'];
            $request = db_query("SELECT * FROM {$tp_prefix}blocks WHERE off=0 OR id=$pre_id ORDER BY bar,pos,id ASC", __FILE__, __LINE__);
        }
        else
            $request = db_query("SELECT * FROM {$tp_prefix}blocks WHERE off=0 ORDER BY bar,pos,id ASC", __FILE__, __LINE__);


... any ideas bloc?
Title: Re: Preview Problem...
Post by: bloc on October 05, 2005, 10:22:17 PM
Um, thats serious, it may be conflict of variables on SMF and TP. i will need to look more into it.
Title: Re: Preview Problem...
Post by: ontap on October 06, 2005, 02:16:37 AM
k... let me know if theres a quick fix! :)
Title: Re: Preview Problem...
Post by: ontap on October 06, 2005, 07:19:49 PM
ive made a small change to that code so the preview will work for pm's and posts,
i removed this bit of code "OR id=$pre_id"

seems to get rid of the error.

Sources\TPortal.php

Find:
if(isset($_REQUEST['preview']) && $context['user']['is_admin']){
            $pre_id=$_REQUEST['preview'];
            $request = db_query("SELECT * FROM {$tp_prefix}blocks WHERE off=0 OR id=$pre_id ORDER BY bar,pos,id ASC", __FILE__, __LINE__);
        }
        else
            $request = db_query("SELECT * FROM {$tp_prefix}blocks WHERE off=0 ORDER BY bar,pos,id ASC", __FILE__, __LINE__);


Replace With:

if(isset($_REQUEST['preview']) && $context['user']['is_admin']){
            $pre_id=$_REQUEST['preview'];
            $request = db_query("SELECT * FROM {$tp_prefix}blocks WHERE off=0 ORDER BY bar,pos,id ASC", __FILE__, __LINE__);
        }
        else
            $request = db_query("SELECT * FROM {$tp_prefix}blocks WHERE off=0 ORDER BY bar,pos,id ASC", __FILE__, __LINE__);
Title: Re: Preview Problem...
Post by: redshark on October 17, 2005, 01:56:56 AM
That is exactly the failure that i have .....on preview i have a white background.

Thanks to ontap : after removing the little code .....all works fine

Cheers

ReD
Title: Re: Preview Problem...
Post by: Klozi on October 20, 2005, 09:51:19 PM
I get the same error.

Quote from: ontap on October 06, 2005, 07:19:49 PM
ive made a small change to that code so the preview will work for pm's and posts,
i removed this bit of code "OR id=$pre_id"

seems to get rid of the error.

Sources\TPortal.php

Find:
if(isset($_REQUEST['preview']) && $context['user']['is_admin']){
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  $pre_id=$_REQUEST['preview'];
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  $request = db_query("SELECT * FROM {$tp_prefix}blocks WHERE off=0 OR id=$pre_id ORDER BY bar,pos,id ASC", __FILE__, __LINE__);
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  }
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  else
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  $request = db_query("SELECT * FROM {$tp_prefix}blocks WHERE off=0 ORDER BY bar,pos,id ASC", __FILE__, __LINE__);


Replace With:

if(isset($_REQUEST['preview']) && $context['user']['is_admin']){
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  $pre_id=$_REQUEST['preview'];
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  $request = db_query("SELECT * FROM {$tp_prefix}blocks WHERE off=0 ORDER BY bar,pos,id ASC", __FILE__, __LINE__);
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  }
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  else
ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  $request = db_query("SELECT * FROM {$tp_prefix}blocks WHERE off=0 ORDER BY bar,pos,id ASC", __FILE__, __LINE__);


Are you really sure, that this didn't make any errors in following sessions?
Okay, I test it now.
Title: Re: Preview Problem...
Post by: ontap on October 20, 2005, 10:38:25 PM
Quote from: Klozi on October 20, 2005, 09:51:19 PM
I get the same error.

Are you really sure, that this didn't make any errors in following sessions?

nope it dosent, it just removes "OR id=$pre_id"...
after the change the preview errors wont show anymore!


(not to sure what $pre_id is for)
Title: Re: Preview Problem...
Post by: bloc on October 21, 2005, 01:13:26 AM
$pre_id is just the ID of the block thats is to be previewd. The trouble is that i used "preview" as a query, whcih also SMF use sometimes..hence the clash and errors. But in the next update this use will be changed.