[2.0.18] Cash Mod

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
1036
66%
Very Good
239
15%
Good
121
8%
Fair
36
2%
Poor
126
8%
 
Total votes: 1558

areil
Registered User
Posts: 29
Joined: Sat Oct 07, 2006 5:26 am

Post by areil » Mon Oct 09, 2006 2:43 am

Sorry if this is out of place!

I installed Zarath's effects shop.. both regular and effects shops work correctly.. however.. the effects shop is not appearing on shop_list.php! If you open my items shop and (in the address bar) change the shop number to 2.. it does link to the effects shop.. so i know it is functional, its just not getting linked anywhere. the back-links work (ie after you buy something, 'return to effects return to shop list')

Anyone know what would need to be changed to have this link show up? Or even what I could put in the overall_header.tpl file to have it show up in the main header? Thank you!

BMonkey01
Registered User
Posts: 9
Joined: Sat Oct 07, 2006 2:03 am
Contact:

Post by BMonkey01 » Mon Oct 09, 2006 2:54 am

Ok... I've gotten to the point that I think I have my code in the correct place, however it is not working... the code does not return errors, however user_lvl (the level currency) is not being updated...

I would really appreciate it if someone could look over this and give me a hand.

this is taken from classes_cash.php starting on Line: 559 (shouldn't be different from a standard install version of classes_cash.php as I have not edited anything before the comment I placed indicating my code.)

Sorry if it is sloppy or totally incorrect as I do not know much about PHP and I am doing this to try and learn a little with hands on experience.

Thank you in advance! ^_^

Code: Select all

while ( $c_cur = &$cash->currency_next($cm_i,CURRENCY_ENABLED,$forum_id) )
			{
				$this_enabled = $all_active;
				if ( !$all_active )
				{
					$sum = 0;
					for ( $i = 0; $i < count($forumlist); $i++ )
					{
						if ( $c_cur->forum_active($forumlist[$i]) )
						{
							$sum += $forumcount[$forumlist[$i]];
						}
					}
					if ( $sum < $board_config['cash_disable_spam_num'] )
					{
						$this_enabled = true;
						$all_spam = false;
					}
				}
				if ( $this_enabled )
				{
					$base = ( $first_post ) ? $posting_user->get_setting($c_cur->id(),'cash_perpost') : $posting_user->get_setting($c_cur->id(),'cash_perreply');
					$perchar = $posting_user->get_setting($c_cur->id(),'cash_perchar',PERCHAR_DEC_BONUS);
					$max = $posting_user->get_setting($c_cur->id(),'cash_maxearn');
					$quotes = ( $c_cur->mask(CURRENCY_INCLUDEQUOTES) ) ? 0 : 1;

					$total_added = ( $mode != 'delete' ) ? min($max,$base + ($perchar * $new_len[$quotes])) : 0;
					$total_removed = ( ($mode != 'newtopic') && ($mode != 'reply') ) ? min($max,$base + ($perchar * $old_len[$quotes])) : 0;
					$total_change = $total_added - $total_removed;
					if ( $total_change != 0 )
					{
						$change_sign = ($total_change > 0);
						$change_amount = ( ( $change_sign ) ? $total_change : (-$total_change) );
						$change_sign = ( ( $change_sign ) ? " + " : " - " );
						$sql_clause[] = $c_cur->db() . " = " . $c_cur->db() . $change_sign . $change_amount;
						$message_clause[] = $c_cur->display($change_amount);
						
						/*
							Checks user_exp against the phpbb_level table to see if the user's new exp total equals the
							required amount to gain the next level and repeats this process until the user does not meet
							the requirement of the next level.
						*/
						
						$sql = "SELECT * FROM phpbb_levels ORDER BY LVL_ID";
						
						if ( !($result = $db->sql_query($sql)) )
						{
							message_die(GENERAL_ERROR, 'Error retrieving post data', '', __LINE__, __FILE__, $sql);
						}
						
						$array_counter = 0;
						$exp_require = array();
						
						while ( $row = $db->sql_fetchrow($result) )
						{
							$exp_require[$array_counter] = $row;
							$array_counter++;
						}
						$lvl_loop = 1;
						
						$new_exp = $userdata['user_exp'] + $total_change;
						
						while ($loop >= 1)
						{
							$userdata['user_lvl']++;
							
							if ($new_exp >= $exp_require[$userdata['user_lvl']])
							{
								$sql = "UPDATE " . USERS_TABLE . "SET USER_LVL = " . $userdata['user_lvl'] . "WHERE user_id = " . $poster_id;
							}
							else
							{
								$loop = 0;
							}
						}
					}
				}
			}

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Mon Oct 09, 2006 3:53 am

areil wrote: Sorry if this is out of place!

I installed Zarath's effects shop.. both regular and effects shops work correctly.. however.. the effects shop is not appearing on shop_list.php! If you open my items shop and (in the address bar) change the shop number to 2.. it does link to the effects shop.. so i know it is functional, its just not getting linked anywhere. the back-links work (ie after you buy something, 'return to effects return to shop list')

Anyone know what would need to be changed to have this link show up? Or even what I could put in the overall_header.tpl file to have it show up in the main header? Thank you!


What mod version is this...? How did you add the shop, do you have districts enabled? There's a lot more info needed. :P

areil
Registered User
Posts: 29
Joined: Sat Oct 07, 2006 5:26 am

Post by areil » Mon Oct 09, 2006 5:19 am

Zarath wrote: What mod version is this...? How did you add the shop, do you have districts enabled? There's a lot more info needed. :P


Good point!

Shop Mod 3.0.3, Thoul's 2006 (c) Effects Store
Manual install of files and coding, sql installer files
Districts are off

Anything else? Sorry I didn't even think to add that!

bacilla
Registered User
Posts: 2
Joined: Fri Dec 30, 2005 10:29 am

Post by bacilla » Mon Oct 09, 2006 10:50 am

i am not sure if it was posted already

found two bugs in 2.2.3a version

FILENAME: admin/cash_groups.php

LINE 122 - (The wrong constant name)
case CASH_GROUPS_USEGROUP:
case CASH_GROUPS_USERGROUP:


LINE 125 - (sql syntax: no space before AND)
WHERE group_id = " . $group_id . "AND user_pending = 0";
WHERE group_id = " . $group_id . " AND user_pending = 0";

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51868
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Post by Brf » Mon Oct 09, 2006 11:13 am

BMonkey01 wrote: I think I have my code in the correct place


What happened to the end of the loop? Where the cash is updated and stuff?

Also, your $loop should be $lvl_loop or the other way around.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51868
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Post by Brf » Mon Oct 09, 2006 11:14 am

areil wrote: Sorry if this is out of place!


This thread is for the Cash Mod, not the Shop Mod. If you are having problems with another mod, post them in that mod's thread.

bacilla
Registered User
Posts: 2
Joined: Fri Dec 30, 2005 10:29 am

Post by bacilla » Mon Oct 09, 2006 12:33 pm

and one new bug

FILE: admin/cash_exchange.php
LINE: 57
(intval($HTTP_POST_VARS['currency_val'][$c_cur->id()]) > 0) )
(intval($HTTP_POST_VARS['currency_val'][$c_cur->id()]) >= 0) )


