Seite 1 von 1

Problem beim Einbau des "Admin Templates" Mods

Verfasst: 16.05.2005 18:13
von charlymcfly
Ich habe eben versucht den Admin Templates Mod versucht einzubauen aber da ich den Categorie Hierachy mod eingebaut habe ist in der functions.php der zu ändernde Teil schon vom Categorie Mod geändert.

So stehts in der Anleitung

Code: Alles auswählen

	global $db, $board_config, $template, $images, $phpbb_root_path;

	$sql = "SELECT *
		FROM " . THEMES_TABLE . "
		WHERE themes_id = $style";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(CRITICAL_ERROR, 'Could not query database for theme info');
	}

	if ( !($row = $db->sql_fetchrow($result)) )
	{
		message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
	}

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
	global $db, $board_config, $template, $images, $phpbb_root_path, $userdata;
	
	while ( $theme_ok == FALSE )
	{
		$sql = "SELECT *
			FROM " . THEMES_TABLE . "
			WHERE themes_id = $style";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(CRITICAL_ERROR, 'Could not query database for theme info');
		}

		if ( !($row = $db->sql_fetchrow($result)) )
		{
			message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
		}

		if ( $row['theme_public'] == TRUE || in_array($row['theme_usergroup'], $userdata['usergroups']) || $userdata['user_level'] == ADMIN || $style == $board_config['default_style'] )
		{
			$theme_ok = TRUE;

		} else {

			$style = $board_config['default_style'];
		}
	}

Das steht in meiner funtions.php

Code: Alles auswählen

	global $db, $board_config, $template, $images, $phpbb_root_path;

//-- mod : categories hierarchy ------------------------------------------------
//-- delete
/*

	$sql = "SELECT *
		FROM " . THEMES_TABLE . "
		WHERE themes_id = $style";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(CRITICAL_ERROR, 'Could not query database for theme info');
	}

	if ( !($row = $db->sql_fetchrow($result)) )
	{
		message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
	}

	$template_path = 'templates/' ;
	$template_name = $row['template_name'] ;

	$template = new Template($phpbb_root_path . $template_path . $template_name);
*/
//-- add
	global $config, $user, $themes;

	$themes_exists = true;
	if ( empty($themes) )
	{
		$themes = new themes();
		$themes->read();
		$themes_exists = false;
	}
	$row = $themes->data[$style];

	// force the main css when in admin
	$head_stylesheet = $row['template_name'] . '.css';
	if ( defined('IN_ADMIN') && ($row['head_stylesheet'] != $head_stylesheet) )
	{
		foreach ( $themes->data as $style_id => $style_data )
		{
			if ( $style_data['head_stylesheet'] == $head_stylesheet )
			{
				$row = $style_data;
				break;
			}
		}
	}

	// clean up  if themes didn't exists
	if ( !$themes_exists )
	{
		unset($themes);
	}

	// get main parameters
	$template_path = 'templates/';
	$template_name = $row['template_name'];

	// intantiate the template
	$template = new template_class($config->root . $template_path . $template_name, $row['custom_tpls']);
