[ABD] dgTopic Thumbs (0.1.1)

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
User avatar
darkoo
Registered User
Posts: 174
Joined: Thu Sep 07, 2006 5:32 pm

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by darkoo »

Well with "table prefix" I ment "phpbb_" in the database. If you have something else than phpbb_ you should change the prefix accordingly.

Example: If your prefix is "myprefix" then--->

Code: Select all

ALTER TABLE `myprefix_attachments` ADD `topic_thumb` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `myprefix_forums` ADD `forum_topics_thumb_choice` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0';

INSERT INTO `yourDBname`.`myprefix_config` (`config_name`, `config_value`, `is_dynamic`) VALUES ('img_max_tthumb_width', '0', '0');
INSERT INTO `yourDBname`.`myprefix_config` (`config_name`, `config_value`, `is_dynamic`) VALUES ('img_min_tthumb_filesize', '0', '0');
INSERT INTO `yourDBname`.`myprefix_config` (`config_name`, `config_value`, `is_dynamic`) VALUES ('tthumb_req_upload_width', '0', '0');
INSERT INTO `yourDBname`.`myprefix_config` (`config_name`, `config_value`, `is_dynamic`) VALUES ('tthumb_req_upload_height', '0', '0'); 

ps. If you don't want to replace your file you should look in the files that I have edited and find the changes I have made and enter them into your own files. The reason to why I didn't create a clean MODX format for this mod is I would get tired of doing the same thing over and over. When I am completely done with this mod then I will pack it up in a clean MODX form.



I hope this clears things up!
polyvore
Registered User
Posts: 22
Joined: Fri Jul 25, 2008 8:24 pm

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by polyvore »

Sweet, thanks man!

Might just have to grind it out, Deffinately worth it :)

my prefix hadn't changed so all good there.
Will get back to you after im done ;)

/.G
updown
Registered User
Posts: 542
Joined: Sat Jan 05, 2008 6:53 am

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by updown »

Nice going, Darkoo - I love this Mod already!! :D

I just finished with trying to optimize your code, especially the viewforum.php queries are very extensive (in my case over 300 per Forumsview!)

I reduced the the hundreds of queries to only one, altered some code and some little bugs:

viewforum.php:

Code: Select all

// dgTopic Thumb MOD - Added -->
    if ($forum_data['forum_topics_thumb_choice'] == 1)
    {
        $sql = 'SELECT topic_id, attach_id
            FROM ' . ATTACHMENTS_TABLE . '
                WHERE topic_thumb = 1
                    AND '. $db->sql_in_set('topic_id', $topic_list);
        $dgresult = $db->sql_query($sql);

        $attachments = array();
        while ($dgrow = $db->sql_fetchrow($dgresult))
        {
            $attachments[$dgrow['topic_id']] = $dgrow['attach_id'];
        }
        $db->sql_freeresult($dgresult);
    }
// dgTopic Thumb MOD - END -->

    foreach ($topic_list as $topic_id)
    {
        $row = &$rowset[$topic_id];

// dgTopic Thumb MOD - Added -->
        $topic_thumb_filename = '';
        if ($forum_data['forum_topics_thumb_choice'] == 1 && $row['topic_type'] != POST_GLOBAL)
        {
                $topic_thumb_filename = (isset($attachments[$topic_id])) ? append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachments[$topic_id] . '&t=' . 2) : '';
        }
// dgTopic Thumb MOD - END -->

        // This will allow the style designer to output a different header
        // or even separate the list of announcements from sticky and normal topics
 
and by the variables, also in viewforum.php:

Code: Select all

            'PAGINATION'        => topic_generate_pagination($replies, $view_topic_url),
            'REPLIES'            => $replies,
            'VIEWS'                => $row['topic_views'],
            'TOPIC_TITLE'        => censor_text($row['topic_title']),
            'TOPIC_TYPE'        => $topic_type,
// dgTopic Thumb MOD - Added -->
            'TOPIC_THUMB_IMG'    => $topic_thumb_filename,
// dgTopic Thumb MOD - END -->

            'TOPIC_FOLDER_IMG'        => $user->img($folder_img, $folder_alt),
            'TOPIC_FOLDER_IMG_SRC'    => $user->img($folder_img, $folder_alt, false, '', 'src'),
            'TOPIC_FOLDER_IMG_ALT'    => $user->lang[$folder_alt],
            'TOPIC_ICON_IMG'        => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
            'TOPIC_ICON_IMG_WIDTH'    => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
            'TOPIC_ICON_IMG_HEIGHT'    => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
            'ATTACH_ICON_IMG'        => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
            'UNAPPROVED_IMG'        => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',

