News: When asking for support, it helps us and you, if you read the Posting Guidelines

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

October 18, 2019, 08:29:50 PM

Login with username, password and session length

Recent

Members
  • Total Members: 3756
  • Latest: Ocean
Stats
  • Total Posts: 189090
  • Total Topics: 20764
  • Online Today: 73
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 0
Guests: 34
Total: 34

Author Topic: Bug Found And Corrected  (Read 3935 times)

0 Members and 1 Guest are viewing this topic.

Offline siath

  • Newbie
  • *
  • Posts: 1
Bug Found And Corrected
« on: June 23, 2011, 07:13:59 AM »
Wrong value type sent to the database. Integer expected. (page)

I was getting this bug on a intall of the latest TP (TP1 RC2).

See, some of my members and some of my code called pages by their name.

Any who, I did a bit of looking and discovered an error in the code.

function TP_loadTheme()
{
   global $db_prefix, $context, $scripturl, $txt, $user_info, $settings;
   global $modSettings, $boardurl, $sourcedir, $smcFunc;

   require_once($sourcedir.'/TPSubs.php');

   $theme = 0;

   // are we on a article? check it for custom theme
    if(isset($_GET['page']) && !isset($_GET['action']))
   {
      // fetch the custom theme if any
      $pag = tp_sanitize($_GET['page']);
      if(is_numeric($pag))
         $request = $smcFunc['db_query']('', '
            SELECT id_theme FROM {db_prefix}tp_articles
            WHERE id = {int:page}',
            array('page' => $pag)
         );
      else
         $request =  $smcFunc['db_query']('', '
            SELECT id_theme FROM {db_prefix}tp_articles
            WHERE shortname = {int:page}',
            array('page' => $pag)
         );

      if($smcFunc['db_num_rows']($request) > 0)
      {

WHERE shortname = {int:page}',

Should be
            WHERE shortname = {string:page}',

It fixed my problem rather quickly. ;)

Anyway, nice job guys keep up the good work.

P.S. Did you know if I put a code box in the page it tells me I can't post external links? Yet, you ask for a code box with information in it... That just doesn't make sense to me.

Offline IchBin™

  • Developer
  • *
  • Posts: 16228
    • My Website
Re: Bug Found And Corrected
« Reply #1 on: June 23, 2011, 08:37:49 AM »
Yes, I've already added this into the code for the next release. Thank you.

Offline ZarPrime

  • Friends
  • *
  • Posts: 4653
Re: Bug Found And Corrected
« Reply #2 on: June 23, 2011, 08:53:42 AM »
P.S. Did you know if I put a code box in the page it tells me I can't post external links? Yet, you ask for a code box with information in it... That just doesn't make sense to me.

And on this, not being able to use the bbc code tags in your posts may be an unintended side effect of a Mod that we are using here.  Sorry about that.  I am looking into it.  Thank you for letting us know.

ZarPrime