Weiterleitung - Bug?

Gesperrt
Edanis
Beiträge: 61
Registriert: So 13. Jun 2004, 15:08
Wohnort: Witten
Kontaktdaten:

Weiterleitung - Bug?

Beitrag von Edanis » Di 30. Aug 2005, 23:45

Hi ;)
unter Bugs darf ich nicht posten, obwohl die Statements sehr danach aussehen; ansonsten dürfte es auch Misc sein und vielleicht habe auch nur ich das Problem. Also

Snapshot contenido-cvs-2005-08-29.tar.bz2, hiervon: http://www.contenido.org/snapshots/, Standartinstallaition mit Modulen und Beispielen. Das problem tritt aber mindestens mit einem paar monaten früheren Snapshot auch.

Beim Startartikel der Kategorie 'Hilfsnavigation/Home' ist die Weiterleitung auf den Link 'front_content.php?idcat=1' gesetzt. Das ist die 'Hauptnavigation', ein Statartikel dort vorhanden und online gesetzt. Überschreibe ich die Weiterleitung mit 'http://localhost/contenido-4.5.3_08/cms ... hp?idcat=1', ist das weiter beschriebene Problem nicht vorhanden. Lasse ich aber den Contenidolink stehen...

Wenn ich im Backend auf Vorschau gehe, sehe ich statt des Zielartikels nur folgendes aufm weißen Hintergrund:
Warning: main(config.php): failed to open stream: No such file or directory in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\contenido\external\backendedit\front_content.php on line 24

Warning: main(): Failed opening 'config.php' for inclusion (include_path='.;c:\php4\pear') in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\contenido\external\backendedit\front_content.php on line 24
Fatal error: Could not display error page. Error to display was: 'No start article in this category'
Warning: auth_loginform(front_crcloginform.inc.php): failed to open stream: No such file or directory in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\conlib\local.php on line 641

Warning: auth_loginform(): Failed opening 'front_crcloginform.inc.php' for inclusion (include_path='.;c:\php4\pear') in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\conlib\local.php on line 641
Errorlog sagt noch mehr:
[31-Aug-2005 00:18:41] PHP Warning: main(config.php): failed to open stream: No such file or directory in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\contenido\external\backendedit\front_content.php on line 24
[31-Aug-2005 00:18:41] PHP Warning: main(): Failed opening 'config.php' for inclusion (include_path='.;c:\php4\pear') in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\contenido\external\backendedit\front_content.php on line 24
[31-Aug-2005 00:18:42] /contenido-4.5.3_08/contenido/external/backendedit/front_content.php?idcat=1 MySQL error 1054: Unknown column 'A.idlang' in 'field list'
SELECT
A.idlang
FROM
con_clients AS A,
con_lang AS B
WHERE
idclient='' AND
A.idlang=B.idlang AND
B.active='1'
LIMIT
0,1
[31-Aug-2005 00:18:42] /contenido-4.5.3_08/contenido/external/backendedit/front_content.php?idcat=1 next_record called with no query pending.
[31-Aug-2005 00:18:42] PHP Warning: auth_loginform(front_crcloginform.inc.php): failed to open stream: No such file or directory in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\conlib\local.php on line 641
[31-Aug-2005 00:18:42] PHP Warning: auth_loginform(): Failed opening 'front_crcloginform.inc.php' for inclusion (include_path='.;c:\php4\pear') in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\conlib\local.php on line 641
[31-Aug-2005 00:18:42] PHP Warning: main(config.php): failed to open stream: No such file or directory in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\contenido\external\backendedit\front_content.php on line 24
[31-Aug-2005 00:18:42] PHP Warning: main(): Failed opening 'config.php' for inclusion (include_path='.;c:\php4\pear') in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\contenido\external\backendedit\front_content.php on line 24
[31-Aug-2005 00:18:42] PHP Warning: auth_loginform(front_crcloginform.inc.php): failed to open stream: No such file or directory in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\conlib\local.php on line 641
[31-Aug-2005 00:18:42] PHP Warning: auth_loginform(): Failed opening 'front_crcloginform.inc.php' for inclusion (include_path='.;c:\php4\pear') in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\conlib\local.php on line 641
Habe ich welche Problemme mit pear?

Weiter, ich habe nach dem Statement gesucht und folgendes gefunden:

Code: Alles auswählen

        $sql = "SELECT
                    A.idlang
                FROM
                    ".$cfg["tab"]["clients"]." AS A,
                    ".$cfg["tab"]["lang"]." AS B
                WHERE
                    idclient='$client' AND
                    A.idlang=B.idlang AND
                    B.active='1'
                LIMIT
                    0,1";
