[BETA] Advanced Points System v.0.9.2

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Get Involved
Locked
User avatar
zentauriom
Registered User
Posts: 76
Joined: Sun Jun 22, 2008 1:09 pm
Location: Landau in der Pfalz
Contact:

Re: [BETA] Points System v.0.7.5

Post by zentauriom »

woahh, that worked :mrgreen:
thank you very very much

Arcade rules yeahhhhhhhhhh :mrgreen:
User avatar
zentauriom
Registered User
Posts: 76
Joined: Sun Jun 22, 2008 1:09 pm
Location: Landau in der Pfalz
Contact:

Re: [BETA] Points System v.0.7.5

Post by zentauriom »

ok, so far Mod works, but:
when i play Games (also created an normal registered User) nothing happend.
I set Permissions, to play not for free.

But Points will be the same, i pay nothing for a game, and it also didnt say (when i got not enough Points)
you cannot play etc
User avatar
zentauriom
Registered User
Posts: 76
Joined: Sun Jun 22, 2008 1:09 pm
Location: Landau in der Pfalz
Contact:

Re: [BETA] Points System v.0.7.5

Post by zentauriom »

did someone tested the mod with :?: :?:
phpbb 3.0.3
arcade mod rc4

before i got phpbb 3.0.2
arcade mod rc3

and it worked perfect
User avatar
zentauriom
Registered User
Posts: 76
Joined: Sun Jun 22, 2008 1:09 pm
Location: Landau in der Pfalz
Contact:

Re: [BETA] Points System v.0.7.5

Post by zentauriom »

sorry guys works perfect now
forgot to set a permission
User avatar
Tophon
Registered User
Posts: 212
Joined: Wed Oct 22, 2008 12:19 am
Contact:

Re: [BETA] Points System v.0.7.5

Post by Tophon »

Made edits and on running installation, get this error:

Code: Select all

Advanced Points mod Installation

Table Prefix :: phpbb_
Database Type :: mysql4

Creating mod database tables...
[phpBB Debug] PHP Notice: in file /points_install/install.php on line 599: Undefined property: dbal_mysql::$mysql_version

Warning: Cannot modify header information - headers already sent by (output started at /points_install/install.php:230) in /includes/functions.php on line 3733

Warning: Cannot modify header information - headers already sent by (output started at /points_install/install.php:230) in /includes/functions.php on line 3735

Warning: Cannot modify header information - headers already sent by (output started at /points_install/install.php:230) in /includes/functions.php on line 3736

Warning: Cannot modify header information - headers already sent by (output started at /points_install/install.php:230) in /includes/functions.php on line 3737
Anyone had this on install before?
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [BETA] Points System v.0.7.5

Post by stickerboy »

zentauriom wrote:sorry guys works perfect now
forgot to set a permission
Hi, if you need to add more information to your post, please use the edit button in future. Or wait the required 6 hours before bumping the topic :)
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
User avatar
zentauriom
Registered User
Posts: 76
Joined: Sun Jun 22, 2008 1:09 pm
Location: Landau in der Pfalz
Contact:

Re: [BETA] Points System v.0.7.5

Post by zentauriom »

cherokee red wrote:
zentauriom wrote:sorry guys works perfect now
forgot to set a permission
Hi, if you need to add more information to your post, please use the edit button in future. Or wait the required 6 hours before bumping the topic :)

ok, i am very sorry for that :oops: (didnt read Forumrules, better do that in Future)
Just wanna say:


it works fine without any Problems in this Installation:

phpbb 3.0.3
Arcade Mod RC4
worldslayer608
Registered User
Posts: 46
Joined: Wed Aug 29, 2007 4:35 pm

Re: [BETA] Points System v.0.7.5

Post by worldslayer608 »

Any help with my avatar issue?

I installed the mod and my avatars no longer work, none of my users can use them, when we try to upload them it still doesn't show up.

any help would be great

thanks
noltha
Registered User
Posts: 55
Joined: Thu Nov 15, 2007 9:11 am

Re: [BETA] Points System v.0.7.5

Post by noltha »

hey guys,

any news for the release? it should be today right?