now u can use float values in "cash exchange form", before it was not impossible, but as default it is float

BMonkey01
Registered User
Posts: 9
Joined: Sat Oct 07, 2006 2:03 am
Contact:

Post by BMonkey01 » Tue Oct 10, 2006 2:27 am

Brf wrote:
BMonkey01 wrote:I think I have my code in the correct place


What happened to the end of the loop? Where the cash is updated and stuff?

Also, your $loop should be $lvl_loop or the other way around.


Just thought I'd say THANK YOU!

You were a big help... Spent all last night (till 3 am) then worked on it as much as I could today (about 3-4 hours more) and it's done!

Ended up setting it as a seperate function that functions_post.php calls after the cash_update function.

I gotta say it eneded up quite a bit different than I had originally thought/planned, but it's done and I'm excited so... Thanks again!

mistnlove
Registered User
Posts: 63
Joined: Sat Oct 22, 2005 1:00 am

Post by mistnlove » Tue Oct 10, 2006 3:12 am

Where can I find the latest version of cash mod, I'm using phpbb version 2.0.21. Can someone hook me up with the page number. much thanks!

BMonkey01
Registered User
Posts: 9
Joined: Sat Oct 07, 2006 2:03 am
Contact:

Post by BMonkey01 » Tue Oct 10, 2006 3:14 am

mistnlove wrote: Where can I find the latest version of cash mod, I'm using phpbb version 2.0.21. Can someone hook me up with the page number. much thanks!


http://www.phpbb.com/phpBB/viewtopic.ph ... sc&start=0