Das kann doch nicht wirklich funktionieren? ;) Betroffen sind folgende Dateien (alle drei, dasgleiche statement):

/cms/news.php, z. 62
/contenido/external/frontend/news.php, z. 62
/contenido/external/backendedit/front_content.php, z. 124

Irgendwie traue ich mir aber noch nicht zu, dies zu korrigieren ;)

Zwar scheint Contenido im Frontend brav und ohne Errorloggemecker weiterzuleiten, scheint aber etwas instable und betrifft Leute die ihr Contenido auf den Server hochdumben, da dürfen keine feste pfade, insbesondere mit 'localhost' stehen.

Gruss, Edward

timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Beitrag von timo » Mi 31. Aug 2005, 09:22

ähm also

erstmal nach Bugs verschoben, da dies in der Tat ein Bug ist. Unsere Policy ist, daß niemand in Bugs postet und wir dann bei wirklichen Bugs diese verschieben - was auch funktioniert, wie du siehst ;)

Das liegt daran, daß die front_content.php aus external/backendedit verwendet wird und diese out-of-date ist. Ich passe diese gerade an, im nächsten Snapshot sollte das behoben sein.

Zum Thema Weiterleitungen: Eine Weiterleitung ist eine Weiterleitung, analog zu einem Link. Eine Weiterleitung ist nicht gedacht, um intern in Contenido herumzuspringen, wird aber leider oft dazu mißbraucht. Alles, was du in das Feld Weiterleitung schreibst, wird auch so als Location-header ausgegeben.

timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Beitrag von timo » Mi 31. Aug 2005, 09:24

Du kannst die front_content.php unter external/backendedit mal ersetzen:

Code: Alles auswählen

<?php


/******************************************
* File      :   front_content.php
* Project   :   Contenido
* Descr     :   Contenido Frontend
*
* Author    :   Olaf Niemann,
*               Jan Lengowski
*
* Created   :   21.01.2003
* Modified  :   21.01.2003
*
* © four for business AG
******************************************/

include_once ("../../includes/startup.php");

cInclude("includes", "functions.general.php");

rereadClients();

include_once ($cfgClient[$client]["path"]["frontend"]."config.php");


chdir($cfgClient[$client]["path"]["frontend"]);


cInclude("includes", "functions.i18n.php");
cInclude("includes", "functions.con.php");
cInclude("includes", "functions.con2.php");
cInclude("includes", "functions.api.php");
cInclude("includes", "functions.pathresolver.php");

cInclude("classes", "class.user.php");

if ($cfg["use_pseudocron"] == true)
{
	/* Include cronjob-Emulator */
	$oldpwd = getcwd();
	chdir($cfg["path"]["contenido"].$cfg["path"]["cronjobs"]);
	cInclude("includes", "pseudo-cron.inc.php");
	chdir($oldpwd);
}

if ($contenido)
{

	//Backend
	page_open(array ('sess' => 'Contenido_Session', 'auth' => 'Contenido_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm'));

}
else
{

	//Frontend
	page_open(array ('sess' => 'Contenido_Frontend_Session', 'auth' => 'Contenido_Frontend_Challenge_Crypt_Auth', 'perm' => 'Contenido_Perm'));

}

$db = new DB_Contenido;

$sess->register("cfgClient");
$sess->register("errsite_idcat");
$sess->register("errsite_idart");
$sess->register("encoding");

if ($cfgClient["set"] != "set")
{
	rereadClients();
}

$sql = "SELECT
				idlang,
                encoding
            FROM
            ".$cfg["tab"]["lang"];

$db->query($sql);

while ($db->next_record())
{
	$encoding[$db->f("idlang")] = $db->f("encoding");
}

if (is_numeric($tmpchangelang) && $tmpchangelang > 0)
{
	$savedlang = $lang;
	$lang = $tmpchangelang;
}

// Change client
if (isset($changeclient)){
    $client = $changeclient;
    unset($lang);
    unset($load_lang);
}

// Change language
if (isset($changelang)) $lang = $changelang;

// Initialize client
if (!isset($client)) {

    //load_client defined in frontend/config.php
    $client = $load_client;
}