Thanks ;)
User avatar
Eliote
Registered User
Posts: 20
Joined: Sat May 10, 2008 10:31 am
Location: France

Re: [BETA] Points System v.0.7.5

Post by Eliote »

Hello

sorry for my English I am French
My forum phpbb 3.0.3
Arcade mod rc3
Points System v.0.7.5

as for me clicks on a topic (viewtopic.php)
I have this mistake (error)
Parse error: syntax error, unexpected ';' in /home.52/l/e/s/lesdieux/www/viewtopic.php on line 989

Consern this modification in your mode
Open: viewtopic.php
Find

Code: Select all

	'FROM'		=> array(
		FORUMS_TABLE	=> 'f',
	)
);
Add after

Code: Select all

//--[Points Modification]--
//-----------------Get config from Database-----------------
$sql = 'SELECT * FROM ' . POINTS_CONFIG_TABLE;
$result = $db->sql_query($sql);
$Points = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
//--[Points Modification]--
Line: 987 //--[Points Modification]--
Line: 988 //-----------------Get config from Database-----------------
Line: 989 $sql = 'SELECT * FROM ' . POINTS_CONFIG_TABLE;
Line: 990 $result = $db->sql_query($sql);
Line: 991 $Points = $db->sql_fetchrow($result);
Line: 992 $db->sql_freeresult($result);
Line: 993 //--[Points Modification]--

My code of the line 900 to 1000 in viewtopic.php

Code: Select all

// If the user is trying to reach the second half of the topic, fetch it starting from the end
$store_reverse = false;
$sql_limit = $config['posts_per_page'];

if ($start > $total_posts / 2)
{
	$store_reverse = true;

	if ($start + $config['posts_per_page'] > $total_posts)
	{
		$sql_limit = min($config['posts_per_page'], max(1, $total_posts - $start));
	}

	// Select the sort order
	$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC');
	$sql_start = max(0, $total_posts - $sql_limit - $start);
}
else
{
	// Select the sort order
	$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
	$sql_start = $start;
}

// Container for user details, only process once
$post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = array();
$has_attachments = $display_notice = false;
$bbcode_bitfield = '';
$i = $i_total = 0;

// Go ahead and pull all data for this topic
$sql = 'SELECT p.post_id
	FROM ' . POSTS_TABLE . ' p' . (($sort_by_sql[$sort_key][0] == 'u') ? ', ' . USERS_TABLE . ' u': '') . "
	WHERE p.topic_id = $topic_id
		" . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . "
		" . (($sort_by_sql[$sort_key][0] == 'u') ? 'AND u.user_id = p.poster_id': '') . "
		$limit_posts_time
	ORDER BY $sql_sort_order";
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);

$i = ($store_reverse) ? $sql_limit - 1 : 0;
while ($row = $db->sql_fetchrow($result))
{
	$post_list[$i] = $row['post_id'];
	($store_reverse) ? $i-- : $i++;
}
$db->sql_freeresult($result);

if (!sizeof($post_list))
{
	if ($sort_days)
	{
		trigger_error('NO_POSTS_TIME_FRAME');
	}
	else
	{
		trigger_error('NO_TOPIC');
	}
}

// Holding maximum post time for marking topic read
// We need to grab it because we do reverse ordering sometimes
$max_post_time = 0;

$sql = $db->sql_build_query('SELECT', array(
	'SELECT'	=> 'u.*, z.friend, z.foe, p.*',

	'FROM'		=> array(
		USERS_TABLE		=> 'u',
		POSTS_TABLE		=> 'p',
		FORUMS_TABLE	=> 'f',
		)
	),
//--[Points Modification]--
//-----------------Get config from Database-----------------
$sql = 'SELECT * FROM ' . POINTS_CONFIG_TABLE;
$result = $db->sql_query($sql);
$Points = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
//--[Points Modification]--

	'LEFT_JOIN'	=> array(
		array(
			'FROM'	=> array(ZEBRA_TABLE => 'z'),
			'ON'	=> 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id'
		)
	),
or is my mistake please ? :roll:
Thank you by advance for your helps ;)
mrgingles
Registered User
Posts: 96
Joined: Mon Jan 02, 2006 2:53 pm
Location: Ischia (Italy)
Contact:

