TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 500
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 95
  • Total: 95

Load.php error in Coppermine/SMF Bridge around TP's insertion.

Started by sir_keg1, April 08, 2007, 05:57:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sir_keg1

Apologies ahead of time if this is not the proper forum to ask this question.

I am having an load.php error with Coppermine when I try to bridge it with SMF. It happens just after the bridge manager is activated. I will leave the message up so you can see it personally.

http://muggle.dixiehallows.com/gallery

This is the error:
Fatal error: Call to undefined function: tp_loadtheme() in /home/dixiscom/public_html/muggle/Sources/Load.php on line 1133

Here is a condensed version of my load.php file:

.....



// Load a theme, by ID.
function loadTheme($ID_THEME = 0, $initialize = true)
{
global $ID_MEMBER, $user_info, $board_info, $sc;
global $db_prefix, $txt, $boardurl, $scripturl, $mbname, $modSettings;
global $context, $settings, $options;

// The theme was specified by parameter.
if (!empty($ID_THEME))
$ID_THEME = (int) $ID_THEME;
// Use the board's specific theme.
elseif (!empty($board_info['theme']) && $board_info['override_theme'])
$ID_THEME = $board_info['theme'];
// The theme was specified by REQUEST.
elseif (!empty($_REQUEST['theme']) && (!empty($modSettings['theme_allow']) || allowedTo('admin_forum')))
{
$ID_THEME = (int) $_REQUEST['theme'];
$_SESSION['ID_THEME'] = $ID_THEME;
}
// The theme was specified by REQUEST... previously.
elseif (!empty($_SESSION['ID_THEME']) && (!empty($modSettings['theme_allow']) || allowedTo('admin_forum')))
$ID_THEME = (int) $_SESSION['ID_THEME'];
// The theme is just the user's choice. (might use ?board=1;theme=0 to force board theme.)
elseif (!empty($user_info['theme']) && !isset($_REQUEST['theme']) && (!empty($modSettings['theme_allow']) || allowedTo('admin_forum')))
$ID_THEME = $user_info['theme'];
// The theme was specified by the board.
elseif (!empty($board_info['theme']))
$ID_THEME = $board_info['theme'];
// The theme is the forum's default.
else
$ID_THEME = $modSettings['theme_guests'];

// TinyPortal
$newtheme=TP_loadTheme();
if($newtheme!=$ID_THEME && $newtheme>0)
$ID_THEME=$newtheme;
// end TinyPortal

// Verify the ID_THEME... no foul play.
if (empty($modSettings['theme_default']) && $ID_THEME == 1 && !allowedTo('admin_forum'))
$ID_THEME = $modSettings['theme_guests'];
elseif (!empty($modSettings['knownThemes']) && !empty($modSettings['theme_allow']) && !allowedTo('admin_forum'))
{
$themes = explode(',', $modSettings['knownThemes']);
if (!in_array($ID_THEME, $themes))
$ID_THEME = $modSettings['theme_guests'];
else
$ID_THEME = (int) $ID_THEME;
}
else
$ID_THEME = (int) $ID_THEME;

$member = empty($ID_MEMBER) ? -1 : $ID_MEMBER;

if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2 && ($temp = cache_get_data('theme_settings-' . $ID_THEME . ':' . $member, 60)) != null)
{
$themeData = $temp;
$flag = true;
}
elseif (($temp = cache_get_data('theme_settings-' . $ID_THEME, 90)) != null)
$themeData = $temp + array($member => array());
else
$themeData = array(-1 => array(), 0 => array(), $member => array());