// Initialize language
if (!isset($lang)) {

    //if there is an entry load_lang in frontend/config.php use it, else use the first language of this client
    if(isset($load_lang)){
        //load_client is set in frontend/config.php
        $lang = $load_lang;

    }else{

        $sql = "SELECT
                    B.idlang
                FROM
                    ".$cfg["tab"]["clients_lang"]." AS A,
                    ".$cfg["tab"]["lang"]." AS B
                WHERE
                    A.idclient='$client' AND
                    A.idlang = B.idlang AND
                    B.active='1'
                LIMIT
                    0,1";

        $db->query($sql);
        $db->next_record();
       
        $lang = $db->f("idlang");

    }
}

if (!$sess->is_registered("lang") ) $sess->register("lang");
if (!$sess->is_registered("client") ) $sess->register("client");

if (isset ($username))
{
	$auth->login_if(true);
}

header("Content-Type: text/html; charset={$encoding[$lang]}");

if (isset ($logout))
{
	$auth->logout(true);
	$auth->unauth(true);
	$auth->auth["uname"] = "nobody";
}

if (file_exists("config.local.php"))
{
	@ include ("config.local.php");
}

/* If the path variable was passed, try to resolve it */
if (isset ($path))
{
	/* Which resolve method is configured? */
	if ($cfg["urlpathresolve"] == true)
	{
		$idcat = prResolvePathViaURLNames($path);
	}
	else
	{
		$idcat = prResolvePathViaCategoryNames($path);
	}
}
//  Fehlerseite
$errsite = "Location: front_content.php?client=$client&idcat=".$errsite_idcat[$client]."&idart=".$errsite_idart[$client]."&lang=$lang&error=1";

if ($idart && !$idcat && !$idcatart)
{
	/* Try to fetch the first idcat */
	$sql = "SELECT idcat FROM ".$cfg["tab"]["cat_art"]." WHERE idart='$idart'";
	$db->query($sql);

	if ($db->next_record())
	{
		$idcat = $db->f("idcat");
	}
}

/* Initialize variables */
unset ($code);
unset ($markscript);

if (!$idcatart)
{

	if (!$idart)
	{

		if (!$idcat)
		{

			if ($cfg["is_start_compatible"] == true)
			{
				$sql = "SELECT
												                                        idart,
												                                        B.idcat
												                                    FROM
												                                        ".$cfg["tab"]["cat_art"]." AS A,
												                                        ".$cfg["tab"]["cat_tree"]." AS B,
												                                        ".$cfg["tab"]["cat"]." AS C
												                                    WHERE
												                                        A.idcat=B.idcat AND
												                                        B.idcat=C.idcat AND
												                                        is_start='1' AND
												                                        idclient='$client'
												                                    ORDER BY
												                                        idtree ASC";
			}
			else
			{
				$sql = "SELECT
												                                    A.idart,
												                                    B.idcat
												                                FROM
												                                    ".$cfg["tab"]["cat_art"]." AS A,
												                                    ".$cfg["tab"]["cat_tree"]." AS B,
												                                    ".$cfg["tab"]["cat"]." AS C,
																					".$cfg["tab"]["cat_lang"]." AS D,
																					".$cfg["tab"]["art_lang"]." AS E
												                                WHERE
												                                    A.idcat=B.idcat AND
												                                    B.idcat=C.idcat AND
																					D.startidartlang = E.idartlang AND
																					D.idlang='$lang' AND
																					E.idart=A.idart AND
																					E.idlang='$lang' AND
												                                    idclient='$client'
												                                ORDER BY
												                                    idtree ASC";

			}

			$db->query($sql);

			if ($db->next_record())
			{

				$idart = $db->f("idart");
				$idcat = $db->f("idcat");

			}
			else
			{
				if ($contenido)
					die(i18n("No start article for this category"));
				else
				{
					if ($error == 1)
					{
						echo "Fatal error: Could not display error page. Error to display was: 'No start article in this category'";
					}
					else
					{
						header($errsite);
					}
				}
			}

		}
		else
		{
			$idart = -1;
			if ($cfg["is_start_compatible"] == true)
			{
				$sql = "SELECT idart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat='".$idcat."' AND is_start='1'";
				$db->query($sql);

				if ($db->next_record())
				{
					$idart = $db->f("idart");
				}
			}
			else
			{
				$sql = "SELECT startidartlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".$idcat."' AND idlang='$lang'";
				$db->query($sql);

				if ($db->next_record())
				{
					if ($db->f("startidartlang") != 0)
					{
						$sql = "SELECT idart FROM ".$cfg["tab"]["art_lang"]." WHERE idartlang='".$db->f("startidartlang")."'";
						$db->query($sql);
						$db->next_record();
						$idart = $db->f("idart");

					}

				}
			}

			if ($idart != -1)
			{
			}
			else
			{
				//im backend richtige Fehlermeldung
				if ($contenido)
					die(i18n("No start article for this category"));
				else
				{
					if ($error == 1)
					{
						echo "Fatal error: Could not display error page. Error to display was: 'No start article in this category'";
					}
					else
					{
						header($errsite);
					}
				}
			}

		}
	}

}
else
{

	$sql = "SELECT idcat, idart FROM ".$cfg["tab"]["cat_art"]." WHERE idcatart='".$idcatart."'";

	$db->query($sql);
	$db->next_record();

	$idcat = $db->f("idcat");
	$idart = $db->f("idart");

}