//-- fin mod : categories hierarchy --------------------------------------------

	if ( $template )
	{
		$current_template_path = $template_path . $template_name;
		@include($phpbb_root_path . $template_path . $template_name . '/' . $template_name . '.cfg');

		if ( !defined('TEMPLATE_CONFIG') )
		{
			message_die(CRITICAL_ERROR, "Could not open $template_name template config file", '', __LINE__, __FILE__);
		}

		$img_lang = ( file_exists(@phpbb_realpath($phpbb_root_path . $current_template_path . '/images/lang_' . $board_config['default_lang'])) ) ? $board_config['default_lang'] : 'english';

		while( list($key, $value) = @each($images) )
		{
			if ( !is_array($value) )
			{
				$images[$key] = str_replace('{LANG}', 'lang_' . $img_lang, $value);
			}
		}
//-- mod : categories hierarchy ------------------------------------------------
//-- add
Kann man den gewünschten Teil dort irgendwie einfügen?

Ich hoffe es kann mir dabei jemand helfen da der Rest vom mod normal einzubauen ist und es das einzige Problem dabei ist.

Verfasst: 16.05.2005 19:25
von Mehrpack
hi,
ich hab keine ahnung ob das funktionieren wird, aber probiern wir es mal *g*

suche:

Code: Alles auswählen

   global $db, $board_config, $template, $images, $phpbb_root_path; 

//-- mod : categories hierarchy ------------------------------------------------ 
//-- delete 
/* 

   $sql = "SELECT * 
      FROM " . THEMES_TABLE . " 
      WHERE themes_id = $style"; 
   if ( !($result = $db->sql_query($sql)) ) 
   { 
      message_die(CRITICAL_ERROR, 'Could not query database for theme info'); 
   } 

   if ( !($row = $db->sql_fetchrow($result)) ) 
   { 
      message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]"); 
   } 

   $template_path = 'templates/' ; 
   $template_name = $row['template_name'] ; 

   $template = new Template($phpbb_root_path . $template_path . $template_name); 
*/ 
//-- add 
   global $config, $user, $themes; 

   $themes_exists = true; 
   if ( empty($themes) ) 
   { 
      $themes = new themes(); 
      $themes->read(); 
      $themes_exists = false; 
   } 
   $row = $themes->data[$style]; 

   // force the main css when in admin 
   $head_stylesheet = $row['template_name'] . '.css'; 
   if ( defined('IN_ADMIN') && ($row['head_stylesheet'] != $head_stylesheet) ) 
   { 
      foreach ( $themes->data as $style_id => $style_data ) 
      { 
         if ( $style_data['head_stylesheet'] == $head_stylesheet ) 
         { 
            $row = $style_data; 
            break; 
         } 
      } 
   } 

   // clean up  if themes didn't exists 
   if ( !$themes_exists ) 
   { 
      unset($themes); 
   } 

   // get main parameters 
   $template_path = 'templates/'; 
   $template_name = $row['template_name']; 

   // intantiate the template 
   $template = new template_class($config->root . $template_path . $template_name, $row['custom_tpls']); 
//-- fin mod : categories hierarchy --------------------------------------------
ersetze mit:

Code: Alles auswählen

   global $db, $board_config, $template, $images, $phpbb_root_path, $userdata; 

//-- mod : categories hierarchy ------------------------------------------------ 
//-- delete 
/* 

   $sql = "SELECT * 
      FROM " . THEMES_TABLE . " 
      WHERE themes_id = $style"; 
   if ( !($result = $db->sql_query($sql)) ) 
   { 
      message_die(CRITICAL_ERROR, 'Could not query database for theme info'); 
   } 

   if ( !($row = $db->sql_fetchrow($result)) ) 
   { 
      message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]"); 
   } 

   $template_path = 'templates/' ; 
   $template_name = $row['template_name'] ; 

   $template = new Template($phpbb_root_path . $template_path . $template_name); 
*/ 
//-- add 
   while ( $theme_ok == FALSE ) 
   {
   global $config, $user, $themes; 

   $themes_exists = true; 
   if ( empty($themes) ) 
   { 
      $themes = new themes(); 
      $themes->read(); 
      $themes_exists = false; 
   } 
   $row = $themes->data[$style]; 

   // force the main css when in admin 
   $head_stylesheet = $row['template_name'] . '.css'; 
   if ( defined('IN_ADMIN') && ($row['head_stylesheet'] != $head_stylesheet) ) 
   { 
      foreach ( $themes->data as $style_id => $style_data ) 
      { 
         if ( $style_data['head_stylesheet'] == $head_stylesheet ) 
         { 
            $row = $style_data; 
            break; 
         } 
      } 
   } 

   // clean up  if themes didn't exists 
   if ( !$themes_exists ) 
   { 
      unset($themes); 
   } 

      if ( $row['theme_public'] == TRUE || in_array($row['theme_usergroup'], $userdata['usergroups']) || $userdata['user_level'] == ADMIN || $style == $board_config['default_style'] ) 
      { 
         $theme_ok = TRUE; 

      } else { 

         $style = $board_config['default_style']; 
      } 
   }

   // get main parameters 
   $template_path = 'templates/'; 
   $template_name = $row['template_name']; 

   // intantiate the template 
   $template = new template_class($config->root . $template_path . $template_name, $row['custom_tpls']); 
//-- fin mod : categories hierarchy --------------------------------------------
falls es nicht geht, hab ich leider keine ahnung.

Mehrpack

Verfasst: 16.05.2005 19:35
von charlymcfly
Leider funktioniert das nicht. Schade

Aber ich danke dir für deine Mühe

Hat denn niemand anders eine Idee wie ich den trotzdem einfügen kann?

Verfasst: 18.05.2005 00:59
von charlymcfly
hat denn keiner ne Ahnung wie ich den trotzdem einbauen kann?