Tanix
Registered User
Posts: 1
Joined: Tue Oct 10, 2006 5:11 pm

Cash Mod installation problem

Post by Tanix » Tue Oct 10, 2006 5:15 pm

EasyMOD came back with the following error message when I tried installing Cash Mod 2.2.3:

Critical Error

FIND FAILED: In file [viewtopic.php] could not find:

LIMIT $start, ".$board_config['posts_per_page'];

MOD script line #362

phpBB was installed yesterday on my localhost and includes only one mod, apart from EasyMOD itself, also installed yesterday (successfully) - Categories Hierarchy, the pack containing a modified phpBB 2.0.21 with Categories Hierarchy v 2.1.6 installed.

I looked through viewtopic.php but couldn't find the line mentioned in the error message.

Help would be much appreciated, please.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51868
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Post by Brf » Tue Oct 10, 2006 5:17 pm

CH is pretty much going to break Easymod for anything else.

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Post by RMcGirr83 » Tue Oct 10, 2006 6:32 pm

especially the current version of 2.1.6...viewtopic as well as some files in admin folder have changed dramatically. ie here is the new viewtopic.php from CH 2.1.6

Code: Select all

<?php
//
//	file: viewtopic.php
//	author: ptirhiik
//	begin: 23/12/2005
//	version: 1.6.0 - 10/06/2006
//	license: http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
//

define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$requester = 'viewtopic';
include($phpbb_root_path . 'common.'.$phpEx);

include($config->url('includes/bbcode'));
include($config->url('includes/class_forums'));
include($config->url('includes/class_topics'));
include($config->url('includes/class_posts'));
include($config->url('includes/class_message'));

if ( $config->data['mod_attachment_CH'] && (_read('mode', TYPE_NO_HTML) == 'attach') )
{
	include($config->url('includes/class_attach_download'));
	exit;
}

// available sorts
$posts = new posts($requester);
$available_sorts = $posts->sort_fields;

// read forums
$forums = new forums();
$forums->read();

// get ids
$forum_id = 0;
$topic_id = _read(POST_TOPIC_URL, TYPE_INT);
$post_id = _read(POST_POST_URL, TYPE_INT);

// sort
$sort = _read('sort', TYPE_NO_HTML, '', $available_sorts);
$order = strtoupper(_read('postorder', TYPE_NO_HTML, '', array_flip(array('', 'asc', 'ASC', 'desc', 'DESC'))));
$postdays = max(0, _read('postdays', TYPE_INT));

// pagination
$start = max(0, _read('start', TYPE_INT));
$ppage = max(0, _read('ppage', TYPE_INT));

// actions
$view = $topic_id || $post_id ? _read('view', TYPE_NO_HTML, '', array_flip(array('', 'first', 'latest', 'newest', 'next', 'previous'))) : '';
$watch = _read('watch', TYPE_NO_HTML, '', array_flip(array('', 'topic')));
$unwatch = _read('unwatch', TYPE_NO_HTML, '', array_flip(array('', 'topic')));
$unmark = _read('unmark', TYPE_NO_HTML, '', array_flip(array('', 'topic', 'post')));

// highlight
$highlight = phpbb_rtrim(trim(htmlspecialchars(urldecode(stripslashes(_read('highlight', '', '', '', false))))), '\\');

// fix actions
if ( empty($topic_id) )
{
	$watch = $unwatch = '';
}
if ( (($unmark == 'post') && empty($post_id)) || (($unmark == 'topic') && empty($topic_id)) )
{
	$unmark = '';
}

// prepare parms
$parms = array(
	'ppage' => $ppage,
	'start' => empty($post_id) ? $start : 0,
	'sort' => $sort,
	'postorder' => $order,
	'postdays' => $postdays,
	'highlight' => empty($highlight) ? '' : urlencode($highlight),
);

// prepare for topic data reading
$posts->parms = $parms;
unset($parms);

// deal with actions : first try to grab the topic
$error_msg = '';
$session_started = false;

// get topic data
$posts->read_topic($topic_id, $post_id);
$forum_id = $posts->forum_id;
$topic_id = $posts->topic_id;