/* Get idcatart */
if (0 != $idart && 0 != $idcat)
{

	$sql = "SELECT idcatart FROM ".$cfg["tab"]["cat_art"]." WHERE idart = '".$idart."' AND idcat = '".$idcat."'";

	$db->query($sql);
	$db->next_record();

	$idcatart = $db->f("idcatart");

}

$idartlang = getArtLang($idart, $lang);

if ($idartlang === false)
{
	header($errsite);	
}

/* If user hast contenido-
   backend rights. */
if ($contenido)
{
	cInclude("classes", 'class.inuse.php');
	cInclude("classes", 'class.user.php');
	cInclude("classes", 'class.table.php');
	cInclude("classes", 'class.notification.php');

	$perm->load_permissions();

	/* Change mode edit / view */
	if (isset ($changeview))
	{
		$sess->register("view");
		$view = $changeview;
	}

	$col = new InUseCollection;

	if ($overrideid != "" && $overridetype != "")
	{
		$col->removeItemMarks($overridetype, $overrideid);
	}
	/* Remove all own marks */
	$col->removeSessionMarks($sess->id);
	/* If the override flag is set, override a specific InUseItem */

	list ($inUse, $message) = $col->checkAndMark("article", $idartlang, true, i18n("Article is in use by %s (%s)"), true, "front_content.php?changeview=edit&action=con_editart&idartlang=$idartlang&type=$type&typenr=$typenr&idart=$idart&idcat=$idcat&idcatart=$idcatart&lang=$lang");

	if ($inUse == true)
	{
		$disabled = 'disabled="disabled"';
		echo $message;
	}

	$sql = "SELECT locked FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".$idart."' AND idlang = '".$lang."'";
	$db->query($sql);
	$db->next_record();
	$locked = $db->f("locked");
	if ($locked == 1)
	{
		$inUse = true;
		$disabled = 'disabled="disabled"';
	}
	/* Check if the user
	   has permission to edit
	   articles in this category */
	if ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat) && $inUse == false)
	{

		/* Create buttons for editing */
		$edit_preview = '<table cellspacing="0" cellpadding="4" border="0">';

		if ($view == "edit")
		{

			$edit_preview = '   <tr>
									                                        <td width="18">
									                                            <a title="Preview" style="font-family: Verdana; font-size: 10px; color: #000000; text-decoration: none" href="'.$sess->url("front_content.php?changeview=prev&idcat=$idcat&idart=$idart").'"><img src="'.$cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"].'but_preview.gif" alt="Preview" title="Preview" border="0"></a>
									                                        </td>
									                                        <td width="18">
									                                            <a title="Preview" style="font-family: Verdana; font-size: 10px; color: #000000; text-decoration: none" href="'.$sess->url("front_content.php?changeview=prev&idcat=$idcat&idart=$idart").'">Preview</a>
									                                        </td>
									                                    </tr>';

		}
		else
		{

			$edit_preview = '   <tr>
									                                        <td width="18">
									                                            <a title="Preview" style="font-family: Verdana; font-size: 10px; color: #000000; text-decoration: none" href="'.$sess->url("front_content.php?changeview=edit&idcat=$idcat&idart=$idart").'"><img src="'.$cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"].'but_edit.gif" alt="Preview" title="Preview" border="0"></a>
									                                        </td>
									                                        <td width="18">
									                                            <a title="Preview" style="font-family: Verdana; font-size: 10px; color: #000000; text-decoration: none" href="'.$sess->url("front_content.php?changeview=edit&idcat=$idcat&idart=$idart").'">Edit</a>
									                                        </td>
									                                    </tr>';

		}

		/* Display articles */
		if ($cfg["is_start_compatible"] == true)
		{
			$sql = "SELECT idart,is_start FROM ".$cfg["tab"]["cat_art"]." WHERE idcat='".$idcat."' ORDER BY idart";

			$db->query($sql);
		}
		else
		{
			$sql = "SELECT idart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat='".$idcat."' ORDER BY idart";

			$db->query($sql);
		}

		$a = 1;

		$edit_preview .= '<tr><td colspan="2"><table cellspacing="0" cellpadding="2" border="0"></tr><td style="font-family: verdana; font-size:10; color:#000000; text-decoration:none">Articles in category:<br>';

		while ($db->next_record() && ($db->affected_rows() != 1))
		{

			$class = "font-family:'Verdana'; font-size:10; color:#000000; text-decoration: underline; font-weight:normal";
			if (!isset ($idart))
			{
				if (isStartArticle(getArtLang($idart, $lang), $idcat, $lang))
				{
					$class = "font-family: verdana; font-size:10; color:#000000; text-decoration: underline ;font-weight:bold";
				}
			}
			else
			{
				if ($idart == $db->f("idart"))
				{
					$class = "font-family: verdana; font-size:10; color:#000000; text-decoration: underline; font-weight:bold";
				}
			}

			$edit_preview .= "<a style=\"$class\" href=\"".$sess->url("front_content.php?idart=".$db->f("idart")."&idcat=$idcat")."\">$a</a>&nbsp;";
			$a ++;
		}

		$edit_preview .= '</td></tr></table></td></tr></table>';

	}

} // end if $contenido

