MyBB Community Forums

Full Version: JM - IRC php errror
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I upload in my serve: http://mods.mybb.com/view/jm-irc

But, if I opened the ACP and I open "Plugins" an error message appear.

This:

http://yugiohspirits.altervista.org/inc/...s/chat.php

Fatal error: require_once() [function.require]: Failed opening required './global.php' (include_path='.:') in /membri/yugiohspirits/inc/plugins/chat.php on line 30


The line 30 of "chat.php" file is:

require_once './global.php';

The complete code of chat.php is:

<?php
/**
 *  JM-IRC - Jordan Mussi
 *    Add a IRC chat page to your forum.
 *  ./chat.php
 *
 * @package    JM-IRC
 * @author     Jordan Mussi <http://jordanmussi.github.io>
 * @version    1
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl-3.0.txt>
 *
 *  Copyright (C) 2014 Jordan Mussi
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

define('IN_MYBB', 1);

require_once './global.php';

if(empty($mybb->settings['jm_irc_page_action']))
{
	header('Location: misc.php?action=chat');
}
else
{
	header('Location: misc.php?action='.$mybb->settings['jm_irc_page_action']);
}


How resolve this bug? D:
recheck the locations of the plugin files
that chat.php file should be at the root folder of your MyBB files server (where global.php file exists)
Ok, resolve.

Why the page is void D: -> http://yugiohspirits.altervista.org/misc...ction=chat ???

Do you want a test's account?

Up Up Up
^ do you have jm_irc.php file in the plugins folder and is the plugin activated & configured ?
Yes, the jm_irc.php file is in the plugins folder and is this:

<?php
/**
 *  JM-IRC - Jordan Mussi
 *    Add a IRC chat page to your forum.
 *  ./inc/plugins/jm_irc.php
 *
 * @package    JM-IRC
 * @author     Jordan Mussi <http://jordanmussi.github.io>
 * @version    1
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl-3.0.txt>
 *
 *  Copyright (C) 2014 Jordan Mussi
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

if(defined("IN_ADMINCP")) // Only run backend stuff when we're in the backend
{
	$plugins->add_hook("admin_config_plugins_activate_commit", "jm_irc_catch_activate");
	$plugins->add_hook("admin_page_output_footer", "jm_irc_load_peekers");

	function jm_irc_info()
	{
		global $lang;

		if(!$lang->jm_irc)
		{
			$lang->load('jm_irc');
		}

		return array(
			'name'			=> $lang->jm_irc,
			'description'	=> '<div style="'.jm_irc_icon().'background-repeat: no-repeat;padding-left: 40px;margin-top: 10px;">'.$lang->jm_irc_desc.jm_irc_desc_extra().'</div>',
			'website'		=> 'https://github.com/JordanMussi/jm_irc',
			'author'		=> 'Jordan Mussi',
			'authorsite'	=> 'http://jordanmussi.github.io',
			'guid'          => 'b08a021d5c0dc2c2e886d985c00ccdca',
			'version'		=> '2.0',
			'compatibility' => '16*'
		);
	}

	function jm_irc_icon()
	{
		return 'background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAaCAYAAADWm14/AAADF0lEQVRIS72X209TMRzHewZjbjjmMtyD+qDiBQf/hhr1dYnPaqKRZ/UPMCYmhAcTExY16oPxwYTExMQLIxpjCCBBFGHj4sASQG7CYIMNmOx42p7fTtd2Mgyjy9L19PL99Ntf2zMNCelMy0AzQtp18fnOl/VQOFjfoPEDg/iFwKGd1xNGfB2dNJ7oIQEgop8/dbDk4iDwZnAKSQDnag/sGsDboV8M4EbrQLOmlWbdXS4X8ng8ykm9G55GGog3ng6UZOa32qKIQFRVVUnjt47MIO1mOKKD+MpqijYy3FDmhQh1XadVYg7tb3dg5Pf7pe5tsTkLILFiiRMAEWIre3hx8hvKpN+dToyqq/dLQ7wfm7cA4skUFRW/vCPFOADiPMTdLox8Pp/U/cPPBQtgIZkuCQABafyMkdfrlQA+jsctgLlEGtlsth11IJvNksBATd1YuRM+TSxbADPLayT6KACAFGM/TEu0nsaA8SUQ93owcrvdkgPtU0kLYGppjc2ec0G1I/jg4keU1t4MRAJw/wtGlZWVEkDH9KoFMB43AcgW5ILxYSxJO147zvbxgx8JZfnqMTeNfJg5yYk4yUO9GDmdTgmga9aIOzgHYr/zYwAgnowxgCs1DODxKAO4fJRZCvWXjuyllquW4tE3jBwOhwTQPb9uAQzOpZBNk4OwxltOO44ubdK8Zl8ZK8f/sLJZH1vMyOKIHVBP+zCy2+0SQM9CxgLonzXOAfIRzgKpl+KB6hAyvMi1fPYdo7IyBs6n3vimBdA3w05Car0Jwop5F2auvxiM1HoQNY9maPy8H1N3xfR1OWtdRhfrDufVU+EC4hxFQSCoeBHBShP7aCiZLySFruNggEERGDLDlqh6MKWC+VC8F/pXwAnFKxk/EOyOzkm2NC8HMYEINZ2tb/iXIKmDV7s6FwtUPkVS5SgcrMutq3qBjR4A0D6RQq+GihcHMYAIODN5ANG0fXsA5IWi2JmLswWIWsdGrmpovaI4AIiL/xUXnThZYdw1Rhre2FMcwFbrvJ16cOKEPY1GMs7dB+ADk2w98ocEJvAXE6wNUbonuqkAAAAASUVORK5CYII=);';
	}

	function jm_irc_desc_extra()
	{
		global $plugins_cache, $lang;

		if(is_array($plugins_cache) && is_array($plugins_cache['active']) && $plugins_cache['active']['jm_irc'])
		{
			return "&nbsp;&nbsp;&mdash;&nbsp;<a href=\"index.php?module=config-settings&action=change&search=JM-IRC\" style=\"font-style: italic;\">{$lang->jm_irc_manage_settings}</a>";
		}
	}

	function jm_irc_is_installed()
	{
		global $db;

		if($db->num_rows($db->simple_select('settinggroups', 'gid', 'name =  \'jm_irc\'')) > 0)
		{
			return true;
		}
		return false;
	}

	function jm_irc_install()
	{
		global $db, $mybb, $lang;

		if(!$lang->jm_irc)
		{
			$lang->load('admin/jm_irc');
		}

		$query = $db->simple_select('settinggroups', 'COUNT(disporder) as disporder');
		$disporder = $db->fetch_field($query, 'disporder');

		$setting_group = array(
			'name'        => 'jm_irc',
			'title'       => $lang->jm_irc_setting_group,
			'description' => $lang->jm_irc_setting_group_desc,
			'disporder'   => $disporder+1,
			'isdefault'   => 0,
		);

		$db->insert_query('settinggroups', $setting_group);
		$gid = (int) $db->insert_id();

		$settings = array(
			array(
				'name'        => 'jm_irc_page_title',
				'title'       => $lang->jm_irc_setting_page_title,
				'description' => $lang->sprintf($lang->jm_irc_setting_page_title_desc, $lang->sprintf($lang->jm_irc_default, $mybb->settings['bbname'].' IRC Channel')),
				'optionscode' => 'text',
				'value'       => $mybb->settings['bbname'].' IRC Channel',
			),
			array(
				'name'        => 'jm_irc_wol',
				'title'       => $lang->jm_irc_setting_wol,
				'description' => $lang->sprintf($lang->jm_irc_setting_wol_desc, $lang->sprintf($lang->jm_irc_default, $mybb->settings['bbname'].' IRC Channel')),
				'optionscode' => 'text',
				'value'       => $mybb->settings['bbname'].' IRC Channel',
			),
			array(
				'name'        => 'jm_irc_server',
				'title'       => $lang->jm_irc_setting_server,
				'description' => $lang->sprintf($lang->jm_irc_setting_server_desc, $lang->sprintf($lang->jm_irc_default, 'irc.icyboards.com')),
				'optionscode' => 'text',
				'value'       => 'irc.icyboards.com',
			),
			array(
				'name'        => 'jm_irc_channels',
				'title'       => $lang->jm_irc_setting_channels,
				'description' => $lang->sprintf($lang->jm_irc_setting_channels_desc, $lang->sprintf($lang->jm_irc_default, '#icynetwork')),
				'optionscode' => 'text',
				'value'       => '#icynetwork',
			),
			array(
				'name'        => 'jm_irc_client',
				'title'       => $lang->jm_irc_setting_client,
				'description' => $lang->sprintf($lang->jm_irc_setting_client_desc, $lang->sprintf($lang->jm_irc_default, 'KiwiIRC')),
				'optionscode' => 'select
kiwiirc=KiwiIRC
mibbit=Mibbit',
				'value'       => 0,
			),
			array(
				'name'        => 'jm_irc_kiwiirc_theme',
				'title'       => $lang->jm_irc_setting_kiwiirc_theme,
				'description' => $lang->sprintf($lang->jm_irc_setting_kiwiirc_theme_desc, $lang->sprintf($lang->jm_irc_default, 'Relaxed')),
				'optionscode' => 'select
relaxed=Relaxed
basic=Basic
cli=CLI (Dark)
mini=Mini (Small)',
				'value'       => 'relaxed',
			),
			array(
				'name'        => 'jm_irc_mibbit_hash',
				'title'       => $lang->jm_irc_setting_mibbit_hash,
				'description' => $lang->jm_irc_setting_mibbit_hash_desc,
				'optionscode' => 'text',
				'value'       => '',
			),
			array(
				'name'        => 'jm_irc_mibbit_prompt',
				'title'       => $lang->jm_irc_setting_mibbit_prompt,
				'description' => $lang->sprintf($lang->jm_irc_setting_mibbit_prompt_desc, $lang->sprintf($lang->jm_irc_default, 'Welcome to the IRC Channel')),
				'optionscode' => 'text',
				'value'       => 'Welcome to the IRC Channel',
			),
			array(
				'name'        => 'jm_irc_default_nick_users',
				'title'       => $lang->jm_irc_setting_default_nick_users,
				'description' => $lang->sprintf($lang->jm_irc_setting_default_nick_users_desc, $lang->sprintf($lang->jm_irc_default, 'No')),
				'optionscode' => 'yesno',
				'value'       => 0,
			),
			array(
				'name'        => 'jm_irc_default_nick',
				'title'       => $lang->jm_irc_setting_default_nick,
				'description' => $lang->sprintf($lang->jm_irc_setting_default_nick_desc, $lang->sprintf($lang->jm_irc_default, 'icyboards???')),
				'optionscode' => 'text',
				'value'       => 'icyboards???',
			),
			array(
				'name'        => 'jm_irc_height',
				'title'       => $lang->jm_irc_setting_height,
				'description' => $lang->sprintf($lang->jm_irc_setting_height_desc, $lang->sprintf($lang->jm_irc_default, '500px')),
				'optionscode' => 'text',
				'value'       => '500px',
			),
			array(
				'name'        => 'jm_irc_width',
				'title'       => $lang->jm_irc_setting_width,
				'description' => $lang->sprintf($lang->jm_irc_setting_width_desc, $lang->sprintf($lang->jm_irc_default, '100%')),
				'optionscode' => 'text',
				'value'       => '100%',
			),
			array(
				'name'        => 'jm_irc_page_action',
				'title'       => $lang->jm_irc_setting_page_action,
				'description' => $lang->sprintf($lang->jm_irc_setting_page_action_desc, $lang->sprintf($lang->jm_irc_default, 'chat'), 'chat'),
				'optionscode' => 'text',
				'value'       => 'chat',
			),
		);

		$i = 1;
		$insert_settings = array();
		foreach($settings as $setting)
		{
			$insert_settings[] = array(
				'name'        => $db->escape_string($setting['name']),
				'title'       => $db->escape_string($setting['title']),
				'description' => $db->escape_string($setting['description']),
				'optionscode' => $db->escape_string($setting['optionscode']),
				'value'       => $db->escape_string($setting['value']),
				'disporder'   => $i++,
				'gid'         => $gid,
			);
		}

		$db->insert_query_multiple('settings', $insert_settings);

		rebuild_settings();

		$template = array(
			'sid' => -1,
			'title' => 'jm_irc',
			'template' => $db->escape_string(file_get_contents(MYBB_ROOT.'inc/plugins/jm_irc/jm_irc.html'))
		);

		$db->insert_query('templates', $template);
	}

	function jm_irc_uninstall()
	{
		global $db, $cache;

		$gid = (int) $db->fetch_field($db->simple_select('settinggroups', 'gid', 'name =  \'jm_irc\''), 'gid');
		$db->delete_query('settinggroups', 'gid = \''.$gid.'\'');
		$db->delete_query('settings', 'gid = \''.$gid.'\'');
		$db->delete_query('templates', 'title = \'jm_irc\'');
	}

	function jm_irc_activate()
	{
		if(!function_exists('find_replace_templatesets'))
		{
			require_once MYBB_ROOT.'inc/adminfunctions_templates.php';
		}

		find_replace_templatesets(
			'header',
			'#'.preg_quote('{$lang->toplinks_help}</a></li>').'#',
			'{$lang->toplinks_help}</a></li>
					<li><a href="{$mybb->settings[\'bburl\']}/misc.php?action={$mybb->settings[\'jm_irc_page_action\']}"><img src="{$theme[\'imgdir\']}/toplinks/chat.gif" alt="" title="" />{$lang->jm_irc_toplink}</a></li>'
		);
	}

	function jm_irc_deactivate()
	{
		if(!function_exists('find_replace_templatesets'))
		{
			require_once MYBB_ROOT.'inc/adminfunctions_templates.php';
		}

		find_replace_templatesets(
			'header',
			'#'.preg_quote('
					<li><a href="{$mybb->settings[\'bburl\']}/misc.php?action={$mybb->settings[\'jm_irc_page_action\']}"><img src="{$theme[\'imgdir\']}/toplinks/chat.gif" alt="" title="" />{$lang->jm_irc_toplink}</a></li>').'#',
			''
		);
	}

	function jm_irc_catch_activate()
	{
		global $mybb;

		if($mybb->input['plugin'] != 'jm_irc')
		{
			return;
		}

		global $message;

		flash_message($message, 'success');
		admin_redirect("index.php?module=config-settings&action=change&search=JM-IRC");
	}

	// The arival of 1.8 will improve the handling of setting peekers...
	function jm_irc_load_peekers()
	{
		echo '			<script type="text/javascript">
					Event.observe(window, "load", function() {
						loadJMIRCPeekers();
					});
					function loadJMIRCPeekers()
					{
						new Peeker($("setting_jm_irc_client"), $("row_setting_jm_irc_kiwiirc_theme"), /kiwiirc/, false);
						new Peeker($("setting_jm_irc_client"), $("row_setting_jm_irc_mibbit_hash"), /mibbit/, false);
						new Peeker($("setting_jm_irc_client"), $("row_setting_jm_irc_mibbit_prompt"), /mibbit/, false);
					}
				</script>';
	}
}
else // Only run frontend stuff when we're in the frontend
{
	$plugins->add_hook('global_start', 'jm_irc_global');
	$plugins->add_hook('misc_start', 'jm_irc_run');
	$plugins->add_hook('fetch_wol_activity_end', 'jm_irc_fetch_wol');
	$plugins->add_hook('build_friendly_wol_location_end', 'jm_irc_build_wol');

	function jm_irc_global()
	{
		global $lang, $mybb;
		if(!$lang->jm_irc)
		{
			$lang->load('admin/jm_irc');
		}
		if(THIS_SCRIPT == 'misc.php' && $mybb->input['action'] == $mybb->settings['jm_irc_page_action'])
		{
			global $templatelist;
			$templatelist .= ',jm_irc';
		}
	}

	function jm_irc_run()
	{
		global $mybb;
		if($mybb->input['action'] != $mybb->settings['jm_irc_page_action'])
		{
			return;
		}

		// Let's make sure everything is configured correctly
		if(empty($mybb->settings['jm_irc_server'])
		|| empty($mybb->settings['jm_irc_channels'])
		|| empty($mybb->settings['jm_irc_default_nick'])
		|| empty($mybb->settings['jm_irc_wol'])
		|| empty($mybb->settings['jm_irc_page_title'])
		) {
			// Uh-oh, better send an error :(
			global $lang;
			if(!$lang->jm_irc)
			{
				$lang->load('admin/jm_irc');
			}

			error($lang->jm_irc_error_not_configured);
		}

		// Now we can globalise the world for we'll need it...
		global $templates, $jm_irc, $url, $headerinclude, $header, $footer;

		add_breadcrumb($mybb->settings['jm_irc_page_title'], 'misc.php?action='.$mybb->settings['jm_irc_page_action']);

		if($mybb->settings['jm_irc_default_nick_users'] == 0 && $mybb->user['uid'] > 0)
		{
			$nick = urlencode($mybb->user['username']);
		}
		else
		{
			$nick = urlencode(str_replace('?', rand(0, 9), $mybb->settings['jm_irc_default_nick']));
		}

		if($mybb->settings['jm_irc_client'] == 'mibbit')
		{
			// We have Mibbit
			$url = 'http://widget.mibbit.com/?';
			$url .= 'server='.urlencode($mybb->settings['jm_irc_server']).'&';
			$url .= 'channel='.urlencode($mybb->settings['jm_irc_channels']).'&';
			$url .= 'nick='.$nick.'&';
			if(!empty($mybb->settings['jm_irc_hash']))
			{
				$url .= 'settings='.urlencode($mybb->settings['jm_irc_hash']).'&';
			}
			if(!empty($mybb->settings['jm_irc_mibbit_prompt']))
			{
				$url .= 'customprompt='.str_replace('%2520', '%20', urlencode(str_replace(' ', '%20', $mybb->settings['jm_irc_mibbit_prompt'])));
			}
			if(substr($url, -1) == '&')
			{
				$url = substr($url, 0, -1);
			}
		}
		else
		{
			// We have KiwiIRC
			$url = 'https://kiwiirc.com/client/';
			$url .= urlencode($mybb->settings['jm_irc_server']).'/';
			$url .= '?nick='.$nick;
			$url .= '&theme='.urlencode($mybb->settings['jm_irc_kiwiirc_theme']);
			$url .= str_replace('%23', '#', urlencode($mybb->settings['jm_irc_channels']));
		}

		eval("\$jm_irc = \"".$templates->get("jm_irc")."\";");

		output_page($jm_irc);
	}

	function jm_irc_fetch_wol(&$user_activity)
	{
		global $user, $mybb;

		if(my_strpos($user['location'], 'misc.php?action='.$mybb->settings['jm_irc_page_action']) !== false)
		{
			$user_activity['activity'] = 'jm_irc';
		}
	}

	function jm_irc_build_wol(&$plugin_array)
	{
		if($plugin_array['user_activity']['activity'] == 'jm_irc')
		{
			global $mybb, $lang;

			if(!$lang->jm_irc)
			{
				$lang->load('admin/jm_irc');
			}

			$plugin_array['location_name'] = $lang->sprintf($lang->jm_irc_wol, 'misc.php?action='.$mybb->settings['jm_irc_page_action'], $mybb->settings['jm_irc_wol']);
		}
	}
}


Yes, it is activated & configured.

But for greater security, if you want, you can use the test's account:

I send mp to .m. with the admin credentials

The test account's is an Administrator's account.
You shouldn't post login info for administrator accounts publicly...
i don't care, don't worry Smile
Why the heck would you post admin credentials publicly then say you don't care? What's next, a thread in the support section that says "HELP MAI 4UM HACK3D"?
I trust the people , ESPECIALLY MyBB staff ...
Any guest can see this post. Not to mention it's going to be indexed in search engines.
Pages: 1 2