switch ( $view )
{
	case '':
		break;

	case 'first':
		if ( $topic_id && $post_id )
		{
			redirect($config->url($requester, array(POST_TOPIC_URL => intval($topic_id)), true));
		}
		break;

	case 'latest':
	case 'newest':
		if ( $topic_id )
		{
			// read session to get lang and cookies
			$userdata = session_pagestart($user_ip, empty($forum_id) ? PAGE_INDEX : $forum_id);
			$user->set($requester, array('viewtopic', 'viewprofile', 'class_forums', 'class_topics', 'class_posts', 'class_fields'));
			$session_started = true;
			$user->read_cookies();

			// move post id to the first unreaded or to the last of the topic
			$new_post_id = intval($posts->topic['topic_last_post_id']);
			if ( intval($user->cookies['unreads'][$topic_id]) )
			{
				$sql = 'SELECT post_id
							FROM ' . POSTS_TABLE . '
							WHERE topic_id = ' . intval($topic_id) . '
								AND post_time > ' . intval($user->cookies['unreads'][$topic_id]) . '
							ORDER BY post_time
							LIMIT 1';
				$result = $db->sql_query($sql, false, __LINE__, __FILE__);
				if ( $row = $db->sql_fetchrow($result) )
				{
					$new_post_id = intval($row['post_id']);
				}
				$db->sql_freeresult($result);
			}
			else if ( $view == 'newest' )
			{
				$l_link = $topic_id  ? 'Click_return_topic' : '';
				$u_link = $topic_id ? $config->url($requester, array(POST_TOPIC_URL => $topic_id), true) : '';
				message_return('No_new_posts_last_visit', $l_link, $u_link);
			}
			if ( !$post_id || ($new_post_id != $post_id) )
			{
				redirect($config->url($requester, array(POST_POST_URL => intval($new_post_id)), true, intval($new_post_id)));
			}
		}
		break;

	case 'next':
	case 'previous':
		if ( $topic_id )
		{
			$sql = 'SELECT topic_id
						FROM ' . TOPICS_TABLE . '
						WHERE forum_id = ' . intval($forum_id) . '
							AND topic_moved_id = 0
							AND topic_last_post_id ' . ($view == 'next' ? '> ' : '< ') . intval($posts->topic['topic_last_post_id']) . '
						ORDER BY topic_last_post_id' . ($view == 'next' ? '' : ' DESC') . '
						LIMIT 1';
			$result = $db->sql_query($sql, false, __LINE__, __FILE__);
			$new_topic_id = ($row = $db->sql_fetchrow($result)) ? intval($row['topic_id']) : 0;
			$db->sql_freeresult($result);
			if ( $new_topic_id )
			{
				redirect($config->url($requester, array(POST_TOPIC_URL => $new_topic_id), true));
			}
			else
			{
				// read session to get lang
				$userdata = session_pagestart($user_ip, empty($forum_id) ? PAGE_INDEX : $forum_id);
				$user->set($requester, array('viewtopic', 'viewprofile', 'class_forums', 'class_topics', 'class_posts', 'class_fields'));
				$session_started = true;

				$l_link = $topic_id  ? 'Click_return_topic' : '';
				$u_link = $topic_id ? $config->url($requester, array(POST_TOPIC_URL => $topic_id), true) : '';
				message_return($view == 'next' ? 'No_newer_topics' : 'No_older_topics', $l_link, $u_link);
			}
		}
		break;
}

// get post
$post_id = $posts->post_id;

//
// Start session management
//
if ( !$session_started )
{
	$userdata = session_pagestart($user_ip, empty($forum_id) ? PAGE_INDEX : $forum_id);
	$user->set($requester, array('viewtopic', 'viewprofile', 'class_forums', 'class_topics', 'class_posts', 'class_fields'));
}
//
// End session management
//

// an error occured ?
if ( empty($posts->topic) || !isset($forums->data[$forum_id]) || !empty($error_msg) )
{
	message_die(GENERAL_MESSAGE, empty($error_msg) ? 'Topic_post_not_exist' : $error_msg);
}

// deal with guests
if ( !$user->data['session_logged_in'] || $user->data['session_is_bot'] )
{
	$watch = $unwatch = '';
	if ( !$config->data['keep_unreads_guests'] || $user->data['session_is_bot'] )
	{
		$unmark = '';
	}
}

// get cache
$user->get_cache(array(POST_FORUM_URL, POST_FORUM_URL . 'jbox'));

// fix parms
$posts->get_parms();