/* If mode is 'edit' and user has permissoion
   edit articles in this idcat  */
if ($inUse == false && $view == "edit" && ($perm->have_perm_area_action_item("con_editcontent", "con_editart", $idcat)))
{

	cInclude("includes", "functions.tpl.php");
	cInclude("includes", "functions.con.php");
	include ($cfg["path"]["contenido"].$cfg["path"]["includes"]."include.con_editcontent.php");

}
else
{

	/* Mark submenuitem 'Preview' */
	if ($contenido)
	{
		$markscript = markSubMenuItem(4, true);
	}

	unset($edit); // disable editmode
	
	/* 'mode' is preview or article displayed
	   in the front-end */

	$sql = "SELECT
			                createcode
			            FROM
			                ".$cfg["tab"]["cat_art"]."
			            WHERE
			                idcat = '".$idcat."' AND
			                idart = '".$idart."'";

	$db->query($sql);
	$db->next_record();

	/* Check if code is expired,
	   create new code if needed */
	if ($db->f("createcode") == 0 && $force == 0)
	{
		$sql = "SELECT code FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".$idcatart."' AND idlang = '".$lang."'";
		$db->query($sql);

		if ($db->num_rows() == 0)
		{
			/* Include here for performance reasons */
			cInclude("includes", "functions.tpl.php");

			conGenerateCode($idcat, $idart, $lang, $client);

			$sql = "SELECT code FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".$idcatart."' AND idlang = '".$lang."'";
			$db->query($sql);
		}

		if ($db->next_record())
		{
			$code = stripslashes($db->f("code"));
		}
		else
		{
			if ($contenido)
				$code = "echo \"No code available.\";";
			else
			{
				if ($error == 1)
				{
					echo "Fatal error: Could not display error page. Error to display was: 'No code available'";
				}
				else
				{
					header($errsite);
				}
			}

		}

	}
	else
	{
		$sql = "DELETE FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".$idcatart."'";
		$db->query($sql);

		// echo "creating code for idcat:$idcat, idart:$idart, lang:$lang, client:$client<br><br>";

		cInclude("includes", "functions.con.php");
		cInclude("includes", "functions.tpl.php");
		cInclude("includes", "functions.mod.php");

		conGenerateCode($idcat, $idart, $lang, $client);

		$sql = "SELECT code FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".$idcatart."' AND idlang = '".$lang."'";

		$db->query($sql);
		$db->next_record();

		$code = stripslashes($db->f("code"));
	}

	/*  Add mark Script to code */
	$code = preg_replace("/<\/head>/i", "$markscript\n</head>", $code);

	/* Check if category is public */
	$sql = "SELECT public FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".$idcat."' AND idlang='".$lang."'";

	$db->query($sql);
	$db->next_record();

	$public = $db->f("public");

	if ($public == 0)
	{

		if ($auth->auth["uid"] == "nobody")
		{
			$sql = "SELECT user_id, value FROM ".$cfg["tab"]["user_prop"]." WHERE type='frontend' and name='allowed_ip'";
			$db->query($sql);

			while ($db->next_record())
			{
				$user_id = $db->f("user_id");

				$range = urldecode($db->f("value"));
				$slash = strpos($range, "/");

				if ($slash == false)
				{
					$netmask = "255.255.255.255";
					$network = $range;
				}
				else
				{
					$network = substr($range, 0, $slash);
					$netmask = substr($range, $slash +1, strlen($range) - $slash -1);
				}

				if (IP_match($network, $netmask, $_SERVER["REMOTE_ADDR"]))
				{
					$sql = "SELECT idright 
																				FROM ".$cfg["tab"]["rights"]." AS A,
																					 ".$cfg["tab"]["actions"]." AS B,
																					 ".$cfg["tab"]["area"]." AS C
																				 WHERE B.name = 'front_allow' AND C.name = 'str' AND A.user_id = '".$user_id."' AND A.idcat = '$idcat'
																						AND A.idarea = C.idarea AND B.idaction = A.idaction";

					$db2 = new DB_Contenido;
					$db2->query($sql);

					if ($db2->num_rows() > 0)
					{
						$auth->auth["uid"] = $user_id;
						$validated = 1;

					}
				}
			}
			if ($validated != 1)
			{
				$allow = false;

				$iterator = $_cecRegistry->getIterator("Contenido.Frontend.CategoryAccess");

				while ($chainEntry = $iterator->next())
				{
					$value = $chainEntry->execute($lang, $idcat, $auth->auth["uid"]);

					if ($value === true)
					{
						$allow = true;
						break;
					}
				}

				$auth->login_if(!$allow);

			}
		}
		else
		{
			$allow = false;

			$iterator = $_cecRegistry->getIterator("Contenido.Frontend.CategoryAccess");

			while ($chainEntry = $iterator->next())
			{
				$value = $chainEntry->execute($lang, $idcat, $auth->auth["uid"]);

				if ($value === true)
				{
					$allow = true;
					break;
				}
			}

			if (!$allow)
			{
				header($errsite);
			}
		}
	}

	/* Sanity: If the stat table doesn't contain an entry, create one */
	$sql = "SELECT idcatart FROM ".$cfg["tab"]["stat"]." WHERE idcatart = '$idcatart' AND idlang='$lang'";
	$db->query($sql);

	if ($db->next_record())
	{
		/* Update the statistics. */
		$sql = "UPDATE ".$cfg["tab"]["stat"]." SET visited = visited + 1 WHERE idcatart = '".$idcatart."' AND idclient = '$client' AND idlang = '".$lang."'";
		$db->query($sql);
	}
	else
	{
		/* Insert new record */
		$next = $db->nextid($cfg["tab"]["stat"]);
		$sql = "INSERT INTO ".$cfg["tab"]["stat"]." (visited, idcatart, idlang, idstat, idclient) VALUES ('1', '$idcatart', '$lang', '$next', '$client')";
		$db->query($sql);
	}

	/* Check for redirect.
	   Properties for the redirect are
	   choosen in the article properties */
	if ($cfg["is_start_compatible"] == true)
	{
		$sql = "SELECT is_start FROM ".$cfg["tab"]["cat_art"]." WHERE idcatart='".$idcatart."'";
		$db->query($sql);
		$db->next_record();
		$isstart = $db->f("is_start");
	}
	else
	{
		$sql = "SELECT startidartlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='$idcat' AND idlang = '$lang'";
		$db->query($sql);
		$db->next_record();
		if ($db->f("idartlang") == $idartlang)
		{
			$isstart = 1;
		}
		else
		{
			$isstart = 0;
		}
	}

	$sql = "SELECT timemgmt FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".$idart."' AND idlang = '".$lang."'";
	$db->query($sql);
	$db->next_record();

	if (($db->f("timemgmt") == "1") && ($isstart != 1))
	{
		$sql = "SELECT online, redirect, redirect_url FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".$idart."' AND idlang = '".$lang."' AND NOW() > datestart AND NOW() < dateend";
	}
	else
	{
		$sql = "SELECT online, redirect, redirect_url FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".$idart."' AND idlang = '".$lang."'";
	}

	$db->query($sql);
	$db->next_record();

	$online = $db->f("online");
	$redirect = $db->f("redirect");
	$redirect_url = $db->f("redirect_url");

	@ eval ("\$"."redirect_url = \"$redirect_url\";"); // transform variables
	
	$is_XHTML = getEffectiveSetting('generator', 'xhtml', false);
	if ($is_XHTML == true) {
		$baseCode = '<base href="'.$cfgClient[$client]["path"]["htmlpath"].'" />';
	} else {
		$baseCode = '<base href="'.$cfgClient[$client]["path"]["htmlpath"].'">';
	}
	$code = str_ireplace_once("<head>", "<head>\n".$baseCode, $code);
	if ($online)
	{

		if ($redirect == '1' && $redirect_url != '')
		{
			page_close();
			header("Location: $redirect_url");
			exit;

		}
		else
		{

			if ($cfg["debug"]["codeoutput"])
			{
				echo "<textarea>".htmlspecialchars($code)."</textarea>";
			}

			eval ("?>\n".$code."\n<?php\n");

		}

	}
	else
	{

		if ($contenido)
		{
			eval ("?>\n".$code."\n<?php\n");

		}
		else
		{
			if ($error == 1)
			{
				echo "Fatal error: Could not display error page. Error to display was: 'No contenido session variable set. Probable error cause: Start article in this category is not set on-line.'";
			}
			else
			{
				header($errsite);
			}
		}

	}

}

