Seite 1 von 1

Mod deinstallieren, wie?

Verfasst: 01.05.2009 15:33
von Crizzo
Hi!

System:
phpbb3.0.4
prosilver basierender Style
Link: http://squadrevolution.blackhawk-zone.de/forum/

Ich habe mir den Almsamim WYSIWYG-Editor v0.0.8 installiert, leider ist das Teil ziemlich verbuggt und ich will ihn wieder loswerden. Ich hab nun alle editieren Dateien zurückgesetzt, die hochgeladenen Dateien gelöscht. Doch wirklich weg ist er immer noch nicht.
Nach der manuellen Installation musste ich noch diese Datei ausführen:
install.php:

Code: Alles auswählen

<?php

/**
*
* @package - Almsamim WYSIWYG editor
* @version $Id: install.php 157 2008-09-08 10:58:40Z nickvergessen $
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

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

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$user->add_lang('mods/wysiwyg');
$new_mod_version = '0.0.8';
$page_title = 'Almsamim WYSIWYG editor v' . $new_mod_version;

$mode = request_var('mode', 'else', true);
if ($user->data['user_type'] != USER_FOUNDER)
{
	$mode  = '';
}
	/*
	* Build regular expression for custom bbcode
	*/
	function build_regexp(&$bbcode_match, &$bbcode_tpl)
	{
		$bbcode_match = trim($bbcode_match);
		$bbcode_tpl = trim($bbcode_tpl);

		$fp_match = preg_quote($bbcode_match, '!');
		$fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match);
		$fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace);

		$sp_match = preg_quote($bbcode_match, '!');
		$sp_match = preg_replace('#^\\\\\[(.*?)\\\\\]#', '\[$1:$uid\]', $sp_match);
		$sp_match = preg_replace('#\\\\\[/(.*?)\\\\\]$#', '\[/$1:$uid\]', $sp_match);
		$sp_replace = $bbcode_tpl;

		// @todo Make sure to change this too if something changed in message parsing
		$tokens = array(
			'URL'	 => array(
				'!(?:(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))!ie'	=>	"\$this->bbcode_specialchars(('\$1') ? '\$1' : 'http://\$2')"
			),
			'LOCAL_URL'	 => array(
				'!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e'	=>	"\$this->bbcode_specialchars('$1')"
			),
			'EMAIL' => array(
				'!(' . get_preg_expression('email') . ')!ie'	=>	"\$this->bbcode_specialchars('$1')"
			),
			'TEXT' => array(
				'!(.*?)!es'	 =>	"str_replace(array(\"\\r\\n\", '\\\"', '\\'', '(', ')'), array(\"\\n\", '\"', ''', '&#40;', '&#41;'), trim('\$1'))"
			),
			'SIMPLETEXT' => array(
				'!([a-zA-Z0-9-+.,_ ]+)!'	 =>	"$1"
			),
			'IDENTIFIER' => array(
				'!([a-zA-Z0-9-_]+)!'	 =>	"$1"
			),
			'COLOR' => array(
				'!([a-z]+|#[0-9abcdef]+)!i'	=>	'$1'
			),
			'NUMBER' => array(
				'!([0-9]+)!'	=>	'$1'
			)
		);

		$sp_tokens = array(
			'URL'	 => '(?i)((?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))(?-i)',
			'LOCAL_URL'	 => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)',
			'EMAIL' => '(' . get_preg_expression('email') . ')',
			'TEXT' => '(.*?)',
			'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)',
			'IDENTIFIER' => '([a-zA-Z0-9-_]+)',
			'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)',
			'NUMBER' => '([0-9]+)',
		);

		$pad = 0;
		$modifiers = 'i';

		if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m))
		{
			foreach ($m[0] as $n => $token)
			{
				$token_type = $m[1][$n];

				reset($tokens[strtoupper($token_type)]);
				list($match, $replace) = each($tokens[strtoupper($token_type)]);

				// Pad backreference numbers from tokens
				if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
				{
					$repad = $pad + sizeof(array_unique($repad[0]));
					$replace = preg_replace('/(?<!\\\\)\$([0-9]+)/e', "'\${' . (\$1 + \$pad) . '}'", $replace);
					$pad = $repad;
				}

				// Obtain pattern modifiers to use and alter the regex accordingly
				$regex = preg_replace('/!(.*)!([a-z]*)/', '$1', $match);
				$regex_modifiers = preg_replace('/!(.*)!([a-z]*)/', '$2', $match);

				for ($i = 0, $size = strlen($regex_modifiers); $i < $size; ++$i)
				{
					if (strpos($modifiers, $regex_modifiers[$i]) === false)
					{
						$modifiers .= $regex_modifiers[$i];

						if ($regex_modifiers[$i] == 'e')
						{
							$fp_replace = "'" . str_replace("'", "\\'", $fp_replace) . "'";
						}
					}

					if ($regex_modifiers[$i] == 'e')
					{
						$replace = "'.$replace.'";
					}
				}

				$fp_match = str_replace(preg_quote($token, '!'), $regex, $fp_match);
				$fp_replace = str_replace($token, $replace, $fp_replace);

				$sp_match = str_replace(preg_quote($token, '!'), $sp_tokens[$token_type], $sp_match);
				$sp_replace = str_replace($token, '${' . ($n + 1) . '}', $sp_replace);
			}

			$fp_match = '!' . $fp_match . '!' . $modifiers;
			$sp_match = '!' . $sp_match . '!s';

			if (strpos($fp_match, 'e') !== false)
			{
				$fp_replace = str_replace("'.'", '', $fp_replace);
				$fp_replace = str_replace(".''.", '.', $fp_replace);
			}
		}
		else
		{
			// No replacement is present, no need for a second-pass pattern replacement
			// A simple str_replace will suffice
			$fp_match = '!' . $fp_match . '!' . $modifiers;
			$sp_match = $fp_replace;
			$sp_replace = '';
		}

		// Lowercase tags
		$bbcode_tag = preg_replace('/.*?\[([a-z0-9_-]+=?).*/i', '$1', $bbcode_match);
		$bbcode_search = preg_replace('/.*?\[([a-z0-9_-]+)=?.*/i', '$1', $bbcode_match);

		if (!preg_match('/^[a-zA-Z0-9_-]+=?$/', $bbcode_tag))
		{
			global $user;
			trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
		}

		$fp_match = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $fp_match);
		$fp_replace = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $fp_replace);
		$sp_match = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $sp_match);
		$sp_replace = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $sp_replace);

		return array(
			'bbcode_tag'				=> $bbcode_tag,
			'first_pass_match'			=> $fp_match,
			'first_pass_replace'		=> $fp_replace,
			'second_pass_match'			=> $sp_match,
			'second_pass_replace'		=> $sp_replace
		);
	}
	