Re: [BETA] Points System v.0.7.5

Post by mrgingles »

Any news for the next relase?
Visit my website! http://www.techcommunity.it
Adrian1
Registered User
Posts: 630
Joined: Tue Jul 15, 2008 11:21 am
Contact:

Re: [BETA] Points System v.0.7.5

Post by Adrian1 »

mrgingles wrote:Any news for the next relase?
I will release it on 10.12.2008.
RPG MOD for phpbb3
User avatar
darkonia
Registered User
Posts: 1901
Joined: Tue May 13, 2008 1:10 pm
Location: Munich, Germany
Contact:

Re: [BETA] Points System v.0.7.5

Post by darkonia »

nice date, thx :ugeek:
MMOG-Heaven - Das Gaming Portal
Community bedeutet Gleichgesinnte finden - MMOG-Heaven ist Deine Community! Von Spielern für Spieler bietet Dir dieses Portal genau das, was ein Spieler braucht. Bleibe ständig informiert, finde die neuesten MMORPGs, oder suche die frischesten News aus der Welt des Online Gamings - dieses und vieles mehr erwartet Dich auf MMOG-Heaven.
User avatar
Lisbon
Registered User
Posts: 825
Joined: Wed Jan 30, 2008 12:28 pm
Location: Zermatt

Re: [BETA] Points System v.0.7.5

Post by Lisbon »

Hi i have this error:
[phpBB Debug] PHP Notice: in file /points_install/install.php on line 171: Cannot modify header information - headers already sent by (output started at /points_install/install.php:1)
file:

Code: Select all