if (file_exists("config.after.php"))
{
	@ include ("config.after.php");
}

function IP_match($network, $mask, $ip)
{

	bcscale(3);
	$ip_long = ip2long($ip);
	$mask_long = ip2long($network);

	#
	# Convert mask to divider
	#
	if (ereg("^[0-9]+$", $mask))
	{
		/// 212.50.13.0/27 style mask (Cisco style)
		$divider = bcpow(2, (32 - $mask));
	}
	else
	{
		/// 212.50.13.0/255.255.255.0 style mask
		$xmask = ip2long($mask);
		if ($xmask < 0)
			$xmask = bcadd(bcpow(2, 32), $xmask);
		$divider = bcsub(bcpow(2, 32), $xmask);
	}
	#
	# Test is IP within specified mask
	#
	if (floor(bcdiv($ip_long, $divider)) == floor(bcdiv($mask_long, $divider)))
	{
		# match - this IP is within specified mask
		return true;
	}
	else
	{
		# fail - this IP is NOT within specified mask
		return false;
	}
}

if (isset ($savedlang))
{
	$lang = $savedlang;
}
page_close();
?>




Oldperl
Beiträge: 4255
Registriert: Do 30. Jun 2005, 22:56
Wohnort: Eltmann, Unterfranken, Bayern
Kontaktdaten:

