- wurden bisher noch nicht verfolgt:
neue Datei: admin/.htaccess neue Datei: admin/.htgroups neue Datei: admin/.htusers neue Datei: admin/config.inc.php - Erstellung der news erweitert (promoImg) geändert: admin/newsAdmin.php neue Datei: admin/newsAmpTest.php neue Datei: admin/newsLib.php.inc neue Datei: admin/newsTest.php neue Datei: admin/redirecter/redirectLog.php neue Datei: css/cwsvJudo-2018-quiz.css geändert: md/galerie.md geändert: md/trainingszeiten.md neue Datei: phpLib/cwsvJudo/gallery.lib.php geändert: phpLib/cwsvJudo/miscAssis.php geändert: phpLib/imgGallery/index.php.tmpl gelöscht: phpLib/imgGallery/indexDev.php.tmpl
This commit is contained in:
6
homepage/redesign2018/markdownExperiment/admin/.htaccess
Normal file
6
homepage/redesign2018/markdownExperiment/admin/.htaccess
Normal file
@@ -0,0 +1,6 @@
|
||||
AuthType Basic
|
||||
AuthName "cwsvJudoAdmin"
|
||||
AuthUserFile /users/cwsvjudo/www/admin/.htusers
|
||||
AuthGroupFile /users/cwsvjudo/www/admin/.htgroups
|
||||
Require user marko
|
||||
Require group admin
|
||||
1
homepage/redesign2018/markdownExperiment/admin/.htgroups
Normal file
1
homepage/redesign2018/markdownExperiment/admin/.htgroups
Normal file
@@ -0,0 +1 @@
|
||||
admin: marko
|
||||
2
homepage/redesign2018/markdownExperiment/admin/.htusers
Normal file
2
homepage/redesign2018/markdownExperiment/admin/.htusers
Normal file
@@ -0,0 +1,2 @@
|
||||
# userFile
|
||||
marko:$2y$05$Bt1hCGXhdO2JcJy9SXt96e.DmXvnutpOxmDw233CGaUOQL6kczXQK
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/// Die Basisdomain, unter der die Hauptseite zu erreichen ist
|
||||
$baseDomain = "cwsvjudo.bplaced.net";
|
||||
/// Subdomain, unter dem dieses Verzeichnis zu finden ist (falls der Fall gegeben ist)
|
||||
$subDomain = "";
|
||||
/// Basis(/Root)-Verzeichnis auf dem Server (für Dateizugriffe, insbesondere phpIncludes)
|
||||
$basePath = "/users/cwsvjudo/www";
|
||||
|
||||
/// scheme-Part der URL (das Protokol)
|
||||
$urlScheme = "http";
|
||||
/// Url zum Zugriff auf "shared Data" unter der Hauptadresse
|
||||
$baseUrl = $urlScheme."://".$baseDomain;
|
||||
/// Die kanonische Url dieses Verzeichnisses (unter welcher
|
||||
/// Domainadresse die Seiten dieses Verzeichnisses bevorzugt zu
|
||||
/// erreichen seien sollen, also entweder eine SubdomainUrl, oder die
|
||||
/// baseUrl mit dem Verzeichnis angehängt) evtl. Pfade müssen noch
|
||||
/// angehangen werden.
|
||||
/// Achtung: Gedacht für eine einheitliche Bezeichnung bei internem
|
||||
/// Verlinken. Der canonicalLink im Header ist bei ampSeiten nicht die
|
||||
/// eigene Adresse, sondern die (kanonische) Adresse der "normalen"
|
||||
/// Version der Seite.
|
||||
$canonicalUrlBase = $urlScheme."://".$subDomain.(!empty($subDomain)?".":"").$baseDomain;
|
||||
?>
|
||||
@@ -11,19 +11,6 @@
|
||||
require_once($basePath."/ressourcen/phpLib/parsedown/Parsedown.php");
|
||||
|
||||
|
||||
function firstNonEmptyOf($somePossibleEmptyStuff){
|
||||
|
||||
if (is_array($somePossibleEmptyStuff) || $somePossibleEmptyStuff instanceof Traversable){
|
||||
foreach($somePossibleEmptyStuff as $entry){
|
||||
if(empty($entry))
|
||||
continue;
|
||||
else
|
||||
return $entry;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// benötigt parsedown
|
||||
function submitNewsToDb($aNews, $someOptions = array()){
|
||||
// Standardargumente setzen
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
require_once("config.php.inc");
|
||||
require_once("newsLib.php.inc");
|
||||
|
||||
require_once( $basePath."/bonus/db.inc" );
|
||||
|
||||
$mysqlConn = @new mysqli($db_server, $db_user, $db_password, $db_name);
|
||||
if($mysqlConn->connect_error){
|
||||
// @ToDo: bessere Fehlerbehandlung
|
||||
die("Datenbankverbindung fehlgeschlagen: " . $mysqlConn->connect_error . "\n");
|
||||
//$message['error'] += "Datenbankverbindung fehlgeschlagen: " . $mysqlConn->connect_error . "<br />";
|
||||
}
|
||||
|
||||
$newsId = isset($_GET["newsId"]) ? $_GET["newsId"] : "";
|
||||
//$newsDate = empty($_GET['date']) ? date("Y-m-d") : $_GET['date'];
|
||||
$newsById = array();
|
||||
$prevNewsId = "";
|
||||
$postNewsId = "";
|
||||
|
||||
|
||||
$news = getNewsById($mysqlConn);
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
<html amp lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script async src="https://cdn.ampproject.org/v0.js"></script>
|
||||
<title><?php echo($news['betreff']);?></title>
|
||||
<link rel="canonical" href="http://example.ampproject.org/article-metadata.html">
|
||||
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
|
||||
<script type="application/ld+json"><?php echo(news2json( $news ));?></script>
|
||||
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
|
||||
</head>
|
||||
<body>
|
||||
<h1>cwsvJudo - News</h1>
|
||||
<?php echo(getAmpNews($news));?>
|
||||
</body>
|
||||
</html>
|
||||
296
homepage/redesign2018/markdownExperiment/admin/newsLib.php.inc
Normal file
296
homepage/redesign2018/markdownExperiment/admin/newsLib.php.inc
Normal file
@@ -0,0 +1,296 @@
|
||||
<?php
|
||||
|
||||
/// Eine News per ID abfragen
|
||||
///
|
||||
/// Der Rückgabewert sollte vor Verwendung (und zur Fehlerbeheandlung)
|
||||
/// auf NULL und/oder leeres Array getestet werden.
|
||||
/// Der Zeichensatz wird von "ISO-8859-1" auf "UTF-8" gesetzt
|
||||
///
|
||||
/// @return Eine einzelne Nachricht als Array
|
||||
function getNewsById($aMysqlConn, $aNewsId = "0", $optionsArray = array("dbCharset" => "ISO-8859-1", "outCharset" => "UTF-8")){
|
||||
if(!$aMysqlConn) return NULL;
|
||||
$ret = array();
|
||||
$query = "";
|
||||
if( is_positive_integer($aNewsId) ){
|
||||
$query = sprintf(
|
||||
"SELECT * FROM nachrichten WHERE nr='%s';",
|
||||
$aMysqlConn->real_escape_string($aNewsId)
|
||||
);
|
||||
}
|
||||
else{
|
||||
$query = sprintf(
|
||||
"SELECT * FROM nachrichten ORDER BY datum DESC, nr DESC LIMIT 0, 1;"
|
||||
);
|
||||
}
|
||||
|
||||
$results = $aMysqlConn->query($query);
|
||||
if( !empty($results) ) $ret = $results->fetch_assoc();
|
||||
// Zeichensatzkonvertierung
|
||||
array_walk(
|
||||
$ret,
|
||||
function (&$value, $key, $optionsArray) {
|
||||
$value = iconv($optionsArray['dbCharset'], $optionsArray['outCharset'], $value);
|
||||
},
|
||||
$optionsArray
|
||||
);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/// Abfrage der Id der vorhergehenden News nach Id
|
||||
function getPrevNewsId($aMysqlConn, $aNews, $optionsArray = array() ){
|
||||
$queryNewsId = sprintf("
|
||||
SELECT nr FROM cwsvjudo.nachrichten
|
||||
WHERE datum <= '%s' AND nr < '%s'
|
||||
ORDER BY nr DESC
|
||||
LIMIT 0, 1;",
|
||||
$aMysqlConn->real_escape_string( $aNews['datum'] ),
|
||||
$aMysqlConn->real_escape_string( $aNews['nr'] )
|
||||
);
|
||||
$mysqlResults = $aMysqlConn->query($queryNewsId);
|
||||
if( !$mysqlResults ) return "";
|
||||
|
||||
$newsIdResult = $mysqlResults->fetch_assoc();
|
||||
if( empty($newsIdResult) ) return "";
|
||||
return $newsIdResult['nr'];
|
||||
}
|
||||
|
||||
|
||||
/// Abfrage der Id der nachfolgenden News nach Id
|
||||
function getNextNewsId($aMysqlConn, $aNews, $optionsArray = array() ){
|
||||
$queryNewsId = sprintf("
|
||||
SELECT nr FROM cwsvjudo.nachrichten
|
||||
WHERE datum >= '%s' AND nr > '%s'
|
||||
ORDER BY nr DESC
|
||||
LIMIT 0, 1;",
|
||||
$aMysqlConn->real_escape_string( $aNews['datum'] ),
|
||||
$aMysqlConn->real_escape_string( $aNews['nr'] )
|
||||
);
|
||||
$mysqlResults = $aMysqlConn->query($queryNewsId);
|
||||
if( !$mysqlResults ) return "";
|
||||
|
||||
$newsIdResult = $mysqlResults->fetch_assoc();
|
||||
if( empty($newsIdResult) ) return "";
|
||||
return $newsIdResult['nr'];
|
||||
}
|
||||
|
||||
|
||||
/// Zu einer Nachricht strukurierte Daten als json bereit stellen
|
||||
function news2json($aNews){
|
||||
$ret = "";
|
||||
|
||||
$ret .= "{";
|
||||
$ret .= " \"@context\": \"http://schema.org\",";
|
||||
$ret .= " \"@type\": \"NewsArticle\",";
|
||||
$ret .= " \"mainEntityOfPage\": {";
|
||||
$ret .= " \"@type\": \"WebPage\",";
|
||||
$ret .= " \"@id\": \"http://cwsvjudo.bplaced.net/pages/amp/news.php?newsId=" . $aNews['nr'] . "\"";
|
||||
$ret .= " },";
|
||||
$ret .= " \"headline\": \"". $aNews['betreff'] ."\",";
|
||||
$ret .= " \"image\": {";
|
||||
$ret .= " \"@type\": \"ImageObject\",";
|
||||
//$ret .= " \"url\": \"http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen-696x-nq8.png\",";
|
||||
//$ret .= " \"url\": \"". $baseUrl . str_replace( ".png", ".jpg", str_replace( "/thumbs/", "/images/", newsPromoImage( getNewsById($mysqlConn, "118") )['src'][0]));
|
||||
//$ret .= " \"height\": 563,";
|
||||
//$ret .= " \"width\": 696";
|
||||
$ret .= " \"url\": \"http://cwsvjudo.bplaced.net" . str_replace( ".png", ".jpg", str_replace( "/thumbs/", "/images/", getHtmlImgTags( $aNews['nachricht'] )[0]['src'])) ."\",";
|
||||
$ret .= " \"height\": 786,";
|
||||
$ret .= " \"width\": 1024";
|
||||
$ret .= " },";
|
||||
$ret .= " \"datePublished\": \"" . $aNews['datum'] . "\",";
|
||||
$ret .= " \"dateModified\": \"" . $aNews['datum'] . "\",";
|
||||
$ret .= " \"author\": {";
|
||||
$ret .= " \"@type\": \"Person\",";
|
||||
$ret .= " \"name\": \"" . $aNews['autor'] . "\"";
|
||||
$ret .= " },";
|
||||
$ret .= " \"publisher\": " . file_get_contents("/users/cwsvjudo/www/ressourcen/structuredData/json/cwsvJudoAsPublisher.json") . ",";
|
||||
//$ret .= " \"publisher\": {";
|
||||
//$ret .= " \"@type\": \"Organization\",";
|
||||
//$ret .= " \"name\": \"Google\",";
|
||||
//$ret .= " \"logo\": {";
|
||||
//$ret .= " \"@type\": \"ImageObject\",";
|
||||
//$ret .= " \"url\": \"https://google.com/logo.jpg\",";
|
||||
//$ret .= " \"width\": 600,";
|
||||
//$ret .= " \"height\": 60";
|
||||
//$ret .= " }";
|
||||
//$ret .= " },";
|
||||
//$ret .= " \"description\": \"".$aNews['betreff']."\"";
|
||||
$ret .= " \"description\": \"".preg_replace( '/[\p{Z}\s]{2,}/s', ' ', strip_tags( $aNews['nachricht'] ) )."\"";
|
||||
$ret .= "}";
|
||||
|
||||
return $ret;
|
||||
|
||||
/*
|
||||
Property list for article structured data
|
||||
|
||||
Properties
|
||||
mainEntityOfPage
|
||||
URL; recommended (AMP), ignored (non-AMP)
|
||||
|
||||
The canonical URL of the article page. Specify mainEntityOfPage when the article is the primary topic of the article page.
|
||||
headline
|
||||
Text; required (AMP), recommended (non-AMP)
|
||||
|
||||
The headline of the article. Headlines should not exceed 110 characters.
|
||||
image
|
||||
ImageObject; required (AMP), recommended (non-AMP)
|
||||
|
||||
The representative image of the article. Only a marked-up image that directly belongs to the article should be specified.
|
||||
|
||||
Images should be at least 696 pixels wide.
|
||||
Images should be in .jpg, .png, or. gif format.
|
||||
Image URLs should be crawlable and indexable.
|
||||
image.url
|
||||
URL; required (AMP), recommended (non-AMP)
|
||||
|
||||
The URL of the image.
|
||||
image.height
|
||||
Number; required (AMP), recommended (non-AMP)
|
||||
|
||||
The height of the image, in pixels.
|
||||
image.width
|
||||
Number; required (AMP), recommended (non-AMP)
|
||||
|
||||
The width of the image, in pixels. Images should be at least 696 pixels wide.
|
||||
publisher
|
||||
Organization; required (AMP), ignored (non-AMP)
|
||||
|
||||
The publisher of the article.
|
||||
publisher.name
|
||||
Text; required (AMP), ignored (non-AMP)
|
||||
|
||||
The name of the publisher.
|
||||
publisher.logo
|
||||
ImageObject; required (AMP), ignored (non-AMP)
|
||||
|
||||
The logo of the publisher. See the AMP logo guidelines for details.
|
||||
publisher.logo.url
|
||||
URL; required (AMP), ignored (non-AMP)
|
||||
|
||||
The URL of the logo.
|
||||
publisher.logo.height
|
||||
Number; required (AMP), ignored (non-AMP)
|
||||
|
||||
The height of the logo, in pixels.
|
||||
publisher.logo.width
|
||||
Number; required (AMP), ignored (non-AMP)
|
||||
|
||||
The width of the logo, in pixels.
|
||||
datePublished
|
||||
DateTime; required (AMP), ignored (non-AMP)
|
||||
|
||||
The date and time the article was first published, in ISO 8601 format.
|
||||
dateModified
|
||||
DateTime; recommended (AMP), ignored (non-AMP)
|
||||
|
||||
The date and time the article was most recently modified, in ISO 8601 format.
|
||||
author
|
||||
Person or Organization; required (AMP), ignored (non-AMP)
|
||||
|
||||
The author of the article.
|
||||
author.name
|
||||
Text; required (AMP), ignored (non-AMP)
|
||||
|
||||
The name of the author.
|
||||
description
|
||||
Text; recommended (AMP), ignored (non-AMP)
|
||||
|
||||
A short description of the article.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/// Aus einer Nachricht das Bild extrahieren
|
||||
///
|
||||
/// Früher^(tm) waren die Promobilder für die Nachrichten direkt im
|
||||
/// htmlCode der Nachricht. Diese Funktion extrahiert aus (einem
|
||||
/// Fragment) htmlCode das enthaltene <img>-Tag.
|
||||
/// @ToDo: Der Funktion gemäß umbenennen (allgemeiner)
|
||||
/// @ToDo: Auf eine beliebige Anzahl von <img>Tags erweitern
|
||||
function newsPromoImage($aNews){
|
||||
$retImage = array();
|
||||
preg_match_all("/<img([\w\W]+?)\/>/s", $aNews['nachricht'], $imgMatches);
|
||||
// echo(" imgMatch: "); print_r($imgMatches);
|
||||
if(!empty($imgMatches[0])){
|
||||
preg_match_all("/src=\"([^\"]*)\"/s", $imgMatches[0][0], $srcMatches);
|
||||
$retImage['src'] = $srcMatches[1];
|
||||
// echo(" found src in ".$imgMatches[0][0].": "); print_r($srcMatches);
|
||||
preg_match_all("/alt=\"([^\"]*)\"/s", $imgMatches[0][0], $altMatches);
|
||||
$retImage['alt'] = $altMatches[1];
|
||||
// echo(" found alt in ".$imgMatches[0][0].": "); print_r($altMatches);
|
||||
preg_match_all("/title=\"([^\"]*)\"/s", $imgMatches[0][0], $titleMatches);
|
||||
$retImage['title'] = $titleMatches[1];
|
||||
// echo(" found title in ".$imgMatches[0][0].": "); print_r($titleMatches);
|
||||
}
|
||||
return $retImage;
|
||||
}
|
||||
|
||||
/// Aus einem Fragment htmlCode die <img>Tags extrahieren
|
||||
///
|
||||
/// Früher^(tm) waren die Promobilder für die Nachrichten direkt im
|
||||
/// htmlCode der Nachricht. Diese Funktion extrahiert aus (einem
|
||||
/// Fragment) htmlCode die enthaltenen <img>-Tags.
|
||||
function getHtmlImgTags($someHtmlCode){
|
||||
$retImages = array();
|
||||
// Alle <img>Tags matchen
|
||||
preg_match_all("/<img([\w\W]+?)\/>/s", $someHtmlCode, $imgMatches, PREG_SET_ORDER);
|
||||
foreach($imgMatches as $imgMatch){
|
||||
// mehrere src/alt/title-Attribute dürften nicht vorkommen!
|
||||
// Falls doch: Wir nehmen immer das erste!
|
||||
$retImage = array();
|
||||
preg_match_all("/src=\"([^\"]*)\"/s", $imgMatch[0], $srcMatches);
|
||||
$retImage['src'] = $srcMatches[1][0];
|
||||
preg_match_all("/alt=\"([^\"]*)\"/s", $imgMatch[0], $altMatches);
|
||||
$retImage['alt'] = $altMatches[1][0];
|
||||
preg_match_all("/title=\"([^\"]*)\"/s", $imgMatch[0], $titleMatches);
|
||||
$retImage['title'] = $titleMatches[1][0];
|
||||
|
||||
array_push($retImages, $retImage);
|
||||
}
|
||||
return $retImages;
|
||||
}
|
||||
|
||||
|
||||
/// Aus einer abgefragten News (als Array) ampCode erzeugen
|
||||
/// Noch ohne Strukturierte Daten
|
||||
function getAmpNews($anAmpNews){
|
||||
if(empty($anAmpNews)) return "";
|
||||
$retAmpCode = "";
|
||||
|
||||
// $retAmpCode .= "<article class=\"clearBoth\"itemscope itemtype=\"http://schema.org/NewsArticle\">";
|
||||
$retAmpCode .= "<article class=\"ampNewsBox\" >";
|
||||
// $retAmpCode .= "<meta itemprop=\"dateModified\" content=\"".mb_convert_encoding($news['datum'], 'UTF-8', 'ISO-8859-1')."\"/>";
|
||||
// $retAmpCode .= "<meta itemscope itemprop=\"mainEntityOfPage\" itemType=\"https://schema.org/WebPage\" itemid=\"http://cwsvjudo.bplaced.net/pages/amp/news.php".(empty($newsId?"":"?newsId=".$newsId))."\"/>";
|
||||
// $retAmpCode .= "<span itemprop=\"publisher\" itemscope itemtype=\"https://schema.org/Organization\"><span itemprop=\"logo\" itemscope itemtype=\"https://schema.org/ImageObject\"><meta itemprop=\"url\" content=\"http://cwsvjudo.bplaced.net/cwsvJudo.png\"><meta itemprop=\"width\" content=\"192\"><meta itemprop=\"height\" content=\"192\"></span><meta itemprop=\"name\" content=\"Abteilung Judo des Chemnitzer WSV\"></span>";
|
||||
// $retAmpCode .= "<span itemprop=\"image\" itemscope itemtype=\"https://schema.org/ImageObject\"><meta itemprop=\"url\" content=\"http://cwsvjudo.bplaced.net/cwsvJudo.png\" /><meta itemprop=\"width\" content=\"192\" /><meta itemprop=\"height\" content=\"192\" /></span>";
|
||||
// $retAmpCode .= "<div class=\"newsTable\">";
|
||||
// $retAmpCode .= "<div class=\"newsTableHeader\">";
|
||||
$retAmpCode .= "<div class=\"ampNewsBoxHeader\" >";
|
||||
// $retAmpCode .= "<span><time itemprop=\"datePublished\" datetime=\"".mb_convert_encoding($news['datum'], 'UTF-8', 'ISO-8859-1')."\">".mb_convert_encoding($news['datum'], 'UTF-8', 'ISO-8859-1')."</time></span>";
|
||||
$retAmpCode .= "<span><time datetime=\"" . $anAmpNews['datum'] . "\" >" . $anAmpNews['datum'] . "</time></span>";
|
||||
// $retAmpCode .= "<span><h3 itemprop=\"headline\">".mb_convert_encoding($news['betreff'], 'UTF-8', 'ISO-8859-1')."</h3></span>";
|
||||
/// @ToDo: headingsLevel variabel gestalten
|
||||
$retAmpCode .= "<span><h3>" . $anAmpNews['betreff'] . "</h3></span>";
|
||||
$retAmpCode .= "</div>";//Ende ampNewsBoxHeader
|
||||
// $retAmpCode .= "<div>".ampify( mb_convert_encoding( addImgSize("<div>".$news['nachricht']."</div>"), 'UTF-8', 'ISO-8859-1') )."</div>";
|
||||
$imgs = getHtmlImgTags( $anAmpNews['nachricht'] );
|
||||
if(!empty($imgs)){
|
||||
list($width, $height) = getimagesize( "/users/cwsvjudo/www/".urldecode($imgs[0]['src']));
|
||||
$retAmpCode .= "<amp-img layout=\"responsive\" title=\"".$imgs[0]['title']."\" alt=\"".$imgs[0]['alt']."\" src=\"".$imgs[0]['src']."\" width=\"".$width."\" height=\"".$height."\"/></amp-img>";
|
||||
}
|
||||
// $retAmpCode .= $anAmpNews['nachricht'];
|
||||
// print_r( $anAmpNews );
|
||||
// $retAmpCode .= strip_tags( $anAmpNews['nachricht'] );
|
||||
// $retAmpCode .= preg_replace( '/[\p{Z}\s]{2,}/s', ' ', strip_tags( $anAmpNews['nachricht'] ) );
|
||||
$retAmpCode .= preg_replace( '/[\p{Z}\s]{2,}/s', ' ', strip_tags( $anAmpNews['nachricht'], '<p><a>' ) );
|
||||
$retAmpCode .= "<div class=\"ampNewsBoxFooter\">MfG ".$anAmpNews['autor']."</span></div>";
|
||||
$retAmpCode .= "</div>";
|
||||
$retAmpCode .= "</article>";
|
||||
return $retAmpCode;
|
||||
}
|
||||
|
||||
|
||||
///---
|
||||
/// Hilfsfunktionen
|
||||
///---
|
||||
|
||||
?>
|
||||
33
homepage/redesign2018/markdownExperiment/admin/newsTest.php
Normal file
33
homepage/redesign2018/markdownExperiment/admin/newsTest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
require_once("config.inc.php");
|
||||
require_once("newsLib.php.inc");
|
||||
|
||||
require_once( "/users/cwsvjudo/www/bonus/db.inc");
|
||||
|
||||
$mysqlConn = @new mysqli($db_server, $db_user, $db_password, $db_name);
|
||||
if($mysqlConn->connect_error){
|
||||
die("Datenbankverbindung fehlgeschlagen: " . $mysqlConn->connect_error . "\n");
|
||||
//$message['error'] += "Datenbankverbindung fehlgeschlagen: " . $mysqlConn->connect_error . "<br />";
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>newsTest</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php $news = getNewsById($mysqlConn, "118");?>
|
||||
<?php //echo("News: "); print_r( getNewsById($mysqlConn, "118") );?>
|
||||
<?php //echo("Found Img: " ); print_r( newsPromoImage( getNewsById($mysqlConn, "118") ) );?>
|
||||
<?php echo("PromoImg: " . str_replace( ".png", ".jpg", str_replace( "/thumbs/", "/images/", newsPromoImage( getNewsById($mysqlConn, "118") )['src'][0])) );?>
|
||||
<?php echo("imgTags: "); print_r(getHtmlImgTags($news['nachricht']));?>
|
||||
<script type="application/ld+json"><?php echo(news2json( $news ));?></script>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
$mysqlConn->close();
|
||||
|
||||
exit();
|
||||
?>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
$loc_de = setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'deu_deu');
|
||||
//echo "Preferred locale for german on this system is '$loc_de'";
|
||||
|
||||
// getting a dbConnection
|
||||
try{
|
||||
$dbConnection = new PDO(
|
||||
'mysql:host=localhost;dbname=cwsvjudo',
|
||||
'cwsvjudo',
|
||||
'***REMOVED***'
|
||||
);
|
||||
|
||||
$redirectQuery = $dbConnection->prepare(
|
||||
"SELECT * FROM cwsvjudo.redirecter ORDER BY id ASC;"
|
||||
);
|
||||
$redirectQuery->execute();
|
||||
|
||||
$redirectList = $redirectQuery->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
catch(PDOException $db_error){
|
||||
die( "Error!: " . $db_error->getMessage() );
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<header>
|
||||
<!--
|
||||
<style>
|
||||
.phpcountCounterTables{
|
||||
display: flex;
|
||||
flex-basis: 50%;
|
||||
}
|
||||
</style>
|
||||
</header>
|
||||
-->
|
||||
<body>
|
||||
<div>
|
||||
<table>
|
||||
<tr><th>id</th><th>REQUEST_URI</th><th>HTTP_USER_AGENT</th></tr>
|
||||
<?php foreach($redirectList as $redirectEntry){
|
||||
//var_dump($redirectEntry['jsonServer']);
|
||||
//var_dump( json_decode($redirectEntry['jsonServer'], true) );
|
||||
$redirectServerArray = json_decode($redirectEntry['jsonServer'], true);
|
||||
echo( "\t\t\t\t");
|
||||
echo( "<tr>");
|
||||
echo( "<td>".$redirectEntry['id']."</td>" );
|
||||
echo( "<td>".$redirectServerArray['REQUEST_URI']."</td>" );
|
||||
echo( "<td>".$redirectServerArray['HTTP_USER_AGENT']."</td>" );
|
||||
echo( "</tr>\n" );
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user