function commenttable

Started by MAST3R, August 10, 2011, 07:51:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MAST3R

tkx m8 for the edit comment in offer page is working great
but for delete comments not working needed to modified the comment.php page line

        stderr("{$lang['comment_delete']}", "{$lang['comment_about_delete']}\n" .
          "<a href='comment.php?action=delete&amp;cid=$commentid&amp;tid=$tid&amp;sure=1" .
          ($locale == 'request' ? '&amp;type=request' : '')."'>
          here</a> {$lang['comment_delete_sure']}");


with this line
        stderr("{$lang['comment_delete']}", "{$lang['comment_about_delete']}\n" .
"<a href='comment.php?action=delete&amp;cid=$commentid&amp;tid=$tid&amp;sure=1" .
          ($locale == 'request' ? '&amp;type=request' : ($locale == 'offer' ? '&type=offer' : ''))."'>
          here</a> {$lang['comment_delete_sure']}");


putyn

$extra_link = ($variant == 'request' ? '&type=request' : ($variant == 'offer' ? '&type=offer' : ''));

MAST3R

#3
in the offer page i try to edit the comment and i got error

i think is from the function commenttable becoz for the requests is working good

putyn

could you be more specific on what you want to do ?

MAST3R

function commenttable($rows, $variant = 'torrent') {
  require_once(INCL_DIR.'html_functions.php');
  global $CURUSER, $INSTALLER09;
  $lang = load_language( 'torrenttable_functions' );
  $htmlout = '';
  $count = 0;
  $variant_options = array('torrent' => 'details', 'request' => 'viewrequests', 'offer' => 'viewoffers');                 
    if (isset($variant_options[$variant]))
    $locale_link = $variant_options[$variant];
    else
    return;
    $extra_link = ($variant == 'request' ? '&type=request' : '');
  $htmlout .= begin_main_frame();
  $htmlout .= begin_frame();
  foreach ($rows as $row) {
$htmlout .= "<p class='sub'>#{$row["id"]} {$lang["commenttable_by"]} ";
    if (isset($row["username"])) {
    if ($row['anonymous'] == 'yes') {
    $htmlout .= ($CURUSER['class'] >= UC_MODERATOR ? 'Anonymous - Posted by: <b>'.htmlspecialchars($row['username']).'</b> ID: '.$row['user'].'' : 'Anonymous').' ';
    } else {
    $title = $row["title"];
    if ($title == "")
    $title = get_user_class_name($row["class"]);
    else
    $title = htmlspecialchars($title);
    $username = htmlspecialchars($row['username']);   
    $avatar1 = empty($row["avatar"]) ? "<img src=\'{$INSTALLER09['pic_base_url']}default_avatar.gif\' width=\'150\' height=\'150\' border=\'0\' alt=\'Avatar\' title=\'Avatar\' />" : "<img src=\'".htmlspecialchars($row['avatar'])."\' width=\'150\' height=\'220\' border=\'0\' alt=\'Avatar\' title=\'Avatar\' />";       
    $htmlout .= "<a name='comm{$row["id"]}' onmouseover=\"Tip('<b>$username</b><br />$avatar1');\" onmouseout=\"UnTip();\" href='userdetails.php?id={$row["user"]}'><b>".htmlspecialchars($row["username"])."</b></a>".($row["donor"] == "yes" ? "<img src='{$INSTALLER09['pic_base_url']}star.gif' alt='".$lang["commenttable_donor_alt"]."' />" : "") . ($row["warned"] == "yes" ? "<img src='{$INSTALLER09['pic_base_url']}warned.gif' alt='".$lang["commenttable_warned_alt"]."' />" : "")." ($title)\n";
    }
    }
else
    $htmlout .= "<a name='comm{$row["id"]}'><i>(".$lang["commenttable_orphaned"].")</i></a>\n";
$htmlout .= get_date( $row['added'],'');
$htmlout .= ($row["user"] == $CURUSER["id"] || $CURUSER["class"] >= UC_STAFF ? "- [<a href='comment.php?action=edit&amp;cid=".$row['id'].$extra_link."&amp;tid=".$row[$variant]."'>".$lang["commenttable_edit"]."</a>]" : "") .
($CURUSER["class"] >= UC_VIP ? " - [<a href='report.php?type=Comment&amp;id=".$row['id']."'>Report this Comment</a>]" : "") .
($CURUSER["class"] >= UC_STAFF ? " - [<a href='comment.php?action=delete&amp;cid=".$row['id'].$extra_link."&amp;tid=".$row[$variant]."'>".$lang["commenttable_delete"]."</a>]" : "") .
($row["editedby"] && $CURUSER["class"] >= UC_STAFF ? "- [<a href='comment.php?action=vieworiginal&amp;cid=".$row['id'].$extra_link."&amp;tid=".$row[$variant]."'>".$lang["commenttable_view_original"]."</a>]" : "") . "</p>\n";
$avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($row["avatar"]) : "");
if (!$avatar)
  $avatar = "{$INSTALLER09['pic_base_url']}default_avatar.gif";
$text = format_comment($row["text"]);
    if ($row["editedby"])
    $text .= "<p><font size='1' class='small'>".$lang["commenttable_last_edited_by"]." <a href='userdetails.php?id={$row['editedby']}'><b>{$row['username']}</b></a> ".$lang["commenttable_last_edited_at"]." ".get_date($row['editedat'],'DATE')."</font></p>\n";
$htmlout .= begin_table(true);
$htmlout .= "<tr valign='top'>\n";
$htmlout .= "<td align='center' width='150' style='padding: 0px'><img src='{$avatar}' alt='' /><br />".get_reputation($row, 'comments')."</td>\n";
$htmlout .= "<td class='text'>$text</td>\n";
$htmlout .= "</tr>\n";
    $htmlout .= end_table();
    }
  $htmlout .= end_frame();
  $htmlout .= end_main_frame();
  return $htmlout;
    }


    $extra_link = ($variant == 'request' ? '&type=request' : '');
how to add the offer here ??
pls help