// is the topic authorised ?
if ( !$user->auth(POST_FORUM_URL, 'auth_read', $forum_id) )
{
	if ( !$user->data['session_logged_in'] )
	{
		redirect($config->url('login', array('redirect' => str_replace('?', '&', $config->url($requester, (empty($post_id) ? array(POST_TOPIC_URL => $topic_id) : array(POST_POST_URL => $post_id)) + $posts->parms + array('watch' => $watch, 'unwatch' => $unwatch, 'unmark' => $unmark)))), true));
	}
	message_return($user->auth(POST_FORUM_URL, 'auth_view', $forum_id) ? sprintf($user->lang('Sorry_auth_read'), $user->lang('Auth_Users_granted_access')) : 'Topic_post_not_exist');
}

// check/update watch status
$is_watching = false;
if ( $can_watch = ($user->data['session_logged_in'] && !$user->data['session_is_bot']) )
{
	$sql = 'SELECT notify_status
				FROM ' . TOPICS_WATCH_TABLE . '
				WHERE topic_id = ' . intval($topic_id) . '
					AND user_id = ' . intval($user->data['user_id']);
	$result = $db->sql_query($sql, false, __LINE__, __FILE__);
	$is_watching = ($row = $db->sql_fetchrow($result));
	$db->sql_freeresult($result);
	if ( $is_watching )
	{
		if ( $unwatch == 'topic' )
		{
			$sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . '
						WHERE user_id = ' . intval($user->data['user_id']) . '
							AND topic_id = ' . intval($topic_id);
			$db->sql_query($sql, false, __LINE__, __FILE__);
			$l_link = 'Click_return_topic';
			$u_link = $config->url($requester, (empty($post_id) ? array(POST_TOPIC_URL => $topic_id) : array(POST_POST_URL => $post_id)) + $posts->parms, true, $post_id);
			message_return('No_longer_watching', $l_link, $u_link);
		}

		// remove watch flag for this user & this topic
		else if ( intval($row['notify_status']) )
		{
			$sql = 'UPDATE ' . TOPICS_WATCH_TABLE . '
						SET notify_status = 0
						WHERE topic_id = ' . intval($topic_id) . '
							AND user_id = ' . intval($user->data['user_id']);
			$db->sql_query($sql, false, __LINE__, __FILE__);
		}
	}

	// not watching yet
	else if ( $watch == 'topic' )
	{
		$fields = array(
			'user_id' => $user->data['user_id'],
			'topic_id' => intval($topic_id),
			'notify_status' => 0,
		);
		$db->sql_statement($fields);
		$sql = 'INSERT INTO ' . TOPICS_WATCH_TABLE . '
					(' . $db->sql_fields . ') VALUES(' . $db->sql_values . ')';
		$db->sql_query($sql, false, __LINE__, __FILE__);

		$l_link = 'Click_return_topic';
		$u_link = $config->url($requester, (empty($post_id) ? array(POST_TOPIC_URL => $topic_id) : array(POST_POST_URL => $post_id)) + $posts->parms, true, $post_id);
		message_return('You_are_watching', $l_link, $u_link);
	}
}

// get cookies and cookies setup
$cookies_setup = $user->get_cookies_setup();

// unmark asked
if ( $unmark && $cookies_setup['keep_unreads'] )
{
	// get the last time read for the topic or the post
	$last_time_read = intval($posts->topic['topic_time']);

	// unmark from a post
	if ( ($unmark == 'post') && !empty($post_id) )
	{
		$sql = 'SELECT post_time
					FROM ' . POSTS_TABLE . '
					WHERE post_id = ' . intval($post_id);
		$result = $db->sql_query($sql, false, __LINE__, __FILE__);
		if ( !($row = $db->sql_fetchrow($result)) )
		{
			message_return('No_such_post', 'Click_return_forum', $config->url(INDEX, array(POST_FORUM_URL => $forum_id), true));
		}
		$db->sql_freeresult($result);
		$last_time_read = intval($row['post_time']);
	}

	$user->read_cookies();
	$user->cookies['unreads'][$topic_id] = $last_time_read - 1;
	$user->write_cookies();

	// return to the forum
	message_return('Topic_unmarked_read', 'Click_return_forum', $config->url(INDEX, array(POST_FORUM_URL => $forum_id), true));
}

// mark the topic readed
$posts->topic_last_read = $user->read_cookies(POST_POST_URL, $topic_id);
$user->write_cookies();

// increment the number of view
$sql = 'UPDATE ' . TOPICS_TABLE . '
			SET topic_views = topic_views + 1
			WHERE topic_id = ' . intval($topic_id);
$db->sql_query($sql, false, __LINE__, __FILE__);

