Seite 1 von 1

Link mod 1.0.3 email an admin ??

Verfasst: 14.02.2006 10:45
von caballonegro
Hallo,
ich möchte in so einem alten linkmod bei mir eine Emailbenachrichtigung an den Admin einbauen, wenn ein registriertes Mitglied einen Link einfügt.

Kann mir da jemand helfen??
Habe mir das rausgelesen wo ich meine das es hin muss, nur ich weiss nicht was und wie.

Hier die vermutliche sequenz aus links.php

Code: Alles auswählen

// A new or edited link was submitted
	if  (($submit)&&(isset($HTTP_POST_VARS['site_url']))&&(isset($HTTP_POST_VARS['site_url_desc']))&&(isset($HTTP_GET_VARS['id'])))
	{
		$site_url=str_replace("\'", "''",htmlspecialchars(trim($HTTP_POST_VARS['site_url'])));
		If (isset($HTTP_POST_VARS['site_url_name'])) 
		{
			$site_name = str_replace("\'", "''",htmlspecialchars(trim($HTTP_POST_VARS['site_url_name']))); 
			if ($site_name=='') $site_name = $site_url;
		} 
		else 
		{
			$site_name = $site_url;
		}
		//$site_desc = str_replace("\'", "''",htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['site_url_desc']))));
		$site_desc = trim($HTTP_POST_VARS['site_url_desc']);
		//BBCode-Support
		//original is prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
		$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
		$site_desc = prepare_message($site_desc, 0, $bbcode_on, 1, $bbcode_uid);
		If ($id=='new')
		{
			$current_time = time();
			$owner = ($userdata['session_logged_in']) ? $userdata['user_id'] : '0';
			$sql = "INSERT INTO ".LINKS_URL." SET url = '$site_url', name='$site_name', description='$site_desc', owner='". $owner ."', added='$current_time', bbcode_uid='$bbcode_uid', enable_bbcode='$bbcode_on'";
		}
		else
		{	
			$sql = "UPDATE ".LINKS_URL." SET url='$site_url', name='$site_name', description='$site_desc', bbcode_uid='$bbcode_uid' ";
			if ($bbcode_on) { $sql .=", enable_bbcode='$bbcode_on' "; };
			$sql .= "WHERE id=". $id;
		}
		if( !($result = $db->sql_query($sql)) )
		{ 
			message_die(GENERAL_ERROR, 'ERROR updating links table'. $sql, '', __LINE__, __FILE__, $sql); 
		}

		If ($id=='new')		//If new url was inserted this is the key of our new url
		{	
			$id = $db->sql_nextid();
		}

		//If a user is submitting a link to his personal bookmarks for the first time
		//we have to make him his own category
		If ((isset($HTTP_POST_VARS['option_new']))&&($HTTP_POST_VARS['option_new']='on'))
		{
			$catname ="'". $userdata['username']."s ". $lang['my_urls']."'";
			$sql = "INSERT INTO ".LINKS_CAT." SET name=". $catname. ", hidden=1, owner=". $userdata['user_id'];
			if( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not create Personal Bookmarks Category', '', __LINE__, __FILE__, $sql);
			}
			$pers_cat = $db->sql_nextid();
			$HTTP_POST_VARS['option_'. $pers_cat]=$HTTP_POST_VARS['option_new'];
		} 
			
		// Now after inserting the link, we have to update/insert the connection to the cat(s)
		// Read all categories 
		$sql = "SELECT id, name 
				FROM ".LINKS_CAT." ORDER BY id";
		if( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not query url list', '', __LINE__, __FILE__, $sql);
		}
		while (($cat_rows[] = $db->sql_fetchrow($result)));
		$total_cats = count($cat_rows)-1;

		//Read the active categories to know what connection url->cat were already set yxc
		//OLD: $sql = "SELECT cat_id FROM ".LINKS_URLINCAT." WHERE url_id='$id' ORDER BY cat_id ASC";
		//NEW: 
		$sql = "SELECT uc.cat_id 
				FROM ".LINKS_CAT." as c, ".LINKS_URLINCAT." as uc 
				WHERE uc.url_id='$id' AND c.id=uc.cat_id AND (owner='0' OR owner='". $userdata['user_id'] ."') ORDER BY uc.cat_id ASC";
		if( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not query which url in which cat', '', __LINE__, __FILE__, $sql);
		}
		while (($INcat_rows[] = $db->sql_fetchrow($result)));
		$total_INcats = count($INcat_rows)-1;

		for($i = 0; $i < $total_cats; $i++) 
		{ 	//all cats 
			$sql= '';$INcat=0;
			for($j = 0; $j < $total_INcats; $j++) 
			{ 	//check if url in this cat
				if ($cat_rows[$i]['id'] == $INcat_rows[$j]['cat_id']) $INcat=1;
			}
			If (($INcat)&&(!isset($HTTP_POST_VARS['option_'. $cat_rows[$i]['id']]))) 
			{
				$sql = "DELETE 
						FROM ".LINKS_URLINCAT." 
						WHERE url_id=$id AND cat_id=". $cat_rows[$i]['id']." ";
			}
			else 
			{	
				If (!($INcat)&&(isset($HTTP_POST_VARS['option_'. $cat_rows[$i]['id']]))) 
				{
					$sql = " INSERT INTO ".LINKS_URLINCAT." 
							 SET url_id=$id,cat_id=". $cat_rows[$i]['id']." ";
				}
			}
			If ($sql != '') if( !($result = $db->sql_query($sql)) )
			{ 
				message_die(GENERAL_ERROR, 'ERROR updating urlincat table'. $sql, '', __LINE__, __FILE__, $sql); 
			}

		}

		// Update successfull, now redirect to link-index
		$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
		header($header_location . append_sid($phpbb_root_path."links.$phpEx"), true);
		exit;

	}
Ist jemand so nett und hilft mir beim einbauen??


Der Mod ist übrigens von Handykoelsch.
http://www.handykoelsch.de/phpBB/links. ... ink&id=new

Was muss man denn wo einbauen das der bbcode sichtbar/verfügbar wird??
im obigen Code steht das hier drinn, muss man das irgendwie dazu abändern ?

Code: Alles auswählen

 //BBCode-Support
		//original is prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
		$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
		$site_desc = prepare_message($site_desc, 0, $bbcode_on, 1, $bbcode_uid); 
Wie gesagt, habe nicht genügend Ahnung von dem ganzen gedöns und bin auf eure Hilfe angewiesen.

besten dank schon jetzt

Verfasst: 15.02.2006 22:09
von caballonegro
könnte mir da bitte jemand helfen??