function split_sql_file($sql, $delimiter)
{
	$sql = str_replace("\r" , '', $sql);
	$data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql);

	$data = array_map('trim', $data);

	// The empty case
	$end_data = end($data);

	if (empty($end_data))
	{
		unset($data[key($data)]);
	}

	return $data;
}
switch ($mode)
{
	case 'install':
		$install = request_var('install', 0);
		$installed = false;
		if ($install == 1)
		{
		set_config('bbcode_image_show', 1);
		set_config('wysiwyg_show', 1);
		set_config('link_p', 0);
		set_config('wysiwyg_bg', '#fff');
		set_config('wysiwyg_color', '#000');
		set_config('wysiwyg_fonts', 'Arial
Courier
Tahoma
Times New Roman
Verdana
Impact
Lucida Console
Georgia
Comic Sans MS');
		set_config('palet', 3);
		set_config('EXP', 'Custom Menu');
		set_config('wdir', 'ltr');
		set_config('wysiwyg_exp', 'Hello
Welcome
Cheers
GoodBye
<img src=http://www.phpbb.com/theme/images/logo_phpbb.png />
<u>HT</u><i>ML</i>');
	$bbcode_data = array(
		's'				=> array( "s", "[s]{TEXT}[/s]", "<strike>{TEXT}</strike>", 0 ,''),
		'sup'				=> array( "sup", "[sup]{TEXT}[/sup]", "<sup>{TEXT}</sup>", 0 ,''),
		'sub'				=> array( "sub", "[sub]{TEXT}[/sub]", "<sub>{TEXT}</sub>", 0 ,''),
		'h1'				=> array( "h1", "[h1]{TEXT}[/h1]", "<h1>{TEXT}</h1>", 0 ,''),
		'h2'				=> array( "h2", "[h2]{TEXT}[/h2]", "<h2>{TEXT}</h2>", 0 ,''),
		'h3'				=> array( "h3", "[h3]{TEXT}[/h3]", "<h3>{TEXT}</h3>", 0 ,''),
		'h4'				=> array( "h4", "[h4]{TEXT}[/h4]", "<h4>{TEXT}</h4>", 0 ,''),
		'h5'				=> array( "h5", "[h5]{TEXT}[/h5]", "<h5>{TEXT}</h5>", 0 ,''),
		'h6'				=> array( "h6", "[h6]{TEXT}[/h6]", "<h6>{TEXT}</h6>", 0 ,''),
		'center'				=> array( "center", "[center]{TEXT}[/center]", "<div align=\"center\">{TEXT}</div>", 0 ,''),
		'right'				=> array( "right", "[right]{TEXT}[/right]", "<div align=\"right\">{TEXT}</div>", 0 ,''),
		'left'				=> array( "left", "[left]{TEXT}[/left]", "<div align=\"left\">{TEXT}</div>", 0 ,''),
		'justify'				=> array( "justify", "[justify]{TEXT}[/justify]", "<div align=\"justify\">{TEXT}</div>", 0 ,''),
		'font='				=> array( "font=", "[font={TEXT1}]{TEXT}[/font]", "<font face=\"{TEXT1}\">{TEXT}</font>", 0 ,''),
		'hr'				=> array( "hr", "[hr][/hr]", "<hr />", 0 ,''),
		'video'				=> array( "video", "[video]{TEXT}[/video]", "<script type=\"text/javascript\" src=\"video.php?link={TEXT}\"></script>", 1 ,'[video]link[/video]')
		);
foreach ( $bbcode_data as $bbcode_name => $bbcode_values ){
				$data = build_regexp($bbcode_values[1], $bbcode_values[2]);
				$sql_ary = array(
					'bbcode_tag'			=> $bbcode_values[0],
					'bbcode_match'			=> $bbcode_values[1],
					'bbcode_tpl'			=> $bbcode_values[2],
					'first_pass_match'		=> $data['first_pass_match'],
					'first_pass_replace'	=> $data['first_pass_replace'],
					'second_pass_match'		=> $data['second_pass_match'],
					'second_pass_replace'	=> $data['second_pass_replace'],
					'display_on_posting'	=> $bbcode_values[3],
					'bbcode_helpline'	=> $bbcode_values[4]
				);
$sql = 'SELECT MAX(bbcode_id) as max_bbcode_id
						FROM ' . BBCODES_TABLE;
					$result = $db->sql_query($sql);
					$row = $db->sql_fetchrow($result);
					$db->sql_freeresult($result);
					if ($row)
					{
						$bbcode_id = $row['max_bbcode_id'] + 1;

						// Make sure it is greater than the core bbcode ids...
						if ($bbcode_id <= NUM_CORE_BBCODES)
						{
							$bbcode_id = NUM_CORE_BBCODES + 1;
						}
					}
					else
					{
						$bbcode_id = NUM_CORE_BBCODES + 1;
					}

$sql_ary['bbcode_id'] = (int) $bbcode_id;
$db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
}
			// create the acp modules
			$modules = new acp_modules();
			$wysiwyg = array(
				'module_basename'	=> '',
				'module_enabled'	=> 1,
				'module_display'	=> 1,
				'parent_id'			=> 31,
				'module_class'		=> 'acp',
				'module_langname'	=> 'WYSIWYG',
				'module_mode'		=> '',
				'module_auth'		=> ''
			);
			$modules->update_module_data($wysiwyg);
			$adjust_wysiwyg = array(
				'module_basename'	=> 'wysiwyg',
				'module_enabled'	=> 1,
				'module_display'	=> 1,
				'parent_id'			=> $wysiwyg['module_id'],
				'module_class'		=> 'acp',
				'module_langname'	=> 'WYSIWYG Editor',
				'module_mode'		=> 'overview',
				'module_auth'		=> ''
			);
			$modules->update_module_data($adjust_wysiwyg);
			// clear cache and log what we did
			$cache->purge();
			add_log('admin', 'Almsamim WYSIWYG editor v' . $new_mod_version . ' installed');
			$installed = true;
		}
	break;
	case 'update007':
		$update = request_var('update', 0);
		$version = request_var('v', '0.0.0', true);
		$updated = false;
		if ($update == 1)
		{
		set_config('bbcode_image_show', 1);
		set_config('wysiwyg_show', 1);
		set_config('link_p', 0);
		set_config('wysiwyg_bg', '#fff');
		set_config('wysiwyg_color', '#000');
		set_config('wysiwyg_fonts', 'Arial
Courier
Tahoma
Times New Roman
Verdana
Impact
Lucida Console
Georgia
Comic Sans MS');
		set_config('palet', 3);
		set_config('EXP', 'Custom Menu');
		set_config('wdir', 'ltr');
		set_config('wysiwyg_exp', 'Hello
Welcome
Cheers
GoodBye
<img src=http://www.phpbb.com/theme/images/logo_phpbb.png />
<u>HT</u><i>ML</i>');
	$bbcode_data = array("video", "[video]{TEXT}[/video]", "<script type=\"text/javascript\" src=\"video.php?link={TEXT}\"></script>", 1 ,'[video]link[/video]');
				$data = build_regexp($bbcode_data[1], $bbcode_data[2]);
				$sql_ary = array(
					'bbcode_tag'			=> $bbcode_data[0],
					'bbcode_match'			=> $bbcode_data[1],
					'bbcode_tpl'			=> $bbcode_data[2],
					'first_pass_match'		=> $data['first_pass_match'],
					'first_pass_replace'	=> $data['first_pass_replace'],
					'second_pass_match'		=> $data['second_pass_match'],
					'second_pass_replace'	=> $data['second_pass_replace'],
					'display_on_posting'	=> $bbcode_data[3],
					'bbcode_helpline'	=> $bbcode_data[4]
				);
$sql = 'SELECT MAX(bbcode_id) as max_bbcode_id
						FROM ' . BBCODES_TABLE;
					$result = $db->sql_query($sql);
					$row = $db->sql_fetchrow($result);
					$db->sql_freeresult($result);
					if ($row)
					{
						$bbcode_id = $row['max_bbcode_id'] + 1;

						// Make sure it is greater than the core bbcode ids...
						if ($bbcode_id <= NUM_CORE_BBCODES)
						{
							$bbcode_id = NUM_CORE_BBCODES + 1;
						}
					}
					else
					{
						$bbcode_id = NUM_CORE_BBCODES + 1;
					}

$sql_ary['bbcode_id'] = (int) $bbcode_id;
$db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
		// clear cache and log what we did
			$cache->purge();
			add_log('admin', 'Almsamim WYSIWYG updated to v' . $new_mod_version);
			$updated = true;
		}
	break;
	default:
		//we had a little cheater
	break;
}

include($phpbb_root_path . 'install_wysiwyg/layout.'.$phpEx);
?>
Wie mache ich das jetzt wiederrückgängig? Die install.php bietet leider keine "uninstall" Funktion. :/

Ich danke euch für Hilfe. :)

Re: Mod deinstallieren, wie?

Verfasst: 01.05.2009 15:41
von dieweltist
Da gab es vor einiger Zeit schon mal einen Thread, wie man am besten eine Mod deinstallieren könnte.

Schneefall entfernen • phpBB.de

Re: Mod deinstallieren, wie?

Verfasst: 01.05.2009 15:46
von Crizzo
"Rückwärts-Ausführung" hab ich schon gemacht.
Unter ACP --> MODS ist immer noch der Eintrag und die install.php kann ich nicht rückwärts ausführen. ;)

Re: Mod deinstallieren, wie?

Verfasst: 01.05.2009 15:55
von Mahony
Hallo
Im ACP unter System - Modul-Konfiguration - Administrations-Bereich kannst du die überflüssigen Module entfernen.


Grüße: Mahony

Re: Mod deinstallieren, wie?

Verfasst: 01.05.2009 15:59
von Crizzo
Danke, der Reiter ist weg.

Das wäre dann alles?

Re: Mod deinstallieren, wie?

Verfasst: 01.05.2009 20:34
von oxpus
Du müsstest dann noch unter BBCodes eine Menge Einträge neuer BBCodes haben.
Entweder dann dort noch entfernen oder bei Bedarf behalten.
Das Entfernen des Editors löscht ja nur diesen, die BBCodes kann man in der Regel auch unabhängig davon verwenden.

Und dazu noch ein paar Parameter in der Board-Konfig, die man auch entfernen könnte:

Code: Alles auswählen

DELETE FROM phpbb_config WHERE config_name IN ('bbcode_image_show','EXP','link_p','palet','wdir','wysiwyg_bg','wysiwyg_color','wysiwyg_exp','wysiwyg_fonts','wysiwyg_show');
Also dieses mit phpmyadmin (oder einem anderen Datenbank Tool) ausführen.

Re: Mod deinstallieren, wie?

Verfasst: 01.05.2009 20:38
von Crizzo
Ich probier das jetzt mal und hoffe, dass du keinen Tippfehler in diesem Befehl hast. :) Hat geklappt. :)

Die BBCode habe ich bemerkt, die muss ich noch filtern.