if (empty($flag))
{
// Load variables from the current or default theme, global or this user's.
$result = db_query("
SELECT variable, value, ID_MEMBER, ID_THEME
FROM {$db_prefix}themes
WHERE ID_MEMBER" . (empty($themeData[0]) ? " IN (-1, 0, $member)" : " = $member") . "
AND ID_THEME" . ($ID_THEME == 1 ? ' = 1' : " IN ($ID_THEME, 1)"), __FILE__, __LINE__);
// Pick between $settings and $options depending on whose data it is.
while ($row = mysql_fetch_assoc($result))
{
// If this is the theme_dir of the default theme, store it.
if (in_array($row['variable'], array('theme_dir', 'theme_url', 'images_url')) && $row['ID_THEME'] == '1' && empty($row['ID_MEMBER']))
$themeData[0]['default_' . $row['variable']] = $row['value'];

// If this isn't set yet, is a theme option, or is not the default theme..
if (!isset($themeData[$row['ID_MEMBER']][$row['variable']]) || $row['ID_THEME'] != '1')
$themeData[$row['ID_MEMBER']][$row['variable']] = substr($row['variable'], 0, 5) == 'show_' ? $row['value'] == '1' : $row['value'];
}
mysql_free_result($result);

if (!empty($themeData[-1]))
foreach ($themeData[-1] as $k => $v)
{
if (!isset($themeData[$member][$k]))
$themeData[$member][$k] = $v;
}

if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2)
cache_put_data('theme_settings-' . $ID_THEME . ':' . $member, $themeData, 60);
// Only if we didn't already load that part of the cache...
elseif (!isset($temp))
cache_put_data('theme_settings-' . $ID_THEME, array(-1 => $themeData[-1], 0 => $themeData[0]), 90);
}

$settings = $themeData[0];
if (!empty($context['TPortal']['front_type'])){
$settings['TPortal_front_type'] = $context['TPortal']['front_type'];
}
$options = $themeData[$member];

$settings['theme_id'] = $ID_THEME;

$settings['actual_theme_url'] = $settings['theme_url'];
$settings['actual_images_url'] = $settings['images_url'];
$settings['actual_theme_dir'] = $settings['theme_dir'];

if (!$initialize)
return;

// Check to see if they're accessing it from the wrong place.
if (isset($_SERVER['HTTP_HOST']) || isset($_SERVER['SERVER_NAME']))
{
$detected_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 'https://' : 'http://';
$detected_url .= empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] . (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT']) : $_SERVER['HTTP_HOST'];
$temp = preg_replace('~/' . basename($scripturl) . '(/.+)?$~', '', strtr(dirname($_SERVER['PHP_SELF']), '\\', '/'));
if ($temp != '/')
$detected_url .= $temp;
}
if (isset($detected_url) && $detected_url != $boardurl)
{
// Try #1 - check if it's in a list of alias addresses.
if (!empty($modSettings['forum_alias_urls']))
{
$aliases = explode(',', $modSettings['forum_alias_urls']);

foreach ($aliases as $alias)
{
// Rip off all the boring parts, spaces, etc.
if ($detected_url == trim($alias) || strtr($detected_url, array('http://' => '', 'https://' => '')) == trim($alias))
$do_fix = true;
}
}

// Hmm... check #2 - is it just different by a www?  Send them to the correct place!!
if (empty($do_fix) && strtr($detected_url, array('://' => '://www.')) == $boardurl && (empty($_GET) || count($_GET) == 1))
{
// Okay, this seems weird, but we don't want an endless loop - this will make $_GET not empty ;).
if (empty($_GET))
redirectexit('www');
else
{
list ($k, $v) = each($_GET);

if ($k != 'www')
redirectexit('www;' . $k . '=' . $v);
}
}
...........



It seems to be around where tinyportal inserted it's line into load.php:

$settings = $themeData[0];
if (!empty($context['TPortal']['front_type'])){
$settings['TPortal_front_type'] = $context['TPortal']['front_type'];



I have yet to encounter this problem with any other TinyPortal/SMF/Coppermine bridge I have encountered (I have done 5 so far.)

Any idea why it is yelling that it's undefined?

G6Cad

I have seen that error before, and if i recall correct, you have some missing code in the SSI.php

Look at the docs and check so you have the TP code added there in that file.

sir_keg1

Thanks for pointing me in the right direction, G6!


<edit file>
$boarddir/index.php
</edit file>

<search for>
require_once($sourcedir . '/Security.php');
</search for>

<add after>
// TinyPortal include
require_once($sourcedir . '/TPortal.php');
</add after>


I had to add that, because I had recycled the SS.php used in another SMF.. one without TinyPortal (and thus that entry).

Thanks for the help!

This website is proudly hosted on Crocweb Cloud Website Hosting.