<?php
/**
*
* @package arcade
* @version $Id: v.3.0.0 install.php 341 2008-08-11 22:27:35Z doktorx $
* @copyright (c) 2008 http://www.support.forumspellen.nl
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);
require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx);

// Report all errors, except notices
error_reporting(E_ALL);
@set_time_limit(0);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

// is the user logged in?
// This might be looked at later if people have problems, but I guess only the founder
// should be using ftp and installing scripts anyway.
if ($user->data['user_type'] != USER_FOUNDER)
{
	trigger_error('You are not authorized to use this script.<br /><br />Please note to use the script the following requirements must be met.  First you must be logged in to the site and second you must have the user type founder. If you are logged in and are the founder then you have incorrect cookie settings in the acp. Please check the cookie domain setting. If your site url is <strong>http://www.example.com</strong> then the cookie domain should be <strong>.example.com</strong>.');
}

// Check to make sure version 3.0.1 of phpBB is installed
if (version_compare(str_replace('rc', 'RC', strtolower($config['version'])), '3.0.1', '<'))
{
	trigger_error('This version of phpBB Arcade is designed to run on phpBB 3.0.1 or higher.  Please upgrade your phpBB installation before running this version of the phpBB Arcade.');
}

require('./config.' . $phpEx);
$mode = request_var('mode', '');
$db->sql_return_on_error(true);

$install_mod = new install_mod();
$phpbb_db_tools = new phpbb_db_tools($db);
$install_mod->install_header($CFG['mod_title']);

switch ($mode)
{
	case 'uninstall':
		echo '<h1>' . $CFG['mod_title'] . ' Uninstallation</h1>';
		echo '<p>Table Prefix :: ' . $table_prefix . '<br />';
		echo 'Database Type :: ' . $db->sql_layer . '</p>';

		echo '<br /><h3>Removing mod database tables and data...</h3>';
		$install_mod->load_data($CFG['remove_data_file']);
		switch ($db->sql_layer)
		{
			default:
			break;
		}
		
		if (isset($CFG['remove_schema_changes']))
		{
			$phpbb_db_tools->perform_schema_changes($CFG['remove_schema_changes']);
                  $phpbb_db_tools->perform_schema_changes($CFG['remove_schema_changes_2']);
		}

		echo '<br /><h3>Removing mod permissions...</h3>';
		$install_mod->remove_permissions($CFG['permission_options']);

		echo '<br /><h3>Removing mod modules and clearing module cache...</h3>';
		$install_mod->remove_modules($CFG['parent_module_remove'], $CFG['module_remove']);

		echo '<br /><h3>Clearing permission cache...</h3>';
		$install_mod->clear_permission_cache();

		if ($CFG['clear_cache_uninstall'])
		{
			echo '<br /><h3>Clearing cache...</h3>';
			$install_mod->clear_cache();
		}

		echo '<br /><h3>' . $CFG['mod_title'] . ' has been uninstalled</h3><br />';
		echo '<h3>Remove ' . $CFG['mod_dir'] . ' directory from your server</h3>';

		$install_mod->install_footer();
	break;

	case 'install':
		echo '<h1>' . $CFG['mod_title'] . ' Installation</h1>';
		echo '<p>Table Prefix :: ' . $table_prefix . '<br />';
		echo 'Database Type :: ' . $db->sql_layer . '</p>';

		echo '<br /><h3>Creating mod database tables...</h3>';
		$install_mod->load_tables();

		echo '<br /><h3>Inserting mod data...</h3>';
		// Ok tables have been built, let's fill in the basic information
		$install_mod->load_data($CFG['data_file']);
		if (isset($CFG['schema_changes']))
		{
			$phpbb_db_tools->perform_schema_changes($CFG['schema_changes']);
		}

		echo '<br /><h3>Inserting mod permissions and clearing permission cache...</h3>';
		// Add permissions
		$install_mod->add_permissions($CFG['permission_options']);

		echo '<br /><h3>Inserting mod modules and clearing module cache...</h3>';
		// Create Mod Modules...
		foreach($CFG['mod_modules'] as $modules)
		{
			$install_mod->create_modules($modules['parent_module_data'], $modules['module_data']);
		}

		if ($CFG['clear_cache_install'])
		{
			echo '<br /><h3>Clearing cache...</h3>';
			$install_mod->clear_cache();
		}

		echo '<br /><h3> ' . $CFG['mod_title'] . ' has been installed</h3><br />';
		echo '<h3>Remove ' . $CFG['mod_dir'] . ' directory from your server</h3><br />';

		$install_mod->install_footer();
	break;

	default:
		$install_mod->install_form();
		$install_mod->install_footer();
	break;
}

$db->sql_return_on_error(false);

if (function_exists('exit_handler'))
{
	exit_handler();
}

/*
* Mod install class
*/
class install_mod
{
	function install_mod()
	{
		global $phpbb_root_path, $phpEx, $user, $table_prefix;

		require($phpbb_root_path . 'includes/functions_module.' . $phpEx);
		require($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx);
		require($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
		require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
		require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);

		$user->add_lang('acp/modules');

		$module_info = new p_master();
		$module_info->add_mod_info('acp');
	}