Beitrag von Oldperl » Mi 31. Aug 2005, 09:57

timo hat geschrieben:Zum Thema Weiterleitungen: Eine Weiterleitung ist eine Weiterleitung, analog zu einem Link. Eine Weiterleitung ist nicht gedacht, um intern in Contenido herumzuspringen, wird aber leider oft dazu mißbraucht. Alles, was du in das Feld Weiterleitung schreibst, wird auch so als Location-header ausgegeben.
Wie leite ich dann intern um?

Gruß aus Franken

Ortwin
ConLite 2.1, alternatives und stabiles Update von Contenido 4.8.x unter PHP 7.x - Download und Repo auf Gitport.de
phpBO Search Advanced - das Suchwort-Plugin für CONTENIDO 4.9
Mein Entwickler-Blog

timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Beitrag von timo » Mi 31. Aug 2005, 09:59

Über ein entsprechendes Modul, welches entsprechende Weiterleitungslogik besitzt und im Layout vor dem ersten HTML-Tag eingefügt wird.

Oldperl
Beiträge: 4255
Registriert: Do 30. Jun 2005, 22:56
Wohnort: Eltmann, Unterfranken, Bayern
Kontaktdaten:

Beitrag von Oldperl » Mi 31. Aug 2005, 10:19

Dankäääää :D

Gruß aus dem sonnenüberfluteten Franken

Ortwin
ConLite 2.1, alternatives und stabiles Update von Contenido 4.8.x unter PHP 7.x - Download und Repo auf Gitport.de
phpBO Search Advanced - das Suchwort-Plugin für CONTENIDO 4.9
Mein Entwickler-Blog

Edanis
Beiträge: 61
Registriert: So 13. Jun 2004, 15:08
Wohnort: Witten
Kontaktdaten:

Beitrag von Edanis » Fr 2. Sep 2005, 22:45

Hallo Timo und danke fürs Verschieben und schnelles Antworten. Habe die Version ausprobiert und die Fehlerausgabe hat sich halbiert ;)

