09 Multilayer Forum

Started by Mindless, July 21, 2012, 09:27:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hyperion (noobKID)

just asking stupid to make sure...
what mods are exacly required to make this forum mod work in full if any?

-thanks :)...

Mindless

#1
09 Overforums - thanks for the help pdq and putyn on this conversion

Credits to all coders involved mainly Retro who created this code in the first place and Alex2005 for updating the code that was already posted on the forum.

Here's whats changed(i'll take it from the top of the file)

  • improved code
  • Configs
  • added an option to enable/disable the polls mod
  • added an option to enable/disable the attahments mod
  • added an option to enable/disable the flood mod
  • added an option to enable/disable the forums stats mod
  • set the forum width
  • easy change to most used pics(like edit button, delete etc...)
  • added the Reduced Readposts modification mod by retro
  • added the action getdaily and updated it
  • all the actions lock, set sticky, rename topic description, move topic, and delete topic have been deleted, and replaced with just one action, updatetopic

    • updated the staff options in action viewtopic for this modification
  • updated deleteforum action
  • updated post action
  • updated viewtopic action

    • updated poll code
    • no more looped queries
    • changed a bit the layout
  • updated editpost action
  • updated deletepost action
  • no more makepostpoll.php file

    • added a new action makepoll(which makes and edits the polls)
    • added a new action, deletepoll
  • no more attachment.php and whodownloaded.php files

    • added a new action, attachment(the old attachment.php file, improved), which downloads and deletes the atachments
    • added a new action, whodownloaded(the old whodownloaded.php file, improved), to see who downloaded
  • updated viewforum action(no more looped queries here either)
  • updated viewunread action

    • updated catch_up() function to work with this update
  • updated search action(no more looped queries here, either)
  • updated forumview action
  • updated default action
  • made optional the function parked() and textbbcode(no errors there if they don't exist)
  • extra security checks and some other small changes

    Well, i could have maked the list shorter by saying that i have changed everything, but what the heck :blum:

    Make sure to backup your database before adding this sql(just to be sure)
    01/05/10

    • Fully Xhtml Valid
    • Putyn rewrote forummanage.php and i used that as a template for moforums.php
    • Updated bug in post update
    • Updated improved cached stats module
    • Lang update to be done - possible split up as well
    • Putyns Post Icons added
    • Double escaping on edit fixed
    • Seedbonus now a config switch :)
    • Autoshout now a config switch :)
    • Putyns forum moderator system added :)
    • Putyns Subforum system added with msubforums.php :)
    • Unread posts fixed
    • Various fixes applied
    • Getdaily fixed - FreakyNutz
    • Annonymous Added - FreakyNutz
    • Subscriptions added - sir_snugglebunny
    • Dont show last edited by for staff
    Code (sql) Select
    CREATE TABLE `attachmentdownloads` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `fileid` int(10) NOT NULL default '0',
      `username` varchar(50) NOT NULL default '',
      `userid` int(10) NOT NULL default '0',
      `date` int(11) NOT NULL default '0',
      `downloads` int(10) unsigned NOT NULL,
      PRIMARY KEY  (`id`),
      KEY `fileid_userid` (`fileid`,`userid`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


    Code (sql) Select
    CREATE TABLE `attachments` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `topicid` int(10) unsigned NOT NULL default '0',
      `postid` int(10) unsigned NOT NULL default '0',
      `filename` varchar(255) NOT NULL default '',
      `size` bigint(20) unsigned NOT NULL default '0',
      `owner` int(10) unsigned NOT NULL default '0',
      `downloads` int(10) unsigned NOT NULL default '0',
      `added` int(11) NOT NULL default '0',
      `type` varchar(100) NOT NULL,
      PRIMARY KEY  (`id`),
      KEY `topicid` (`topicid`),
      KEY `postid` (`postid`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


    Code (sql) Select
    CREATE TABLE `forums` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `name` varchar(60) NOT NULL default '',
      `description` varchar(200) default NULL,
      `sort` tinyint(3) unsigned NOT NULL default '0',
      `forid` tinyint(4) default '0',
      `postcount` int(10) unsigned NOT NULL default '0',
      `topiccount` int(10) unsigned NOT NULL default '0',
      `minclassread` tinyint(3) unsigned NOT NULL default '0',
      `minclasswrite` tinyint(3) unsigned NOT NULL default '0',
      `minclasscreate` tinyint(3) unsigned NOT NULL default '0',
      `place` int(10) NOT NULL default '-1',
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


    Code (sql) Select
    CREATE TABLE `forum_mods` (
      `id` int(10) NOT NULL auto_increment,
      `uid` int(10) NOT NULL default '0',
      `fid` int(10) NOT NULL default '0',
      `user` varchar(15) NOT NULL default '',
      PRIMARY KEY  (`id`),
      KEY `uid` (`uid`,`fid`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


    Code (sql) Select
    CREATE TABLE `overforums` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `name` varchar(60) NOT NULL default '',
      `description` varchar(200) default NULL,
      `minclassview` tinyint(3) unsigned NOT NULL default '0',
      `forid` tinyint(3) unsigned NOT NULL default '1',
      `sort` tinyint(3) unsigned NOT NULL default '0',
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


    Code (sql) Select
    CREATE TABLE `postpollanswers` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `pollid` int(10) unsigned NOT NULL default '0',
      `userid` int(10) unsigned NOT NULL default '0',
      `selection` tinyint(3) unsigned NOT NULL default '0',
      PRIMARY KEY  (`id`),
      KEY `pollid` (`pollid`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


    Code (sql) Select
    CREATE TABLE `postpolls` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `added` int(11) NOT NULL default '0',
      `question` text NOT NULL,
      `option0` varchar(40) NOT NULL default '',
      `option1` varchar(40) NOT NULL default '',
      `option2` varchar(40) NOT NULL default '',
      `option3` varchar(40) NOT NULL default '',
      `option4` varchar(40) NOT NULL default '',
      `option5` varchar(40) NOT NULL default '',
      `option6` varchar(40) NOT NULL default '',
      `option7` varchar(40) NOT NULL default '',
      `option8` varchar(40) NOT NULL default '',
      `option9` varchar(40) NOT NULL default '',
      `option10` varchar(40) NOT NULL default '',
      `option11` varchar(40) NOT NULL default '',
      `option12` varchar(40) NOT NULL default '',
      `option13` varchar(40) NOT NULL default '',
      `option14` varchar(40) NOT NULL default '',
      `option15` varchar(40) NOT NULL default '',
      `option16` varchar(40) NOT NULL default '',
      `option17` varchar(40) NOT NULL default '',
      `option18` varchar(40) NOT NULL default '',
      `option19` varchar(40) NOT NULL default '',
      `sort` enum('yes','no') NOT NULL default 'no',
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


    Code (sql) Select
    CREATE TABLE `posts` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `topicid` int(10) unsigned NOT NULL default '0',
      `userid` int(10) unsigned NOT NULL default '0',
      `added` int(22) default '0',
      `body` longtext collate utf8_bin,
      `editedby` int(10) unsigned NOT NULL default '0',
      `editedat` int(11) default '0',
      `post_history` mediumtext collate utf8_bin NOT NULL,
      `posticon` int(2) NOT NULL default '0',
      `anonymous` enum('yes','no') collate utf8_bin NOT NULL default 'no',
      PRIMARY KEY  (`id`),
      KEY `topicid` (`topicid`),
      KEY `userid` (`userid`),
      FULLTEXT KEY `body` (`body`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_bin;


    Code (sql) Select
    CREATE TABLE `topics` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `userid` int(10) unsigned NOT NULL default '0',
      `subject` varchar(40) default NULL,
      `locked` enum('yes','no') NOT NULL default 'no',
      `forumid` int(10) unsigned NOT NULL default '0',
      `lastpost` int(10) unsigned NOT NULL default '0',
      `sticky` enum('yes','no') NOT NULL default 'no',
      `views` int(10) unsigned NOT NULL default '0',
      `pollid` int(10) unsigned NOT NULL default '0',
      `anonymous` enum('yes','no') NOT NULL default 'no',
      PRIMARY KEY  (`id`),
      KEY `userid` (`userid`),
      KEY `subject` (`subject`),
      KEY `lastpost` (`lastpost`),
      KEY `locked_sticky` (`locked`,`sticky`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_bin;



    New
    Code (sql) Select
    CREATE TABLE `subscriptions` (
      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `userid` int(10) unsigned NOT NULL DEFAULT '0',
      `topicid` int(10) unsigned NOT NULL DEFAULT '0',
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


    Code (sql) Select
    ALTER TABLE users ADD `forum_mod` enum('yes','no') character set utf8 collate utf8_bin NOT NULL default 'no';
    ALTER TABLE users ADD `forums_mod` varchar(320) character set utf8 collate utf8_bin NOT NULL default '';
    ALTER TABLE `users` ADD `forum_access` int(11) NOT NULL default '0' AFTER `last_access; 
    ALTER TABLE `users` ADD `subscription_pm` enum('yes','no') character set utf8 collate utf8_bin NOT NULL default 'no';
    ALTER TABLE users ADD `mood` int(10) NOT NULL default '1';



    To keep exsisting table in place then to use this new update simply run this sql - if you use the tables above skip this part.
    Code (sql) Select
    ALTER TABLE forums ADD `place` int(10) NOT NULL default '-1';
    ALTER TABLE `topics` ADD `anonymous` ENUM( 'yes', 'no' ) DEFAULT 'no' NOT NULL;
    ALTER TABLE `posts` ADD `anonymous` ENUM( 'yes', 'no' ) DEFAULT 'no' NOT NULL;



    Add to include/config.php --= 0 if you dont use them :
    Code (php) Select
    $TBDEV['forums_online'] = 1;
    $TBDEV['forums_autoshout_on'] = 1;
    $TBDEV['forums_seedbonus_on'] = 1;



    Add to userdetails.php in you admin section beside all other stuff :

    Code (php) Select
    $HTMLOUT.="<tr><td class='rowhead'>Forum Mod</td><td colspan='2' align='left'><input name=\"forum_mod\" value=\"yes\" type=\"radio\" " .
        ($user["forum_mod"] == "yes" ? " checked='checked'" : "") . " />Yes <input name=\"forum_mod\" value=\"no\" type=\"radio\" " .
        ($user["forum_mod"] == "no" ? " checked='checked'" : "") . " />No</td></tr>\n";
        if ($user["forum_mod"] == "yes") {
        $r = mysql_query("SELECT id,name,description FROM forums WHERE place = -1 ORDER BY name ASC") or sqlerr();
        $forumsc = mysql_num_rows($r);
          $HTMLOUT.="<tr><td colspan='3' align='center'>
          <input type='hidden' name='forums_count' value='".$forumsc."' />
          <div style='border-style:solid; border-color:#333333; border-width: 1px 1px 1px 3px; width:100%; height:170px; overflow:auto;'>
          <table cellpadding='5' border='0' style='margin:3px;' >";
        $i = 1;
        while ($a = mysql_fetch_assoc($r)) {
        $HTMLOUT.="<tr><td style='border-width: 1px 0px 0px 0px;border-style:dotted;' width='100%'><a href='{$TBDEV['baseurl']}/forums.php?action=viewforum&forumid=".$a["id"]."'>".$a["name"]."</a><br />
        <font style='font-size:10px; padding-left:15px;'>". (strlen($a["description"]) >80 ? substr($a["description"], 0, 80) . "..." : $a["description"]) ."</font>
        </td>
        <td nowrap='nowrap' align='right' style='border:none; border-width: 1px 0px 0px 0px;border-style:dotted'>
        <input type='radio' name='forums_".$i."' value='yes_".$a["id"]."' ".(stristr($user["forums_mod"], "[" . $a["id"] . "]") == true ? "checked='checked'" : "") ." title='Set moderator for this forum' />
        <input type='radio' name='forums_".$i."' value='no_".$a["id"]."' ". (stristr($user["forums_mod"], "[" . $a["id"] . "]") != true ? "checked='checked'" : "") ." title='Unset moderator for this forum' /></td></tr>";
        $i++;
        }
          $HTMLOUT.="</table>
          </div>
          </td></tr>";
        }



    Add to modtask.php :
    Code (php) Select
    // forum moderator mod by putyn tbdev
        // start
        if (isset($_POST["forum_mod"]) && ($forum_mod = $_POST["forum_mod"]) != $user["forum_mod"]) {
            $whatm = ($forum_mod == "yes" ? "added " : "removed");
            if ($forum_mod == "no") {
                $updateset[] = "forums_mod = ''";
                mysql_query("DELETE FROM forum_mods WHERE uid=" . $user["id"]) or sqlerr(__file__,
                    __line__);
            }
            $updateset[] = "forum_mod=" . sqlesc($forum_mod);
            $modcomment = get_date( time(), 'DATE', 1 ) . " " . $CURUSER["username"] . " " . $whatm .
                " forum rights\n" . $modcomment;
        }
        // update forums list
        $forumsc = (isset($_POST["forums_count"]) ? 0 + $_POST["forums_count"] : 0);

        if ($forumsc > 0 && $forum_mod != "no") {
            for ($i = 1; $i < $forumsc + 1; $i++) {
                if (substr($_POST["forums_$i"], 0, 3) == "yes")
                    $foo[] = (int)substr($_POST["forums_$i"], 4);
            }
            foreach ($foo as $fo) {
                $boo[] = "(" . $fo . "," . $user["id"] . "," . sqlesc($user["username"]) . ")";
                $boo1[] = "[" . $fo . "]";
            }

            mysql_query("DELETE FROM forum_mods WHERE uid=" . $user["id"]) or sqlerr(__file__,
                __line__);
            mysql_query("INSERT INTO forum_mods(fid,uid,user) VALUES " . join(",", $boo)) or
                sqlerr(__file__, __line__);
            $updateset[] = "forums_mod=" . sqlesc(join("", $boo1));
        }
        // end forum moderator mod



    Add these to admin.php :

    New
    Code (php) Select
    'forummanager' => 'forummanager',
    'moforums' => 'moforums',
    'msubforums' => 'msubforums',



    Add to admin/index.php

    New
    Code (php) Select
    <span class='btn'><a href='admin.php?action=forummanager'>{$lang['index_forummanage']}</a></span>
    <span class='btn'><a href='admin.php?action=moforums'>{$lang['index_moforums']}</a></span>
    <span class='btn'><a href='msubforums.php'>{$lang['index_msubforums']}</a></span>



    Add to lang/en/lang_ad_index.php

    New
    Code (php) Select
    'index_forummanage' => 'Forum manage',
    'index_moforums' => 'Over Forum manage',
    'index_msubforums' => 'Sub Forum manage',



    Add to my.php
    Code (php) Select
    $HTMLOUT .= tr("Forum Subscribe Pm", "<input type='radio' name='subscription_pm' " . ($CURUSER["subscription_pm"] == "yes" ? " checked='checked'" : "") . " value='yes' />yes <input type='radio' name='subscription_pm' " . ($CURUSER["subscription_pm"] == "no" ? " checked='checked'" : "") . " value='no' />no<br /> When someone posts in a subscribed thread, you will be PMed.", 1);


    Add to takeprofiledit.php :
    Code (php) Select
    $subscription_pm = $_POST["subscription_pm"];
    $updateset[] = "subscription_pm = " . sqlesc($subscription_pm);



    Post any problems suggestions ect please. Add your own forum images for the buttons to forumicons folder and pic for some i think. Upload forummanager.php and moforums.php to admin folder and attacthments.php, forums.php, preview.php, subscriptions.php, usermoods.php, topmoods.php and whodownloaded.php to root, upload mood.php to include folder, finally create a folder forum_attachments - add a index.html or .htaccess to it and chmod to 777 :) - Updated Forums with many changes, Upload post_icons extract bleachespic and upload them to pic folder, upload msubforums.php to root :) Remember you may need to alter your staff forum id's in the 2 arrays on forums.php for autoshout if you use it. This version has offensive avatars added so refer to that post for the rest of the code.

    [attachment deleted by admin]