TinyPortal
Development => Feedback => Bugs/Errors => Topic started by: Master on April 14, 2008, 03:31:37 PM
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);
}
}
}