// dgTopic Thumb MOD - Added -->
            'S_TOPIC_THUMB'            => (isset($attachments[$topic_id])) ? true : false,
// dgTopic Thumb MOD - END -->
            'S_TOPIC_TYPE'            => $row['topic_type'], 
Please, take I deep look into this, perhaps I missed something important - but I tested this the last few hours and it now works very fine and fast for me.

Thanks again for your help - I hope this is also some help for you :idea:
polyvore
Registered User
Posts: 22
Joined: Fri Jul 25, 2008 8:24 pm

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by polyvore »

Hi Darkoo,

Just Finished manually making the edits!

I think all is good except for one error which goes away when i remove that text which defines the size.
I'm Talking about the Edit to viewforum_body.html


Code: Select all

Parse error: syntax error, unexpected '}' in /nfs/c01/h04/mnt/36518/domains/cgchain.com/html/includes/template.php(175) : eval()'d code on line 171

Here is a cut from my template.php in includes

Code: Select all

		if (defined('IN_ERROR_HANDLER'))
		{
			if ((E_NOTICE & error_reporting()) == E_NOTICE)
			{
				error_reporting(error_reporting() ^ E_NOTICE);
			}
		}

		if ($filename = $this->_tpl_load($handle))
		{
			($include_once) ? include_once($filename) : include($filename);
		}
		else
		{
			eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
		}

		return true;
	}

	/**
	* Display the handle and assign the output to a template variable or return the compiled result.
	* @access public
	*/
	function assign_display($handle, $template_var = '', $return_content = true, $include_once = false)
	{
		ob_start();
		$this->display($handle, $include_once);
		$contents = ob_get_clean();

		if ($return_content)
		{
			return $contents;
		}

		$this->assign_var($template_var, $contents);

		return true;
	}

	/**
	* Load a compiled template if possible, if not, recompile it
	* @access private
	*/
	function _tpl_load(&$handle)
	{
		global $user, $phpEx, $config;
polyvore
Registered User
Posts: 22
Joined: Fri Jul 25, 2008 8:24 pm

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by polyvore »

DISREGARD THAT, i purged all themes, and images, and redid the viewforum edit and it WORKS!

the thumbs are coming up a bit small in the image but i think i just need to tweak it. Once thats set im DONE :d

Thank you so much, will donate ASAP for all your hard works :D


Edit:

Installation only took about 45 minutes (Thats manually editing)
Everything was Sectioned off so finding the The edits was really easy (easier than MODX format of some mods)
So Far no Errors whatsoever, there is a tiny bit of unalignment in the images, but i think thats just from making the settings larger than the default border. I only need to play with those settings though, thats all easy template stuff so no hassles there...

Once again THANKS HEAPS.
polyvore
Registered User
Posts: 22
Joined: Fri Jul 25, 2008 8:24 pm

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by polyvore »

Ok, Just got an error when uploading a new avatar.

Its an SQL Error

Code: Select all

General Error
SQL ERROR [ mysql4 ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 3 [1064]

SQL

SELECT forum_topics_thumb_choice FROM phpbb_forums WHERE forum_id = LIMIT 1

BACKTRACE

FILE: includes/db/mysql.php
LINE: 158
CALL: dbal_mysql->sql_error()

FILE: includes/db/mysql.php
LINE: 205
CALL: dbal_mysql->sql_query()

FILE: includes/db/dbal.php
LINE: 159
CALL: dbal_mysql->_sql_query_limit()

FILE: includes/functions_upload.php
LINE: 494
CALL: dbal_mysql->sql_query_limit()

FILE: includes/functions_user.php
LINE: 1956
CALL: fileupload->fileupload()

FILE: includes/functions_user.php
LINE: 2222
CALL: avatar_upload()

FILE: includes/ucp/ucp_profile.php
LINE: 639
CALL: avatar_process_user()

FILE: includes/functions_module.php
LINE: 471
CALL: ucp_profile->main()

FILE: ucp.php
LINE: 324
CALL: p_master->load_active()
thexam
Registered User
Posts: 26
Joined: Sun Mar 09, 2008 2:37 am

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by thexam »

THNX this is a fantastic mod I really love it.
I have some questions.
does this mod also make a tumb from a remote image?
Al the topics on my board start whit a Image, most of them are remote images.
It would be really great if those are made in to tumbs also.
and I have the highslide mod from stoker added to my board will that lead to conflicts?.
polyvore
Registered User
Posts: 22
Joined: Fri Jul 25, 2008 8:24 pm

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by polyvore »

To Answer your question about remote links, i couldn't get it to work. Doesn't effect me though, the 10% that link remotely will soon realise why their threads don't have thumbs and change it. :)
User avatar
darkoo
Registered User
Posts: 174
Joined: Thu Sep 07, 2006 5:32 pm

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by darkoo »

Nice to see that you are very active and happy with this mod. And I am very happy that you are optimizing my mod and making it better!! Since I myself am not so good with php, it would be of great help making this as clean and beautiful as possible.
User avatar
darkoo
Registered User
Posts: 174
Joined: Thu Sep 07, 2006 5:32 pm

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by darkoo »

The avatar error is pretty weird! I´ll be looking over it in 20 minutes or so.. gonna get some food in me now.. brb..
thexam
Registered User
Posts: 26
Joined: Sun Mar 09, 2008 2:37 am

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by thexam »

polyvore wrote:To Answer your question about remote links, i couldn't get it to work. Doesn't effect me though, the 10% that link remotely will soon realise why their threads don't have thumbs and change it. :)
Thnx for your quick reply.
Hope you’ll reconsider and find a solution to make it work with remote images.
On my board It's about 95% remote and 5% attachments.
So I won't be getting the most out of this mod this way.
User avatar
darkoo
Registered User
Posts: 174
Joined: Thu Sep 07, 2006 5:32 pm

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by darkoo »

Hey Thexam!

I know that remote images is a pain I myself have the same problem. The solution is most likely not impossible but pretty hard which I have not the time for. I would hope that some one here figures it out and help us out. When it comes to a solution for my website I will probably add a function where the user is required to upload a image in those forums where dgTopic thumb is enabled..
thexam
Registered User
Posts: 26
Joined: Sun Mar 09, 2008 2:37 am

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by thexam »

I wish I could help out but my PHP/HTML knowledge is very limited.
so what you are doing is magic for me.
As I stated before I'm using the highslide mod bij stokerpiller this mod works with attachments and remote pictures also.
http://www.phpbb.com/community/viewtopi ... 0&t=830965
maybe it's a possibility to combine both mods?
just a noobs thought of course.
User avatar
darkoo
Registered User
Posts: 174
Joined: Thu Sep 07, 2006 5:32 pm

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by darkoo »

Hey updown, it´s really great what you have done there.. taking all douse lines I added and making it so much less and still working.. :)

But there is a small problem with the changes you made:
"S_TOPIC_THUMB" douse´t properly work. If you start a topic without an attachment and then reply to that topic with an attachment then "S_TOPIC_THUMB" gets "true". So what I mean is that "S_TOPIC_THUMB" should only get to be true if first post of a topic has an attachment.

PS. could you please help me out with the avatar error I can´t seem to find the problem..


Thx for your help!
polyvore
Registered User
Posts: 22
Joined: Fri Jul 25, 2008 8:24 pm

Re: [DEV] dgTopic Thumbs (0.1.0)

Post by polyvore »

Hey Darkoo,
Ive been narrowing down where the SQL error starts and it begins in the functions_upload

where it calls " $result = $db->sql_query_limit($sql, 1); "

I removed the SQL tabke and added it again but its still not working.

This is part of your edit

Code: Select all

			// dgTopic Thumb MOD - Added -->	
		global $auth, $user, $config, $db, $cache, $forums, $mode;
		global $phpbb_root_path, $phpEx;		
		
		$forum_id = $_GET['f'];
		$sql = 'SELECT forum_topics_thumb_choice
			FROM ' . FORUMS_TABLE . 
			' WHERE forum_id = ' . $forum_id;
		$result = $db->sql_query_limit($sql, 1);
		$row = (int) $db->sql_fetchfield('forum_topics_thumb_choice');
		$topic_thumb_choice = $row;
		$db->sql_freeresult($result);
		
		
		$sql = 'SELECT `config_value` FROM `' . CONFIG_TABLE . '` WHERE `config_name`= \'tthumb_req_upload_width\' LIMIT 1'; 
		$result = $db->sql_query($sql);
		$tthumb_req_upload_width = $db->sql_fetchfield('config_value');
		$db->sql_freeresult($result);
		
		$sql = 'SELECT `config_value` FROM `' . CONFIG_TABLE . '` WHERE `config_name`= \'tthumb_req_upload_height\' LIMIT 1'; 
		$result = $db->sql_query($sql);
		$tthumb_req_upload_height = $db->sql_fetchfield('config_value');
		$db->sql_freeresult($result);			
		// dgTopic Thumb MOD - END -->	

Any Ideas on what it could mean by this, just to push me in the right direction of figuring out a fix for myself?
If i remove the functions upload the avatars are all good to be changed, but the mod dissapears.

Code: Select all

SQL ERROR [ mysql4 ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 3 [1064]
Locked

Return to “[3.0.x] Abandoned MODs”