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

Recent

Welcome to TinyPortal. Please login or sign up.

May 19, 2024, 03:38:53 PM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,189
  • Total Topics: 21,220
  • Online today: 128
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online

small bug in download center and fix to it TP 1.05

Started by Master, April 14, 2008, 03:31:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Master

in TPdlmanager.php:


// allow to attach this to another item
$context['TPortal']['attachitems']=array();
if(allowedTo('dlmanager'))
{
// get all items for a list
$itemlist = db_query("SELECT id, name FROM {$tp_prefix}dlmanager WHERE type = 'dlitem' AND subitem=0 ORDER BY name ASC", __FILE__, __LINE__);
if(mysql_num_rows($itemlist)>0){
while($ilist=mysql_fetch_assoc($itemlist))
{
$context['TPortal']['attachitems'][] = array(
'id' => $ilist['id'],
'name' => $ilist['name'],
);
}
mysql_free_result($request);
}
}
else
{
// how about attaching to one of your own?
// get all items for a list
$itemlist = db_query("SELECT id,name FROM {$tp_prefix}dlmanager WHERE category>0 AND type = 'dlitem' AND subitem=0 AND authorID=$ID_MEMBER ORDER BY name ASC", __FILE__, __LINE__);
if(mysql_num_rows($itemlist)>0){
while($ilist=mysql_fetch_assoc($itemlist))
{
$context['TPortal']['attachitems'][] = array(
'id' => $ilist['id'],
'name' => $ilist['name'],
);
}
mysql_free_result($request);
}
}
}

the $request variable  in mysql_free_result function should be $itemlist this should be done twice in last code
therefore this code will be like this:


// allow to attach this to another item
$context['TPortal']['attachitems']=array();
if(allowedTo('dlmanager'))
{
// get all items for a list
$itemlist = db_query("SELECT id, name FROM {$tp_prefix}dlmanager WHERE type = 'dlitem' AND subitem=0 ORDER BY name ASC", __FILE__, __LINE__);
if(mysql_num_rows($itemlist)>0){
while($ilist=mysql_fetch_assoc($itemlist))
{
$context['TPortal']['attachitems'][] = array(
'id' => $ilist['id'],
'name' => $ilist['name'],
);
}
mysql_free_result($itemlist);
}
}
else
{
// how about attaching to one of your own?
// get all items for a list
$itemlist = db_query("SELECT id,name FROM {$tp_prefix}dlmanager WHERE category>0 AND type = 'dlitem' AND subitem=0 AND authorID=$ID_MEMBER ORDER BY name ASC", __FILE__, __LINE__);
if(mysql_num_rows($itemlist)>0){
while($ilist=mysql_fetch_assoc($itemlist))
{
$context['TPortal']['attachitems'][] = array(
'id' => $ilist['id'],
'name' => $ilist['name'],
);
}
mysql_free_result($itemlist);
}
}
}