// add all required user fields to pool
$user->pool_fields = array_merge($user->pool_fields, array(
	'user_posts',
	'user_from',
	'user_interests',
	'user_website',
	'user_email',
	'user_icq',
	'user_aim',
	'user_yim',
	'user_regdate',
	'user_msnm',
	'user_viewemail',
	'user_rank',
	'user_sig',
	'user_sig_bbcode_uid',
	'user_avatar',
	'user_avatar_type',
	'user_allowavatar',
	'user_allowsmile',
));

// now we can read and display the posts
$posts->read();
$posts->display();

// lock status
$forum_locked = ($forums->data[$forum_id]['forum_status'] == FORUM_LOCKED);
$topic_locked = ($posts->topic['topic_status'] == TOPIC_LOCKED) || $forum_locked;

// display poll
if ( !empty($posts->topic['topic_vote']) )
{
	$sql = 'SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result
				FROM ' . VOTE_DESC_TABLE . ' vd, ' . VOTE_RESULTS_TABLE . ' vr
				WHERE vd.topic_id = ' . intval($topic_id) . '
					AND vr.vote_id = vd.vote_id
					ORDER BY vr.vote_option_id';
	$result = $db->sql_query($sql, false, __LINE__, __FILE__);
	$vote_info = array();
	$vote_results_sum = 0;
	while ( $row = $db->sql_fetchrow($result) )
	{
		$vote_results_sum += intval($row['vote_result']);
		$vote_info[] = $row;
	}
	$db->sql_freeresult($result);

	if ( $count_vote_info = count($vote_info) )
	{
		$vote_id = $vote_info[0]['vote_id'];
		$vote_title = $vote_info[0]['vote_text'];

		$sql = 'SELECT vote_id
					FROM ' . VOTE_USERS_TABLE . '
					WHERE vote_id = ' . intval($vote_id) . '
						AND vote_user_id = ' . intval($user->data['user_id']) . '
					LIMIT 1';
		$result = $db->sql_query($sql, false, __LINE__, __FILE__);
		$user_voted = ($row = $db->sql_fetchrow($result)) ? true : false;
		$db->sql_freeresult($result);

		$view_result = (_read('vote', TYPE_NO_HTML) == 'viewresult');
		$poll_expired = intval($vote_info[0]['vote_length']) ? (intval($vote_info[0]['vote_start']) + intval($vote_info[0]['vote_length'])) < time() : false;

		// view results
		if ( $topic_locked || $user_voted || $view_result || $poll_expired || !$user->auth(POST_FORUM_URL, 'auth_vote', $forum_id) )
		{
			$vote_graphic = 0;
			$vote_graphic_max = count($images['voting_graphic']);
			for ( $i = 0; $i < $count_vote_info; $i++ )
			{
				$vote_percent = intval($vote_info[$i]['vote_result']) / max($vote_results_sum, 1);
				$vote_graphic_length = round($vote_percent * $config->data['vote_graphic_length']);

				$vote_graphic = ($i % $vote_graphic_max);
				$vote_graphic_img_left = $images['voting_left'][$vote_graphic];
				$vote_graphic_img = $images['voting_graphic'][$vote_graphic];
				$vote_graphic_img_right = $images['voting_right'][$vote_graphic];

				$template->assign_block_vars('poll_option', array(
					'POLL_OPTION_CAPTION' => _censor($vote_info[$i]['vote_option_text']),
					'POLL_OPTION_RESULT' => intval($vote_info[$i]['vote_result']),
					'POLL_OPTION_PERCENT' => sprintf('%.1d%%', ($vote_percent * 100)),

					'POLL_OPTION_IMG' => $vote_graphic_img,
					'POLL_OPTION_IMG_LEFT' => $vote_graphic_img_left,
					'POLL_OPTION_IMG_RIGHT' => $vote_graphic_img_right,
					'POLL_OPTION_IMG_WIDTH' => $vote_graphic_length,
				));
			}
			$template->assign_vars(array(
				'L_TOTAL_VOTES' => $user->lang('Total_votes'),
				'TOTAL_VOTES' => $vote_results_sum,

				'POLL_DISPLAY' => $template->include_file('viewtopic_poll_result.tpl'),
			));
		}

		// accept vote
		else
		{
			for ( $i = 0; $i < $count_vote_info; $i++ )
			{
				$template->assign_block_vars("poll_option", array(
					'POLL_OPTION_ID' => $vote_info[$i]['vote_option_id'],
					'POLL_OPTION_CAPTION' => _censor($vote_info[$i]['vote_option_text']),
				));
			}
			$template->assign_vars(array(
				'L_SUBMIT_VOTE' => $user->lang('Submit_vote'),
				'I_SUBMIT' => $user->img('cmd_submit'),
				'S_SUBMIT' => $user->lang('cmd_submit'),
				'U_VIEW_RESULTS' => $config->url('viewtopic', array(POST_TOPIC_URL => $topic_id, 'vote' => 'viewresult') + $posts->parms, true),
				'L_VIEW_RESULTS' => $user->lang('View_results'),
				'I_VIEW_RESULTS' => $user->img('cmd_view'),
				'S_POLL_ACTION' => $config->url('posting', array('mode' => 'vote', POST_TOPIC_URL => $topic_id), true),

				'POLL_DISPLAY' => $template->include_file('viewtopic_poll_ballot.tpl'),
			));
			display_buttons(array(
				'submit' => array('txt' => 'Submit_vote', 'img' => 'cmd_submit', 'key' => 'cmd_submit'),
			));
			_hide(POST_TOPIC_URL, $topic_id);
			_hide('mode', 'vote');
			_hide('sid', $user->data['session_id']);
			_hide_set();
		}

		// display the poll
		$template->assign_vars(array(
			'POLL' => $user->lang('Poll'),
			'POLL_QUESTION' => _censor($vote_info[0]['vote_text']),
		));
	}
}

