Verfasst: Fr 26. Mai 2006, 18:37
könntest du das hier posten?
Gruß Mc
Gruß Mc
Das Diskussionsforum zum Open Source Content Management System
https://forum.contenido.org/
Code: Alles auswählen
eval("?>\n".$code."\n<?php\n");Code: Alles auswählen
if ($contenido) { eval("?>\n".$code."\n<?php\n"); Code: Alles auswählen
/* geändert für vpTransformationen - Start */cInclude("includes", "functions.transformations.php");ob_start();eval("?>\n".$code."\n<?php\n");$exec_php_str = ob_get_contents();ob_end_clean();$exec_php_str = Transform($exec_php_str);echo $exec_php_str;/* geändert für vpTransformationen - Ende */Code: Alles auswählen
<?php
/**
* Description : vpTransformationen v0.3.2
* Author : Ingo van Peeren
* Urls : http://www.contenido-tutorials.de
* Create date : 2005-01-02
* Modified : 2005-12-20
*/
$cfg["tab"]["vpTransformationen"] = $cfg['sql']['sqlprefix'] . "_vpTransformationen";
if (!function_exists('html_entity_decode')) {
function html_entity_decode($given_html, $quote_style = ENT_QUOTES)
{
$trans_table = array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style));
$trans_table['''] = "'";
return (strtr($given_html, $trans_table));
}
}
/**
* get a specific entry
*
* @poaram $args['trid'] id of item to get
* @returns array
* @return abac array, or false on failure
*/
function getTransformation($args)
{
global $cfg;
extract($args);
if (!isset($trid) || !is_numeric($trid)) {
return false;
}
$db = new DB_Contenido;
$sql = "SELECT trid,
short,
textlong,
title,
type,
language
FROM " . $cfg["tab"]["vpTransformationen"] . "
WHERE trid = '" . $trid . "'";
$db->query($sql);
if (! $db->next_record()) {
return false;
} else {
$abac = array('trid' => $db->f("trid"),
'short' => $db->f("short"),
'textlong' => $db->f("textlong"),
'title' => $db->f("title"),
'type' => $db->f("type"),
'language' => $db->f("language"));
return $abac;
}
}
/**
* get all entries
*
* @params $arg['filter'] int 0=abbr, 1=acronyms, 2=links, 3=languages, 4=explanations
* @returns array
* @return array of entries, or false on failure
*/
function getAvailableTransformations($args)
{
global $cfg;
extract($args);
// Optional arguments
if (!isset($startnum) || !is_numeric($startnum)) {
$startnum = 1;
}
if (!isset($numitems) || !is_numeric($numitems)) {
$numitems = -1;
}
$db = new DB_Contenido;
$where = "";
if ($filter <> -99) {
$where = "WHERE type=$filter";
}
if ($language) {
if ($where != "") $where .= " AND language=$language OR language=''";
else $where = "WHERE language=$language OR language=''";
}
$sql = "SELECT trid,
short,
textlong,
title,
type,
language
FROM " . $cfg["tab"]["vpTransformationen"] . "
$where
ORDER BY type ASC, short DESC";
$db->query($sql);
$transformations = array();
while ($db->next_record()) {
$transformations[] = array('trid' => $db->f("trid"),
'short' => $db->f("short"),
'textlong' => $db->f("textlong"),
'title' => $db->f("title"),
'type' => $db->f("type"),
'language' => $db->f("language"));
}
return ($transformations);
} // end function
/**
* count the number of items in the database
*
* @params $args['filter'] int 0=abbr, 1=acronyms, 2=links, 3=languages, 4=explanations
* @returns integer
* @returns number of items in the database
*/
function countTransformations($args)
{
global $cfg;
extract($args);
unset($args);
if (!isset($filter)) {
return false;
}
$db = new DB_Contenido;
$where = "";
if ($filter <> -99) {
$where = "WHERE type=$filter";
}
if ($language) {
if ($where != "") $where .= " AND language=$language OR language=''";
else $where = "WHERE language=$language OR language=''";
}
$sql = "SELECT *
FROM " . $cfg["tab"]["vpTransformationen"] . "
$where";
$db->query($sql);
$numitems = $db->num_rows();
return $numitems;
}
function Transform($text)
{
global $cfg, $lang;
static $search = array();
static $replace = array();
static $gotabbreviations = 0;
$acronym_behavior = getEffectiveSetting("vptrans", "acronym-behavior", "all");
$link_behavior = getEffectiveSetting("vptrans", "link-behavior", "all");
$explanation_behavior = getEffectiveSetting("vptrans", "explanation-behavior", "all");
$exactmatch = getEffectiveSetting("vptrans", "exact_match", false);
$externallinkclass = getEffectiveSetting("vptrans", "externallink-class", "externallink");
$abbrclass = getEffectiveSetting("vptrans", "abbr-class", "abbr");
$languageclass = getEffectiveSetting("vptrans", "language-class", "language");
$explanationclass = getEffectiveSetting("vptrans", "explanation-class", "explanation");
preg_match_all("=(.*)(<body[^>]*>)(.*)(</body>)(.*)=si", $text, $help);
if ($help[3][0]) {
$text = $help[3][0];
// Step -1 - remove all parts to ignore
$ignorecount = preg_match_all("'<!-- VPTRANS_IGNORE START -->(.*?)<!-- VPTRANS_IGNORE ENDE -->'si", $text, $ignore);
for ($i = 0; $i < $ignorecount; $i++) {
$text = preg_replace('/(' . preg_quote($ignore[0][$i], '/') . ')/', " MULTIHOOKIGNOREREPLACEMENT{$i} ", $text, 1);
}
// Step 0 - remove all links
$hrefcount = preg_match_all("'(<a\s{1}[^>]*>)(.*?)(<[\\\]?/a>)'si", $text, $href);
for ($i = 0; $i < $hrefcount; $i++) {
// echo "<!-- " . $href[0][$i] . " -->\n";
$text = preg_replace('/(' . preg_quote($href[0][$i], '/') . ')/', " MULTIHOOKHREFREPLACEMENT{$i} ", $text, 1);
}
// Step 0.1 - remove all acronym tags, we do not want to change them!!
$acronymcount = preg_match_all("'<acronym\s{1}[^>]*>.*?<[\\\]?/acronym>'si", $text, $acronym);
for ($i = 0; $i < $acronymcount; $i++) {
$text = preg_replace('/(' . preg_quote($acronym[0][$i], '/') . ')/', " MULTIHOOKACRONYMREPLACEMENT{$i} ", $text, 1);
}
// Step 0.2 - remove all abbr tags, we do not want to change them!!
$abbrcount = preg_match_all("'<abbr\s{1}[^>]*>.*?<[\\\]?/abbr>'si", $text, $abbr);
for ($i = 0; $i < $abbrcount; $i++) {
$text = preg_replace('/(' . preg_quote($abbr[0][$i], '/') . ')/', " MULTIHOOKABBRREPLACEMENT{$i} ", $text, 1);
}
// Step 1 - remove all html tags, we do not want to change them!!
$htmlcount = preg_match_all("/<(?:[^\"\']+?|.+?(?:\"|\').*?(?:\"|\')?.*?)*?>/i", $text, $html);
for ($i = 0; $i < $htmlcount; $i++) {
$text = preg_replace('/(' . preg_quote($html[0][$i], '/') . ')/', " MULTIHOOKHTMLREPLACEMENT{$i} ", $text, 1);
}
// Step 3 - move all urls starting with http:// etc. out of the way
$linkcount = preg_match_all("/(http|https|ftp|ftps|news)\:\/\/([a-zA-Z0-9\-\._]+[\.]{1}[a-zA-Z]{2,6})(\/[a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_=~]+)?/si", $text, $links);
for($i = 0; $i < $linkcount; $i++) {
$text = preg_replace('/(' . preg_quote($links[0][$i], '/') . ')/', " MULTIHOOKLINKREPLACEMENT{$i} ", $text, 1);
}
if (! $gotabbreviations) {
$gotabbreviations = 1;
$tmps = getAvailableTransformations(array('filter' => -99,
'language' => $lang));
// Create search/replace array from abbreviations/links information
$i = 0;
foreach ($tmps as $tmp) {
$i++;
$extclass = (preg_match("/(^http:\/\/)/", $tmp['textlong']) == 1) ? "class=\"$externallinkclass\"" : "";
$tmp['textlong'] = preg_replace('/(\b)/', '\\1MULTIHOOKTEMPORARY', $tmp['textlong']);
$tmp['title'] = preg_replace('/(\b)/', '\\1MULTIHOOKTEMPORARY', $tmp['title']);
if ($tmp['textlong'] != "") $normtitle = ' title="' . htmlspecialchars($tmp['textlong']) . '"';
else $normtitle = "";
if ($tmp['title'] != "") $linktitle = ' title="' . htmlspecialchars($tmp['title']) . '"';
else $linktitle = "";
if ($tmp['title']) $xhtmllang = ' lang="' . $tmp['title'] . '"';
else $xhtmllang = "";
// $xhtmllang = get_xhtml_language($tmp['language']);
if ($tmp['type'] == 0) {
// 0 = Abbreviation
$shelp = '(?<![\/\w@])(' . preg_quote($tmp['short'], '/') . '|' . preg_quote(htmlentities($tmp['short']), '/') . ')(?![\/\w@])(?!\w)';
if ($exactmatch) {
$abbr_search[] = "/" . $shelp . "/";
$abbr_lsearch[] = "/(" . $shelp . "(?![^<]*?>))/s";
} else {
$abbr_search[] = "/" . $shelp . "/i";
$abbr_lsearch[] = "/(" . $shelp . "(?![^<]*?>))/si";
}
$abbr_replace[] = "<abbr" . $xhtmllang . $normtitle . "><span" . $normtitle . " class=\"" . $abbrclass . "\">\\1</span></abbr>";
} else if ($tmp['type'] == 1) {
// 1 = Acronym
$teststring = str_replace("MULTIHOOKTEMPORARY", "", $tmp['textlong']);
$testtext = html_entity_decode($text);
if (($acronym_behavior == "efa") && (!strpos($testtext, $teststring) === false) && (strpos($testtext, $teststring) < strpos($testtext, $tmp['short']))) {
} else {
$shelp = '(?<![\/\w@])(' . preg_quote($tmp['short'], '/') . '|' . preg_quote(htmlentities($tmp['short']), '/') . ')(?![\/\w@])(?!\w)';
if ($exactmatch) {
$acronym_search[] = "/" . $shelp . "/U";
$acronym_lsearch[] = "/(" . $shelp . "(?![^<]*?>))/s";
} else {
$acronym_search[] = "/" . $shelp . "/iU";
$acronym_lsearch[] = "/(" . $shelp . "(?![^<]*?>))/si";
}
$acronym_replace[] = "<acronym" . $xhtmllang . $normtitle . ">\\1</acronym>";
}
} else if ($tmp['type'] == 2) {
// 2 = Link
// if short beginns with a single ' we need another regexp to not check for \w
// this enables autolinks for german apostrophs
if ($tmp['short'][0] == '\'') {
$shelp = '(?<![\/@])(' . preg_quote($tmp['short'], '/') . '|' . preg_quote(htmlentities($tmp['short']), '/') . ')(?![\/\w@])(?!\w)';
} else {
$shelp = '(?<![\/\w@])(' . preg_quote($tmp['short'], '/') . '|' . preg_quote(htmlentities($tmp['short']), '/') . ')(?![\/\w@])(?!\w)';
}
if ($exactmatch) $link_search[] = "/" . $shelp . "/U";
else $link_search[] = "/" . $shelp . "/iU";
$link_replace[] = "<a href=\"" . htmlspecialchars($tmp['textlong']) . "\"" . $linktitle . " " . $extclass . ">\\1</a>";
} else if ($tmp['type'] == 3) {
// 3 = Language
$shelp = '(?<![\/\w@])(' . preg_quote($tmp['short'], '/') . '|' . preg_quote(htmlentities($tmp['short']), '/') . ')(?![\/\w@])(?!\w)';
if ($exactmatch) {
$language_search[] = "/" . $shelp . "/";
$language_lsearch[] = "/(" . $shelp . "(?![^<]*?>))/s";
} else {
$language_search[] = "/" . $shelp . "/i";
$language_lsearch[] = "/(" . $shelp . "(?![^<]*?>))/si";
}
$language_replace[] = "<span" . $xhtmllang . $normtitle . " class=\"" . $languageclass . "\">\\1</span>";
} else if ($tmp['type'] == 4) {
// 4 = Explanation
$shelp = '(?<![\/\w@])(' . preg_quote($tmp['short'], '/') . '|' . preg_quote(htmlentities($tmp['short']), '/') . ')(?![\/\w@])(?!\w)';
if ($exactmatch) {
$explanation_search[] = "/" . $shelp . "/";
$explanation_lsearch[] = "/(" . $shelp . "(?![^<]*?>))/s";
} else {
$explanation_search[] = "/" . $shelp . "/i";
$explanation_lsearch[] = "/(" . $shelp . "(?![^<]*?>))/si";
}
$explanation_replace[] = "<span" . $normtitle . " class=\"" . $explanationclass . "\">\\1</span>";
}
}
}
// Step 6 - the main replacements
$linktexts = $href[2];
// LINK
if ($link_behavior == "first") {
if (is_array($link_search)) $text = preg_replace($link_search, $link_replace, $text, 1);
} else {
if (is_array($link_search)) $text = preg_replace($link_search, $link_replace, $text);
}
// ACRONYM
if ($acronym_behavior == "first") {
if (is_array($acronym_search)) {
$text = preg_replace($acronym_search, $acronym_replace, $text, 1);
if (is_array($linktexts)) $linktexts = preg_replace($acronym_lsearch, $acronym_replace, $linktexts, 1);
}
} else {
if (is_array($acronym_search)) {
$text = preg_replace($acronym_search, $acronym_replace, $text);
if (is_array($linktexts)) $linktexts = preg_replace($acronym_lsearch, $acronym_replace, $linktexts);
}
}
// LANGUAGE
if (is_array($language_search)) {
$text = preg_replace($language_search, $language_replace, $text);
if (is_array($linktexts)) $linktexts = preg_replace($language_lsearch, $language_replace, $linktexts);
}
// ABBR
if (is_array($abbr_search)) {
$text = preg_replace($abbr_search, $abbr_replace, $text);
if (is_array($linktexts)) $linktexts = preg_replace($abbr_lsearch, $abbr_replace, $linktexts);
}
// EXPLANATION
if ($explanation_behavior == "first") {
if (is_array($explanation_search)) {
$text = preg_replace($explanation_search, $explanation_replace, $text, 1);
if (is_array($linktexts)) $linktexts = preg_replace($explanation_lsearch, $explanation_lreplace, $linktexts, 1);
}
} else {
if (is_array($explanation_search)) {
$text = preg_replace($explanation_search, $explanation_replace, $text);
if (is_array($linktexts)) $linktexts = preg_replace($explanation_lsearch, $explanation_lreplace, $linktexts);
}
}
foreach ($href[0] as $key=>$value) {
$href[0][$key] = $href[1][$key].$linktexts[$key].$href[3][$key];
}
// Step 7 - replace the spaces we munged in preparation of step 6
$href[0] = preg_replace('/MULTIHOOKTEMPORARY/', '', $href[0]);
$text = preg_replace('/MULTIHOOKTEMPORARY/', '', $text);
// Step 8-12 - replace the tags that we removed before
for ($i = 0; $i < $linkcount; $i++) {
$text = preg_replace("/ MULTIHOOKLINKREPLACEMENT{$i} /", $links[0][$i], $text, 1);
}
for ($i = 0; $i < $htmlcount; $i++) {
$text = preg_replace("/ MULTIHOOKHTMLREPLACEMENT{$i} /", $html[0][$i], $text, 1);
}
for ($i = 0; $i < $hrefcount; $i++) {
if ((preg_match("/http:/i", $href[0][$i])) && (!preg_match("/" . $_SERVER["HTTP_HOST"] . "/i", $href[0][$i]))) {
if (preg_match("/class=[\"\']?" . $externallinkclass . "[\"\'\s]/i", $href[0][$i])) {
}
elseif (preg_match("/class=[\"\']?/i", $href[0][$i])) {
$href[0][$i] = preg_replace("/class=(\"|\')?/i", "class=\\1" . $externallinkclass . " ", $href[0][$i], 1);
}
else $href[0][$i] = preg_replace("/<a[\s]/i", "<a class=\"$externallinkclass\" ", $href[0][$i], 1);
}
}
for ($i = 0; $i < $hrefcount; $i++) {
$text = preg_replace("/ MULTIHOOKHREFREPLACEMENT{$i} /", $href[0][$i], $text, 1);
}
for ($i = 0; $i < $abbrcount; $i++) {
$text = preg_replace("/ MULTIHOOKABBRREPLACEMENT{$i} /", $abbr[0][$i], $text, 1);
}
for ($i = 0; $i < $acronymcount; $i++) {
$text = preg_replace("/ MULTIHOOKACRONYMREPLACEMENT{$i} /", $acronym[0][$i], $text, 1);
}
for ($i = 0; $i < $ignorecount; $i++) {
$text = preg_replace("/ MULTIHOOKIGNOREREPLACEMENT{$i} /", $ignore[1][$i], $text, 1);
}
$transtext = $help[1][0] . $help[2][0] . $text . $help[4][0] . $help[5][0];
} else $transtext = $text;
return $transtext;
}
/**
* create a new entry
*
* @param $args ['short'] short name of the item
* @param $args ['long'] long name of the item
* @param $args ['title'] title of the item
* @param $args ['type'] type of the item: 1=acronym, 0=abbreviation, 2=link
* @param $args ['language'] language of the item
* @returns int
* @return id on success, false on failure
*/
function createTransformation($args)
{
global $cfg, $contenido;
// Get arguments from argument array
extract($args);
// Argument check - make sure that all required arguments are present,
// if not then set an appropriate error message and return
if ((!isset($short)) ||
(!isset($textlong)) ||
(!isset($title)) ||
(!isset($type)) ||
(!isset($language))) {
echo "Argument fehlt";
return false;
}
if (($type != 3) && ($textlong == "")) {
echo "Langtext/Erklärung oder Link fehlt";
return false;
}
// Security check
if (!$contenido) {
echo "Contenido???";
return false;
}
// Get datbase setup
$db = new DB_Contenido;
$sql = "SELECT
trid
FROM
" . $cfg["tab"]["vpTransformationen"] . "
WHERE
BINARY short = '" . $short . "' AND
language = '" . $language . "'";
$db->query($sql);
if ($db->next_record()) {
return false;
}
// Add item
$sql = "INSERT INTO " . $cfg["tab"]["vpTransformationen"] . " (
trid,
short,
title,
textlong,
type,
language)
VALUES (
'',
'" . $short . "',
'" . $title . "',
'" . $textlong . "',
'" . $type . "',
'" . $language . "')";
$db->query($sql);
if (! $db->affected_rows()) return false;
// Return the id of the newly created abbr to the calling process
return true;
}
/**
* delete an abbreviation
*
* @param $args ['aid'] ID of the abbr/acronym/link
* @returns bool
* @return true on success, false on failure
*/
function deleteTransformation($args)
{
global $cfg, $contenido;
// Get arguments from argument array
extract($args);
// Argument check
if (!isset($trid)) {
return false;
}
// Security check
if (!$contenido) {
return false;
}
// Get datbase setup
$db = new DB_Contenido;
// Delete the item
$sql = "DELETE FROM " . $cfg["tab"]["vpTransformationen"] . "
WHERE trid = '" . $trid . "'";
$db->query($sql);
// Let the calling process know that we have finished successfully
return true;
}
/**
* update an entry
*
* @param $args ['aid'] the id
* @param $args ['short'] short name
* @param $args ['title'] title
* @param $args ['long'] long name
* @param $args ['type'] type
* @param $args ['language'] language
*/
function updateTransformation($args)
{
global $cfg, $contenido;
// Get arguments from argument array
extract($args);
// Argument check
if ((!isset($trid)) ||
(!isset($short)) ||
(!isset($title)) ||
(!isset($textlong)) ||
(!isset($type)) ||
(!isset($language))) {
return false;
}
if (!$contenido) {
return false;
}
if (($type != 3) && ($textlong == "")) {
echo "Langtext/Erklärung oder Link fehlt";
return false;
}
// Get database setup
$db = new DB_Contenido;
// Update the abbr
$sql = "UPDATE " . $cfg["tab"]["vpTransformationen"] . "
SET short = '" . $short . "',
textlong = '" . $textlong . "',
title = '" . $title . "',
type = '" . $type . "',
language = '" . $language . "'
WHERE trid = '" . $trid . "'";
$db->query($sql);
// Let the calling process know that we have finished successfully
return true;
}
?
Code: Alles auswählen
Fatal error: Maximum execution time of 30 seconds exceeded in /home/htdocs/web114/html/kh/contenido/includes/functions.transformations.php on line 198BTW: Spricht irgendwas dagegen die Styleanweisung in eine CSS-Datei zupacken ? Dann kann man ja das Aussehen beliebig anpassen.* Anpassung: Angepasst werden muessen die idcatart des aktuellen Artikels in der Variablen $idcatart und die idcatart des Editierartikels in $idcatartedit
************************************************/
$dbConnect = new DB_Contenido;
//Anpassungen
$pfad = "front_content.php?idcatart=" . $idcatart;
//Anpassungen Ende
$dbConnect = new DB_Contenido;
$sort = $_GET['sort'];
$alpha = $_GET['alpha'];
$aktiv = 1;//aktiv =1: nur die aktiven Datensaetze
$updatedat = $_GET['detailid'];
$idcatartedit = $_GET['detailid'];
//-----------------------
Code: Alles auswählen
<?php
$dbConnect = new DB_Contenido;
if (!empty($_POST)) { //wenn Formularfelder ausgefuellt, dann auslesen
extract($_POST);
}
//Ueber die Variable updatedat wird diejenige id des Datensatzes uebergeben, der geaendert werden soll
$updatedat=$_GET['updatedat'];
//-------- Wenn Button "Speichern" betätigt wurde Felder prüfen --------
if ($submit == "Aendern"):
//------Pflichtfelder prüfen---------
if (strlen($name) <1):
$fehler = true;
$fehlerName = true;
$fehlermeldung .= " - keinen Nachnamen eingegeben!<br>";
endif;
if (strlen($vorname) <1):
$fehler =true;
$fehlerVorname = true;
$fehlermeldung .= " - keinen Vornamen eingegeben!<br>";
endif;
if (strlen($fb) <1):
$fehler = true;
$fehlerFb = true;
$fehlermeldung .= " - keinen Fachbereich angegeben!<br>";
endif;
if (strlen($abteilung) <1):
$fehler = true;
$fehlerAbteilung = true;
$fehlermeldung .= " - keine Abteilung angegeben!<br>";
endif;
if (strlen($fon) <1):
$fehler = true;
$fehlerFon = true;
$fehlermeldung .= " - keine Telefonnummer angegeben!<br>";
endif;
if (!isset($aktiv)):
$fehler = true;
$fehlerAktiv = true;
$fehlermeldung .= " - Aktiv / nicht aktiv ist nicht gesetzt!<br>";
endif;
// ---- E-Mail prüfen nur wenn Eintrag erfolgt
if (!empty($Mail)):
$mail_expr = "/^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/";
if( !preg_match($mail_expr, $Mail) ) :
$fehler = true;
$fehlerMail = true;
$fehlermeldung .= "- E-Mail ist nicht gültig<br>";
endif;
endif;
//-------------- Ende Felder prüfen! ---------------------------------------------
//---------------Wenn kein Fehler aufgetreten ist dann Datensatz in Tabelle speichern! -------------
if ($fehler == false):
$sql = "UPDATE con_mitarbeiter SET name ='$name', titel = '$titel', vorname ='$vorname', fb ='$fb', abteilung ='$abteilung', fon ='$fon', fax ='$fax', mobil ='$mobil', mail ='$mail', aktiv ='$aktiv' WHERE ID = '$id'";
if (@mysql_query($sql)) {
echo("<p><table class=\"text\" width=\"90%\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#CC3333\"><tr><td bgcolor=\"#E2E2E2\">Der Datensatz wurde geändert - <a href = \"front_content.php?idcat=78\">zurück zur Mitgliederliste</a> </td</tr></table></p>");
} else {
echo("<p><table class=\"text\" width=\"90%\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#CC3333\"><tr><td bgcolor=\"#E2E2E2\">Fehler beim Eintragen des Datensatzes: " . mysql_error() . "</td</tr></table></p>");
}
endif;
endif;
//------------------ Ende submit ---------------------------------------
//Datensatz abfragen, der geaendert werden soll
if (!isset($submit)) :
$result = @mysql_query("SELECT ID, name, titel, vorname, fb, abteilung, fon, fax, mobil, mail, aktiv FROM con_mitarbeiter WHERE ID=$updatedat");
if (!$result) {
echo("<p><table width=\"90%\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#CC3333\"><tr><td bgcolor=\"#57B0C1\">Fehler bei der Ausführung der Abfrage: " . mysql_error() . "</td</tr></table></p>");
exit();
}
while ( $row = mysql_fetch_array($result) ) {
$id = $row["ID"];
$name = $row["name"];
$titel = $row["titel"];
$vorname = $row["vorname"];
$fb = $row["fb"];
$abteilung =$row["abteilung"];
$fon = $row["fon"];
$fax = $row["fax"];
$mobil = $row["mobil"];
$mail = $row["mail"];
$aktiv = $row["aktiv"];
}
endif;
//---------- mögliche Fehlerausgabe -------------
if ($fehler == true):
echo "<p>" .$fehlermeldung . "</p>";
endif;
?>
<form action="<? echo "$_Server[PHP_SELF]" ?>" method="post">
<table width="100%" border="0" cellpadding="2" cellspacing="2">
<tr><td width="30%">ID:</td><td width="70%"><input size="35" type="text" name="id" value="<? echo $id; ?>"</td>
<tr><td width="30%">Nachname*:</td><td width="70%"><input size="35" type="text" name="name" value="<? echo $name; ?>" </td></tr>
<tr><td width="30%">Tittel:</td><td width="70%"><input type="text" name="titel" size="35" value="<? echo $titel; ?>"</td></tr>
<tr><td width="30%">Vorname*:</td><td width="70%"><input size="35" type="text" name="vorname" value=" <? echo $vorname; ?>"</td></tr>
<tr><td width="30%">Fachbereich*:</td><td width="70%"><input size="35" name="fb" type="text" value=" <? echo $fb; ?>"</td></tr>
<tr><td width="30%">Abteilung*:</td><td width="70%"><input size="35" name="abteilung" type="text" value=" <? echo $abteilung; ?>"</td></tr>
<tr><td width="30%">Telefon*:</td><td width="70%"><input size="35" name="fon" type="text" value=" <? echo $fon; ?>"</td></tr>
<tr><td width="30%">Fax:</td><td width="70%"><input type="text" name="fax" size="35" value=" <? echo $fax; ?>"</td></tr>
<tr><td width="30%">Mobil:</td><td width="70%"><input type="text" name="mobil" size="35" value=" <? echo $mobil; ?>"</td></tr>
<tr><td width="30%">E-Mail:</td><td width="70%"><input size="35" name="mail" type="text" value=" <? echo $mail; ?>"</td></tr>
<tr><td width="30%">Aktiv?*</td><td width="70%"><input name="aktiv" type="radio" value="1" checked="checked"> Aktiv <input name="aktiv" type="radio" value="0"> nicht Aktiv </td></tr>
<tr><td width="30%"><input type="hidden" name="id" value=" <? $id; ?>"></td><td width="70%"><input type="submit" name="submit" value="Aendern"></td></tr></table>
<?php
echo "<table><tr><td class =\"text\"><a href=\"javascript:history.back()\">zurück zur Auswahlliste</a></td></tr></table>";
?>
</form>
Code: Alles auswählen
if ($fehler == false):
$sql = "UPDATE con_mitarbeiter SET name ='$name', titel = '$titel', vorname ='$vorname', fb ='$fb', abteilung ='$abteilung', fon ='$fon', fax ='$fax', mobil ='$mobil', mail ='$mail', aktiv ='$aktiv' WHERE ID = '$id'";
Code: Alles auswählen
... WHERE ID = '$id'";
Code: Alles auswählen
... WHERE ID = '$updatedat'";
Das funktioniert aber auch nur, wenn das Ganze nochmal in " und " steht.<strong>www. </strong><nobr><a target=\"_blank\" href=". $Webseite .">". link ."</a></nobr></p>
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname: einfache Mitgliederliste - Datenausgabe
* Author(s): Mc
* Erstellt: 13-03-2006
* Modifiziert: 10.04.2006 $idcatart als Variable fuer Anpassung des Pfades
* Motifiziert: 09.04.2006 aktiv als Variable; alle Buchstaben des Alphabets werden angezeigt, nur die vorhandenen Anfangsbuchstaben bei den Nachnamen werden fuer die Auswahl verlinkt; feste Zellenbreite fuer die Tabelle; MouseOver bei Ueberfahren des Datensatzes
* Modifiziert: 25.09.2006 media-konzept kuster:
* - Die Buchstabenlinks werden nun unabhaengig von Gross-/Kleinschrift generiert
* - Symbol '#' zu den Buchstabenlinks und der Ausgabe fuer Felder die mit einer Zahl anstelle eines Buchstaben beginnen eingefuegt.
* Beschreibung: Ausgabe von Adressdaten aus der Tabelle con_adressen (muss vorher neu angelegt werden) mit verschiedenen Sortier- und Auswahlmöglichkeiten
* Anpassung: Angepasst werden muss die idcatart des aktuellen Artikels in der Variablen $idcatart
* Beispiel: http://www.wirtschaftsrat-erlangen.de/front_content.php?idcat=18
* ToDo: Verlinkung auf den vollständigen Datensatz; erfolgt im angegebenen Beispiel wegen des Datenschutzes nicht
************************************************/
//Anpassungen
$idcatart = "48"; //idcatart des aktuellen Artikels
$pfad = "front_content.php?idcatart=" . $idcatart;
//Anpassungen Ende
$dbConnect = new DB_Contenido;
$sort = $_GET['sort'];
$alpha = $_GET['alpha'];
$aktiv = 1;//aktiv =1: nur die aktiven Datensaetze
//-----------------------
?>
<p>
<table class="text" width="100%" cellspacing=1 cellpadding=2 bgcolor="#CCCCCC">
<tr>
<td class="text" bgcolor="#E2E2E2">alphabetische Auswahl</td>
</tr>
<tr>
<td class="text" bgcolor="#E2E2E2" valign="top">
<!--------------------- alphabetische Auswahl ------------------>
<?php
// Array erstellen mit den Buchstaben des Alphabetes
$Aliste = array("#","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
// es werden nur diejenigen Buchstaben des Alphabetes ausgelesen, zu denen ein Nachname existiert
// und dann im Array $array gespeichert
$array = array(); // Hierdurch wird ein Array namens $array ohne Inhalt initialisiert
$result = @mysql_query("SELECT DISTINCT LEFT(Nachname,1) AS Buchstaben FROM con_adressen WHERE aktiv = $aktiv ORDER BY Nachname");
if (!$result) {
echo("<p>Fehler bei der Ausführung der Abfrage: " . mysql_error() . "</p>");
exit();
}
while($row = mysql_fetch_array($result)) {
$Buchstabe = $row["Buchstaben"];
$array[] = $Buchstabe;
}
//ab hier Ausgabe des Alphabetes mit Verlinkung der vorhandenen Buchstaben
for ($i=0; $i<29; $i++)
{
$text = $Aliste[$i]; //Buchstaben des Alphabetes auslesen
if ($text == "#")
{
for ($ii="0"; $ii<="9"; $ii++)
{
if(in_array($ii,$array))
{
$text = "<a href=\"".$pfad."&alpha="."9"."\">".$text."</a>";
break;
}
}
}
else
{
if(in_array($text,$array) || in_array(strtolower($text),$array))
{ //Ueberpruefung, ob der Buchstabe $text im array enthalten ist
$text = "<a href=\"".$pfad."&alpha=".$text."\">".$text."</a>";
}
}
echo $text." ";
}
?>
<a href="<?php echo $pfad; ?>">alle</a><br>
</td>
</tr>
</table>
<!--------------------- Ende alphabetische Auswahl ------------------>
<?php
// Datensaetze abfragen mit unterschiedlichen Sortiervorgaben: $sort (Nachname, PLZ, Ort, ..) bzw. $alpha (Ausgabe nur derjenigen Datensätze mit entsprechendem Anfangsbuchstaben im Nachnamen; wenn weder $sort noch $alpha übergeben wurde, erfolgt Ausgabe aller Datensätze sortiert nach dem Nachnamen. Wenn $alpha vorgewaehlt wurde, kann innerhalb des Buchstabens nach Nachname, Beruf usw. sortiert werden.
$query_str_1 = "SELECT id, Titel, Vorname, Nachname, Beruf, PLZ, Ort, aktiv FROM con_adressen WHERE aktiv=$aktiv";
if ($alpha == "9")
{
$query_str_2 = "AND (Nachname LIKE '0%' OR Nachname LIKE '1%' OR Nachname LIKE '2%' OR Nachname LIKE '3%' OR Nachname LIKE '4%' OR Nachname LIKE '5%' OR Nachname LIKE '6%' OR Nachname LIKE '7%' OR Nachname LIKE '8%' OR Nachname LIKE '9%')";
}
else
{
$query_str_2 = "AND Nachname LIKE '$alpha%'";
}
if(isset($sort) && empty($alpha)){
$result = @mysql_query("$query_str_1 ORDER BY $sort, Nachname");
}
elseif (isset($alpha) && empty($sort)){
$result = @mysql_query("$query_str_1 $query_str_2 ORDER BY Nachname");
}
elseif ($alpha && $sort){
$result = @mysql_query("$query_str_1 $query_str_2 ORDER BY $sort, Nachname");
}
else {
$result = @mysql_query("$query_str_1 ORDER BY Nachname");
}
// jeden Datensatz in einer Zeile anzeigen
echo "<table align=\"left\" class=\"text\" width=\"100%\" cellspacing=1 cellpadding=2 bgcolor=\"#CCCCCC\">";
echo "<tr><td bgcolor=\"#E2E2E2\" width=\"190px\"><b><a href =\"".$pfad."&sort=Nachname&alpha=".$alpha."\">Name</a>, Titel Vorname </b></td><td bgcolor=\"#E2E2E2\" width=\"360px\"><b><a href =\"".$pfad."&sort=Beruf&alpha=".$alpha."\">Beruf/Firma</a></b></td><td bgcolor=\"#E2E2E2\" width=\"50px\"><b><a href =\"".$pfad."&sort=PLZ&alpha=".$alpha."\">PLZ</a></b></td><td bgcolor=\"#E2E2E2\" width=\"140px\"><b><a href =\"".$pfad."&sort=Ort&alpha=".$alpha."\">Ort</a></b></td></tr>\n";
while ( $row = mysql_fetch_array($result) ) {
$id = $row["id"];
$Titel = $row["Titel"];
$Vorname = $row["Vorname"];
$Nachname = $row["Nachname"];
$Beruf = $row["Beruf"];
$PLZ = $row["PLZ"];
$Ort = $row["Ort"];
$aktiv = $row["aktiv"];
echo "<tr bgcolor=\"E2E2E2\" onMouseOver=this.style.backgroundColor=\"#E2EDD7\"; onMouseOut=this.style.backgroundColor=\"#E2E2E2\"; valign=\"top\"><td><nobr>" . $Nachname . ", " . $Titel . " " . $Vorname ."</nobr></td> <td>" . $Beruf ."</td><td>" . $PLZ ."</td><td>". $Ort . "</td></tr>\n";
}
echo "</table>";
?>