09 Request System By pdq

Started by Mindless, July 21, 2012, 08:28:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DragonCoder

#11
@ file comment.php no bbcodes shows at all need fix for it  and anyone have viewrequests.php  thats not giving out a white page php error it is do not ask for error log as you know 09 not got it

Edit fixed made my own work for it and my own  Request .... As i can see theres no fix for a dead mod here... none one wants to know

really

#10
Works very well but when i trying to add second requestI get an error message.

( ! ) Notice: Undefined index: in C:\wamp\www\TB\mods\requests\add_request.php on line 137
Call Stack
#   Time   Memory   Function   Location
1   0.0000   180576   {main}( )   ..\viewrequests.php:0
2   0.0625   521536   require_once( 'C:\wamp\www\TB\mods\requests\add_request.php' )   ..\viewrequests.php:60


On line 137
$catname  = htmlspecialchars($change[$arr['cat']]['name']);
$catpic   = htmlspecialchars($change[$arr['cat']]['image']);          

Note:i didn`t install (karma, reports and textbbcode mods)

Thank you very much for Mods and Help.

SOLVED..

denede

#9
**

Mindless

#8
Well seeing its only a while loop looping over an entry it would be a formality to fix such a thing, one i have no time for, one i have no such platform to put these scripts on and work with, can post the files for others because its no going to be for weeks untill i can do it.

ErikZown

Quote from: Mindless on July 27, 2012, 12:57:50 PM
Old files, this was fixed on the post on TBdev, so take the files from U-232 V2 - replace $INSTALLER09 with $TBDEV few sql entries to remove from queries, 5 min job for you then post the rar back here, otherwise when i have time i'll do so ?

Thanks but my coder i hired manage to fix it somehow... :)

Mindless

#6
Old files, this was fixed on the post on TBdev, so take the files from U-232 V2 - replace $INSTALLER09 with $TBDEV few sql entries to remove from queries, 5 min job for you then post the rar back here, otherwise when i have time i'll do so ?

ErikZown

Hey Mindless or someone, can you please help me with this bug....
When a request is not filled, then viewrequest page looks good, but when i fill a request, the request just gets repeated. :S

Look at this image to see what i mean


Thanks

Hyperion (noobKID)

thanks dude... just what i needed...
a code to look over when i am failing my own request version ;)...

mind if im making a noobKID version later on if i wish? :)...

ErikZown

hey btw, just noticed one thing.
You say add "comments.anonymous, torrent" but why have 2 "torrent" ?
So if you look in the example, how it should look like:
Quotetorrent, comments.added, comments.anonymous, torrent,

Edit: oops, sorry maybe i would edit my last post... sorry

ErikZown

wooooow love you man! Thanks Mindless, gonna try this one  :D

Mindless

remember to always backup your files and db before making any changes... :wub:

This is a mod in progress, based on Snugglebunnies Request mod which is based off of OiNKs mod i believe, so credit to them as well.

i think is complete but needs testing. :)

other than languages translations this should work fine for 09/latest so need some brave souls to test and do lang edits :)

this mod works with karma, reports and textbbcode mods so if not use any or all of those make sure to change the settings:

Code (php) Select
/** settings **/
$TBDEV['reports']      = 0;// 1/0 on/off
$TBDEV['karma']        = 0;// 1/0 on/off
$TBDEV['textbbcode']   = 0;// 1/0 on/off



^^ add these 3 lines in your include/config.php :cool:

SOME SQL NEEDED

Code (sql) Select
CREATE TABLE `voted_requests` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `requestid` int(10) unsigned NOT NULL default '0',
  `userid` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `pollid` (`id`),
  KEY `userid` (`userid`),
  KEY `requestid_userid` (`requestid`,`userid`)
) ENGINE=MyISAM;

CREATE TABLE `requests` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `userid` int(10) unsigned NOT NULL default '0',
  `request` varchar(225) NOT NULL default '',
  `descr` text NOT NULL,
  `added` int(11) unsigned NOT NULL default '0',
  `comments` int(11) unsigned NOT NULL default '0',
  `hits` int(10) unsigned NOT NULL default '0',
  `cat` int(10) unsigned NOT NULL default '0',
  `filledby` int(10) unsigned NOT NULL default '0',
  `torrentid` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `userid` (`userid`),
  KEY `id_added` (`id`,`added`)
) ENGINE=MyISAM;

ALTER TABLE `comments` ADD `request` INT(10) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `comments` ADD `anonymous` ENUM('yes', 'no') NOT NULL DEFAULT 'no';
ALTER TABLE `torrents` ADD `anonymous` ENUM('yes', 'no') NOT NULL DEFAULT 'no';





...and you'll need these functions if you dont have them !!, can put in user_functions.php if want :]

Code (php) Select
/** some functions (may put in include/user_functions.php) **/
/** member ratio by Sir_Snuggle_Bunny  **/
function member_ratio($up, $down) {
    switch(true) {
        case ($down > 0 && $up > 0):
        $ratio = '<span style="color:'.get_ratio_color($up/$down).';">'.number_format($up/$down, 3).'</span>';
        break;
        case ($down > 0 && $up == 0):
        $ratio = '<span style="color:'.get_ratio_color(1/$down).';">'.number_format(1/$down, 3).'</span>';
        break;
        case ($down == 0 && $up > 0):
        $ratio=  '<span style="color: '.get_ratio_color($up/1).';">inf</span>';
        break;
       default:
       $ratio = '---';
   }
return $ratio;
}

function format_user($user) {
    global $TBDEV;
    return '<a href="'.$TBDEV['baseurl'].'/userdetails.php?id='.$user['id'].'" title="'.get_user_class_name($user['class']).'">
            <span style="color:'.get_user_class_color($user['class']).';">'.$user['username'].'</span>
            </a>'.get_user_icons($user).' ';
}

/** class color by pdq **/
   $class_colors = array(
        UC_USER                 => '#000000',
        UC_POWER_USER           => '#000000',
        UC_VIP                  => '#000000',
        UC_UPLOADER             => '#000000',
        UC_MODERATOR            => '#000000',
        UC_ADMINISTRATOR        => '#000000',
        UC_SYSOP                => '#FF0000');
       
    function get_user_class_color($class) {
        $class = (int)$class;
        if (isset($class_colors[$class]))
            return $class_colors[$class];
        else
            return '';
    }
/** end functions **/




some more edits:
in bittorrent.php find:

Code (php) Select
function genrelist() {
    $ret = array();
    $res = mysql_query("SELECT id, name FROM categories ORDER BY name");
    while ($row = mysql_fetch_array($res))
        $ret[] = $row;
    return $ret;
}



add in

Code (sql) Select
, image

like:

Code (php) Select
function genrelist() {
    $ret = array();
    $res = mysql_query("SELECT id, name, image FROM categories ORDER BY name");
    while ($row = mysql_fetch_array($res))
        $ret[] = $row;
    return $ret;
}




in details.php find:

Code (sql) Select
$subres = mysql_query("SELECT comments.id, text, user, torrent, comments.added, editedby, editedat, avatar, av_w, av_h, warned, username, title, class, donor FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = $id ORDER BY comments.id ".$pager['limit']) or sqlerr(__FILE__, __LINE__);


add in

Code (sql) Select
, comments.anonymous, torrent

like:

Code (sql) Select
$subres = mysql_query("SELECT comments.id, text, user, torrent, comments.added, comments.anonymous, torrent, editedby, editedat, avatar, av_w, av_h, warned, username, title, class, donor FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = $id ORDER BY comments.id ".$pager['limit']) or sqlerr(__FILE__, __LINE__);



thats be it! :D

now replace all of commenttable function found in include/torrenttable_functions.php

Code (php) Select
function commenttable($rows, $variant = 'torrent') {
global $CURUSER, $TBDEV;

$lang = load_language( 'torrenttable_functions' );

$htmlout = '';
$count = 0;
$variant_options = array('torrent' => 'details',
                             'request' => 'viewrequests',
                             //'user'    => 'userdetails'
                             );
                       
    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) {
   //print_r($rows);
$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);
                $htmlout .= "<a name='comm{$row["id"]}' href='userdetails.php?id={$row["user"]}'><b>" .
            htmlspecialchars($row["username"]) . "</b></a>" . ($row["donor"] == "yes" ? "<img src='{$TBDEV['pic_base_url']}star.gif' alt='".$lang["commenttable_donor_alt"]."' />" : "") . ($row["warned"] == "yes" ? "<img src=".
        "'{$TBDEV['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 = "{$TBDEV['pic_base_url']}forumicons/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 width='{$row['av_w']}' height='{$row['av_h']}' 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;
}

[attachment deleted by admin]