TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 06:28:03 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,106
  • Total Topics: 21,213
  • Online today: 358
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 243
  • Total: 243

Bug Found And Corrected

Started by siath, June 23, 2011, 02:13:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

siath

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.

IchBin

Yes, I've already added this into the code for the next release. Thank you.

ZarPrime

Quote from: siath on June 23, 2011, 02:13:59 PM
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