// moderator actions
if ( $user->auth(POST_FORUM_URL, 'auth_mod', $forum_id) )
{
	// moderator actions details display
	$moderator_actions = array(
		'delete' => array('txt' => 'Delete_topic', 'img' => 'topic_mod_delete'),
		'move' => array('txt' => 'Move_topic', 'img' => 'topic_mod_move'),
		'lock' => array('txt' => 'Lock_topic', 'img' => 'topic_mod_lock', 'cond' => $posts->topic['topic_status'] != TOPIC_LOCKED),
		'unlock' => array('txt' => 'Unlock_topic', 'img' => 'topic_mod_unlock', 'cond' => $posts->topic['topic_status'] == TOPIC_LOCKED),
		'split' => array('txt' => 'Split_topic', 'img' => 'topic_mod_split'),
	);
	foreach ( $moderator_actions as $mode => $data )
	{
		if ( !isset($data['cond']) || $data['cond'] )
		{
			$template->assign_block_vars('modcp', array(
				'U_ACTION' => $config->url('modcp', array('mode' => $mode, POST_TOPIC_URL => $topic_id, 'sid' => $user->data['session_id']), true),
				'L_ACTION' => $user->lang($data['txt']),
				'I_ACTION' => $user->img($data['img']),
			));
		}
	}
}

// bottom select
$template->assign_vars(array(
	'L_DISPLAY_POSTS' => $user->lang('Display_posts'),
	'L_SORT_BY' => $user->lang('Sort_by'),
	'L_GO' => $user->lang('Go'),
	'I_GO' => $user->img('cmd_mini_submit'),
));
$lists = array(
	'postdays' => array(0 => 'All_Posts', 1 => '1_Day', 7 => '7_Days', 14 => '2_Weeks', 30 => '1_Month', 90 => '3_Months', 180 => '6_Months', 364 =>'1_Year'),
	'sort' => &$available_sorts,
	'postorder' => array('ASC' => 'Sort_Ascending', 'DESC' => 'Sort_Descending'),
);
$parms = $posts->parms;
$parms['sort'] = $posts->sort;
$parms['postorder'] = $posts->order;
foreach ( $lists as $parm => $list )
{
	$options[ strtoupper($parm) ] = '';
	foreach ( $list as $value => $desc )
	{
		$selected = ($parms[$parm] == $value) ? ' selected="selected"' : '';
		$options[ strtoupper($parm) ] .= '<option value="' . $value . '"' . $selected . '>' . $user->lang($desc) . '</option>';
	}
}
unset($parms);
$template->assign_vars($options);