Folgendes bekomme ich ins Errorlog wenn ich auf Vorschau klicke und beim Artikel eine interne Weiterleitung eingestellt ist:
[02-Sep-2005 22:27:55] PHP Warning: main(config.php): failed to open stream: No such file or directory in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\contenido\external\backendedit\front_content.php on line 23
[02-Sep-2005 22:27:55] PHP Warning: main(): Failed opening 'config.php' for inclusion (include_path='.;c:\php4\pear') in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\contenido\external\backendedit\front_content.php on line 23
[02-Sep-2005 22:27:55] PHP Warning: auth_loginform(front_crcloginform.inc.php): failed to open stream: No such file or directory in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\conlib\local.php on line 641
[02-Sep-2005 22:27:55] PHP Warning: auth_loginform(): Failed opening 'front_crcloginform.inc.php' for inclusion (include_path='.;c:\php4\pear') in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\conlib\local.php on line 641
[02-Sep-2005 22:27:55] PHP Warning: main(config.php): failed to open stream: No such file or directory in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\contenido\external\backendedit\front_content.php on line 23
[02-Sep-2005 22:27:55] PHP Warning: main(): Failed opening 'config.php' for inclusion (include_path='.;c:\php4\pear') in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\contenido\external\backendedit\front_content.php on line 23
[02-Sep-2005 22:27:56] PHP Warning: auth_loginform(front_crcloginform.inc.php): failed to open stream: No such file or directory in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\conlib\local.php on line 641
[02-Sep-2005 22:27:56] PHP Warning: auth_loginform(): Failed opening 'front_crcloginform.inc.php' for inclusion (include_path='.;c:\php4\pear') in E:\Projekte\WebSeiten\LocalWeb\contenido-4.5.3_08\conlib\local.php on line 641
Eigentlich rein zufällig kam ich aber an RFC 2616,wo besagt wird, bei der Weiterleitung mittels Location eine globale Adresse stehen soll (http://www.faqs.org/rfcs/rfc2616.html):
14.30 Location
...
Location = "Location" ":" absoluteURI
Somit ist die Weiterleitung wie ich sie habe nicht im Sinne des Protokols. Um eine Site zwischen Servern austauschen zu können benötigt man aber eine lokale Adresse, sonst muss jedesmal das Ziel umgeschrieben werden. Folgender Code lässt das ersparen:

Ersetzt den Code (alle drei front_content.php, um die z.750):

Code: Alles auswählen

            page_close();
            header("Location: $redirect_url");
            exit;

durch den:

Code: Alles auswählen

            if (substr($redirect_url, 0, 17) == 'front_content.php') {
                $redirect_url = $cfgClient[$client]["path"]["htmlpath"] . $redirect_url;
            }
            page_close();
            header("Location: $redirect_url");
            exit;

Lokale Links werden 'globalisiert' indem der Mandantenpfad vorangestellt wird. Ein Modul mit der 'Weiterleitungslogik' ersetzt das natürlich nicht.

Gruss, Edward

PS. Was mir noch einfällt:

Beim Klick in Administration - Sprachen verschwindet das rechte Submenü.

Und beim Klick in Administration - Frontend (kein Frontenduser vorhanden) steht das hier im Errorlog:
[02-Sep-2005 22:59:43] /contenido-4.5.3_08/contenido/main.php?area=frontend&frame=4&contenido=e9e9c6032fe5cee0dab2a2837aff7993 MySQL error 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
SELECT frontendgroupmembercollection.idfrontendgroupmember, idfrontendgroup FROM con_frontendgroupmembers AS frontendgroupmembercollection WHERE idfrontenduser =
[02-Sep-2005 22:59:43] /contenido-4.5.3_08/contenido/main.php?area=frontend&frame=4&contenido=e9e9c6032fe5cee0dab2a2837aff7993 next_record called with no query pending.

timo
Beiträge: 6284
Registriert: Do 15. Mai 2003, 18:32
Wohnort: Da findet ihr mich nie!
Kontaktdaten:

Beitrag von timo » Fr 16. Sep 2005, 14:59

Das ist soweit korrekt. Die Definition der Funktionsweise der Weiterleitungsbox ist aber die folgende:

- Alles, was dort hineingeschrieben wird, wird ohne Umwandlung 1:1 an den Header-Befehl übergeben.

Deine Methode funktioniert zwar in Standardumgebungen, aber nicht in Umgebungen, die z.b. mod_rewrite verwenden.

Wir haben deshalb keine relativen Weiterleitungen implementiert, weil es dort zu viel zu beachten gibt und auch nicht immer funktioniert (bzw funktionieren kann)...

Eine allumfassende Lösung wäre mir natürlich lieber, aber ich halte es im Moment für sinnvoller, auf das Weiterleitungsthema hinzuweisen als eine unvollständige Lösung einzubauen ;)

Gesperrt