	function install_header($title, $dir = '', $lang = '')
	{
		global $phpbb_root_path;

	header('Content-type: text/html; charset=UTF-8');
	echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" dir="' . $dir . '" lang="' . $lang . '" xml:lang="' . $lang . '">
	<head>

	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<meta http-equiv="content-language" content="' . $lang . '" />
	<meta http-equiv="content-style-type" content="text/css" />
	<meta http-equiv="imagetoolbar" content="no" />

	<style type="text/css" media="screen">
		blockquote {
			background: #ebebeb none 6px 8px no-repeat;
			border: 1px solid #dbdbdb;
			font-size: 0.95em;
			margin: 0.5em 1px 0 25px;
			overflow: hidden;
			padding: 5px;
			background-color: #EBEADD;
			border-color:#DBDBCE;
		}
	</style>

	<title>' . $title . '</title>

	<link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />

	<script type="text/javascript">
	<!--
	function togglemenu(id)
	{
		if (document.getElementById(id))
		{
			if (document.getElementById(id).style.display == \'none\')
			{
				document.getElementById(id).style.display = \'inline\';
			}
			else
			{
				document.getElementById(id).style.display = \'none\';
			}
		}
	}
	-->
	</script>

	</head>

	<body>
	<div id="wrap">
		<div id="page-header">
		<h1>Installation Panel</h1>
		</div>

		<div id="page-body">
			<div id="acp">
			<div class="panel">
				<span class="corners-top"><span></span></span>
					<div id="content">
						<div id="main">';

	}

	function install_form()
	{
		global $CFG, $db, $table_prefix;

		$tables = get_tables($db);
		$installed_version = $install_option = $uninstall_option = '';
		if (in_array($table_prefix . 'config', $tables))
		{
			$sql = 'SELECT config_value
				FROM ' . $table_prefix . "config
				WHERE config_name = 'points_version'";
			$result = $db->sql_query($sql);
			$installed_version = (string) $db->sql_fetchfield('config_value');
			$db->sql_freeresult($result);
		}
		unset($tables);

		if ($installed_version != '')
		{
			if (version_compare($this->format_version($installed_version), $this->format_version($CFG['mod_version']), '<'))
			{
				$update_option = '<option value="">---- Update Options ----</option>
					<option value="update">Update to latest version of ' . $CFG['mod_title'] . '</option>';
			}
			else
			{
				$uninstall_option = '<option value="">---- Uninstall Options ----</option>
					<option value="uninstall">Uninstall ' . $CFG['mod_title'] . '</option>';
			}
		}
		else
		{
			$install_option = '<option value="">---- Install Options ----</option>
				<option value="install">First Time Install of ' . $CFG['mod_title'] . ' ' . $CFG['mod_version'] . '</option>';
		}

		echo '<h1>' . $CFG['mod_title'] . ' Installation Options</h1>';
		echo '<p>Table Prefix :: ' . $table_prefix . '<br />';
		echo 'Database Type :: ' . $db->sql_layer . '</p>';

		echo '	<form action="' . $_SERVER['PHP_SELF'] . '" method="post">
				<p>This script will install or uninstall the tables for the ' . $CFG['mod_title'] . '.
				<br />To check the installation please click <a href="./install_check.php">here</a>.</p>
				<p><b>Backup data tables before going on!</b></p>
				<p><select name="mode">
					' . $install_option . '
					' . $uninstall_option . '
					</select></p>
				<p><input type="submit" value="Submit" class="button2"></p>
				<p><b>Once you have finished with this script, delete it from your server!</b></p>
			</form>';
	}

	function install_footer()
	{
		global $CFG;

						echo '<p>Click <a href="./../index.php">here</a> to return to the board index.</p></div>
					</div>
				<span class="corners-bottom"><span></span></span>
			</div>
			</div>
		</div>

		<div id="page-footer">
			' . $CFG['mod_copyright'] . '
			Powered by phpBB &copy; 2000, 2002, 2005, 2007 <a href="http:// www.phpbb.com/">phpBB Group</a>

		</div>
	</div>

	</body>
	</html>';

		garbage_collection();
	}

	function clear_cache()
	{
		global $cache;

		$cache->purge();
	}

	function clear_permission_cache()
	{
		global $cache, $table_prefix, $phpbb_root_path, $phpEx;

		$auth_admin = new auth_admin();
		$cache->destroy('_acl_options');
		$auth_admin->acl_clear_prefetch();

	}

	function add_permissions($options)
	{
		global $cache;

		$auth_admin = new auth_admin();
		$auth_admin->acl_add_option($options);
	}


	function remove_permissions($options)
	{
		global $db, $cache;

		$auth_option_id = array();
		if (!empty($options['local']))
		{
			foreach($options['local'] as $local)
			{
				$sql = 'SELECT auth_option_id
					FROM ' . ACL_OPTIONS_TABLE . "
				WHERE auth_option = '" . $db->sql_escape($local) . "'";

				$result = $db->sql_query($sql);
				while ($row = $db->sql_fetchrow($result))
				{
					$auth_option_id[] = $row['auth_option_id'];
				}
				$db->sql_freeresult($result);
			}
		}

		if (!empty($options['global']))
		{
			foreach($options['global'] as $global)
			{
				$sql = 'SELECT auth_option_id
					FROM ' . ACL_OPTIONS_TABLE . "
				WHERE auth_option = '" . $db->sql_escape($global) . "'";

				$result = $db->sql_query($sql);
				while ($row = $db->sql_fetchrow($result))
				{
					$auth_option_id[] = $row['auth_option_id'];
				}
				$db->sql_freeresult($result);
			}
		}

		// We now have a list of ids we need to remove from the auth tables...
		if (!empty($auth_option_id))
		{
			$tables = array(ACL_OPTIONS_TABLE, ACL_GROUPS_TABLE, ACL_USERS_TABLE, ACL_ROLES_DATA_TABLE);

			foreach ($tables as $table)
			{
				$sql = "DELETE FROM $table
					WHERE " . $db->sql_in_set('auth_option_id', array_map('intval', $auth_option_id));
				$db->sql_query($sql);
			}

			$auth_admin = new auth_admin();
			$cache->destroy('_acl_options');
			$auth_admin->acl_clear_prefetch();
		}
	}



	function db_error($error, $sql, $line, $file)
	{
		global $db;

		echo '<p style="color: red;">' . basename($file) . ' [ ' . $line . ' ]</p><p style="color: red;">SQL : <textarea style="font-family:\'Courier New\',monospace;width:99%" rows="5" cols="10">' . preg_replace('/\t(AND|OR)(\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n", $sql))) . '</textarea></p><p style="color: red;"><b>' . $error . '</b></p>';
		// Rollback if in transaction
		if ($db->transaction)
		{
			$db->sql_transaction('rollback');
		}
	}

	function create_modules($parent_module_data, $module_data)
	{
		global $phpbb_root_path, $phpEx, $db;
		$_module = &new acp_modules();
		$_module->module_class = $parent_module_data['module_class'];

		$db->sql_error_triggered = false;

		// If the module class is acp we add it to the MODS tab in the ACP
		if ($parent_module_data['module_class'] == 'acp')
		{
			$sql = 'SELECT module_id
				FROM ' . MODULES_TABLE . "
				WHERE module_langname = 'ACP_CAT_DOT_MODS'";
			$result = $db->sql_query($sql);
			$row = $db->sql_fetchrow($result);
			$db->sql_freeresult($result);

			// Create .MODS tab if missing and get id again
			if(!$row)
			{
				$dot_mods = array(
					'module_basename' 	=> '',
					'module_enabled'	=> '1',
					'module_display' 	=> '1',
					'parent_id' 		=> '0',
					'module_class' 		=> 'acp',
					'module_langname' 	=> 'ACP_CAT_DOT_MODS',
					'module_mode' 		=> '',
					'module_auth' 		=> '',
				);

				$_module->update_module_data($dot_mods, true);

				$sql = 'SELECT module_id
					FROM ' . MODULES_TABLE . "
					WHERE module_langname = 'ACP_CAT_DOT_MODS'";
				$result = $db->sql_query($sql);
				$row = $db->sql_fetchrow($result);
				$db->sql_freeresult($result);
			}

			$parent_module_data['parent_id'] = $row['module_id'];
		}

		// Add category
		$_module->update_module_data($parent_module_data, true);
		$_module->remove_cache_file();

		// Check for last sql error happened
		if ($db->sql_error_triggered)
		{
			$db->sql_error_triggered = false;
			$error = $db->sql_error($db->sql_error_sql);
			$this->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
		}
		else
		{
			add_log('admin', 'LOG_MODULE_ADD', $_module->lang_name($parent_module_data['module_langname']));
		}

		$sql = 'SELECT module_id
			FROM ' . MODULES_TABLE . "
			WHERE module_langname = '{$parent_module_data['module_langname']}'
				AND module_class = '{$parent_module_data['module_class']}'";
		$result = $db->sql_query($sql);
		$row = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

		for ($i = 0, $count = sizeof($module_data);$i < $count; $i++)
		{
			$module_data[$i]['parent_id'] = $row['module_id'];
			$_module->update_module_data($module_data[$i], true);
			$_module->remove_cache_file();

			// Check for last sql error happened
			if ($db->sql_error_triggered)
			{
				$db->sql_error_triggered = false;
				$error = $db->sql_error($db->sql_error_sql);
				$this->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
			}
			else
			{
				add_log('admin', 'LOG_MODULE_ADD', $_module->lang_name($module_data[$i]['module_langname']));
			}
		}

		return;
	}

	function update_modules($parent_module_langname, $parent_module_class, $module_data)
	{
		global $phpbb_root_path, $phpEx, $db;
		$_module = &new acp_modules();
		$_module->module_class = $parent_module_class;

		$db->sql_error_triggered = false;

		$sql = 'SELECT module_id
			FROM ' . MODULES_TABLE . "
			WHERE module_langname = '$parent_module_langname'
				AND module_class = '$parent_module_class'";
		$result = $db->sql_query($sql);
		$row = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

		for ($i = 0, $count = sizeof($module_data);$i < $count; $i++)
		{
			$module_data[$i]['parent_id'] = $row['module_id'];
			$_module->update_module_data($module_data[$i], true);
			$_module->remove_cache_file();

			// Check for last sql error happened
			if ($db->sql_error_triggered)
			{
				$db->sql_error_triggered = false;
				$error = $db->sql_error($db->sql_error_sql);
				$this->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
			}
			else
			{
				add_log('admin', 'LOG_MODULE_ADD', $_module->lang_name($module_data[$i]['module_langname']));
			}
		}

		return;
	}

	function remove_modules($parent_module_data, $module_data)
	{
		global $db;
		$_module = &new acp_modules();

		$db->sql_error_triggered = false;

		if (!empty($module_data))
		{
			$sql = 'SELECT module_id, module_class
				FROM ' . MODULES_TABLE . '
				WHERE ' . $db->sql_in_set('module_basename', $module_data);
			$result = $db->sql_query($sql);
			while ($row = $db->sql_fetchrow($result))
			{
				$_module->module_class = $row['module_class'];
				$_module->delete_module($row['module_id']);
				// Check for last sql error happened
				if ($db->sql_error_triggered)
				{
					$db->sql_error_triggered = false;
					$error = $db->sql_error($db->sql_error_sql);
					$this->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
				}
			}
			$db->sql_freeresult($result);
		}

		if (!empty($parent_module_data))
		{
			// Needs to be ordered descending so that we can remove the parent module (tab) last
			$sql = 'SELECT module_id, module_class
				FROM ' . MODULES_TABLE . '
				WHERE ' . $db->sql_in_set('module_langname', $parent_module_data) . '
				ORDER BY module_id DESC';
			$result = $db->sql_query($sql);
			while ($row = $db->sql_fetchrow($result))
			{
				$_module->module_class = $row['module_class'];
				$_module->delete_module($row['module_id']);
				// Check for last sql error happened
				if ($db->sql_error_triggered)
				{
					$db->sql_error_triggered = false;
					$error = $db->sql_error($db->sql_error_sql);
					$this->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
				}
			}
			$db->sql_freeresult($result);
		}

		return;
	}

    function load_tables($prefix = '')
    {
        global $db, $dbms, $table_prefix;

        $available_dbms = get_available_dbms($dbms);
        // If mysql is chosen, we need to adjust the schema filename slightly to reflect the correct version. ;)
        if ($dbms == 'mysql')
        {
            if (version_compare((isset($db->mysql_version)) ? $db->mysql_version : $db->sql_server_info(true), '4.1.3', '>='))
            {
                $available_dbms[$dbms]['SCHEMA'] .= '_41';
            }
            else
            {
                $available_dbms[$dbms]['SCHEMA'] .= '_40';
            }
        }
		// Ok we have the db info go ahead and read in the relevant schema
		// and work on building the table
		$dbms_schema = 'schemas/' . $prefix . $available_dbms[$dbms]['SCHEMA'] . '_schema.sql';

		// How should we treat this schema?
		$remove_remarks = $available_dbms[$dbms]['COMMENTS'];
		$delimiter = $available_dbms[$dbms]['DELIM'];

		$sql_query = @file_get_contents($dbms_schema);

		$sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query);

		$remove_remarks($sql_query);

		$sql_query = split_sql_file($sql_query, $delimiter);

		echo '<blockquote>';
		echo '	<div style="cursor:pointer;cursor:hand;" onclick="if (this.getElementsByTagName(\'div\')[0].style.display != \'block\') { this.getElementsByTagName(\'div\')[0].style.display = \'block\';} else { this.getElementsByTagName(\'div\')[0].style.display = \'none\'; }">';
		echo '		<cite>Results: (click to show/hide)</cite>';
		echo '		<div style="display: none;"><br />';
		foreach ($sql_query as $sql)
		{
			// $sql = trim(str_replace('|', ';', $sql));
			if (!$db->sql_query($sql))
			{
				$error = $db->sql_error();
				$this->db_error($error['message'], $sql, __LINE__, __FILE__);
			}
			else
			{
				echo '<p style="color: green;"><textarea style="font-family:\'Courier New\',monospace;width:99%" rows="5" cols="10">' . preg_replace('/\t(AND|OR)(\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n", $sql))) . '</textarea></p>';
			}
		}
		echo '		</div>';
		echo '	</div>';
		echo '</blockquote>';
		unset($sql_query);
	}

	function load_data($file)
	{
		global $db, $dbms, $table_prefix;

		// Ok tables have been built, let's fill in the basic information
		$sql_query = file_get_contents($file);

		// Deal with any special comments
		switch ($dbms)
		{
			case 'mssql':
			case 'mssql_odbc':
				$sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query);
			break;
		}

		// Change prefix
		$sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query);

		// Change language strings...
		$sql_query = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', 'adjust_language_keys_callback', $sql_query);

		// Since there is only one schema file we know the comment style and are able to remove it directly with remove_remarks
		remove_remarks($sql_query);
		$sql_query = split_sql_file($sql_query, ';');

		echo '<blockquote>';
		echo '	<div style="cursor:pointer;cursor:hand;" onclick="if (this.getElementsByTagName(\'div\')[0].style.display != \'block\') { this.getElementsByTagName(\'div\')[0].style.display = \'block\';} else { this.getElementsByTagName(\'div\')[0].style.display = \'none\'; }">';
		echo '		<cite>Results: (click to show/hide)</cite>';
		echo '		<div style="display: none;"><br />';
		foreach ($sql_query as $sql)
		{
			// $sql = trim(str_replace('|', ';', $sql));
			if (!$db->sql_query($sql))
			{
				$error = $db->sql_error();
				$this->db_error($error['message'], $sql, __LINE__, __FILE__);
			}
			else
			{
				echo '<p style="color: green;"><textarea style="font-family:\'Courier New\',monospace;width:99%" rows="5" cols="10">' . preg_replace('/\t(AND|OR)(\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n", $sql))) . '</textarea></p>';
			}
		}
		echo '		</div>';
		echo '	</div>';
		echo '</blockquote>';
		unset($sql_query);
	}

	function format_version($version)
	{
		return str_replace(' ', '.', $version);
	}

	/**
	* Set config value. Creates missing config entry.
	*/
	function set_config($config_name, $config_value)
	{
		global $db, $cache;

		$sql = 'UPDATE ' . CONFIG_TABLE . "
			SET config_value = '" . $db->sql_escape($config_value) . "'
			WHERE config_name = '" . $db->sql_escape($config_name) . "'";
		$db->sql_query($sql);

		if (!$db->sql_affectedrows() && !isset($this->config[$config_name]))
		{
			$sql = 'INSERT INTO ' . CONFIG_TABLE . ' ' . $db->sql_build_array('INSERT', array(
				'config_name'	=> $config_name,
				'config_value'	=> $config_value));
			$db->sql_query($sql);
		}

		$this->config[$config_name] = $config_value;

		// Destroy the cache of the config
		// because the values have changed
		$cache->destroy('_arcade');
	}
}

?>
Tks for help
sotis
Registered User
Posts: 294
Joined: Tue Oct 17, 2006 4:56 pm
Location: Bulgaria
Contact:

Re: [BETA] Points System v.0.7.5

Post by sotis »

After changing the points name in non-english characters (точки) and submitting, the name appears like question marks: ??????????????
Locked

Return to “[3.0.x] MODs in Development”