// display topic header
$template->assign_vars(array(
	'L_AUTHOR' => $user->lang('Author'),
	'L_MESSAGE' => $user->lang('Message'),

	'TOPIC_TITLE' => _censor($posts->topic['topic_title']),
	'U_VIEW_TOPIC' => $config->url($requester, array(POST_TOPIC_URL => $topic_id) + $posts->parms, true),

	'U_NEW_TOPIC' => $config->url('posting', array('mode' => 'newtopic', POST_FORUM_URL => $forum_id), true),
	'L_NEW_TOPIC' => $forum_locked ? $user->lang('Forum_locked') : $user->lang('Post_new_topic'),
	'I_NEW_TOPIC' => $forum_locked ? $user->img('post_locked') : $user->img('post_new'),

	'U_REPLY_TOPIC' => $config->url('posting', array('mode' => 'reply', POST_TOPIC_URL => $topic_id), true),
	'L_REPLY_TOPIC' => $topic_locked ? $user->lang('Topic_locked') : $user->lang('Reply_to_topic'),
	'I_REPLY_TOPIC' => $topic_locked ? $user->img('reply_locked') : $user->img('reply_new'),

	'U_VIEW_PREVIOUS_TOPIC' => $config->url($requester, array(POST_TOPIC_URL => $topic_id, 'view' => 'previous'), true),
	'L_VIEW_PREVIOUS_TOPIC' => $user->lang('View_previous_topic'),
	'I_VIEW_PREVIOUS_TOPIC' => $user->img('topic_previous'),

	'U_VIEW_NEXT_TOPIC' => $config->url($requester, array(POST_TOPIC_URL => $topic_id, 'view' => 'next'), true),
	'L_VIEW_NEXT_TOPIC' => $user->lang('View_next_topic'),
	'I_VIEW_NEXT_TOPIC' => $user->img('topic_next'),

	'U_WATCH_TOPIC' => $config->url($requester, array(POST_TOPIC_URL => $topic_id, ($is_watching ? 'unwatch' : 'watch') => 'topic') + $posts->parms, true),
	'L_WATCH_TOPIC' => $user->lang($is_watching ? 'Stop_watching_topic' : 'Start_watching_topic'),
	'I_WATCH_TOPIC' => $user->img($is_watching ? 'topic_un_watch' : 'topic_watch'),

	'U_UNREAD_TOPIC' => $config->url($requester, array(POST_TOPIC_URL => $topic_id, 'unmark' => 'topic'), true),
	'L_UNREAD_TOPIC' => $user->lang('Topic_unmark_read'),
	'I_UNREAD_TOPIC' => $user->img('topic_unmark_read'),

	'S_POST_DAYS_ACTION' => $config->url($requester, array(POST_TOPIC_URL => $topic_id, 'start' => $start), true),
));
$template->set_switch('watch', $can_watch);
$template->set_switch('unread_topic', $cookies_setup['keep_unreads']);

// page title
$page_title = $user->lang('View_topic') . ' - ' . _censor($posts->topic['topic_title']);

// display nav
$forums->display_nav($forum_id);

// display pagination
$pagination = new pagination($requester, array(POST_TOPIC_URL => $topic_id) + $posts->parms);
$pagination->display('pagination', $posts->total_items, $posts->ppage, $posts->parms['start'], true, 'Posts_count');
unset($pagination);

// kill posts
unset($posts);

// display moderators
$moderators = new moderators();
$moderators->read();
$moderators->display('moderators', $forum_id);
unset($moderators);

// forum rules
$forums->display_rules($forum_id);

// jumpbox
make_jumpbox(INDEX, $forum_id);

// Mozilla navigation bar
$nav_links['prev'] = array(
	'url' => $config->url($requester, array(POST_TOPIC_URL => $topic_id, 'view' => 'previous'), true),
	'title' => $user->lang('View_previous_topic'),
);
$nav_links['next'] = array(
	'url' => $config->url($requester, array(POST_TOPIC_URL => $topic_id, 'view' => 'next'), true),
	'title' => $user->lang('View_next_topic'),
);
$nav_links['up'] = array(
	'url' => $config->url(INDEX, array(POST_FORUM_URL => $forum_id), true),
	'title' => $user->lang($forums->data[$forum_id]['forum_name']),
);

// and finaly send the tpl
$template->set_filenames(array('body' => 'viewtopic_body.tpl'));
include($config->url('includes/page_header'));
$template->pparse('body');
include($config->url('includes/page_tail'));

?>
notice the new class_message that was not incorporated in previous versions (we run 2.1.1 RC5 btw).

Kay <3
Registered User
Posts: 1
Joined: Tue Oct 10, 2006 9:57 pm

Question??

Post by Kay <3 » Tue Oct 10, 2006 10:47 pm

Now that I have installed Cash Mod and set up Currencies I try to view user profile but it won't work. :cry: How do you donate money to other people?

Post Reply

Return to “[2.0.x] MOD Database Releases”